Skip to content

Commit 30e5892

Browse files
authored
Merge pull request #12 from Thomasedv/master
Updating release branch to V4
2 parents 69dd998 + 5df912b commit 30e5892

File tree

9 files changed

+1743
-1577
lines changed

9 files changed

+1743
-1577
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ which are not part of the work. For example, Corresponding Source
141141
includes interface definition files associated with source files for
142142
the work, and the source code for shared libraries and dynamically
143143
linked subprograms that the work is specifically designed to require,
144-
such as by intimate data communication or control flow between those
144+
such as by intimate get_settings_data communication or control flow between those
145145
subprograms and other parts of the work.
146146

147147
The Corresponding Source need not include anything that users

Modules/download_tab.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
from PyQt5.QtCore import Qt
1+
from PyQt5.QtCore import Qt, QTimer
22
from PyQt5.QtWidgets import QWidget, QPushButton, QLabel, QTextBrowser, QCheckBox, \
33
QHBoxLayout, QVBoxLayout
44

55
from Modules.dropdown_widget import DropDown
6-
from Modules.lineEdit import LineEdit
6+
from Modules.lineedit import LineEdit
7+
from utils.utilities import SettingsClass
78

89

910
class MainTab(QWidget):
1011

11-
def __init__(self, settings, parent=None):
12+
def __init__(self, settings: SettingsClass, parent=None):
1213
super().__init__(parent=parent)
1314

1415
# Starts the program (Youtube-dl)
1516
self.start_btn = QPushButton('Download')
17+
self.start_btn.clicked.connect(self.start_button_timer)
1618
# stops the program
1719
self.stop_btn = QPushButton('Abort')
1820
# Closes window (also stops the program)
@@ -27,10 +29,15 @@ def __init__(self, settings, parent=None):
2729
self.profile_dropdown = DropDown(self)
2830
self.profile_dropdown.setFixedWidth(100)
2931

30-
if settings['Profiles']:
31-
for profile in settings['Profiles'].keys():
32+
self.timer = QTimer(self)
33+
self.timer.setInterval(100)
34+
self.timer.setSingleShot(True)
35+
self.timer.timeout.connect(lambda: self.start_btn.setDisabled(False))
36+
37+
if settings.profiles:
38+
for profile in settings.profiles:
3239
self.profile_dropdown.addItem(profile)
33-
current_profile = settings['Other stuff']['current_profile']
40+
current_profile = settings.user_options['current_profile']
3441
if current_profile:
3542
self.profile_dropdown.setCurrentText(current_profile)
3643
else:
@@ -56,8 +63,6 @@ def __init__(self, settings, parent=None):
5663
# Start making checkbutton for selecting downloading from text file mode.
5764
self.checkbox = QCheckBox('Download from text file.')
5865

59-
## Layout tab 1.
60-
6166
# Contains, start, abort, close buttons, and a stretch to make buttons stay on the correct side on rezise.
6267
self.QH = QHBoxLayout()
6368

@@ -91,14 +96,18 @@ def __init__(self, settings, parent=None):
9196

9297
self.setLayout(self.QV)
9398

99+
def start_button_timer(self, state):
100+
if not state:
101+
self.timer.start(1000)
102+
94103

95104
if __name__ == '__main__':
96105
# Only visual aspects work here!!
97106
import sys
98107
from PyQt5.QtWidgets import QApplication
99-
from utils.utilities import get_base_settings
108+
from utils.filehandler import FileHandler
100109

101110
app = QApplication(sys.argv)
102-
gui = MainTab(get_base_settings())
111+
gui = MainTab(FileHandler().load_settings())
103112
gui.show()
104113
app.exec_()
File renamed without changes.

Modules/parameterTree.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ParameterTree(QTreeWidget):
1717
addOption = pyqtSignal(QTreeWidgetItem)
1818
itemRemoved = pyqtSignal(QTreeWidgetItem, int)
1919

20-
def __init__(self, profile: dict):
20+
def __init__(self, profile: dict, parent=None):
2121
"""
2222
Data table:
2323
All data is in column 0.
@@ -30,7 +30,7 @@ def __init__(self, profile: dict):
3030
37 - List of QModelIndex to items that this depends on.
3131
3232
"""
33-
super().__init__()
33+
super().__init__(parent=parent)
3434

3535
self.favorite = False
3636

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ If you want to convert the videos, or otherwise use features of youtube-dl that
88
that also has to be in the same folder (or path) as Grabber.**
99

1010
You can get those programs here:
11-
* Youtube-dl: https://rg3.github.io/youtube-dl/
12-
* ffmpeg: https://www.ffmpeg.org/
11+
* Youtube-dl: https://rg3.github.io/youtube-dl/
12+
* ffmpeg: https://ffmpeg.zeranoe.com/builds/
1313

14-
Requirements to use source:
14+
**USE THE 4.0.2 static ffmpeg version!** Extract the 3 executables from the bin folder to the Grabber folder or PATH
15+
16+
______
17+
18+
Requirements to use source code:
1519

1620
* Python 3.6+
1721
* PyQt5 5.9 (Earlier version might work too, worked fine with 5.8 before i upgraded.)

__main__.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from PyQt5.QtWidgets import QApplication, QMessageBox
66

77
from core import GUI
8-
from utils.utilities import SettingsError
98
from utils.filehandler import FileHandler
9+
from utils.utilities import SettingsError, ProfileLoadError
1010

1111

1212
def main():
@@ -21,13 +21,25 @@ def main():
2121
if EXIT_CODE == GUI.EXIT_CODE_REBOOT:
2222
continue
2323

24-
except (SettingsError, json.decoder.JSONDecodeError) as e:
24+
except (SettingsError, ProfileLoadError, json.decoder.JSONDecodeError) as e:
25+
if isinstance(e, ProfileLoadError):
26+
file = 'profiles file'
27+
else:
28+
file = 'settings file'
29+
2530
warning = QMessageBox.warning(None,
26-
'Corrupt settings',
27-
''.join([str(e), '\nRestore default settings?']),
31+
f'Corruption of {file}!',
32+
''.join([str(e), '\nRestore to defaults?']),
2833
buttons=QMessageBox.Yes | QMessageBox.No)
34+
2935
if warning == QMessageBox.Yes:
30-
FileHandler().load_settings(True)
36+
filehandler = FileHandler()
37+
if isinstance(e, ProfileLoadError):
38+
filehandler.save_profiles({})
39+
else:
40+
setting = filehandler.load_settings(reset=True)
41+
filehandler.save_settings(setting.get_settings_data)
42+
3143
app = None # Ensures the app instance is properly removed!
3244
continue
3345

0 commit comments

Comments
 (0)