In [1]:
from underground_garage import shows
In [2]:
pl = shows.showplaylist(shows.showsinarchive()[0])
In [3]:
from pydub import AudioSegment
In [4]:
import requests
In [6]:
r = requests.get(pl[0], stream=True)
if r.status_code == 200:
r.raw.decode_content = True
sound = AudioSegment.from_mp3(r.raw)
In [7]:
def combinelist(playlist, filename='list.mp3'):
"""
Combines a list of mp3 urls into a single file
"""
sound = AudioSegment.silent(duration=0)
for url in playlist:
r = requests.get(url, stream=True)
if r.status_code == 200:
r.raw.decode_content = True
sound = sound + AudioSegment.from_mp3(r.raw)
sound.export(filename, format='mp3')
combinelist(pl)