minor fixes
This commit is contained in:
parent
aad25c98d9
commit
29bffb6e53
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -72,10 +72,51 @@
|
||||
<body>
|
||||
<form method="post" action="/submit" id="download">
|
||||
<input type="text" name="link" id="link" placeholder="link">
|
||||
<input type="text" name="video_format" placeholder="video_format">
|
||||
<input type="text" name="audio_format" placeholder="audio_format">
|
||||
<input type="text" name="resolution" placeholder="resolution">
|
||||
<input type="text" name="merge_output_format" placeholder="merge_output_format">
|
||||
<p>Формат видео
|
||||
<select id="video_format" name="video_format">
|
||||
<option hidden>Выбор формата видео</option>
|
||||
<option value="3gp">3gp</option>
|
||||
<option value="flv">flv</option>
|
||||
<option value="mp4">mp4</option>
|
||||
<option value="mov">mov</option>
|
||||
<option value="webm" selected>webm</option>
|
||||
</select >
|
||||
</p>
|
||||
<p>Формат аудио
|
||||
<select id="audio_format" name="audio_format">
|
||||
<option hidden>Выбор формата аудио</option>
|
||||
<option value="mp3">mp3</option>
|
||||
<option value="ogg">ogg</option>
|
||||
<option value="m4a">m4a</option>
|
||||
<option value="opus">opus</option>
|
||||
<option value="webm" selected>webm</option>
|
||||
<option value="wav">wav</option>
|
||||
<option value="aac">aac</option>
|
||||
</select >
|
||||
</p>
|
||||
<p>Качество видео
|
||||
<select id="resolution" name="resolution">
|
||||
<option hidden>Выбор формата аудио</option>
|
||||
<option value="240">240</option>
|
||||
<option value="360">360</option>
|
||||
<option value="480" >480</option>
|
||||
<option value="720">720</option>
|
||||
<option value="1080" selected>1080</option>
|
||||
<option value="2048">2048</option>
|
||||
<option value="3840">3840</option>
|
||||
</select >
|
||||
</p>
|
||||
<p>Выходной формат видео
|
||||
<select id="merge_output_format" name="merge_output_format">
|
||||
<option hidden>Выбор формата аудио</option>
|
||||
<option value="avi">avi</option>
|
||||
<option value="flv">flv</option>
|
||||
<option value="mp4">mp4</option>
|
||||
<option value="mkv" selected>mkv</option>
|
||||
<option value="mov">mov</option>
|
||||
<option value="webm">webm</option>
|
||||
</select>
|
||||
</p>
|
||||
<button type="submit" class="custom-btn btn-1"><span class="submit-spinner submit-spinner_hide"></span> Download</button>
|
||||
</form>
|
||||
<div id="linksList" class="col">
|
||||
@ -170,8 +211,12 @@
|
||||
document.forms.download.querySelector('.submit-spinner').classList.add('submit-spinner_hide');
|
||||
console.log(xhr.status);
|
||||
if (xhr.status !== 200 && xhr.status !== 201) {
|
||||
if ('response' in xhr && xhr.response !== null) {
|
||||
sendReq()
|
||||
} else {
|
||||
return;
|
||||
};
|
||||
};
|
||||
|
||||
const response = xhr.response;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user