diff --git a/utils/utilities.py b/utils/utilities.py index 084f9f0..f0b543d 100644 --- a/utils/utilities.py +++ b/utils/utilities.py @@ -22,7 +22,7 @@ def path_shortener(full_path: str): times += 1 if times == 3 and full_path.count('/') >= 4: short_path = ''.join([full_path[:full_path.find('/')+1], '...', full_path[split:]]) - print(short_path) + # print(short_path) break elif times == 3: split = full_path.find('/', split) @@ -102,7 +102,8 @@ def __init__(self, settings, profiles, filehandler=None): if not profiles: profiles = old_profiles else: - profiles = old_profiles.update(profiles) + old_profiles.update(profiles) + profiles = copy.deepcopy(old_profiles) try: self._userdefined = settings['default'] self._parameters = settings['parameters'] @@ -116,8 +117,8 @@ def __init__(self, settings, profiles, filehandler=None): self._validate_settings() - print(self._profiles) - print(self.get_settings_data) + # print(self._profiles) + # print(self.get_settings_data) def __enter__(self): return self._parameters @@ -211,13 +212,16 @@ def change_profile(self, profile): @staticmethod def _upgrade_settings(old_settings): - print('Upgrading settings!!') + # print('Upgrading settings!!') settings = {} try: settings['default'] = copy.deepcopy(old_settings['Other stuff']) + if old_settings['Favorites']: + settings['default']['favorites'] = copy.deepcopy(old_settings['Favorites']) settings['parameters'] = copy.deepcopy(old_settings['Settings']) except KeyError: pass + try: profiles = copy.deepcopy(old_settings['Profiles']) except KeyError: @@ -243,6 +247,9 @@ def _validate_settings(self): 'state', 'tooltip'] + for setting in {i for i in base_settings['parameters'] if i not in self._parameters}: + self._parameters[setting] = copy.deepcopy(base_settings['parameters'][setting]) + for setting, option in self._parameters.items(): # setting: The name of the setting, like "Ignore errors" # option: The dict which contains the base keys. @@ -303,7 +310,6 @@ def _validate_settings(self): self._filehandler.save_settings(self.get_settings_data) - stylesheet = f""" QWidget {{ background-color: #484848; @@ -877,6 +883,17 @@ def _validate_settings(self): "title like \"Coldplay - Paradise\".\nExample" "(regex):\n\"(?P.+?) - (?P.+)\"" } +base_settings['parameters']['Merge output format'] = { + "active option": 0, + "command": "--merge-output-format {}", + "dependency": None, + "options": ["mp4", "mkv", "ogg", "webm", "flv"], + "state": False, + "tooltip": "If a merge is required (e.g. bestvideo+bestaudio)," + "\noutput to given container format." + "\nOne of mkv, mp4, ogg, webm, flv." + "\nIgnored if no merge is required" +} def get_base_settings() -> dict: