movie.py: more bugfixes

This commit is contained in:
rolux 2012-08-22 12:27:32 +02:00
parent 9449b929e6
commit e8cec680e9

View file

@ -61,7 +61,7 @@ def format_path(data, has_director_directory=True):
def parse_item_files(files): def parse_item_files(files):
# parses a list of file objects associated with one item (file objects # parses a list of file objects associated with one item (file objects
# as returned by parse_path, but extended with 'originalPath' and 'time') # as returned by parse_path, but extended with 'path' and 'time')
def get_file_key(file): def get_file_key(file):
return '\n'.join([ return '\n'.join([
file['version'] or '', file['version'] or '',
@ -82,8 +82,8 @@ def parse_item_files(files):
duplicate_files = [] duplicate_files = []
for key in [get_file_key(file) for file in files]: for key in [get_file_key(file) for file in files]:
key_files = sorted( key_files = sorted(
sorted([file['path'] for file in files if get_file_key(file) == key]), sorted([file for file in files if get_file_key(file) == key]),
key=lambda x: len(x) key=lambda x: len(x['path'])
) )
unique_files.append(key_files[0]) unique_files.append(key_files[0])
duplicate_files += key_files[1:] duplicate_files += key_files[1:]