You are not logged in.

#1 2024-10-10 17:30:44

hjheins
Member
Registered: 2020-03-08
Posts: 28

DLNA output solution for pipewire => pa-dlna

Hello all,

I started using pipewire a few weeks ago, and quickly found out that there wasn't any support for DLNA output.
Why is this important? It is a really nice to have if you want to play audio to any DLNA device directly from your computer.

Then I found pa-dlna. long story short: this works. I made it into a package so it runs in the background as a user service and is always available.

However: I am not that proficient in PKGBUILD and have no access to AUR. Is there anybody out there that is willing to adopt this package and publish it in aur?

Prerequisite: python-libpulse

# Maintainer: HJHeins <hjheins at proton . me>
pkgname=python-libpulse
pkgshort=libpulse
pkgver=0.4
pkgrel=1
pkgdesc="Pulsaudio python connectivity library. Also works with pipewire."
arch=('any')
url="https://gitlab.com/xdegaye/libpulse"
license=('MIT')
depends=('libpulse' 'python3')
makedepends=('git' 'python-wheel' 'python-build' 'python-installer' 'python-flit-core')
source=("${pkgshort}-v${pkgver}.tar.bz::https://gitlab.com/xdegaye/$pkgshort/-/archive/v$pkgver/$pkgshort-v$pkgver.tar.bz2")
sha256sums=('5f6c4df686039c5e7516b59a3d2201fd3d3a9726e36b6365221f789c7075c3dc')

build() {
  cd $pkgshort-v$pkgver
  python -m build --wheel --no-isolation
}

package() {
  cd $pkgshort-v$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm 644 $srcdir/$pkgshort-v$pkgver/LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}/"
}

the main course: pa-dlna

# Maintainer: HJHeins <hjheins at proton . me>
pkgname=pa-dlna
pkgver=0.13
pkgrel=1
pkgdesc="Pulsaudio DLNA server written in python. Also works with pipewire."
arch=('any')
url="https://gitlab.com/xdegaye/pa-dlna"
license=('MIT License')
depends=('libpulse' 'python3' 'python-libpulse')
makedepends=('git' 'python-wheel' 'python-build' 'python-installer' 'python-flit-core')
source=("${pkgname}-${pkgver}.tar.bz2::https://gitlab.com/xdegaye/pa-dlna/-/archive/v${pkgver}/${pkgname}-v${pkgver}.tar.bz2"
"${pkgname}.bak"
"upnp-cmd.bak"
"$pkgname.service")
sha256sums=('7148c365df4414dc3b05aa89e03367c21788435a0f6c2fcecc5b70b2e9a74a31'
'd824bd1f27c96ecb2cfb56122acd1904190634c0d0b04413e92edd8322afa5fb' '8a82c3d0b2d770b27a9d5f362ca5d5942d0e84984b03a3e9c1cc64d68824294b'
'46a0775fee7e740db9a393ce6128aaf65c433cabca565ad1c4075f0115e94653')

build() {
#  mv $pkgname-v$pkgver $pkgname-$pkgver
  cd $pkgname-v$pkgver
  python -m build --wheel --no-isolation
}

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

  install -Dm 644 $srcdir/$pkgname.service -t "${pkgdir}/etc/systemd/user/"
  install -Dm 755 $srcdir/upnp-cmd.bak -T "${pkgdir}/usr/bin/upnp-cmd"
  install -Dm 755 $srcdir/$pkgname.bak -T "${pkgdir}/usr/bin/pa-dlna"
  install -Dm 644 $srcdir/$pkgname-v$pkgver/LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}/"
  rm -rf $srcdir/$pkgname-v$pkgver
  }

sources

pa-dlna.service

[Unit]
Description=Pulseaudio or Pipewire DLNA Service
After=network.target
Requires=pipewire-session-manager.service

[Service]
Type=simple
ExecStart=/usr/bin/pa-dlna
Restart=on-failure
RestartSec=5
Slice=session.slice
SyslogIdentifier=%n

[Install]
WantedBy=multi-user.target

pa-dlna.bak

#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from pa_dlna.pa_dlna import main
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

upnp-cmd.bak

#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from pa_dlna.upnp_cmd import main
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

Last edited by hjheins (2024-10-17 10:29:13)

Offline

#2 2024-10-10 17:32:40

hjheins
Member
Registered: 2020-03-08
Posts: 28

Re: DLNA output solution for pipewire => pa-dlna

As Info: this one is still build directly from git master as a bugfix that is needed is not yet packages as the next release

Offline

#3 2024-10-12 12:36:46

hjheins
Member
Registered: 2020-03-08
Posts: 28

Re: DLNA output solution for pipewire => pa-dlna

I would definitely also take comments on how to improve the pkgbuild file :-)

Offline

#4 2024-10-12 15:49:39

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,995

Re: DLNA output solution for pipewire => pa-dlna

The python-libpulse package build() function does nothing.
Also build() & package() are run from within $srcdir.

I think you should check https://man.archlinux.org/man/PKGBUILD.5 and https://wiki.archlinux.org/title/Python … guidelines


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2024-10-12 20:44:51

hjheins
Member
Registered: 2020-03-08
Posts: 28

Re: DLNA output solution for pipewire => pa-dlna

thanks, and noted. I updated python-libpulse.

Offline

#6 2024-10-12 21:26:53

loqs
Member
Registered: 2014-03-06
Posts: 18,091

Re: DLNA output solution for pipewire => pa-dlna

That is still not following the python package guidelines. Is there an issue with using a build such as:

...
makedepends=('python-build' 'python-flit-core' 'python-installer' 'python-wheel')
...
build() {
  cd $pkgshort-v$pkgver
  python -m build --wheel --no-isolation
}

package() {
  cd $pkgshort-v$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}/"
 }

Edit:
Other issues:

arch=('i686' 'x86_64' 'arm' 'armv7h' 'armv6h' 'aarch64' 'riscv64')

should be any for pure python packages.

options=(!lto)

Does not do anything in a pure python package.

license=('MIT License')

should be 'MIT'

makedepends=('git')

Not used as the source is a tarball.

source=("${pkgshort}-v${pkgver}.tar.gz::https://gitlab.com/xdegaye/$pkgshort/-/archive/v$pkgver/$pkgshort-v$pkgver.tar.bz2")

Why rename a bz2 tarball to .gz?

Last edited by loqs (2024-10-12 21:32:45)

Offline

#7 2024-10-13 09:11:56

hjheins
Member
Registered: 2020-03-08
Posts: 28

Re: DLNA output solution for pipewire => pa-dlna

Thank yo @loqs! that helps a lot.
I updated python-libpulse. As Info: when there is no source tarball, it pulls from git, which is also how I tested it. You think I should drop everything before the :  there?

I have also cleaned up pa-dlna the same way

Last edited by hjheins (2024-10-13 09:33:31)

Offline

#8 2024-11-26 18:00:04

dreieck
Member
Registered: 2012-10-08
Posts: 65

Re: DLNA output solution for pipewire => pa-dlna

Now, python-libpulse and pa-dlna are in the AUR (in their -git variants).

Since I do not use systemd, I cannot test the .service file and I have not included any.

If anyone can confirm that the posted `pa-dlna.service` is correct, or someone can post a correct one, AND tell where to install it, I can include it in the package.

(I assume that `pa-dlna` should be started per user, since pipewire / pulseaudio also run per user, correct?)

Regards!

Last edited by dreieck (2024-11-26 18:00:30)

Offline

Board footer

Powered by FluxBB