From 146ed6792f7ebefdc53237c0538a1abd9b6f4512 Mon Sep 17 00:00:00 2001 From: Dantenerosas Date: Mon, 30 Oct 2023 22:06:42 +0300 Subject: [PATCH] minor fixes --- src/core/master_service.py | 11 +++- .../telegram_media_downloader/config.yaml | 6 +- src/web/templates/index.html | 55 +++++++++++++++++-- 3 files changed, 63 insertions(+), 9 deletions(-) diff --git a/src/core/master_service.py b/src/core/master_service.py index ba0fd69..6419ac8 100644 --- a/src/core/master_service.py +++ b/src/core/master_service.py @@ -1,5 +1,6 @@ import asyncio import concurrent.futures as pool +import json import subprocess import traceback @@ -35,7 +36,16 @@ class MasterService: "for pid in $(ps -ef | grep video_downloader_executor_process | awk '{print $2}'); do kill -9 $pid; done", shell=True, capture_output=True ) + # TODO Возможно бросать ошибку если упал мастер сервис. + redis = RedisClient() + messages = await redis.get_all_tasks_from_queue(redis.TASKS_NAME) + if messages: + messages = {k.decode("utf-8"): json.loads(v.decode("utf-8")) for k, v in + messages.items()} + for params in list(messages.values()): + await self.queue.put(params) + await redis.del_tasks_queue() tasks = [self.loop.create_task(self.create_workers()) for i in range(self.MAX_EXECUTOR_WORKERS + 1)] await asyncio.gather(self.rabbit_consumer(self.queue), *tasks) @@ -49,7 +59,6 @@ class MasterService: while True: video_params = await self.queue.get() redis = RedisClient() - await redis.del_tasks_queue() await redis.del_task_from_queue_and_add_to_tasks(link=video_params["link"], task=video_params) self.currently_underway[video_params['link']] = video_params diff --git a/src/parsers/Telegram/telegram_media_downloader/config.yaml b/src/parsers/Telegram/telegram_media_downloader/config.yaml index e5d7300..0e9be60 100644 --- a/src/parsers/Telegram/telegram_media_downloader/config.yaml +++ b/src/parsers/Telegram/telegram_media_downloader/config.yaml @@ -1,9 +1,9 @@ api_hash: cb06da2bf01e15627434223242b6446d api_id: 21648766 chat: -- chat_id: landigos - download_filter: id == 6986 - last_read_message_id: 6986 +- chat_id: dvachannel + download_filter: id == 125493 + last_read_message_id: 125493 file_formats: video: - all diff --git a/src/web/templates/index.html b/src/web/templates/index.html index 16c0f74..a965b0a 100644 --- a/src/web/templates/index.html +++ b/src/web/templates/index.html @@ -72,10 +72,51 @@
- - - - +

Формат видео + +

+

Формат аудио + +

+

Качество видео + +

+

Выходной формат видео + +