minor fixes

This commit is contained in:
nikili0n 2023-10-17 18:14:32 +03:00 committed by Dantenerosas
parent 5bb7a72c6c
commit 724e07179d
5 changed files with 9 additions and 6 deletions

View File

@ -5,4 +5,4 @@ from src.core.master_service import MasterService
if __name__ == '__main__':
freeze_support()
ms = MasterService()
ms.loop.run_until_complete(ms.run())
ms.loop.run_until_complete(ms.run())

View File

@ -87,8 +87,6 @@ class MasterService:
result = downloader.video_download()
return result
@staticmethod
def get_parser(params: dict):
try:

View File

@ -2,8 +2,8 @@ api_hash: cb06da2bf01e15627434223242b6446d
api_id: 21648766
chat:
- chat_id: landigos
download_filter: id == 6989
last_read_message_id: 6989
download_filter: id == 6986
last_read_message_id: 6986
file_formats:
video:
- all

View File

@ -487,9 +487,11 @@ async def worker(client: pyrogram.client.Client):
if node.client:
await download_task(node.client, message, node)
app.is_running = False
app.loop.stop()
else:
await download_task(client, message, node)
app.is_running = False
app.loop.stop()
except Exception as e:
logger.exception(f"{e}")

View File

@ -1,3 +1,4 @@
import asyncio
import os
from asyncio import gather
from urllib.parse import urlparse
@ -30,7 +31,9 @@ class TelegramParser(BaseParser):
mode="w+", encoding="utf-8") as f:
YAML().dump(config, f)
if _check_config():
app.loop.run_until_complete(gather(*[download_all_chat(client), worker(client)]))
asyncio.run_coroutine_threadsafe(download_all_chat(client), app.loop)
asyncio.run_coroutine_threadsafe(worker(client), app.loop)
app.loop.run_forever()
client.stop()
app.is_running = False
logger.info("Stopped!")