2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 05:18:10 +00:00

Add new sessions to the media_sessions dict before starting them

This commit is contained in:
Dan 2018-05-01 20:25:35 +02:00
parent db14aa288d
commit 1b48f850bf

View File

@ -2992,6 +2992,8 @@ class Client:
self.api_id self.api_id
) )
self.media_sessions[dc_id] = session
session.start() session.start()
session.send( session.send(
@ -3009,9 +3011,9 @@ class Client:
self.api_id self.api_id
) )
session.start() self.media_sessions[dc_id] = session
self.media_sessions[dc_id] = session session.start()
if volume_id: # Photos are accessed by volume_id, local_id, secret if volume_id: # Photos are accessed by volume_id, local_id, secret
location = types.InputFileLocation( location = types.InputFileLocation(
@ -3080,10 +3082,10 @@ class Client:
is_cdn=True is_cdn=True
) )
cdn_session.start()
self.media_sessions[r.dc_id] = cdn_session self.media_sessions[r.dc_id] = cdn_session
cdn_session.start()
try: try:
with tempfile.NamedTemporaryFile("wb", delete=False) as f: with tempfile.NamedTemporaryFile("wb", delete=False) as f:
file_name = f.name file_name = f.name