add default values to items without imdb
This commit is contained in:
parent
ab2949f815
commit
a1acc6b3aa
2 changed files with 13 additions and 0 deletions
|
@ -359,6 +359,7 @@
|
|||
"title": "Mainstream Score",
|
||||
"type": "float",
|
||||
"columnWidth": 60,
|
||||
"default" 0,
|
||||
"format": {"type": "ColorPercent", "args": [1, true]},
|
||||
"sort": true
|
||||
},
|
||||
|
@ -367,6 +368,7 @@
|
|||
"title": "Arthouse Score",
|
||||
"type": "float",
|
||||
"columnWidth": 60,
|
||||
"default" 0,
|
||||
"format": {"type": "ColorPercent", "args": [1, true]},
|
||||
"sort": true
|
||||
},
|
||||
|
|
|
@ -383,6 +383,17 @@ class Item(models.Model):
|
|||
if key in self.data:
|
||||
del self.data[key]
|
||||
|
||||
# update defaults
|
||||
if settings.USE_IMDB:
|
||||
defaults = filter(lambda k: 'default' in k, settings.CONFIG['itemKeys'])
|
||||
for k in defaults:
|
||||
if len(self.itemId) == 7:
|
||||
if k['id'] in self.data and self.data[k['id']] == k['default']:
|
||||
del self.data[k['id']]
|
||||
else:
|
||||
if k['id'] not in self.data:
|
||||
self.data[k['id']] = k['default']
|
||||
|
||||
if self.poster and os.path.exists(self.poster.path):
|
||||
self.poster_height = self.poster.height
|
||||
self.poster_width = self.poster.width
|
||||
|
|
Loading…
Reference in a new issue