From c027596ff0690b06aca646e831204bb39031c480 Mon Sep 17 00:00:00 2001 From: 10se1ucgo Date: Sun, 13 Mar 2016 14:44:47 -0400 Subject: [PATCH] I keep forgetting that I shouldn't use the root logger :p --- README.md | 3 ++- ffmpeg.py | 5 +++-- jam_tools.py | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b56685d..e050de6 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,8 @@ As of 2/21/16, it works! * [watchdog](https://pypi.python.org/pypi/watchdog) - Cross-platform file system monitoring * [youtube-dl](https://github.com/rg3/youtube-dl/) - Audio/Video downloader (supports many websites, not just YouTube) * [psutil](https://github.com/giampaolo/psutil) - Process/system utilities (Used for detecting Steam path) -* [requests](http://docs.python-requests.org/en/master/) +* [requests](http://docs.python-requests.org/en/master/) - HTTP library used for downloading FFmpeg +* [unidecode](https://pypi.python.org/pypi/Unidecode) - Filter out pesky unicode characters that cause problems :( ## Python <3.3 * [shutilwhich](https://pypi.python.org/pypi/shutilwhich) - Backport of shutil.which() diff --git a/ffmpeg.py b/ffmpeg.py index c969c90..e2e3a26 100644 --- a/ffmpeg.py +++ b/ffmpeg.py @@ -180,8 +180,9 @@ def run(self): try: logger.info(convert_audio(track, file, self.rate, self.vol)) except subprocess.CalledProcessError as e: - logging.exception("FFmpeg converter: Couldn't convert {track}".format(track=track)) - logging.critical("FFmpeg converter: Error output log\n" + e.output.decode('ascii', 'replace')) + print(e) + logger.exception("FFmpeg converter: Couldn't convert {track}".format(track=track)) + logger.critical("FFmpeg converter: Error output log\n" + e.output.decode('ascii', 'replace')) errors.append(track) # File's headers aren't stripped, which normally would increase self.converted by 1. self.converted += 1 diff --git a/jam_tools.py b/jam_tools.py index 87412e6..d8d56d4 100644 --- a/jam_tools.py +++ b/jam_tools.py @@ -23,6 +23,7 @@ from string import whitespace, punctuation import psutil +import unidecode import wx # Tested w/ wxPhoenix 3.0.2 from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler @@ -390,6 +391,7 @@ def get_tracks(audio_path): for track in glob.glob(os.path.join(audio_path, '*.wav')): bind = None name = os.path.splitext(os.path.basename(track))[0] # Name of file minus path/extension + name = unidecode.unidecode(name) if name in track_data and ('aliases' in track_data[name] or 'bind' in track_data[name]): custom_aliases = track_data[name].get('aliases') custom_bind = track_data[name].get('bind') @@ -419,7 +421,7 @@ def filter_aliases(alias_or_name): filtered_name += char.lower() elif char in punctuation and not "'": filtered_name += ' ' - return filtered_name.encode('ascii', 'ignore') + return filtered_name def get_steam_path():