-
Notifications
You must be signed in to change notification settings - Fork 0
/
YouTubeArchiver.py
50 lines (44 loc) · 1.41 KB
/
YouTubeArchiver.py
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
38
39
40
41
42
43
44
45
46
47
48
49
50
import os
import sys
import time
from functions.checks import check
from functions.download import Download
from functions.archive import Archive
from functions.functions import YTA
try:
os.chdir(os.path.dirname(__file__))
except:
os.chdir(os.path.dirname(sys.argv[0]))
try:
selfpath = os.path.dirname(os.path.realpath(__file__)) #attempts to get the scripts own directory
except NameError:
selfpath = os.path.dirname(os.path.abspath(sys.argv[0])) #runs this instead if script is used inside py2exe
ytdl = 'yt-dlp' #sets the downloader used via variable for easier swapping
ytdlprint = 'yt-dlp' #sets the displayed downloader used via variable for easier swapping
ytdl = check.ytdlcheck(selfpath, ytdl, ytdlprint)
check.ffmpegcheck()
#Main menu for the user
while True:
returntomenu = True
YTA.clear()
print(f'Using {ytdl}')
print('Please select an option')
print('\n[D]ownload')
print('\n[A]rchive')
print('\n[E]xit')
mmchoice = input('\n: ').upper()
if mmchoice == 'D':
Download.download(ytdl, ytdlprint, returntomenu)
elif mmchoice == 'A':
Archive.archive(ytdl, ytdlprint, returntomenu)
elif mmchoice == 'E':
sys.exit()
elif 'D' and 'A' and 'E' in mmchoice and len(mmchoice) == 3:
print('\nhaha very funny')
time.sleep(2)
YTA.clear()
continue
else:
YTA.notvalid()
time.sleep(2)
continue