Aadhithya
commited on
Commit
•
1948f3c
1
Parent(s):
dbcbb5d
Update roop/utilities.py
Browse files- roop/utilities.py +1 -13
roop/utilities.py
CHANGED
@@ -4,6 +4,7 @@ import os
|
|
4 |
import platform
|
5 |
import shutil
|
6 |
import ssl
|
|
|
7 |
import subprocess
|
8 |
from pathlib import Path
|
9 |
from typing import List, Optional
|
@@ -131,18 +132,5 @@ def is_video(video_path: str) -> bool:
|
|
131 |
return bool(mimetype and mimetype.startswith('video/'))
|
132 |
return False
|
133 |
|
134 |
-
|
135 |
-
def conditional_download(download_directory_path: str, urls: List[str]) -> None:
|
136 |
-
if not os.path.exists(download_directory_path):
|
137 |
-
os.makedirs(download_directory_path)
|
138 |
-
for url in urls:
|
139 |
-
download_file_path = os.path.join(download_directory_path, os.path.basename(url))
|
140 |
-
if not os.path.exists(download_file_path):
|
141 |
-
request = request.urlopen(url) # type: ignore[attr-defined]
|
142 |
-
total = int(request.headers.get('Content-Length', 0))
|
143 |
-
with tqdm(total=total, desc='Downloading', unit='B', unit_scale=True, unit_divisor=1024) as progress:
|
144 |
-
request.urlretrieve(url, download_file_path, reporthook=lambda count, block_size, total_size: progress.update(block_size)) # type: ignore[attr-defined]
|
145 |
-
|
146 |
-
|
147 |
def resolve_relative_path(path: str) -> str:
|
148 |
return os.path.abspath(os.path.join(os.path.dirname(__file__), path))
|
|
|
4 |
import platform
|
5 |
import shutil
|
6 |
import ssl
|
7 |
+
import urllib
|
8 |
import subprocess
|
9 |
from pathlib import Path
|
10 |
from typing import List, Optional
|
|
|
132 |
return bool(mimetype and mimetype.startswith('video/'))
|
133 |
return False
|
134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
def resolve_relative_path(path: str) -> str:
|
136 |
return os.path.abspath(os.path.join(os.path.dirname(__file__), path))
|