check for existing item with that oxdbId

This commit is contained in:
j 2010-12-08 02:16:13 +01:00
parent 91582033a1
commit 966da72548

View file

@ -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: