mirror of
https://github.com/fHDHR/fHDHR_NextPVR.git
synced 2025-12-06 09:26:57 -05:00
Check If Chunk Method can close better
This commit is contained in:
parent
36b4078c62
commit
8a84364e0d
@ -263,12 +263,16 @@ class HDHR_HTTP_Server():
|
|||||||
req = requests.get(channelUri, stream=True)
|
req = requests.get(channelUri, stream=True)
|
||||||
|
|
||||||
def generate():
|
def generate():
|
||||||
yield ''
|
try:
|
||||||
for chunk in req.iter_content(chunk_size=hdhr.config["direct_stream"]['chunksize']):
|
yield ''
|
||||||
if not duration == 0 and not time.time() < duration:
|
for chunk in req.iter_content(chunk_size=hdhr.config["direct_stream"]['chunksize']):
|
||||||
req.close()
|
if not duration == 0 and not time.time() < duration:
|
||||||
break
|
req.close()
|
||||||
yield chunk
|
break
|
||||||
|
yield chunk
|
||||||
|
except GeneratorExit:
|
||||||
|
req.close()
|
||||||
|
print("Connection Closed.")
|
||||||
|
|
||||||
return Response(generate(), content_type=req.headers['content-type'], direct_passthrough=True)
|
return Response(generate(), content_type=req.headers['content-type'], direct_passthrough=True)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user