# Maintainer: beefy-player contributors <beefcarver@tilde.club>

pkgname=beefy-player
pkgver=1.2.5
pkgrel=1
pkgdesc="Flashy terminal player for internet radio with a live spectrum analyser"
arch=('any')
url="https://tildeforge.dev/beefcarver/beefy-player"
license=('WTFPL')
depends=(
  'python'
  'python-dbus-next'
  'python-httpx'
  'python-numpy'
  'python-pillow'
  'python-rich'
  'python-textual'
)
makedepends=(
  'python-build'
  'python-hatchling'
  'python-installer'
  'python-wheel'
)
checkdepends=(
  'python-pytest'
  'python-pytest-asyncio'
)
optdepends=(
  'ffmpeg: decode the stream for the spectrum analyser, and ffplay as the audio fallback'
  'libpulse: capture the output monitor so the analyser follows what you hear (parec/pactl)'
  'mpv: preferred audio backend'
  'tmux: detect the outer terminal for kitty graphics passthrough inside tmux'
)

# The sdist attached to the v$pkgver release.  bump_packaging.py keeps
# this and sha256sums in step with the tag; build/check/package use
# $_srcname because the sdist unpacks to hatchling's PEP 503 name.
_srcname="beefy_player-$pkgver"
source=("$pkgname-$pkgver.tar.gz::$url/releases/download/v$pkgver/$_srcname.tar.gz")
sha256sums=('344f2266cb63d05bf294349599ecef636b3c8c25c8b29bcf0eff8818394b5f74')

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

check() {
  cd "$_srcname"
  # The suite is offline: catalogues are fixtures, mpv/parec are faked.
  python -m pytest -q
}

package() {
  cd "$_srcname"
  python -m installer --destdir="$pkgdir" dist/*.whl
}
