From b4a1a00ed61cccc08d1739dec26ed12b9fa0030a Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 27 Aug 2011 10:46:03 +0200 Subject: [PATCH] update files --- pandora/item/models.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pandora/item/models.py b/pandora/item/models.py index aaf897f6c..283a92cb7 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -758,8 +758,8 @@ class Item(models.Model): else: level = 2 return level - users = User.objects.filter(volumes__files__file__in=self.files.filter(active=True)).distinct() - current_level = get_level(users) + current_users = User.objects.filter(volumes__files__file__in=self.files.filter(active=True)).distinct() + current_level = get_level(current_users) users = User.objects.filter(volumes__files__file__in=files).distinct() possible_level = get_level(users) @@ -774,6 +774,18 @@ class Item(models.Model): self.rendered = False self.save() self.update_timeline() + else: + files = self.files.filter(instances__volume__user__in=current_users).order_by('part') + #FIXME: this should be instance folders + folders = list(set([f.folder + for f in files.filter(is_video=True, instances__extra=False)])) + files = files.filter(folder__startswith=folders[0]) + if files.filter(active=False).count() > 0: + files.update(active=True) + self.rendered = False + self.save() + self.update_timeline() + def make_torrent(self): base = self.path('torrent')