git: 0ba92b30f825 - main - audio/py-pyradio: New port: Command line radio player

From: Nicola Vitale <nivit_at_FreeBSD.org>
Date: Sat, 26 Nov 2022 16:04:44 UTC
The branch main has been updated by nivit:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0ba92b30f8255d407c2bbeaab8ee01c230802a98

commit 0ba92b30f8255d407c2bbeaab8ee01c230802a98
Author:     Nicola Vitale <nivit@FreeBSD.org>
AuthorDate: 2022-11-26 15:57:48 +0000
Commit:     Nicola Vitale <nivit@FreeBSD.org>
CommitDate: 2022-11-26 15:57:48 +0000

    audio/py-pyradio: New port: Command line radio player
    
    Pyradio is a curses based Internet radio player.
    
    It provides the following features:
    
      * vi like keys in addition to arrows and special keys
      * Station editor (add/edit) with CJK characters support
      * Configuration editor
      * Multiple playlist support
      * vi like station registers
      * Search function
      * Theming support
      * RadioBrowser support
---
 audio/Makefile                               |  1 +
 audio/py-pyradio/Makefile                    | 51 ++++++++++++++++++++++++++++
 audio/py-pyradio/distinfo                    |  3 ++
 audio/py-pyradio/files/patch-pyradio_ping.py | 11 ++++++
 audio/py-pyradio/files/patch-setup.py        | 25 ++++++++++++++
 audio/py-pyradio/pkg-descr                   | 12 +++++++
 6 files changed, 103 insertions(+)

diff --git a/audio/Makefile b/audio/Makefile
index 218b1aa88b58..4a03fb9b0fb8 100644
--- a/audio/Makefile
+++ b/audio/Makefile
@@ -660,6 +660,7 @@
     SUBDIR += py-pyliblo
     SUBDIR += py-pymad
     SUBDIR += py-pyogg
+    SUBDIR += py-pyradio
     SUBDIR += py-pysndfile
     SUBDIR += py-python-mpd2
     SUBDIR += py-soundcloud
diff --git a/audio/py-pyradio/Makefile b/audio/py-pyradio/Makefile
new file mode 100644
index 000000000000..db7e65364794
--- /dev/null
+++ b/audio/py-pyradio/Makefile
@@ -0,0 +1,51 @@
+PORTNAME=	pyradio
+DISTVERSION=	0.8.9.31
+CATEGORIES=	audio python
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	nivit@FreeBSD.org
+COMMENT=	Curses based Internet radio player
+WWW=		https://github.com/coderholic/pyradio
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENCE
+
+BUILD_DEPENDS=	${PKGNAMEPREFIX}dnspython>=2.2.1:dns/py-dnspython@${PY_FLAVOR} \
+		${PKGNAMEPREFIX}psutil>=5.9.2:sysutils/py-psutil@${PY_FLAVOR} \
+		${PKGNAMEPREFIX}requests>=2.28.1:www/py-requests@${PY_FLAVOR} \
+		${PKGNAMEPREFIX}wheel>=0.38.4:devel/py-wheel@${PY_FLAVOR} \
+		bash:shells/bash
+RUN_DEPENDS=	${PKGNAMEPREFIX}dnspython>=2.2.1:dns/py-dnspython@${PY_FLAVOR} \
+		${PKGNAMEPREFIX}psutil>=5.9.2:sysutils/py-psutil@${PY_FLAVOR} \
+		${PKGNAMEPREFIX}requests>=2.28.1:www/py-requests@${PY_FLAVOR} \
+		${PKGNAMEPREFIX}wheel>=0.38.4:devel/py-wheel@${PY_FLAVOR} \
+		bash:shells/bash
+
+USES=		python:3.7+
+USE_GITHUB=	yes
+GH_ACCOUNT=	coderholic
+USE_PYTHON=	autoplist distutils
+
+PORTDOCS=	*
+
+OPTIONS_DEFINE=			DOCS
+OPTIONS_DEFAULT=		MPV
+OPTIONS_SINGLE=			MEDIA_PLAYER
+OPTIONS_SINGLE_MEDIA_PLAYER=	MPLAYER MPV VLC
+
+# override predefined
+MPV_DESC=	Mpv media player support
+VLC_DESC=	VLC media player support
+
+DOCS_PLIST_FILES=	man/man1/pyradio.1.gz \
+			man/man1/pyradio_rb.1.gz
+MPLAYER_RUN_DEPENDS+=	mplayer:multimedia/mplayer
+MPV_RUN_DEPENDS+=	mpv:multimedia/mpv
+VLC_RUN_DEPENDS+=	vlc:multimedia/vlc
+
+post-install-DOCS-on:
+	${MKDIR} ${STAGEDIR}${DOCSDIR}
+	${INSTALL_MAN} ${WRKSRC}/pyradio*.1 ${STAGEDIR}${MANPREFIX}/man/man1
+	${INSTALL_DATA} ${WRKSRC}/*.html ${WRKSRC}/*.md ${STAGEDIR}${DOCSDIR}/
+
+.include <bsd.port.mk>
diff --git a/audio/py-pyradio/distinfo b/audio/py-pyradio/distinfo
new file mode 100644
index 000000000000..ad54fa8f4cee
--- /dev/null
+++ b/audio/py-pyradio/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1669451407
+SHA256 (coderholic-pyradio-0.8.9.31_GH0.tar.gz) = f5787d002f4bb891dc00421934c93ab42f6afa616dd51773cc53f775b16112a2
+SIZE (coderholic-pyradio-0.8.9.31_GH0.tar.gz) = 629976
diff --git a/audio/py-pyradio/files/patch-pyradio_ping.py b/audio/py-pyradio/files/patch-pyradio_ping.py
new file mode 100644
index 000000000000..fe35285c2b92
--- /dev/null
+++ b/audio/py-pyradio/files/patch-pyradio_ping.py
@@ -0,0 +1,11 @@
+--- pyradio/ping.py.orig	2022-11-25 15:21:16 UTC
++++ pyradio/ping.py
+@@ -35,7 +35,7 @@ def linux_ping(server, count=1, timeout_in_seconds=1):
+             -1: error
+     '''
+     try:
+-        r=subprocess.Popen(['ping', '-c', str(count), '-w', str(timeout_in_seconds), server ], stdout=subprocess.PIPE).stdout.read()
++        r=subprocess.Popen(['ping', '-c', str(count), '-t', str(timeout_in_seconds), server ], stdout=subprocess.PIPE).stdout.read()
+         # print(r)
+         return 0 if '100%' in str(r) else 1
+     except:
diff --git a/audio/py-pyradio/files/patch-setup.py b/audio/py-pyradio/files/patch-setup.py
new file mode 100644
index 000000000000..af0c7fa59a93
--- /dev/null
+++ b/audio/py-pyradio/files/patch-setup.py
@@ -0,0 +1,25 @@
+--- setup.py.orig	2022-11-25 15:21:16 UTC
++++ setup.py
+@@ -2,7 +2,7 @@
+ from os import path as op
+ from sys import version_info
+ 
+-from setuptools import setup, find_packages
++from setuptools import setup
+ 
+ from pyradio import version, __project__, __license__
+ 
+@@ -27,8 +27,11 @@ meta = dict(
+     author='Ben Dowling',
+     author_email='ben.m.dowling@gmail.com',
+     url=' http://github.com/coderholic/pyradio',
+-    packages=find_packages(),
+-    include_package_data=True,
++    packages=['pyradio'],
++    package_dir={'pyradio':'pyradio'},
++    package_data={
++      'pyradio': ['themes/*'],
++    },
+     entry_points={
+         'console_scripts': [
+             'pyradio = pyradio.main:shell',
diff --git a/audio/py-pyradio/pkg-descr b/audio/py-pyradio/pkg-descr
new file mode 100644
index 000000000000..3f9df7913c3d
--- /dev/null
+++ b/audio/py-pyradio/pkg-descr
@@ -0,0 +1,12 @@
+Curses based Internet radio player.
+
+PyRadio provides the following features:
+
+  * vi like keys in addition to arrows and special keys
+  * Station editor (add/edit) with CJK characters support
+  * Configuration editor
+  * Multiple playlist support
+  * vi like station registers
+  * Search function
+  * Theming support
+  * RadioBrowser support