🚸 Select download path

This commit is contained in:
zhbaor 2023-03-04 18:18:39 +08:00
parent afc9c112cb
commit 3b5a998aaa
7 changed files with 303 additions and 18 deletions

View file

@ -11,12 +11,13 @@ class Manager:
self.video_list: list[Video] = []
self.bvid_set = set()
self.queue = SimpleQueue()
self.path = ""
def get_info_worker(self):
while not self.queue.empty():
video: Video = self.queue.get()
video.get_info()
sleep(5)
sleep(1)
def add_videos_by_number(self, video_numbers: list[str]):
for video_number in video_numbers:
@ -34,12 +35,16 @@ class Manager:
while not self.queue.empty():
video: Video = self.queue.get()
filename = sanitize(video.title) + ".m4a"
video.download(parent_dir / filename)
sleep(5)
while True:
try:
video.download(parent_dir / filename)
break
except:
sleep(1)
sleep(1)
def download(self, parent_dir: str | Path = Path(".")):
if isinstance(parent_dir, str):
parent_dir = Path(parent_dir)
def download(self):
parent_dir = Path(self.path)
for video in self.video_list:
print(video)
self.queue.put(video)