Skip to content
Browse files

What sort of sadist puts a unicode copyright symbol in their playlist…

… header?
  • Loading branch information...
1 parent adbd296 commit 3292211dc021de53b1c645d932f767d95f5742f6 @kingosticks committed
Showing with 6 additions and 4 deletions.
  1. +6 −4 mopidy_tunein/tunein.py
View
10 mopidy_tunein/tunein.py
@@ -3,10 +3,12 @@
import ConfigParser as configparser
import logging
import requests
-import cStringIO
import time
import urlparse
-
+try:
+ import cStringIO as StringIO
+except ImportError:
+ import StringIO as StringIO
try:
import xml.etree.cElementTree as elementtree
except ImportError:
@@ -248,7 +250,7 @@ def parse_stream_url(self, url):
if playlist:
parser = find_playlist_parser(extension, content_type)
if parser:
- playlist_data = cStringIO.StringIO(playlist)
+ playlist_data = StringIO.StringIO(playlist)
results = [u for u in parser(playlist_data) if u is not None]
if not results:
@@ -319,7 +321,7 @@ def _get_playlist(self, uri):
logger.debug('Found streaming audio at %s' % uri)
data = None
else:
- data = response.content # Want the encoded data
+ data = response.content.decode('utf-8', errors='ignore')
response.close()
return (data, content_type)
except Exception as e:

0 comments on commit 3292211

Please sign in to comment.
Something went wrong with that request. Please try again.