privateone commited on
Commit
eb81f74
·
1 Parent(s): e55d3e3

Code Updates & SeveralFixes

Browse files
FileStream/__main__.py CHANGED
@@ -58,7 +58,7 @@ async def start_services():
58
  print("------------------------------ DONE ------------------------------\n\n")
59
 
60
  # Start the background task to clear inactive clients after web server setup
61
- asyncio.create_task(clear_inactive_clients()) # Now this works as event loop is running
62
 
63
  print(
64
  f"------------------------- Service Started -------------------------\n"
 
58
  print("------------------------------ DONE ------------------------------\n\n")
59
 
60
  # Start the background task to clear inactive clients after web server setup
61
+ #asyncio.create_task(clear_inactive_clients()) # Now this works as event loop is running
62
 
63
  print(
64
  f"------------------------- Service Started -------------------------\n"
FileStream/utils/FileProcessors/custom_mix.py CHANGED
@@ -81,22 +81,21 @@ class TGFileController:
81
 
82
  async def get_file_properties(self, db_id: str, MULTI_CLIENTS) -> FileId:
83
  """
84
- Returns the properties of a media of a specific message in a FIleId class.
85
- if the properties are cached, then it'll return the cached results.
86
- or it'll generate the properties from the Message ID and cache them.
87
- """
88
  if not db_id in self.cached_file_ids:
89
  logging.debug("Before Calling generate_file_properties")
90
  await self.generate_file_properties(db_id, MULTI_CLIENTS)
91
  logging.debug(f"Cached file properties for file with ID {db_id}")
92
  return self.cached_file_ids[db_id]
93
 
94
- async def generate_file_properties(self, db_id: str,
95
- MULTI_CLIENTS) -> FileId:
 
 
96
  """
97
- Generates the properties of a media file on a specific message.
98
- returns ths properties in a FIleId class.
99
- """
100
  logging.debug("Before calling get_file_ids")
101
  file_id = await get_file_ids(self.client, db_id, Message)
102
  logging.debug(f"Generated file ID and Unique ID for file with ID {db_id}")
@@ -104,12 +103,11 @@ class TGFileController:
104
  logging.debug(f"Cached media file with ID {db_id}")
105
  return self.cached_file_ids[db_id]
106
 
107
- async def generate_media_session(self, client: Client,
108
- file_id: FileId) -> Session:
 
 
109
  """
110
- Generates the media session for the DC that contains the media file.
111
- This is required for getting the bytes from Telegram servers.
112
- """
113
 
114
  media_session = client.media_sessions.get(file_id.dc_id, None)
115
 
@@ -157,16 +155,14 @@ class TGFileController:
157
  return media_session
158
 
159
  @staticmethod
160
- async def get_location(
161
- file_id: FileId
162
- ) -> Union[
163
  raw.types.InputPhotoFileLocation,
164
  raw.types.InputDocumentFileLocation,
165
  raw.types.InputPeerPhotoFileLocation,
166
  ]:
167
  """
168
- Returns the file location for the media file.
169
- """
170
  file_type = file_id.file_type
171
 
172
  if file_type == FileType.CHAT_PHOTO:
 
81
 
82
  async def get_file_properties(self, db_id: str, MULTI_CLIENTS) -> FileId:
83
  """
84
+ Returns the properties of a media of a specific message in a FIleId class.
85
+ if the properties are cached, then it'll return the cached results.
86
+ or it'll generate the properties from the Message ID and cache them.
87
+ """
88
  if not db_id in self.cached_file_ids:
89
  logging.debug("Before Calling generate_file_properties")
90
  await self.generate_file_properties(db_id, MULTI_CLIENTS)
91
  logging.debug(f"Cached file properties for file with ID {db_id}")
92
  return self.cached_file_ids[db_id]
93
 
94
+ async def generate_file_properties(self, db_id: str,MULTI_CLIENTS) -> FileId:
95
+ """
96
+ Generates the properties of a media file on a specific message.
97
+ returns ths properties in a FIleId class.
98
  """
 
 
 
99
  logging.debug("Before calling get_file_ids")
100
  file_id = await get_file_ids(self.client, db_id, Message)
101
  logging.debug(f"Generated file ID and Unique ID for file with ID {db_id}")
 
103
  logging.debug(f"Cached media file with ID {db_id}")
104
  return self.cached_file_ids[db_id]
105
 
106
+ async def generate_media_session(self, client: Client,file_id: FileId) -> Session:
107
+ """
108
+ Generates the media session for the DC that contains the media file.
109
+ This is required for getting the bytes from Telegram servers.
110
  """
 
 
 
111
 
112
  media_session = client.media_sessions.get(file_id.dc_id, None)
113
 
 
155
  return media_session
156
 
157
  @staticmethod
158
+ async def get_location(file_id: FileId) -> Union[
 
 
159
  raw.types.InputPhotoFileLocation,
160
  raw.types.InputDocumentFileLocation,
161
  raw.types.InputPeerPhotoFileLocation,
162
  ]:
163
  """
164
+ Returns the file location for the media file.
165
+ """
166
  file_type = file_id.file_type
167
 
168
  if file_type == FileType.CHAT_PHOTO: