Merge branch 'main' of git.tronel.org:Public/panasonic

This commit is contained in:
Frédéric Tronel
2024-01-06 16:16:44 +01:00

View File

@@ -234,10 +234,11 @@ def downloadMovie(url, outputFileName):
exit(-1)
outputFD = output.fileno()
session = sessions.Session()
sample = 2.
headers = {'TimeSeekRange.dlna.org': 'npt=0.000-%.03f' % sample}
r = requests.get(url, headers=headers)
r = session.get(url, headers=headers)
if r.status_code != 200:
logger.error('Impossible to download first %f seconds: %d' % (sample,r.status_code))
exit(-1)
@@ -269,7 +270,8 @@ def downloadMovie(url, outputFileName):
pb = tqdm(total=estimatedLength, unit='bytes', desc='Download', unit_scale=True, unit_divisor=1024)
nbiters = 0
with requests.get(url, stream=True) as r:
with session.get(url, stream=True) as r:
chunks = r.iter_content(chunk_size = 100000)
for chunk in chunks:
output.write(chunk)