check for existing item with that oxdbId
This commit is contained in:
parent
91582033a1
commit
966da72548
1 changed files with 6 additions and 3 deletions
|
@ -170,6 +170,10 @@ def get_item(info):
|
|||
for key in ('episode_title', 'series_title', 'season', 'episode'):
|
||||
if key in info and info[key]:
|
||||
item.data[key] = info[key]
|
||||
try:
|
||||
existing_item = Item.objects.get(oxdbId=item.oxdb_id())
|
||||
item = existing_item
|
||||
except Item.DoesNotExist:
|
||||
item.save()
|
||||
return item
|
||||
|
||||
|
@ -287,7 +291,6 @@ class Item(models.Model):
|
|||
|
||||
def save(self, *args, **kwargs):
|
||||
self.json = self.get_json()
|
||||
if not self.oxdbId:
|
||||
self.oxdbId = self.oxdb_id()
|
||||
|
||||
if self.poster:
|
||||
|
|
Loading…
Reference in a new issue