-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
37 lines (26 loc) · 874 Bytes
/
Copy pathmain.py
File metadata and controls
37 lines (26 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from stify import Stify
from utube import Utube
from threading import Thread
from persistence import init_db
IGNORE_PLAYLISTS = ["sleep", "podcast", "meditation", "whitenoise", "jre", "focus", "christian"]
class PlaylistDowloaderThread(Thread):
def __init__(self, playlist):
super().__init__()
self.playlist = playlist
def run(self):
utube = Utube()
for track in self.playlist.tracks:
utube.download(track, self.playlist.name)
def run():
init_db()
s = Stify()
playlists = [playlist for playlist in s.playlists if playlist.name not in IGNORE_PLAYLISTS]
threads = []
for playlist in playlists:
thread = PlaylistDowloaderThread(playlist)
thread.run()
# threads.append(thread)
# for thread in threads:
# thread.join()
if __name__ == '__main__':
run()