Skip to content

Commit

Permalink
Merge pull request #24 from jeanslack/sanitize_error
Browse files Browse the repository at this point in the history
fix UnboundLocalError: local variable newstr referenced before assign…
  • Loading branch information
jeanslack authored Jan 9, 2023
2 parents 56da6c3 + 2f5632c commit 0659ac9
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 24 deletions.
1 change: 1 addition & 0 deletions AUTHORS
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]>

7 changes: 7 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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
+--------------------------------+
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion TODO
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.




Expand Down
1 change: 1 addition & 0 deletions ffcuesplitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Platform: all platforms
Writer: jeanslack <[email protected]>
license: GPL3
Copyright: (C) 2023 Gianluca Pernigotto <[email protected]>
Rev: December 24 2022
"""

Expand Down
1 change: 1 addition & 0 deletions ffcuesplitter/cuesplitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
####################################################################
Expand Down
1 change: 1 addition & 0 deletions ffcuesplitter/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
####################################################################
Expand Down
2 changes: 1 addition & 1 deletion ffcuesplitter/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ffcuesplitter/ffprobe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions ffcuesplitter/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)"
Expand Down
1 change: 1 addition & 0 deletions ffcuesplitter/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
####################################################################
Expand Down
12 changes: 6 additions & 6 deletions ffcuesplitter/str_utils.py
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
"""

Expand Down
24 changes: 14 additions & 10 deletions ffcuesplitter/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
####################################################################
Expand All @@ -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
# ------------------------------------------------------------------------


Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
####################################################################
Expand Down

0 comments on commit 0659ac9

Please sign in to comment.