better item detection of existing items, sort steams by part and fallback to path
This commit is contained in:
parent
ca5bf80763
commit
d1b210d06a
4 changed files with 9 additions and 5 deletions
|
|
@ -160,6 +160,8 @@ class File(models.Model):
|
|||
for type in ox.movie.EXTENSIONS:
|
||||
if data['extension'] in ox.movie.EXTENSIONS[type]:
|
||||
data['type'] = type
|
||||
if 'part' in data and not data['part']:
|
||||
del data['part']
|
||||
return data
|
||||
|
||||
def normalize_path(self):
|
||||
|
|
@ -181,7 +183,7 @@ class File(models.Model):
|
|||
data = self.get_path_info()
|
||||
self.extension = data.get('extension')
|
||||
self.language = data.get('language')
|
||||
self.part = ox.sort_string(unicode(data.get('part')) or '')
|
||||
self.part = ox.sort_string(unicode(data.get('part', '')))
|
||||
self.part_title = ox.sort_string(unicode(data.get('partTitle')) or '')
|
||||
self.type = data.get('type') or 'unknown'
|
||||
self.version = data.get('version')
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ def get_or_create_item(volume, info, user):
|
|||
item_info = ox.parse_movie_path(info['path'])
|
||||
if item_info.get('director') and item_info.get('directorSort'):
|
||||
for name, sortname in zip(item_info['director'], item_info['directorSort']):
|
||||
get_name_sort(name, sortname)
|
||||
get_name_sort(name, sortname)
|
||||
return get_item(item_info, user)
|
||||
|
||||
def get_or_create_file(volume, f, user, item=None):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue