New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GStreamer issue for some m3u source #853

Closed
slowjoe007 opened this Issue Sep 16, 2014 · 10 comments

Comments

4 participants
@slowjoe007

slowjoe007 commented Sep 16, 2014

I use Pi MusicBox to stream web radio stations.

When providing http://www.fritz.de/live.m3u as the source URI, I see this error message in /var/log/mopidy/mopidy.log:

2014-09-14 12:29:31,682 - WARNING  Problem looking up http://www.fritz.de/live.m3u: GStreamer encountered a general supporting library error.

The content of this m3u file is as follows:

#EXTM3U
#EXTINF:-1,Fritz vom rbb live hören - www.fritz.de
http://rbb-mp3-fritz-m.akacast.akamaistream.net/7/799/292093/v1/gnl.akacast.akamaistream.net/rbb_mp3_fritz_m
#EXTINF:-1,Fritz vom rbb live hören - www.fritz.de
http://rbb.ic.llnwd.net/stream/rbb_fritz_mp3_m_a
#EXTINF:-1,Fritz vom rbb live hören - www.fritz.de
http://rbb.ic.llnwd.net/stream/rbb_fritz_mp3_m_b

Directly providing any of the URIs listed in the m3u file, streaming works well. Maybe the issue is caused by the special characters (German umlauts) in the #EXTINF lines.

@willwach

This comment has been minimized.

willwach commented Jan 2, 2015

Same problem for most streams of RBB.
Newest version of "pi musicbox" 0.5.2
With debug messages.

www.inforadio.de
2015-01-02 09:40:45,604 - INFO Starting new HTTP connection (1): opml.radiotime.com
2015-01-02 09:40:47,661 - INFO Starting new HTTP connection (1): www.inforadio.de
2015-01-02 09:40:48,182 - ERROR GStreamer encountered a general supporting library error. Debug message: /usr/local/lib/python2.7/dist-packages/mopidy/audio/playlists.py(212): _event (): /GstPlayBin2:playbin20/GstURIDecodeBin:uridecodebin6/GstDecodeBin2:decodebin23/mopidy+audio+playlists+UriListElement:mopidy+audio+playlists+urilistelement2:
<type 'exceptions.IndexError'>: list index out of range

www.fritz.de
2015-01-02 09:41:29,276 - INFO Starting new HTTP connection (1): opml.radiotime.com
2015-01-02 09:41:30,850 - INFO Starting new HTTP connection (1): www.fritz.de
2015-01-02 09:41:35,095 - ERROR GStreamer encountered a general supporting library error. Debug message: /usr/local/lib/python2.7/dist-packages/mopidy/audio/playlists.py(212): _event (): /GstPlayBin2:playbin20/GstURIDecodeBin:uridecodebin8/GstDecodeBin2:decodebin24/mopidy+audio+playlists+UriListElement:mopidy+audio+playlists+urilistelement3:
<type 'exceptions.IndexError'>: list index out of range

www.radioeins.de
2015-01-02 09:42:17,784 - INFO Starting new HTTP connection (1): opml.radiotime.com
2015-01-02 09:42:18,541 - INFO Starting new HTTP connection (1): www.radioeins.de
2015-01-02 09:42:19,029 - ERROR GStreamer encountered a general supporting library error. Debug message: /usr/local/lib/python2.7/dist-packages/mopidy/audio/playlists.py(212): _event (): /GstPlayBin2:playbin20/GstURIDecodeBin:uridecodebin11/GstDecodeBin2:decodebin26/mopidy+audio+playlists+UriListElement:mopidy+audio+playlists+urilistelement5:
<type 'exceptions.IndexError'>: list index out of range

@kingosticks

This comment has been minimized.

Member

kingosticks commented Jan 2, 2015

When I tried http://www.fritz.de/live.m3u on musicbox with some extra debug I got:

2015-01-02 17:22:31,232 - ERROR    GStreamer encountered a general supporting library error. Debug message: /usr/local/lib/python2.7/dist-packages/mopidy/audio/playlists.py(212): _event (): /GstPlayBin2:playbin20/GstURIDecodeBin:uridecodebin4/GstDecodeBin2:decodebin21/mopidy+audio+playlists+M3uDecoder:mopidy+audio+playlists+m3udecoder1:
<type 'exceptions.UnicodeDecodeError'>: 'ascii' codec can't decode byte 0xc3 in position 31: ordinal not in range(128)

If you modify the string literals inaudio/playlists.py:parse_m3u() to be defined as bytestrings than this now works. Which I think makes sense as you are otherwise trying to compare a unicode literal with io.BytesIO data. But what I do not understand is why does the original code work when running Mopidy on my desktop, but not when Mopidy on pi musicbox (or in the python shell)? What controls which (default?) codec to use and why is it different between the two systems?

@kingosticks

This comment has been minimized.

Member

kingosticks commented Jan 3, 2015

Seems that running mopidy-mpris, as I do on my PC, magically changes the return value of sys.getdefaultencoding() to return "utf-8". Disabling the extension makes it return "ascii" instead, just as it does in the regular python shell and on pi musicbox where the MPRIS extension is not installed. When this "ascii" codec is the default encoding I see UnicodeDecodeError issues for these playlists. But I still can't work out what part of the dbus code causes this.

@jodal

This comment has been minimized.

Member

jodal commented Jan 3, 2015

There's no code in Mopidy-MPRIS itself to change the default encoding, and I really don't like it if one of the libraries used there does this :-/

@kingosticks

This comment has been minimized.

Member

kingosticks commented Jan 3, 2015

Yeh sorry, I didn't mean to imply it was Mopidy-mpris code, it's definitely
one of the libraries. Google tells me that gtk does this horrible trick (or
at least used to) but I can't see that it's a dependency of the
dbus/dbus-glib stuff.
On 3 Jan 2015 12:37, "Stein Magnus Jodal" notifications@github.com wrote:

There's no code in Mopidy-MPRIS itself to change the default encoding, and
I really don't like it if one of the libraries used there does this :-/


Reply to this email directly or view it on GitHub
#853 (comment).

@kingosticks

This comment has been minimized.

Member

kingosticks commented Jan 3, 2015

Ah ha! It's import indicate in mopidy-mpris/frontend.py that causes this change in behaviour.

Python 2.7.5+ (default, Feb 27 2014, 19:37:08) 
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.getdefaultencoding()
'ascii'
>>> import indicate
>>> sys.getdefaultencoding()
'utf-8'
@kingosticks

This comment has been minimized.

Member

kingosticks commented Jan 3, 2015

For completeness: this is because importing indicate (http://dpaste.com/17HTG1F) will import gtk-2.0's pango which is guilty of the actual PyUnicode_SetDefaultEncoding call. The relevant bug reports are at https://bugzilla.gnome.org/show_bug.cgi?id=328031 and is presumably fixed in the gi versions of all this stuff.

Either way, the Mopidy playlist strings should probably still be defined as bytestrings, currently some are and some are not.

@jodal jodal added this to the v0.19.6 - Bug fixes milestone Jan 4, 2015

kingosticks added a commit that referenced this issue Jan 4, 2015

@kingosticks

This comment has been minimized.

Member

kingosticks commented Jan 4, 2015

I'm not 100% sure this fixes the : list index out of range error, I think that might be a different problem as I can still trigger than when loading the 'Fritz vom rbb' stream through TuneIn (rather than just adding http://www.fritz.de/live.m3u directly)

@willwach

This comment has been minimized.

willwach commented Jan 7, 2015

Many thanks to @kingosticks for your work.
The last days i had no time to read your comments.
I tried FRITZ from TuneIn when I got this errors.

So, what will i have to do, to get the bugfixes into my musicbox installation?
I installed the "image for the Raspberry Pi SD Card" and not directly from github.

@kingosticks

This comment has been minimized.

Member

kingosticks commented Jan 7, 2015

On musicbox run pip install https://github.com/mopidy/mopidy/archive/release/v0.19.x.zip.

But I think the error you see is something else. The playlists for those particular stations are somehow malformed and neither Mopidy or Mopidy-TuneIn is able to parse them; somehow that ends up with a bogus URI list in the audio pipeline and I think that's the list index out of range. Maybe I'm doing something stupid in Mopidy-TuneIn for this error case, so for now let's take further discussion there.

@jodal jodal modified the milestones: v0.19.6 - Bug fixes, v0.20 - Audio cleanup 1 Mar 13, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment