From 00489087851c68650944fa80f2f3414421fd9d79 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 27 Jul 2013 18:10:21 +0000 Subject: [PATCH] dont move all episodes into one item, fixes #1706 --- pandora/archive/models.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pandora/archive/models.py b/pandora/archive/models.py index 8f019aa91..5bc374733 100644 --- a/pandora/archive/models.py +++ b/pandora/archive/models.py @@ -207,8 +207,11 @@ class File(models.Model): get_name_sort(name, sortname) #add all files in one folder to same item if self.instances.all().count(): - folder = os.path.dirname(self.instances.all()[0].path) + '/' - qs = item.models.Item.objects.filter(files__instances__path__startswith=folder) + if info.get('isEpisode'): + prefix = os.path.splitext(self.instances.all()[0].path)[0] + else: + prefix = os.path.dirname(self.instances.all()[0].path) + '/' + qs = item.models.Item.objects.filter(files__instances__path__startswith=prefix) if qs.exists(): self.item = qs[0] if not self.item: