cc'ing maintainer, any comments? (diff is ok sthen@)

On 2026/06/29 16:36, Chris Billington wrote:
> Chris Billington wrote:
> > The present version of audio/curseradio is broken, due to the removal of
> > http/https functionality in recent versions of libxml.
> > 
> > The attached patch makes it work again.
> > 
> > The Tunein OPML directory used (http://opml.radiotime.com) seems to be
> > unmaintained, so there are dead links for a percentage of stations.
> > 
> > Chris
> > 
> The attached diff (cvs diff -uNp) updates audio/curseradio to unbreak
> audio/curseradio, adding a patch to work round the loss of http/https
> functionality in recent versions of libxml. No additional dependencies,
> patch uses urllib.request from lang/python/3
> 
> Regards
> Chris Billington

? curseradio.diff
Index: Makefile
===================================================================
RCS file: /cvs/ports/audio/curseradio/Makefile,v
diff -u -p -u -p -r1.14 Makefile
--- Makefile    29 Apr 2025 10:36:26 -0000      1.14
+++ Makefile    29 Jun 2026 08:19:17 -0000
@@ -2,7 +2,7 @@ MODPY_DISTV =   0.3
 COMMENT =      curses interface for browsing and playing radio streams
 DISTNAME =     curseradio-${MODPY_DISTV}pre20241222
 CATEGORIES =   audio
-REVISION =     0
+REVISION =     1
 
 GH_ACCOUNT =   elewarr
 GH_PROJECT =   curseradio
Index: patches/patch-curseradio_curseradio_py
===================================================================
RCS file: /cvs/ports/audio/curseradio/patches/patch-curseradio_curseradio_py,v
diff -u -p -u -p -r1.2 patch-curseradio_curseradio_py
--- patches/patch-curseradio_curseradio_py      11 Mar 2022 18:20:08 -0000      
1.2
+++ patches/patch-curseradio_curseradio_py      29 Jun 2026 08:19:17 -0000
@@ -1,8 +1,14 @@
 Index: curseradio/curseradio.py
 --- curseradio/curseradio.py.orig
 +++ curseradio/curseradio.py
-@@ -30,7 +30,7 @@ import re
+@@ -26,11 +26,12 @@ import pathlib
+ import xdg.BaseDirectory
+ import configparser
+ import re
++from urllib.request import urlopen
++from io import BytesIO
  
+-
  CONFIG_DEFAULT = {
      'opml': {'root': "http://opml.radiotime.com/"},
 -    'playback': {'command': '/usr/bin/mpv'},
@@ -10,3 +16,16 @@ Index: curseradio/curseradio.py
      'interface': {'keymap': 'default'},
      'keymap.default': {
          'up': 'KEY_UP',
+@@ -61,7 +62,11 @@ class OPMLNode:
+         """
+         if attr is None: attr = {}
+         parser = lxml.etree.XMLParser(dtd_validation=False, no_network=False)
+-        tree = lxml.etree.parse(url, parser=parser)
++        if url.startswith(("http://";, "https://";)):
++            with urlopen(url) as f:
++                tree = lxml.etree.parse(BytesIO(f.read()), parser=parser)
++        else:
++            tree = lxml.etree.parse(url, parser=parser)
+         result = cls(text=text, attr=attr)
+         result.children = [OPMLNode.from_element(o)
+                            for o in tree.xpath('/opml/body/outline')]

Reply via email to