forked from 0x2620/pandora
don't add base keys to Item.data
This commit is contained in:
parent
9a86ddce01
commit
337cafcf76
2 changed files with 38 additions and 35 deletions
|
@ -92,7 +92,7 @@ def add_annotations(data):
|
||||||
start=float(a['in']), end=float(a['out']),
|
start=float(a['in']), end=float(a['out']),
|
||||||
value=value)
|
value=value)
|
||||||
annotation.save()
|
annotation.save()
|
||||||
#update facets if needed
|
# update facets if needed
|
||||||
if layer_id in item.facet_keys:
|
if layer_id in item.facet_keys:
|
||||||
item.update_layer_facet(layer_id)
|
item.update_layer_facet(layer_id)
|
||||||
if annotation:
|
if annotation:
|
||||||
|
|
|
@ -79,8 +79,10 @@ def get_item(info, user=None):
|
||||||
item_data['year'] = info.get('year', '') or ''
|
item_data['year'] = info.get('year', '') or ''
|
||||||
|
|
||||||
# add additional item metadata parsed from path
|
# add additional item metadata parsed from path
|
||||||
for key in [i for i in info if i in set([k['id'] for k in settings.CONFIG['itemKeys']])
|
ignore_keys = set(list(Item.base_keys) + ['language'] + list(item_data))
|
||||||
and i not in ('language', ) and i not in item_data]:
|
possible_keys = set([k['id'] for k in settings.CONFIG['itemKeys'] if k['id'] not in ignore_keys])
|
||||||
|
for key in info:
|
||||||
|
if key in possible_keys:
|
||||||
item_data[key] = info[key]
|
item_data[key] = info[key]
|
||||||
|
|
||||||
for key in ('episodeTitle', 'episodeDirector', 'episodeYear',
|
for key in ('episodeTitle', 'episodeDirector', 'episodeYear',
|
||||||
|
@ -830,6 +832,37 @@ class Item(models.Model):
|
||||||
self.get('seriesTitle')))) is not None
|
self.get('seriesTitle')))) is not None
|
||||||
save('series', isSeries)
|
save('series', isSeries)
|
||||||
|
|
||||||
|
base_keys = (
|
||||||
|
'aspectratio',
|
||||||
|
'bitrate',
|
||||||
|
'clips',
|
||||||
|
'created',
|
||||||
|
'cutsperminute',
|
||||||
|
'duration',
|
||||||
|
'hue',
|
||||||
|
'id',
|
||||||
|
'oxdbId',
|
||||||
|
'lightness',
|
||||||
|
'modified',
|
||||||
|
'numberofannotations',
|
||||||
|
'numberofcuts',
|
||||||
|
'numberofdocuments',
|
||||||
|
'numberoffiles',
|
||||||
|
'parts',
|
||||||
|
'pixels',
|
||||||
|
'random',
|
||||||
|
'timesaccessed',
|
||||||
|
'accessed',
|
||||||
|
'resolution',
|
||||||
|
'width',
|
||||||
|
'height',
|
||||||
|
'rendered',
|
||||||
|
'rightslevel',
|
||||||
|
'saturation',
|
||||||
|
'size',
|
||||||
|
'volume',
|
||||||
|
)
|
||||||
|
|
||||||
def update_sort(self):
|
def update_sort(self):
|
||||||
try:
|
try:
|
||||||
s = self.sort
|
s = self.sort
|
||||||
|
@ -865,36 +898,6 @@ class Item(models.Model):
|
||||||
value = len(value.split(' ')) if value else 0
|
value = len(value.split(' ')) if value else 0
|
||||||
return value
|
return value
|
||||||
|
|
||||||
base_keys = (
|
|
||||||
'aspectratio',
|
|
||||||
'bitrate',
|
|
||||||
'clips',
|
|
||||||
'created',
|
|
||||||
'cutsperminute',
|
|
||||||
'duration',
|
|
||||||
'hue',
|
|
||||||
'id',
|
|
||||||
'oxdbId',
|
|
||||||
'lightness',
|
|
||||||
'modified',
|
|
||||||
'numberofannotations',
|
|
||||||
'numberofcuts',
|
|
||||||
'numberofdocuments',
|
|
||||||
'numberoffiles',
|
|
||||||
'parts',
|
|
||||||
'pixels',
|
|
||||||
'random',
|
|
||||||
'timesaccessed',
|
|
||||||
'accessed',
|
|
||||||
'resolution',
|
|
||||||
'width',
|
|
||||||
'height',
|
|
||||||
'rendered',
|
|
||||||
'rightslevel',
|
|
||||||
'saturation',
|
|
||||||
'size',
|
|
||||||
'volume',
|
|
||||||
)
|
|
||||||
|
|
||||||
# sort keys based on database, these will always be available
|
# sort keys based on database, these will always be available
|
||||||
s.public_id = self.public_id.replace('0x', 'xx')
|
s.public_id = self.public_id.replace('0x', 'xx')
|
||||||
|
@ -971,7 +974,7 @@ class Item(models.Model):
|
||||||
sort_type = key['value'].get('type', sort_type)
|
sort_type = key['value'].get('type', sort_type)
|
||||||
if isinstance(sort_type, list):
|
if isinstance(sort_type, list):
|
||||||
sort_type = sort_type[0]
|
sort_type = sort_type[0]
|
||||||
if name not in base_keys:
|
if name not in self.base_keys:
|
||||||
if sort_type == 'title':
|
if sort_type == 'title':
|
||||||
value = get_title_sort(self.get(source, u'Untitled'))
|
value = get_title_sort(self.get(source, u'Untitled'))
|
||||||
value = utils.sort_title(value)[:955]
|
value = utils.sort_title(value)[:955]
|
||||||
|
|
Loading…
Reference in a new issue