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

pkgname=beefy-player
pkgver=1.2.2
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'
)

# Upstream does not tag releases yet, so the source is the archive of the
# commit that carries this version.  Once a `v$pkgver` tag exists, switch to
#
#   source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
#
_commit=941c7446384bf346e40d1438a7ce67939d9615df
source=("$pkgname-$pkgver.tar.gz::$url/archive/$_commit.tar.gz")
sha256sums=('8ac568676ef5ef8345441c28e4f8f5d61fb06d5225e566ac578acae18672c778')

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

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

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