-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
228 lines (174 loc) · 7.18 KB
/
main.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
import tkinter as tk
from tkinter import filedialog
from tkinter import ttk
import youtube_dl
import pyautogui
import random as r
size = pyautogui.size() # Get screen size
location = pyautogui.position() # Get Mouse Location
screenwidthx = size[0]
screenwidthy = size[1]
locationx = location[0]
locationy = location[1]
print(screenwidthx, "x", screenwidthy)
print(locationx, "x", locationy)
def downloader():
urlget = urlentry.get()
if urlget == "":
print("Not a valid URL")
pass
else:
urlget = str(urlentry.get())
formatget = str(selected.get())
rateget = str(rateselected.get())
ratemb = 10000000
if rateget == "1gb/s": # converts values like '1gb/s' into 1000000000, whch is 1gb in singular bytes.
ratemb = 1000000000
elif rateget == "500mb/s":
ratemb = 500000000
elif rateget == "250mb/s":
ratemb = 250000000
elif rateget == "100mb/s":
ratemb = 100000000
elif rateget == "10mb/s":
ratemb = 10000000
elif rateget == "1mb/s":
ratemb = 1000000
else:
print("Shorten Error")
print("Selected URL: ", urlget) # print useful info into the console
print("Selected Format: ", formatget)
print("Selected Rate Limit: ", ratemb, "(", rateget, ")", "Bytes/s")
ydl_opts = { # options for downloading the video
'outtmpl': 'c:/tmp/%(title)s.%(ext)s',
'format': formatget,
'limitrate': ratemb,
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl: # with the options in "ydl_opts"...
ydl.download([urlget]) # download the url in "urlget"
def openfile(): # opens the file manager to select a file when called
file = str(
filedialog.askopenfilename()) # opens file manager and waits for a file to be selected before putting the directory into the variable "file"
print("Selected File:", file)
directoryentry.delete(0, "end") # deletes whats currently in the "directoryentry"
directoryentry.insert(string=file, index=0) # adds the new directory into "directoryentry"
def converter(): # converts the file when called
pass # not finished
def calculator():
pass
def autoclicker():
while True:
randomx = r.randint(0, screenwidthx)
randomy = r.randint(0, screenwidthy)
pyautogui.click(randomx, randomy)
def autodownloader():
pass
def filearchiver():
pass
def videoplayer():
pass
def musicplayer():
pass
# UNDER THIS LINE IS MOSTLY TKINTER STUFF + GUI STUFF
mainwindow = tk.Tk()
mainwindow.geometry("685x330")
mainwindow.resizable(0, 0)
mainwindow.title("Jake's Youtube Downloader")
# mainwindow.iconbitmap("icon.ico") # BROKEN WHEN CONVERTED TO EXE FOR SOME REASON
tabControl = ttk.Notebook(mainwindow)
DownloaderTab = ttk.Frame(tabControl)
ConverterTab = ttk.Frame(tabControl)
CalculatorTab = ttk.Frame(tabControl)
AutoclickerTab = ttk.Frame(tabControl)
AutoDownloaderTab = ttk.Frame(tabControl)
FileArchiverTab = ttk.Frame(tabControl)
VideoPlayerTab = ttk.Frame(tabControl)
MusicPlayerTab = ttk.Frame(tabControl)
HelpTab = ttk.Frame(tabControl)
CreditsTab = ttk.Frame(tabControl)
tabControl.add(DownloaderTab, text="Downloader")
tabControl.add(ConverterTab, text="Converter")
tabControl.add(CalculatorTab, text="Calculator")
tabControl.add(AutoclickerTab, text="Autoclicker")
tabControl.add(AutoDownloaderTab, text="Auto Downloader")
tabControl.add(FileArchiverTab, text="File Archiver")
tabControl.add(VideoPlayerTab, text="Video Player")
tabControl.add(MusicPlayerTab, text="Music Player")
tabControl.add(HelpTab, text="Help")
tabControl.add(CreditsTab, text="Credits")
formats = [
"mp4",
"webm",
"m4a",
]
rateoptions = [
"1gb/s",
"500mb/s",
"250mb/s",
"100mb/s",
"10mb/s",
"1mb/s",
]
selected = tk.StringVar(mainwindow)
selected.set(formats[0])
converterselected = tk.StringVar(mainwindow)
converterselected.set(formats[0])
rateselected = tk.StringVar(mainwindow)
rateselected.set(rateoptions[4])
# - MAIN WINDOW - #
# Downloader Tab
downloaderlabelframe = tk.LabelFrame(DownloaderTab, text="Downloader", bg="grey94", width=670, height=300)
urllabel = tk.Label(DownloaderTab, fg="black", text="Url:")
urlentry = tk.Entry(DownloaderTab, fg="black", bg="white", width=50)
startdownloader = tk.Button(DownloaderTab, text="Start\nDownload", width=10, height=3, bg="grey94", fg="black", command=downloader)
formatselection = tk.OptionMenu(DownloaderTab, selected, *formats, )
rateselection = tk.OptionMenu(DownloaderTab, rateselected, *rateoptions)
# Converter Tab
converterlabelframe = tk.LabelFrame(ConverterTab, text="Converter", bg="grey94", width=670, height=300)
openfilebutton = tk.Button(ConverterTab, text="select file", bg="grey94", fg="black", width=10, height=2, command=openfile)
converterformatselection = tk.OptionMenu(ConverterTab, converterselected, *formats)
directoryentry = tk.Entry(ConverterTab, fg="black", bg="white", width=46)
directorylabel = tk.Label(ConverterTab, fg="black", bg="grey94", text="Directory:")
startconverter = tk.Button(ConverterTab, text="Start\nConverter", width=10, height=3, bg="grey94", fg="black", command=converter)
# Calculator Tab
calculatorlabelframe = tk.LabelFrame(CalculatorTab, text="Calculator", bg="grey94", width=670, height=300)
# Autoclicker Tab
autoclickerlabelframe = tk.LabelFrame(AutoclickerTab, text="Autoclicker", bg="grey94", width=670, height=300)
# Auto Downloader Tab
autodownloaderlabelframe = tk.LabelFrame(AutoDownloaderTab, text="Auto Downloader", bg="grey94", width=670, height=300)
# File Archiver Tab
filearchiverlabelframe = tk.LabelFrame(FileArchiverTab, text="File Archiver", bg="grey94", width=670, height=300)
# Video Player Tab
videoplayerlabelframe = tk.LabelFrame(VideoPlayerTab, text="Video Player", bg="grey94", width=670, height=300)
# Music Player Tab
musicplayerlabelframe = tk.LabelFrame(MusicPlayerTab, text="Music Player", bg="grey94", width=670, height=300)
# Help Tab
helplabelframe = tk.LabelFrame(HelpTab, text="Help", bg="grey94", width=670, height=300)
helplabel = tk.Label(HelpTab, fg="black", bg="grey94", text="I will eventually put some helpful text here :)")
# Credits tab
creditslabelframe = tk.LabelFrame(CreditsTab, text="Credits", bg="grey94", width=670, height=300)
creditslabel = tk.Label(CreditsTab, fg="black", bg="grey94", text="I will eventually put some credits here :)")
tabControl.pack(expand=1, fill="both")
downloaderlabelframe.place(x=5, y=0)
converterlabelframe.place(x=5, y=0)
autoclickerlabelframe.place(x=5, y=0)
calculatorlabelframe.place(x=5, y=0)
autodownloaderlabelframe.place(x=5, y=0)
filearchiverlabelframe.place(x=5, y=0)
videoplayerlabelframe.place(x=5, y=0)
musicplayerlabelframe.place(x=5, y=0)
helplabelframe.place(x=5, y=0)
creditslabelframe.place(x=5, y=0)
urllabel.place(x=15, y=25)
urlentry.place(x=50, y=25)
startdownloader.place(x=370, y=25)
formatselection.place(x=15, y=55)
rateselection.place(x=100, y=55)
openfilebutton.place(x=15, y=60)
converterformatselection.place(x=15, y=105)
directoryentry.place(x=74, y=25)
directorylabel.place(x=15, y=25)
startconverter.place(x=370, y=25)
helplabel.place(x=15, y=15)
creditslabel.place(x=15, y=15)
mainwindow.mainloop()