# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Jan Magnus Brevik <janmbrevik@gmail.com>

pkgname=gpodder
pkgver=3.11.5
pkgrel=3
pkgdesc='Podcast client written in Python using GTK'
arch=('any')
url='https://gpodder.github.io/'
license=('GPL3')
depends=('gtk3' 'python-cairo' 'dbus-python' 'python-gobject' 'python-mygpoclient'
         'python-podcastparser' 'python-requests')
makedepends=('intltool' 'python-build' 'python-installer' 'python-setuptools')
optdepends=('libnotify: Gtk+ Desktop Notifications extension'
            'python-mutagen: Tag downloaded files, Remove cover art from OGG files extensions'
            'webkit2gtk-4.1: HTML show notes'
            'yt-dlp: Youtube-dl extension'
            'python-pysocks: SOCKS proxy support')
source=("https://github.com/gpodder/$pkgname/archive/$pkgver/$pkgname-$pkgver.tar.gz"
        "Try-importing-WebKit2-4.1-first-then-4.0.patch::https://github.com/gpodder/gpodder/commit/9910aeed49b286287534cdafcab7f9e7e2b04d51.patch?full_index=1")
sha256sums=('c09de56290589f5d66592d79acdfb8b70e76deab6df590715e4556c6d2d2068c'
            'd6ffeeb6971d5de363fba904776aa659560b7d78b8b7029761543f37054dfe39')

prepare() {
  cd $pkgname-$pkgver
  patch -Np1 -i ../Try-importing-WebKit2-4.1-first-then-4.0.patch
  # Use gio open directly instead of xdg-open
  sed -i "s/\['xdg-open', filename\]/['gio', 'open', filename]/" src/gpodder/util.py
}

build() {
  cd $pkgname-$pkgver
  make messages
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
}
