Skip to content

Commit

Permalink
Merge pull request #22 from jeanslack/small_fix
Browse files Browse the repository at this point in the history
other small fixes
  • Loading branch information
jeanslack authored Dec 31, 2022
2 parents fc85008 + 43cde63 commit 56da6c3
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
+--------------------------------+
December 28 2022 Version 1.0.16 Beta
+--------------------------------+

- Fixes utils.sanitize
- Improve README.md
- Improve message debugs

+--------------------------------+
December 27 2022 Version 1.0.15 Beta
+--------------------------------+
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ both as a Python module and from command line.
## Features

- Supports many input formats.
- Convert to Wav, Flac, Ogg, Mp3, + copy.
- Convert to Wav, Flac, Ogg, Mp3 formats.
- Ability to copy source codec and format without re-encoding.
- Batch file processing for both filenames and dirnames with switchable recursive mode.
- Batch mode processing is also available.
- Accepts both multiple CUE file names and multiple folder path names.
- Ability to activate the recursive option to search for CUE files in all subfolders.
- Optionally auto-generate audio collection folders (Artist/Album/TrackNumber - Title)
- Auto-tag from .cue file data.
- Supports multiple .cue file encodings.
- Auto-tag from CUE file data.
- Features automatic character set detection for CUE files (via chardet).
- Works on Linux, MacOs, FreeBSD, Windows.
- Can be used both as a Python module and in command line mode.

Expand Down
12 changes: 6 additions & 6 deletions ffcuesplitter/cuesplitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ def do_operations(self):
self.ffmpeg_arguments()

msgdebug(info=(f"Temporary Target: '{self.kwargs['tempdir']}'"))
count = 0
msgdebug(info="Extracting audio tracks (type Ctrl+c to stop):")

count = 0
for args, secs, title in zip(self.arguments,
self.seconds,
self.audiotracks):
Expand Down Expand Up @@ -309,8 +309,8 @@ def deflacue_object_handler(self):
sourcenames = {k: [] for k in [str(x.file.path) for x in tracks]}

if self.kwargs['collection']: # Artist&Album names sanitize
self.set_subdirs(cd_info.get('PERFORMER', 'No Artist name'),
cd_info.get('ALBUM', 'No Album name'))
self.set_subdirs(cd_info.get('PERFORMER', 'Unknown Artist'),
cd_info.get('ALBUM', 'Unknown Album'))

for track in enumerate(tracks):
track_file = track[1].file.path
Expand All @@ -322,8 +322,8 @@ def deflacue_object_handler(self):
if str(track_file) in sourcenames:
sourcenames.pop(str(track_file))
if not sourcenames:
raise FFCueSplitterError('No audio source files '
'found!')
raise FFCueSplitterError('No other audio source '
'files found here!')
continue

filename = (f"{sanitize(track[1].title)}") # title names sanitize
Expand Down Expand Up @@ -388,7 +388,7 @@ def open_cuefile(self, testpatch=None):
"""
Read cue file and start file parsing via deflacue package
"""
msgdebug(info=f"Source: '{self.kwargs['filename']}'")
msgdebug(info=f"CUE sheet: '{self.kwargs['filename']}'")

if testpatch:
self.testpatch = True
Expand Down
4 changes: 2 additions & 2 deletions ffcuesplitter/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
__maintainer__ = "Gianluca Pernigotto - Jeanslack"
__maintainer_contact__ = "[email protected]"
__copyleft__ = '2022'
__version__ = '1.0.15'
__release__ = 'December 27 2022'
__version__ = '1.0.16'
__release__ = 'December 28 2022'
__appname__ = "FFcuesplitter"
__packagename__ = "ffcuesplitter"
__license__ = "GPL3 (Gnu Public License)"
Expand Down
11 changes: 6 additions & 5 deletions ffcuesplitter/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ def sanitize(string: str = 'stringa') -> str:
Returns the new sanitized string
"""
msg = f"Only accepts <class 'str'> not {type(string)}"
assert isinstance(string, str), msg
newstr = string.strip().strip('.') # spaces and dots
if not isinstance(string, str):
raise TypeError("Expects Type string only")

if platform.system() == 'Windows':
return re.sub(r"[\"\*\:\<\>\?\/\|\\]", '', newstr)
newstr = re.sub(r"[\"\*\:\<\>\?\/\|\\]", '', newstr)
else:
newstr.replace('/', '')

return newstr.replace('/', '')
return newstr.strip().strip('.') # spaces and dots
# ------------------------------------------------------------------------


Expand Down

0 comments on commit 56da6c3

Please sign in to comment.