Update GuessIt

This commit is contained in:
Ruud
2013-09-17 21:04:15 +02:00
parent 5f5f17112a
commit ad01a3da4d
11 changed files with 179 additions and 50 deletions
+3 -3
View File
@@ -77,12 +77,12 @@ def file_in_same_dir(ref_file, desired_file):
def load_file_in_same_dir(ref_file, filename):
"""Load a given file. Works even when the file is contained inside a zip."""
path = split_path(ref_file)[:-1] + [str(filename)]
path = split_path(ref_file)[:-1] + [filename]
for i, p in enumerate(path):
if p[-4:] == '.zip':
if p.endswith('.zip'):
zfilename = os.path.join(*path[:i + 1])
zfile = zipfile.ZipFile(zfilename)
return zfile.read('/'.join(path[i + 1:]))
return u(io.open(os.path.join(*path), encoding = 'utf-8').read())
return u(io.open(os.path.join(*path), encoding='utf-8').read())