Internet radio browser GUI for music/video streams from various directory services.

⌈⌋ ⎇ branch:  streamtuner2


View Ticket

Ticket Hash: dcb9f8467f813c3ae95711fff9d127f47b9adfe6
Title: Can't play stream with python3.11
Status: Open Type: Code_Defect
Severity: Severe Priority:
Subsystem: Resolution:
Last Modified: 2024-11-09 20:31:32
Version Found In: 2.2.2
User Comments:
nobody added on 2024-11-09 20:31:32:

With python3.11, when trying to play a stream from the surfmusik plugin (and probably others), it crashes with this error:

Traceback (most recent call last):
  File "/usr/share/streamtuner2/st2.py", line 287, in on_play_clicked
    row = channel.play()
          ^^^^^^^^^^^^^^
  File "/usr/share/streamtuner2/channels/__init__.py", line 606, in play
    action.play(row, audioformat, listformat)
  File "/usr/share/streamtuner2/action.py", line 184, in play
    run_fmt_url(row, audioformat, source, conf.play)
  File "/usr/share/streamtuner2/action.py", line 173, in run_fmt_url
    cmd = interpol(cmd, source, row, add_default=add_default)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/streamtuner2/action.py", line 269, in interpol
    url = convert_playlist(row["url"], listfmt(source), listfmt(dest), local_file=True, row=row)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/streamtuner2/action.py", line 314, in convert_playlist
    probe = cnv.probe_fmt()
            ^^^^^^^^^^^^^^^
  File "/usr/share/streamtuner2/action.py", line 433, in probe_fmt
    if re.search(rx, self.src, re.X|re.M|re.S):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 176, in search
    return _compile(pattern, flags).search(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 294, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/_compiler.py", line 743, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/_parser.py", line 980, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/_parser.py", line 455, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/_parser.py", line 863, in _parse
    p = _parse_sub(source, state, sub_verbose, nested + 1)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/_parser.py", line 455, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/_parser.py", line 841, in _parse
    raise source.error('global flags not at the start '
re.error: global flags not at the start of the expression at position 25

changing line 103 of action.py from:

   ("xspf", r""" <\?xml .* <playlist .* ((?i)http://xspf\.org)/ns/0/ """),

to

   ("xspf", r""" (?i)<\?xml .* <playlist .* (http://xspf\.org)/ns/0/ """),

fixes the problem.