Skip to content

Commit 211a095

Browse files
committed
First Commit
1 parent 08add2d commit 211a095

6 files changed

Lines changed: 24 additions & 7 deletions

File tree

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
EEEAAAOOO_10_Hours.mp3
2-
EEEAAAOOO_10_Hours.webm
1+
/output/
2+
/ytdl/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Basic app to download music from youtube
22

33
## Still in development, it is working, but not perfect at all.
4-
Do not hesitate to ask for features, make suggestions or pull requests. I may not answer you immediately, but it will still be useful for me and next users.
4+
Do not hesitate to ask for features, make suggestions or pull requests. I may not answer you immediately, but it will still be useful for me and next users.

Youtube_music_downloader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,4 @@ def download(video_url, folder, signal=None, id=None, format='mp3'):
115115
if __name__ == "__main__":
116116
DownloadThread('https://www.youtube.com/watch?v=Jv2uxzhPFl4', './', 0, None).run()
117117

118-
# lignes de YoutubeDL.py: 375,
118+
# lignes de YoutubeDL.py: 375

config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"YTDL": {"default path": "J:/Coding_Projects/Youtube Download/ytdl/Tests"}}

run_pyqt.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import os.path
1+
import json
22
import re
33

44
import time
@@ -13,6 +13,18 @@
1313
from Youtube_music_downloader import DownloadThread
1414

1515

16+
with open('config.json', 'r') as fp:
17+
config = json.load(fp)
18+
19+
20+
def default_path():
21+
return config['YTDL']['default path']
22+
23+
24+
def set_default_path(path):
25+
config['YTDL']['default path'] = path
26+
27+
1628
class MainWindow(QMainWindow):
1729
def __init__(self):
1830
super().__init__()
@@ -46,6 +58,10 @@ def change_view(self, view):
4658
def home(self):
4759
self.change_view(self.home_view)
4860

61+
def closeEvent(self, event):
62+
with open('config.json', 'w') as fp:
63+
json.dump(config, fp)
64+
4965

5066
class Home(QWidget):
5167

@@ -116,7 +132,7 @@ def __init__(self, parent):
116132

117133
# Input for path and its label
118134
self.path_input = QLineEdit(self)
119-
self.path_input.setText(os.path.dirname(__file__))
135+
self.path_input.setText(default_path())
120136
self.path_input.setGeometry(60, 140, self.WIDTH - 120 - 80, 24)
121137
self.path_input_label = QLabel('Output path', self)
122138
self.path_input_label.setObjectName('input_label')
@@ -159,6 +175,7 @@ def file_explorer(self):
159175
QFileDialog.ShowDirsOnly)
160176
if path != '':
161177
self.path_input.setText(path)
178+
set_default_path(path)
162179

163180
def download(self):
164181
if self.download_input.text() != '':

style.qss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,3 @@ QPushButton#clear_button:pressed {
7676
background-color: white;
7777
border: 1px solid grey;
7878
}
79-

0 commit comments

Comments
 (0)