pkgname=onthespot-git
pkgver=1.1.4
_branch="master"
pkgrel=1
pkgdesc="Qt based music downloader written in python"
arch=('any')
url="https://github.com/justin025/onthespot"
license=('GPLv2')
depends=('ffmpeg' 'python-requests' 'python_urllib3' 'python-musictag' 'python-mutagen' 'python-pyqt6' 'python-pillow' 'python-librespot' 'yt-dlp' 'python-flask' 'python-flask-login' 'python-m3u8' 'python-pywidevine')
conflicts=('onthespot')
provides=('onthespot')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
optdepends=()
source=("https://github.com/justin025/onthespot/archive/refs/heads/$_branch.zip")
sha256sums=(SKIP)

build() {
  cd "onthespot-$_branch"
  python -m build --wheel --no-isolation
}

package() {
  cd "onthespot-$_branch"
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -dm 755 "$pkgdir/usr/share/applications"
  install -dm 755 "$pkgdir/usr/share/icons/hicolor/"{256x256,scalable}"/apps/"
  install -Dm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
  install -Dm 644 "src/onthespot/resources/org.onthespot.OnTheSpot.desktop" "$pkgdir/usr/share/applications/"
  install -Dm 644 "src/onthespot/resources/icons/onthespot.png" "$pkgdir/usr/share/icons/hicolor/256x256/apps/onthespot.png"
}
