From 7a3736ee75b79cb69f69ce65a85612f8720d46df Mon Sep 17 00:00:00 2001 From: William McBrine Date: Sun, 8 Jun 2014 07:45:28 -0400 Subject: [PATCH] Use cp1252 instead of iso8859-1 for Windows 8-bit characters. --- metadata.py | 4 ++-- mind.py | 2 +- plugin.py | 2 +- plugins/music/music.py | 6 +++--- plugins/photo/photo.py | 2 +- plugins/togo/togo.py | 2 +- plugins/video/transcode.py | 14 +++++++------- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/metadata.py b/metadata.py index 84e025f..be6dae6 100755 --- a/metadata.py +++ b/metadata.py @@ -648,7 +648,7 @@ def from_nfo(full_path): def _tdcat_bin(tdcat_path, full_path, tivo_mak): fname = unicode(full_path, 'utf-8') if mswindows: - fname = fname.encode('iso8859-1') + fname = fname.encode('cp1252') tcmd = [tdcat_path, '-m', tivo_mak, '-2', fname] tdcat = subprocess.Popen(tcmd, stdout=subprocess.PIPE) return tdcat.stdout.read() @@ -713,7 +713,7 @@ def force_utf8(text): if sys.platform == 'darwin': text = text.decode('macroman') else: - text = text.decode('iso8859-1') + text = text.decode('cp1252') return text.encode('utf-8') def dump(output, metadata): diff --git a/mind.py b/mind.py index 7f40111..31d244c 100644 --- a/mind.py +++ b/mind.py @@ -254,7 +254,7 @@ def dictcode(d): if sys.platform == 'darwin': v = v.decode('macroman') else: - v = v.decode('iso8859-1') + v = v.decode('cp1252') elif type(v) != unicode: v = str(v) v = v.encode('utf-8') diff --git a/plugin.py b/plugin.py index cf384c0..66e8749 100644 --- a/plugin.py +++ b/plugin.py @@ -44,7 +44,7 @@ class EncodeUnicode(Filter): if sys.platform == 'darwin': val = val.decode('macroman') else: - val = val.decode('iso8859-1') + val = val.decode('cp1252') elif type(val) != unicode: val = str(val) return val.encode(encoding) diff --git a/plugins/music/music.py b/plugins/music/music.py index 4207d6a..1190f53 100644 --- a/plugins/music/music.py +++ b/plugins/music/music.py @@ -112,7 +112,7 @@ class Music(Plugin): if needs_transcode: if mswindows: - fname = fname.encode('iso8859-1') + fname = fname.encode('cp1252') cmd = [config.get_bin('ffmpeg'), '-i', fname, '-vn'] if ext in ['.mp3', '.mp2']: @@ -248,7 +248,7 @@ class Music(Plugin): ffmpeg_path = config.get_bin('ffmpeg') if 'Duration' not in item and ffmpeg_path: if mswindows: - fname = fname.encode('iso8859-1') + fname = fname.encode('cp1252') cmd = [ffmpeg_path, '-i', fname] ffmpeg = subprocess.Popen(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE, @@ -327,7 +327,7 @@ class Music(Plugin): local_path = os.path.sep.join(list_name.split(os.path.sep)[:-1]) if ext in ('.m3u', '.pls'): - charset = 'iso-8859-1' + charset = 'cp1252' else: charset = 'utf-8' diff --git a/plugins/photo/photo.py b/plugins/photo/photo.py index d93be0a..21897ec 100644 --- a/plugins/photo/photo.py +++ b/plugins/photo/photo.py @@ -263,7 +263,7 @@ class Photo(Plugin): fname = unicode(path, 'utf-8') if sys.platform == 'win32': - fname = fname.encode('iso8859-1') + fname = fname.encode('cp1252') if attrs and 'size' in attrs: result = attrs['size'] diff --git a/plugins/togo/togo.py b/plugins/togo/togo.py index 966e401..777055c 100644 --- a/plugins/togo/togo.py +++ b/plugins/togo/togo.py @@ -304,7 +304,7 @@ class ToGo(Plugin): if status[url]['decode']: fname = outfile if mswindows: - fname = fname.encode('iso8859-1') + fname = fname.encode('cp1252') tivodecode_path = config.get_bin('tivodecode') tcmd = [tivodecode_path, '-m', mak, '-o', fname, '-'] tivodecode = subprocess.Popen(tcmd, stdin=subprocess.PIPE, diff --git a/plugins/video/transcode.py b/plugins/video/transcode.py index c47162d..b5e6afc 100644 --- a/plugins/video/transcode.py +++ b/plugins/video/transcode.py @@ -50,7 +50,7 @@ def debug(msg): if sys.platform == 'darwin': msg = msg.decode('macroman') else: - msg = msg.decode('iso8859-1') + msg = msg.decode('cp1252') logger.debug(msg) def transcode(isQuery, inFile, outFile, tsn='', mime='', thead=''): @@ -75,7 +75,7 @@ def transcode(isQuery, inFile, outFile, tsn='', mime='', thead=''): cmd_string = config.getFFmpegTemplate(tsn) % settings fname = unicode(inFile, 'utf-8') if mswindows: - fname = fname.encode('iso8859-1') + fname = fname.encode('cp1252') if inFile[-5:].lower() == '.tivo': tivodecode_path = config.get_bin('tivodecode') @@ -695,8 +695,8 @@ def mp4_remux(inFile, basename, tsn='', temp_share_path=''): fname = unicode(inFile, 'utf-8') oname = unicode(outFile, 'utf-8') if mswindows: - fname = fname.encode('iso8859-1') - oname = oname.encode('iso8859-1') + fname = fname.encode('cp1252') + oname = oname.encode('cp1252') settings = {'video_codec': '-vcodec copy', 'video_br': select_videobr(inFile, tsn), @@ -780,7 +780,7 @@ def video_info(inFile, cache=True): return vInfo if mswindows: - fname = fname.encode('iso8859-1') + fname = fname.encode('cp1252') cmd = [ffmpeg_path, '-i', fname] # Windows and other OS buffer 4096 and ffmpeg can output more than that. err_tmp = tempfile.TemporaryFile() @@ -970,7 +970,7 @@ def video_info(inFile, cache=True): if sys.platform == 'darwin': value = value.decode('macroman') else: - value = value.decode('iso8859-1') + value = value.decode('cp1252') rawmeta[key] = [value] except: pass @@ -1004,7 +1004,7 @@ def audio_check(inFile, tsn): select_audiolang(inFile, tsn) + ' -t 00:00:01 -f vob -') fname = unicode(inFile, 'utf-8') if mswindows: - fname = fname.encode('iso8859-1') + fname = fname.encode('cp1252') cmd = [config.get_bin('ffmpeg'), '-i', fname] + cmd_string.split() ffmpeg = subprocess.Popen(cmd, stdout=subprocess.PIPE) fd, testname = tempfile.mkstemp() -- 2.11.4.GIT