out_file.write(struct.pack('<L', data_len))
-def get_manifest(base_url, dest_dir=tempfile.gettempdir(),
- manifest_file='Manifest'):
+def get_manifest(base_url, dest_dir=tempfile.gettempdir()):
"""Returns the manifest and the new URL if this is changed"""
if os.path.exists(dest_dir) == False:
response = urllib2.urlopen(manifest_url)
data = response.read()
- manifest_path = os.path.join(dest_dir, manifest_file)
+ manifest_path = os.path.join(dest_dir, 'Manifest')
f = open(manifest_path, "w")
f.write(data)
f.close()
if os.path.exists(chunk_file) == False:
chunk_url = base_url + '/' + chunks_quality + '/' + chunk_name
- response = urllib2.urlopen(chunk_url)
- data = response.read()
+ try:
+ response = urllib2.urlopen(chunk_url)
+ data = response.read()
+
+ f = open(chunk_file, "wb")
+ f.write(data)
+ f.close()
+ except Exception as e:
+ print e
- f = open(chunk_file, "wb")
- f.write(data)
- f.close()
else:
f = open(chunk_file, "rb")
data = f.read()