tested
Browse files- App/Worker.py +6 -5
App/Worker.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
from celery import Celery, chain
|
2 |
import os, shutil, subprocess
|
3 |
-
import uuid
|
|
|
4 |
import time
|
5 |
import requests
|
6 |
from App import celery_config, bot
|
@@ -26,8 +27,8 @@ def worker_process_init_handler(**kwargs):
|
|
26 |
# Script
|
27 |
|
28 |
|
29 |
-
def download_with_wget(link, download_dir):
|
30 |
-
subprocess.run(["wget", "-P", download_dir, link])
|
31 |
|
32 |
|
33 |
@celery.task
|
@@ -57,8 +58,8 @@ def download_assets(links: List[str], temp_dir: str):
|
|
57 |
filename = os.path.basename(urlparse(link).path)
|
58 |
|
59 |
# Use the extracted filename to save the file
|
60 |
-
|
61 |
-
download_with_wget(link,
|
62 |
|
63 |
|
64 |
@celery.task
|
|
|
1 |
from celery import Celery, chain
|
2 |
import os, shutil, subprocess
|
3 |
+
import uuid, cgi
|
4 |
+
from urllib.parse import urlparse
|
5 |
import time
|
6 |
import requests
|
7 |
from App import celery_config, bot
|
|
|
27 |
# Script
|
28 |
|
29 |
|
30 |
+
def download_with_wget(link, download_dir, filename):
|
31 |
+
subprocess.run(["wget", "-P", download_dir, "-O", filename, link])
|
32 |
|
33 |
|
34 |
@celery.task
|
|
|
58 |
filename = os.path.basename(urlparse(link).path)
|
59 |
|
60 |
# Use the extracted filename to save the file
|
61 |
+
|
62 |
+
download_with_wget(link, temp_dir, filename)
|
63 |
|
64 |
|
65 |
@celery.task
|