-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.py
62 lines (49 loc) · 1.61 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
from PyQt5.QtWidgets import QApplication, QWidget, QLineEdit, QMessageBox, QPushButton, QLabel
import sys
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot, QThread
import colors
import youtubedl
class Thread(QThread):
def __init__(self, name):
QThread.__init__(self)
self.name = name
# def setName(self,name):
# self.name = name
def run(self):
youtubedl.run(self.name)
print(colors.green + "Downloaded!\n", colors.reset)
class homepage(QWidget):
def __init__(self):
super().__init__()
self.initUI()
status_thread = False
name = ""
def initUI(self):
self.setGeometry(600, 400, 600, 400)
self.setWindowTitle("Music-downloader")
self.setWindowIcon(QIcon('music.webp'))
self.textbox = QLineEdit(self)
self.label = QLabel("Song Name/Playlist link", self)
self.btn = QPushButton('Download', self)
self.label.move(20, 100)
self.label.resize(150, 30)
self.btn.move(270, 200)
self.btn.resize(70, 30)
self.textbox.move(150, 100)
self.textbox.resize(400, 30)
self.msg = QMessageBox(self)
self.btn.clicked.connect(self.on_click)
self.show()
@pyqtSlot()
def on_click(self):
self.setWindowTitle("Music-downloader(downloading)")
name = self.textbox.text()
self.thread = Thread(name)
self.thread.start()
def main():
app = QApplication(sys.argv)
hp = homepage()
sys.exit(app.exec_())
if __name__ == '__main__':
main()