forked from 0x2620/pandora
rename items instead of merge
This commit is contained in:
parent
b77a29933c
commit
408af96aa2
1 changed files with 13 additions and 4 deletions
|
@ -264,9 +264,18 @@ class Item(models.Model):
|
||||||
if self.oxdbId != oxdbId:
|
if self.oxdbId != oxdbId:
|
||||||
q = Item.objects.filter(oxdbId=oxdbId).exclude(id=self.id)
|
q = Item.objects.filter(oxdbId=oxdbId).exclude(id=self.id)
|
||||||
if q.count() != 0:
|
if q.count() != 0:
|
||||||
|
if len(self.itemId) == 7:
|
||||||
self.oxdbId = None
|
self.oxdbId = None
|
||||||
q[0].merge_with(self, save=False)
|
q[0].merge_with(self, save=False)
|
||||||
else:
|
else:
|
||||||
|
n = 1
|
||||||
|
key = 'episodeTitle' in self.data and 'episodeTitle' or 'title'
|
||||||
|
title = self.get(key, 'Untitled')
|
||||||
|
while q.count() != 0:
|
||||||
|
n += 1
|
||||||
|
self.data[key] = u'%s [%d]' % (title, n)
|
||||||
|
oxdbId = self.oxdb_id()
|
||||||
|
q = Item.objects.filter(oxdbId=oxdbId).exclude(id=self.id)
|
||||||
self.oxdbId = oxdbId
|
self.oxdbId = oxdbId
|
||||||
update_poster = True
|
update_poster = True
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue