dont move all episodes into one item, fixes #1706

This commit is contained in:
j 2013-07-27 18:10:21 +00:00
parent 8281f62e0d
commit 0048908785

View file

@ -207,8 +207,11 @@ class File(models.Model):
get_name_sort(name, sortname) get_name_sort(name, sortname)
#add all files in one folder to same item #add all files in one folder to same item
if self.instances.all().count(): if self.instances.all().count():
folder = os.path.dirname(self.instances.all()[0].path) + '/' if info.get('isEpisode'):
qs = item.models.Item.objects.filter(files__instances__path__startswith=folder) 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(): if qs.exists():
self.item = qs[0] self.item = qs[0]
if not self.item: if not self.item: