From 2f5632c8b071e71a5c6aa75157c996ae1ddc8fe7 Mon Sep 17 00:00:00 2001 From: Gianluca Pernigotto Date: Mon, 9 Jan 2023 12:26:59 +0100 Subject: [PATCH] fix UnboundLocalError: local variable newstr referenced before assignment --- AUTHORS | 1 + CHANGELOG | 7 +++++++ README.md | 2 +- TODO | 2 +- ffcuesplitter.py | 1 + ffcuesplitter/cuesplitter.py | 1 + ffcuesplitter/exceptions.py | 1 + ffcuesplitter/ffmpeg.py | 2 +- ffcuesplitter/ffprobe.py | 2 +- ffcuesplitter/info.py | 9 +++++---- ffcuesplitter/main.py | 1 + ffcuesplitter/str_utils.py | 12 ++++++------ ffcuesplitter/utils.py | 24 ++++++++++++++---------- setup.py | 1 + 14 files changed, 42 insertions(+), 24 deletions(-) diff --git a/AUTHORS b/AUTHORS index 1f3e8b1..3515ff1 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,3 +1,4 @@ Author: jeanslack +Copyright: (C) 2023 Gianluca Pernigotto diff --git a/CHANGELOG b/CHANGELOG index 2a44f97..76b8575 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ ++--------------------------------+ +January 09 2023 Version 1.0.17 Beta ++--------------------------------+ + +- Fixes utils.sanitize error #23 +- Update year. + +--------------------------------+ December 28 2022 Version 1.0.16 Beta +--------------------------------+ diff --git a/README.md b/README.md index c8e8735..df1141f 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ For arguments meaning and more details, type `help(FFCueSplitter)` ## License and Copyright -Copyright © 2022 Gianluca Pernigotto +Copyright (C) 2023 Gianluca Pernigotto Author and Developer: Gianluca Pernigotto Mail: License: GPL3 (see LICENSE file in the docs folder) diff --git a/TODO b/TODO index 9f6fcb0..459dc7c 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,6 @@ - Consider using `logger` for messages (?) -- Create log file and list all processed file.cue. + diff --git a/ffcuesplitter.py b/ffcuesplitter.py index 406c2f3..3fbc846 100644 --- a/ffcuesplitter.py +++ b/ffcuesplitter.py @@ -8,6 +8,7 @@ Platform: all platforms Writer: jeanslack license: GPL3 +Copyright: (C) 2023 Gianluca Pernigotto Rev: December 24 2022 """ diff --git a/ffcuesplitter/cuesplitter.py b/ffcuesplitter/cuesplitter.py index 78ef91e..023d834 100644 --- a/ffcuesplitter/cuesplitter.py +++ b/ffcuesplitter/cuesplitter.py @@ -6,6 +6,7 @@ Platform: all Writer: jeanslack license: GPL3 +Copyright: (C) 2023 Gianluca Pernigotto Rev: Dec 22 2022 Code checker: flake8 and pylint #################################################################### diff --git a/ffcuesplitter/exceptions.py b/ffcuesplitter/exceptions.py index b704895..cd13ca7 100644 --- a/ffcuesplitter/exceptions.py +++ b/ffcuesplitter/exceptions.py @@ -4,6 +4,7 @@ Platform: all Writer: jeanslack license: GPL3 +Copyright: (C) 2023 Gianluca Pernigotto Rev: February 03 2022 Code checker: flake8 and pylint #################################################################### diff --git a/ffcuesplitter/ffmpeg.py b/ffcuesplitter/ffmpeg.py index 66feb89..1779a60 100644 --- a/ffcuesplitter/ffmpeg.py +++ b/ffcuesplitter/ffmpeg.py @@ -5,7 +5,7 @@ Compatibility: Python3 Platform: all platforms Author: Gianluca Pernigotto -Copyright: (c) 2022/2023 Gianluca Pernigotto +Copyright: (C) 2023 Gianluca Pernigotto license: GPL3 Rev: Dec.27.2022 Code checker: flake8, pylint diff --git a/ffcuesplitter/ffprobe.py b/ffcuesplitter/ffprobe.py index cd14a25..ce8f590 100644 --- a/ffcuesplitter/ffprobe.py +++ b/ffcuesplitter/ffprobe.py @@ -5,7 +5,7 @@ Compatibility: Python3 Platform: all Author: Gianluca Pernigotto -Copyright: (c) 2022/2023 Gianluca Pernigotto +Copyright: (C) 2023 Gianluca Pernigotto license: GPL3 Rev: Dec.14.2022 Code checker: flake8, pylint diff --git a/ffcuesplitter/info.py b/ffcuesplitter/info.py index 1972ad1..9c046ae 100644 --- a/ffcuesplitter/info.py +++ b/ffcuesplitter/info.py @@ -3,7 +3,8 @@ Porpose: useful information strings Writer: jeanslack license: GPL3 -Rev: February 03 2022 +Copyright: (C) 2023 Gianluca Pernigotto +Rev: January 09 2023 #################################################################### This file is part of FFcuesplitter. @@ -25,9 +26,9 @@ __contact__ = '' __maintainer__ = "Gianluca Pernigotto - Jeanslack" __maintainer_contact__ = "jeanlucperni@gmail.com" -__copyleft__ = '2022' -__version__ = '1.0.16' -__release__ = 'December 28 2022' +__copyleft__ = '2023' +__version__ = '1.0.17' +__release__ = 'January 09 2023' __appname__ = "FFcuesplitter" __packagename__ = "ffcuesplitter" __license__ = "GPL3 (Gnu Public License)" diff --git a/ffcuesplitter/main.py b/ffcuesplitter/main.py index 7c221e4..fdf2b66 100644 --- a/ffcuesplitter/main.py +++ b/ffcuesplitter/main.py @@ -6,6 +6,7 @@ Platform: all Writer: jeanslack license: GPL3 +Copyright: (C) 2023 Gianluca Pernigotto Rev: Dec 27 2022 Code checker: flake8, pylint #################################################################### diff --git a/ffcuesplitter/str_utils.py b/ffcuesplitter/str_utils.py index 759b816..fd02348 100644 --- a/ffcuesplitter/str_utils.py +++ b/ffcuesplitter/str_utils.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- """ -Name: str_utils.py (module) -Porpose: module for cosmetic output console in ANSI sequences -Writer: Gianluca Pernigoto -Copyright: (c) 2022 Gianluca Pernigoto -license: GPL3 -Rev: Jan 10 2022 +Name: str_utils.py (module) +Porpose: module for cosmetic output console in ANSI sequences +Writer: Gianluca Pernigoto +Copyright: (C) 2023 Gianluca Pernigotto +license: GPL3 +Rev: Jan 10 2022 Code checker: flake8, pylint """ diff --git a/ffcuesplitter/utils.py b/ffcuesplitter/utils.py index 1cd62cd..6a39d36 100644 --- a/ffcuesplitter/utils.py +++ b/ffcuesplitter/utils.py @@ -4,6 +4,7 @@ Platform: all Writer: jeanslack license: GPL3 +Copyright: (C) 2023 Gianluca Pernigotto Rev: Dec 27 2022 Code checker: flake8 and pylint #################################################################### @@ -30,28 +31,31 @@ import datetime -def sanitize(string: str = 'stringa') -> str: +def sanitize(string: str = 'string') -> str: r""" Makes the passed string consistent and compatible - with file systems of some operating systems. + with the OS file system. - All OS: - Remove all leading/trailing spaces and dots. + - On Windows, removes the following illegal chars: " * : < > ? / \ | + and replaces slash (/) character with hyphen (-). + - On other operating systems, it replaces slash (/) character + with hyphen (-). + - On all operating systems, removes leading/trailing spaces + and dots (.). - On Windows it removes the following illegal chars: " * : < > ? / \ | - On Unix it remove slash char: / - Returns the new sanitized string + Returns the new sanitized string. """ if not isinstance(string, str): raise TypeError("Expects Type string only") if platform.system() == 'Windows': - newstr = re.sub(r"[\"\*\:\<\>\?\/\|\\]", '', newstr) + string = re.sub(r"[\"\*\:\<\>\?\|\\]", '', string) + string = string.replace('/', '-') else: - newstr.replace('/', '') + string = string.replace('/', '-') - return newstr.strip().strip('.') # spaces and dots + return string.strip().strip('.') # removes spaces and dots # ------------------------------------------------------------------------ diff --git a/setup.py b/setup.py index 790fd5b..a274581 100644 --- a/setup.py +++ b/setup.py @@ -9,6 +9,7 @@ Platform: all Writer: jeanslack license: GPL3 +Copyright: (C) 2023 Gianluca Pernigotto Rev: Feb 02 2022 Code checker: flake8, pylint ####################################################################