-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from jeanslack/sanitize_error
fix UnboundLocalError: local variable newstr referenced before assign…
- Loading branch information
Showing
14 changed files
with
42 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
Author: | ||
jeanslack <[email protected]> | ||
Copyright: (C) 2023 Gianluca Pernigotto <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: <[email protected]> | ||
License: GPL3 (see LICENSE file in the docs folder) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
- Consider using `logger` for messages (?) | ||
- Create log file and list all processed file.cue. | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
Platform: all platforms | ||
Writer: jeanslack <[email protected]> | ||
license: GPL3 | ||
Copyright: (C) 2023 Gianluca Pernigotto <[email protected]> | ||
Rev: December 24 2022 | ||
""" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
Platform: all | ||
Writer: jeanslack <[email protected]> | ||
license: GPL3 | ||
Copyright: (C) 2023 Gianluca Pernigotto <[email protected]> | ||
Rev: Dec 22 2022 | ||
Code checker: flake8 and pylint | ||
#################################################################### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
Platform: all | ||
Writer: jeanslack <[email protected]> | ||
license: GPL3 | ||
Copyright: (C) 2023 Gianluca Pernigotto <[email protected]> | ||
Rev: February 03 2022 | ||
Code checker: flake8 and pylint | ||
#################################################################### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
Compatibility: Python3 | ||
Platform: all platforms | ||
Author: Gianluca Pernigotto <[email protected]> | ||
Copyright: (c) 2022/2023 Gianluca Pernigotto <[email protected]> | ||
Copyright: (C) 2023 Gianluca Pernigotto <[email protected]> | ||
license: GPL3 | ||
Rev: Dec.27.2022 | ||
Code checker: flake8, pylint | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
Compatibility: Python3 | ||
Platform: all | ||
Author: Gianluca Pernigotto <[email protected]> | ||
Copyright: (c) 2022/2023 Gianluca Pernigotto <[email protected]> | ||
Copyright: (C) 2023 Gianluca Pernigotto <[email protected]> | ||
license: GPL3 | ||
Rev: Dec.14.2022 | ||
Code checker: flake8, pylint | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,8 @@ | |
Porpose: useful information strings | ||
Writer: jeanslack <[email protected]> | ||
license: GPL3 | ||
Rev: February 03 2022 | ||
Copyright: (C) 2023 Gianluca Pernigotto <[email protected]> | ||
Rev: January 09 2023 | ||
#################################################################### | ||
This file is part of FFcuesplitter. | ||
|
@@ -25,9 +26,9 @@ | |
__contact__ = '<[email protected]>' | ||
__maintainer__ = "Gianluca Pernigotto - Jeanslack" | ||
__maintainer_contact__ = "[email protected]" | ||
__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)" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
Platform: all | ||
Writer: jeanslack <[email protected]> | ||
license: GPL3 | ||
Copyright: (C) 2023 Gianluca Pernigotto <[email protected]> | ||
Rev: Dec 27 2022 | ||
Code checker: flake8, pylint | ||
#################################################################### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Name: str_utils.py (module) | ||
Porpose: module for cosmetic output console in ANSI sequences | ||
Writer: Gianluca Pernigoto <[email protected]> | ||
Copyright: (c) 2022 Gianluca Pernigoto <[email protected]> | ||
license: GPL3 | ||
Rev: Jan 10 2022 | ||
Name: str_utils.py (module) | ||
Porpose: module for cosmetic output console in ANSI sequences | ||
Writer: Gianluca Pernigoto <[email protected]> | ||
Copyright: (C) 2023 Gianluca Pernigotto <[email protected]> | ||
license: GPL3 | ||
Rev: Jan 10 2022 | ||
Code checker: flake8, pylint | ||
""" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
Platform: all | ||
Writer: jeanslack <[email protected]> | ||
license: GPL3 | ||
Copyright: (C) 2023 Gianluca Pernigotto <[email protected]> | ||
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 | ||
# ------------------------------------------------------------------------ | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
Platform: all | ||
Writer: jeanslack <[email protected]> | ||
license: GPL3 | ||
Copyright: (C) 2023 Gianluca Pernigotto <[email protected]> | ||
Rev: Feb 02 2022 | ||
Code checker: flake8, pylint | ||
#################################################################### | ||
|