Improved content type handling

This commit is contained in:
Martin Brodbeck 2013-09-16 16:28:47 +02:00
parent 190a9ec263
commit a3a8fa97fa
2 changed files with 8 additions and 4 deletions

View file

@ -46,8 +46,12 @@ def record_worker(stoprec, streamurl, target_dir, name=None):
filename += '.mp3'
elif(content_type == 'application/ogg' or content_type == 'audio/ogg'):
filename += '.ogg'
elif(content_type == 'audio/x-mpegurl'):
#TODO Add support for M3U playlists
print('Sorry, M3U playlists are currently not supported')
sys.exit()
else:
print('Unknown content type. Assuming mp3.')
print('Unknown content type "' + content_type + '". Assuming mp3.')
filename += 'mp3'
target = open(filename, "wb")
while(not stoprec.is_set() and not conn.closed):

View file

@ -5,6 +5,6 @@ target_dir = $HOME/Arbeitsfläche
dlf = http://dradio_mp3_dlf_m.akacast.akamaistream.net/7/249/142684/v1/gnl.akacast.akamaistream.net/dradio_mp3_dlf_m
dkultur = http://dradio_mp3_dkultur_m.akacast.akamaistream.net/7/530/142684/v1/gnl.akacast.akamaistream.net/dradio_mp3_dkultur_m
dwissen = http://dradio_mp3_dwissen_m.akacast.akamaistream.net/7/728/142684/v1/gnl.akacast.akamaistream.net/dradio_mp3_dwissen_m
swr2 = http://mp3-live.swr.de/swr2_m.m3u
brklassik = http://streams.br-online.de/br-klassik_2.m3u
mdrklassik = http://avw.mdr.de/livestreams/mdr_klassik_live_128.m3u
swr2 = http://swr-mp3-m-swr2.akacast.akamaistream.net/7/721/137135/v1/gnl.akacast.akamaistream.net/swr-mp3-m-swr2
brklassik = http://gffstream.ic.llnwd.net/stream/gffstream_w13a
mdrklassik = http://c22033-l.i.core.cdn.streamfarm.net/22008mdrklassik/live/3087mdrklassik/live_de_128.mp3[brodbemn@pcvs90