dont update timeline in update_selected, remove unused async get_item case

This commit is contained in:
j 2016-06-16 14:48:54 +02:00
parent 0486d62ec9
commit 6dcbcdd19c
2 changed files with 13 additions and 19 deletions

View file

@ -105,7 +105,7 @@ def process_stream(fileId):
file = models.File.objects.get(id=fileId)
file.encoding = False
file.save()
file.item.update_selected(update_timeline=False)
file.item.update_selected()
if not file.item.rendered \
and not file.item.files.exclude(id=fileId).filter(Q(queued=True) | Q(encoding=True)).count():
file.item.update_timeline()

View file

@ -64,7 +64,7 @@ def get_id(info):
return imdbId
return None
def get_item(info, user=None, async=False):
def get_item(info, user=None):
'''
info dict with:
imdbId, title, director, year,
@ -98,10 +98,7 @@ def get_item(info, user=None, async=False):
item.external_data = item_data
item.user = user
item.oxdbId = item.public_id
item.save(sync=not async)
if async:
tasks.update_external.delay(item.public_id)
else:
item.save(sync=True)
item.update_external()
else:
public_id = get_id(info)
@ -124,8 +121,7 @@ def get_item(info, user=None, async=False):
item = existing_item
except Item.DoesNotExist:
item.oxdbId = item.oxdb_id()
p = item.save(sync=not async)
if not p and async:
item.save(sync=True)
tasks.update_poster.delay(item.public_id)
else:
qs = Item.objects.filter(find__key='title', find__value__iexact=info['title'])
@ -137,8 +133,7 @@ def get_item(info, user=None, async=False):
item = Item()
item.data = item_data
item.user = user
p = item.save(sync=not async)
if not p and async:
item.save(sync=True)
tasks.update_poster.delay(item.public_id)
return item
@ -361,6 +356,7 @@ class Item(models.Model):
self.public_id = str(uuid.uuid1())
self.add_default_data()
super(Item, self).save(*args, **kwargs)
update_poster = True
if not settings.USE_IMDB:
self.public_id = ox.toAZ(self.id)
@ -462,7 +458,7 @@ class Item(models.Model):
for a in self.annotations.all().order_by('id'):
a.item = other
a.set_public_id()
Annotations.objects.filter(id=a.id).update(item=other, public_id=a.public_id)
Annotation.objects.filter(id=a.id).update(item=other, public_id=a.public_id)
if hasattr(self, 'files'):
for f in self.files.all():
@ -1186,7 +1182,7 @@ class Item(models.Model):
qs = qs.exclude(id__in=wanted)
qs.update(wanted=False)
def update_selected(self, update_timeline=True):
def update_selected(self):
sets = self.sets()
for s in sets:
if s.filter(Q(is_video=True) | Q(is_audio=True)).filter(available=False).count() == 0:
@ -1202,8 +1198,6 @@ class Item(models.Model):
if update:
self.rendered = False
self.save()
if update_timeline:
tasks.update_timeline.delay(self.public_id)
break
if not sets:
self.rendered = False