mirror of
https://github.com/fHDHR/fHDHR_NextPVR.git
synced 2025-12-06 16: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)
|
||||
|
||||
def generate():
|
||||
try:
|
||||
yield ''
|
||||
for chunk in req.iter_content(chunk_size=hdhr.config["direct_stream"]['chunksize']):
|
||||
if not duration == 0 and not time.time() < duration:
|
||||
req.close()
|
||||
break
|
||||
yield chunk
|
||||
except GeneratorExit:
|
||||
req.close()
|
||||
print("Connection Closed.")
|
||||
|
||||
return Response(generate(), content_type=req.headers['content-type'], direct_passthrough=True)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user