diff --git a/CHANGELOG b/CHANGELOG index 60f6fb49..6afa576d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,7 +7,7 @@ License: GPL3 Change Log: +------------------------------------+ -Mon, 28 Oct 2024 V.5.0.21 +Wed, 30 Oct 2024 V.5.0.21 * Update French language (thanks to Phil Aug). * Update Spanish language (thanks to katnatek). @@ -19,7 +19,15 @@ Mon, 28 Oct 2024 V.5.0.21 * Fixed some broken link. * Fixed an issue when restoring the configuration directory, which copied unnecessary files and directories. - + * Fixed issue with using physically non-existent and access-denied output + paths (e.g. removing USB sticks, hard drives, etc.) which would inevitably + lead to an application reset during startup (Very annoying). + * Fixed NameError: name 'tarbal' is not defined. Did you mean: 'tarball'? + during presets download operation. + * Changed: Unlike portable mode, In installed mode output directories are no + longer automatically recreated if they do not exist. + * Changed the names of the default output directories when using the + application in portable mode (see Media/Transcoding + Media/Downloads). +------------------------------------+ Sun, 28 July 2024 V.5.0.20 diff --git a/INSTALL b/INSTALL index bbc9b967..33e542a9 100644 --- a/INSTALL +++ b/INSTALL @@ -93,7 +93,10 @@ Installing on Linux/FreeBSD: python3 -m pip install videomass Optionally install yt-dlp: - python3 -m pip install yt-dlp + please read this before installing yt-dlp: https://github.com/yt-dlp/yt-dlp/pull/11255 + + python3 -m pip install "yt-dlp[default]" + Installing on Windows and MacOs: @@ -110,7 +113,9 @@ Installing on Windows and MacOs: python3 -m pip install videomass Optionally install yt-dlp: - python3 -m pip install yt-dlp + please read this before installing yt-dlp: https://github.com/yt-dlp/yt-dlp/pull/11255 + + python3 -m pip install "yt-dlp[default]" To Update on Windows, MacOs, Linux, FreeBSD: diff --git a/debian/changelog b/debian/changelog index 161b2432..f675f525 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,8 +10,17 @@ videomass (5.0.21-1) UNRELEASED; urgency=medium * Fixed some broken link. * Fixed an issue when restoring the configuration directory, which copied unnecessary files and directories. - - -- Gianluca Pernigotto Mon, 28 Oct 2024 00:00:00 +0200 + * Fixed issue with using physically non-existent and access-denied output + paths (e.g. removing USB sticks, hard drives, etc.) which would inevitably + lead to an application reset during startup (Very annoying). + * Fixed NameError: name 'tarbal' is not defined. Did you mean: 'tarball'? + during presets download operation. + * Changed: Unlike portable mode, In installed mode output directories are no + longer automatically recreated if they do not exist. + * Changed the names of the default output directories when using the + application in portable mode (see Media/Transcoding + Media/Downloads). + + -- Gianluca Pernigotto Wed, 30 Oct 2024 00:00:00 +0200 videomass (5.0.20-1) UNRELEASED; urgency=medium diff --git a/requirements/requirements-linux.txt b/requirements/requirements-linux.txt index 9a8a18c7..3f5250a5 100644 --- a/requirements/requirements-linux.txt +++ b/requirements/requirements-linux.txt @@ -1,5 +1,5 @@ videomass -yt-dlp +yt-dlp[default] hatchling build wheel diff --git a/requirements/requirements-windows.txt b/requirements/requirements-windows.txt index fb3703ff..bf9f6b2a 100644 --- a/requirements/requirements-windows.txt +++ b/requirements/requirements-windows.txt @@ -5,7 +5,7 @@ pypubsub six wxpython requests -yt-dlp +yt-dlp[default] # Requirements for Windows diff --git a/videomass/vdms_main/main_frame.py b/videomass/vdms_main/main_frame.py index 8e06f265..bd87ffc5 100644 --- a/videomass/vdms_main/main_frame.py +++ b/videomass/vdms_main/main_frame.py @@ -6,7 +6,7 @@ Author: Gianluca Pernigotto Copyleft - 2024 Gianluca Pernigotto license: GPL3 -Rev: June.24.2024 +Rev: Oct.29.2024 Code checker: flake8, pylint This file is part of Videomass. @@ -867,8 +867,8 @@ def prst_downloader(self, event): tarball = io_tools.get_github_releases(url, "tarball_url") if tarball[0] in ['request error:', 'response error:']: - wx.MessageBox(f"{tarbal[0]} {tarbal[1]}", - f"{tarbal[0]}", wx.ICON_ERROR, self) + wx.MessageBox(f"{tarball[0]} {tarball[1]}", + f"{tarball[0]}", wx.ICON_ERROR, self) return name = f"Videomass-presets-{tarball[0].split('/v')[-1]}.tar.gz" diff --git a/videomass/vdms_sys/configurator.py b/videomass/vdms_sys/configurator.py index b999fecd..e9cfc8ff 100644 --- a/videomass/vdms_sys/configurator.py +++ b/videomass/vdms_sys/configurator.py @@ -49,21 +49,17 @@ def create_dirs(dirname, fconf): if not os.path.exists(dirname): try: os.makedirs(dirname, mode=0o777) - except FileExistsError as err: + except Exception as err: return {'ERROR': err} - except OSError as err: - os.remove(fconf) # force to restart on deleting - thismsg = ('Please try restarting Videomass to ' - 'restore default settings now.') - return {'ERROR': f'{err}\n{thismsg}'} return {'R': None} -def restore_dirconf(dirconf, srcdata): +def restore_dirconf(dirconf, srcdata, portable): """ - check existence of configuration directory - with possibility of restore. + This function is responsible for restoring the + configuration directory if it is missing and + populating it with its essential files. Returns dict: key == 'R' key == ERROR (if any errors) @@ -79,6 +75,17 @@ def restore_dirconf(dirconf, srcdata): if drest: return {'ERROR': drest} + if portable: + transoutdir = os.path.join(dirconf, "Media", "Transcoding") + dwlddir = os.path.join(dirconf, "Media", "Downloads") + try: + if not os.path.exists(transoutdir): + os.makedirs(transoutdir, mode=0o777) + if not os.path.exists(dwlddir): + os.makedirs(dwlddir, mode=0o777) + except Exception as err: + return {'ERROR': err} + return {'R': None} @@ -111,6 +118,11 @@ def get_options(fileconf, makeportable): conf.write_options() data = {'R': conf.read_options()} + diff = conf.default_outputdirs(**data['R']) + if diff != data['R']: + conf.write_options(**diff) # write default outputdirs + data = {'R': conf.read_options()} + return data @@ -159,9 +171,6 @@ def portable_paths(portdirname): cache_dir = os.path.join(dir_conf, 'cache') # updates executable trash_dir = os.path.join(dir_conf, "Trash") - if not os.path.exists(dir_conf): - os.makedirs(dir_conf, mode=0o777) - return file_conf, dir_conf, log_dir, cache_dir, trash_dir @@ -307,6 +316,7 @@ def get_configuration(self): # checks configuration directory ckdconf = restore_dirconf(self.dataloc['confdir'], self.dataloc['srcdata'], + self.makeportable, ) if ckdconf.get('ERROR'): return ckdconf @@ -320,8 +330,6 @@ def get_configuration(self): # create the required directories if not existing requiredirs = (os.path.join(self.dataloc['cachedir'], 'tmp'), self.dataloc['logdir'], - userconf['outputdir'], - userconf['ydlp-outputdir'], self.dataloc['trashdir_default'] ) if not userconf['trashdir_loc'].strip(): diff --git a/videomass/vdms_sys/settings_manager.py b/videomass/vdms_sys/settings_manager.py index 482e87bb..9ba916f6 100644 --- a/videomass/vdms_sys/settings_manager.py +++ b/videomass/vdms_sys/settings_manager.py @@ -6,7 +6,7 @@ Author: Gianluca Pernigotto Copyleft - 2024 Gianluca Pernigotto license: GPL3 -Rev: Apr.09.2024 +Rev: Oct.29.2024 Code checker: flake8, pylint This file is part of Videomass. @@ -301,10 +301,12 @@ def __init__(self, filename, makeportable=None): self.filename = filename if makeportable: - path = os.path.join(makeportable, "My_Files") - outputdir = os.path.relpath(path) - ConfigManager.DEFAULT_OPTIONS['outputdir'] = outputdir - ConfigManager.DEFAULT_OPTIONS['ydlp-outputdir'] = outputdir + trscodepath = os.path.join(makeportable, "Media", "Transcoding") + dwldpath = os.path.join(makeportable, "Media", "Downloads") + trscodedir = os.path.relpath(trscodepath) + dwlddir = os.path.relpath(dwldpath) + ConfigManager.DEFAULT_OPTIONS['outputdir'] = trscodedir + ConfigManager.DEFAULT_OPTIONS['ydlp-outputdir'] = dwlddir def write_options(self, **options): """ @@ -338,3 +340,18 @@ def read_options(self): return None return options + + def default_outputdirs(self, **options): + """ + Restores default output paths. + This method is needed to set the values of the `outputdir` + and `ydlp-outputdir` keys set to physically non-existent + filesystem paths (such as pendrives, hard-drives, etc.). + Returns a dictionary object. + """ + if not os.path.exists(options['outputdir']): + options['outputdir'] = f"{os.path.expanduser('~')}" + if not os.path.exists(options['ydlp-outputdir']): + options['ydlp-outputdir'] = f"{os.path.expanduser('~')}" + + return options