From 7c9b3d4ac3ff46a151c9556d97a9df96cd9f3a03 Mon Sep 17 00:00:00 2001 From: Gianluca Pernigotto Date: Fri, 30 Dec 2022 15:09:15 +0100 Subject: [PATCH 1/2] other small fixes --- CHANGELOG | 6 ++++++ README.md | 10 ++++++---- ffcuesplitter/cuesplitter.py | 12 ++++++------ ffcuesplitter/info.py | 4 ++-- ffcuesplitter/utils.py | 11 ++++++----- 5 files changed, 26 insertions(+), 17 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 9d8b672..5e510ab 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ ++--------------------------------+ +December 28 2022 Version 1.0.16 Beta ++--------------------------------+ + +- Fix utils.sanitize + +--------------------------------+ December 27 2022 Version 1.0.15 Beta +--------------------------------+ diff --git a/README.md b/README.md index 028d5df..c8e8735 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/ffcuesplitter/cuesplitter.py b/ffcuesplitter/cuesplitter.py index bb472da..78ef91e 100644 --- a/ffcuesplitter/cuesplitter.py +++ b/ffcuesplitter/cuesplitter.py @@ -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): @@ -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 @@ -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 @@ -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 diff --git a/ffcuesplitter/info.py b/ffcuesplitter/info.py index 8bf8d04..1972ad1 100644 --- a/ffcuesplitter/info.py +++ b/ffcuesplitter/info.py @@ -26,8 +26,8 @@ __maintainer__ = "Gianluca Pernigotto - Jeanslack" __maintainer_contact__ = "jeanlucperni@gmail.com" __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)" diff --git a/ffcuesplitter/utils.py b/ffcuesplitter/utils.py index 8262117..1cd62cd 100644 --- a/ffcuesplitter/utils.py +++ b/ffcuesplitter/utils.py @@ -43,14 +43,15 @@ def sanitize(string: str = 'stringa') -> str: Returns the new sanitized string """ - msg = f"Only accepts 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 # ------------------------------------------------------------------------ From 43cde63af5ae26ccea8eb0cd298e756e356becba Mon Sep 17 00:00:00 2001 From: Gianluca Pernigotto Date: Fri, 30 Dec 2022 15:14:35 +0100 Subject: [PATCH 2/2] fix CHANGELOG --- CHANGELOG | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 5e510ab..2a44f97 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,7 +2,9 @@ December 28 2022 Version 1.0.16 Beta +--------------------------------+ -- Fix utils.sanitize +- Fixes utils.sanitize +- Improve README.md +- Improve message debugs +--------------------------------+ December 27 2022 Version 1.0.15 Beta