Skip to content

Commit 69dd998

Browse files
authored
Merge pull request #10 from Thomasedv/master
Release v0.3.2
2 parents c4ff49c + aead28c commit 69dd998

File tree

8 files changed

+529
-523
lines changed

8 files changed

+529
-523
lines changed

Modules/download_element.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from PyQt5.QtCore import QProcess
22

3-
from utils.utilities import ArgumentError
4-
53

64
class Download(QProcess):
75
def __init__(self, working_dir: str, program_path: str, commands: list, parent=None):
@@ -18,7 +16,10 @@ def __init__(self, working_dir: str, program_path: str, commands: list, parent=N
1816

1917
def start_dl(self):
2018
if self.program_path is None:
21-
raise ArgumentError()
19+
raise TypeError('Missing youtube-dl path.')
20+
# TODO: Handler errors with starting youtube-dl
21+
22+
self.errorOccurred.connect(lambda: print('error', self.error()))
2223

2324
self.start(self.program_path, self.commands)
2425

Modules/parameterTree.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def __init__(self, profile: dict):
3838
# self.setHeaderHidden(True)
3939
self.setRootIsDecorated(False)
4040
self.setHeaderHidden(True)
41+
# self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
4142
self.setContextMenuPolicy(Qt.CustomContextMenu)
4243
self.customContextMenuRequested.connect(self.contextMenu)
4344

@@ -119,7 +120,9 @@ def del_option(self, parent: QTreeWidgetItem, child: QTreeWidgetItem):
119120
self.update_size()
120121

121122
def move_widget(self, item: QTreeWidgetItem):
123+
self.blockSignals(True)
122124
taken_item = self.takeTopLevelItem(self.indexOfTopLevelItem(item))
125+
self.blockSignals(False)
123126
self.move_request.emit(taken_item, self.favorite)
124127

125128
def load_profile(self, profile: dict):
@@ -146,12 +149,15 @@ def load_profile(self, profile: dict):
146149

147150
def hock_dependency(self):
148151
top_level_names = []
152+
149153
for item in self.topLevelItems():
154+
150155
# Create a list if top level items, their dependent and the QModelIndex of said item.
156+
151157
top_level_names.append([item.data(0, 32), item.data(0, 34), self.indexFromItem(item)])
152158

153159
# Locate matches, and store in dict
154-
160+
# TODO: Make readable
155161
indices = {t[0]: i for i, t in enumerate(top_level_names)}
156162
for index, (first, second, third) in enumerate(top_level_names):
157163
if second in indices:
@@ -178,6 +184,7 @@ def check_dependency(self, item: QTreeWidgetItem):
178184
:param item: changed item from QTreeWidget (paramTree)
179185
:type item: QTreeWidget
180186
"""
187+
181188
if item.data(0, 33) == 0 and item.data(0, 37):
182189
for i in item.data(0, 37):
183190
if item.checkState(0) == Qt.Unchecked:
@@ -335,9 +342,9 @@ def make_exclusive(self, item: QTreeWidgetItem):
335342
"command": "-o {}",
336343
"dependency": None,
337344
"options": [
338-
"D:/Music/DL/%(title)s.%(ext)s",
339-
"C:/Users/Clint Oris/Downloads/%(title)s.%(ext)s",
340-
"D:/Music/%(title)s.%(ext)s"
345+
"D:/Music/DL/",
346+
"C:/Users/Clint Oris/Downloads/",
347+
"D:/Music/"
341348
],
342349
"state": True,
343350
"tooltip": "Select download location."

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Grabber
22
A wrapper for Youtube-dl for Windows.
33

4-
![Main](https://i.imgur.com/g5ddMdu.png) ![param](https://i.imgur.com/2vArT7R.png) ![List](https://i.imgur.com/hTRe9f7.png) ![About](https://i.imgur.com/bTuJHDr.png)
4+
![Main](https://i.imgur.com/fKopNX6.png)
55

66
**Requires you to have youtube-dl.exe in the same folder as this program(Grabber), or in PATH.
77
If you want to convert the videos, or otherwise use features of youtube-dl that require ffmpeg,
8-
that also has to be in the same folder as Grabber.**
8+
that also has to be in the same folder (or path) as Grabber.**
99

1010
You can get those programs here:
1111
* Youtube-dl: https://rg3.github.io/youtube-dl/
@@ -19,6 +19,12 @@ Requirements to use source:
1919
Made with PyQt5 https://www.riverbankcomputing.com/software/pyqt/intro
2020

2121

22+
![param](https://i.imgur.com/4jFwhFe.png) ![About](https://i.imgur.com/52Fy75J.png)
23+
![Option](https://i.imgur.com/ceYwgyS.png) ![List](https://i.imgur.com/L0PL5OH.png)
24+
25+
26+
Images from version 0.3.1.
27+
2228
Current to do list:
2329

2430
* Make code consistent in style. (Mostly completed...)
@@ -30,5 +36,5 @@ Current to do list:
3036
* Add general error handling when stuff goes wrong, especially read/write errors if there are some.
3137
* ~~Upload first release executable. (Built with PyInstaller)~~ Done!
3238
* Learn to do testing...
33-
* Add hide fram taskbar. (So only a icon in bottom right corner, potentially pop-up when done downloading.)
39+
* Add hide from taskbar. (So only a icon in bottom right corner, potentially pop-up when done downloading.)
3440
* Add custom profiles.
Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,42 @@
1-
import json
2-
import sys
3-
4-
from PyQt5.QtCore import Qt
5-
from PyQt5.QtWidgets import QApplication, QMessageBox
6-
7-
from core import GUI
8-
from utils.utilities import SettingsError
9-
10-
11-
def main():
12-
while True:
13-
try:
14-
app = QApplication(sys.argv)
15-
program = GUI()
16-
17-
EXIT_CODE = app.exec_()
18-
app = None
19-
20-
if EXIT_CODE == GUI.EXIT_CODE_REBOOT:
21-
continue
22-
23-
except (SettingsError, json.decoder.JSONDecodeError) as e:
24-
warning = QMessageBox.warning(None,
25-
'Corrupt settings',
26-
''.join([str(e), '\nRestore default settings?']),
27-
buttons=QMessageBox.Yes | QMessageBox.No)
28-
if warning == QMessageBox.Yes:
29-
GUI.get_settings(True)
30-
app = None
31-
continue
32-
33-
break
34-
35-
36-
if __name__ == '__main__':
37-
# TODO: Test on high DPI screen.
38-
# TODO: Get a high DPI screen...
39-
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
40-
QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
41-
main()
1+
import json
2+
import sys
3+
4+
from PyQt5.QtCore import Qt
5+
from PyQt5.QtWidgets import QApplication, QMessageBox
6+
7+
from core import GUI
8+
from utils.utilities import SettingsError
9+
from utils.filehandler import FileHandler
10+
11+
12+
def main():
13+
while True:
14+
try:
15+
app = QApplication(sys.argv)
16+
program = GUI()
17+
18+
EXIT_CODE = app.exec_()
19+
app = None
20+
21+
if EXIT_CODE == GUI.EXIT_CODE_REBOOT:
22+
continue
23+
24+
except (SettingsError, json.decoder.JSONDecodeError) as e:
25+
warning = QMessageBox.warning(None,
26+
'Corrupt settings',
27+
''.join([str(e), '\nRestore default settings?']),
28+
buttons=QMessageBox.Yes | QMessageBox.No)
29+
if warning == QMessageBox.Yes:
30+
FileHandler().load_settings(True)
31+
app = None # Ensures the app instance is properly removed!
32+
continue
33+
34+
break
35+
36+
37+
if __name__ == '__main__':
38+
# TODO: Test on high DPI screen.
39+
# TODO: Get a high DPI screen...
40+
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
41+
QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
42+
main()

0 commit comments

Comments
 (0)