# Maintainer: Joey Yakimowich-Payne <jyapayne@pm.me>
#
# BlueRune's now playing example (examples/extensions/nowplaying.py) for every user: the
# program, the user unit that runs it in each BlueRune session, and its metainfo and icon for
# the Store (docs/extensions.md, "Packaging an extension"). The files beside this PKGBUILD that
# link into the tree are resolved when release/publish.sh --extras exports it.
pkgname=bluerune-extension-now-playing
pkgver=1
pkgrel=1
pkgdesc="What is playing, with its controls, on BlueRune's desktop"
arch=('any')
url='https://bluerune.dev/docs/extensions/'
license=('Apache-2.0 OR MIT')
install=bluerune-extension-now-playing.install
# Desktop cards came after 0.3.3; bluerune-session.target starts the unit.
depends=('bluerune>0.3.3' 'python' 'python-gobject' 'glib2' 'hicolor-icon-theme')
optdepends=('mpv-mpris: mpv on the card')
source=(
    nowplaying.py
    bluerune-extension-now-playing.service
    org.bluerune.Extension.NowPlaying.metainfo.xml
    org.bluerune.Extension.NowPlaying.svg
    LICENSE-MIT
)
sha256sums=('16fa8dc7e4b69b2443fad65734a095be1c56e9a1f3e47e6d4c1e6acbc7e68cb3'
            '483c5c550ae9aa6f6e2ff3d219e3af328e2a142525836e5160d2b083246d6b1a'
            '539711154feb913e9ebeb077999accff46883ae8f5d672503fc2bdb943408c71'
            'aa6f2873a146f92fc166f0a12499c9b83fc3e4eb49f989c9cefeb3ec9e76b54b'
            'de6686d0422e16d4c09e5af7bc8b56a0208562a7e57c6d434e8c50ec9b0e5b6d')

package() {
    install -Dm755 nowplaying.py "$pkgdir/usr/lib/bluerune/extensions/now-playing/nowplaying"
    install -Dm644 -t "$pkgdir/usr/lib/systemd/user" bluerune-extension-now-playing.service
    install -d "$pkgdir/usr/lib/systemd/user/bluerune-session.target.wants"
    ln -s ../bluerune-extension-now-playing.service "$pkgdir/usr/lib/systemd/user/bluerune-session.target.wants/"
    install -Dm644 -t "$pkgdir/usr/share/metainfo" org.bluerune.Extension.NowPlaying.metainfo.xml
    install -Dm644 -t "$pkgdir/usr/share/icons/hicolor/scalable/apps" org.bluerune.Extension.NowPlaying.svg
    install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE-MIT
}
