Permalink
Browse files

Merge pull request #479 from itofzo/fix_rename_multi_multi_episodes_dev

Fix renaming: Only need one of the episodes of Multi-Episodes
  • Loading branch information...
2 parents 830b3b1 + d51c177 commit 45f16287fceabd64cbbb2dfe404fb1c1812623ca @midgetspy committed Sep 19, 2012
Showing with 20 additions and 6 deletions.
  1. +11 −3 sickbeard/show_queue.py
  2. +9 −3 sickbeard/webserve.py
View
@@ -337,6 +337,7 @@ def execute(self):
self.inProgress = False
+
class QueueItemRename(ShowQueueItem):
def __init__(self, show=None):
ShowQueueItem.__init__(self, ShowQueueActions.RENAME, show)
@@ -360,9 +361,15 @@ def execute(self):
# Only want to rename if we have a location
if cur_ep_obj.location:
if cur_ep_obj.relatedEps:
- for cur_related_ep in cur_ep_obj.relatedEps:
- if cur_related_ep not in ep_obj_rename_list:
- ep_obj_rename_list.append(cur_ep_obj)
+ # do we have one of multi-episodes in the rename list already
+ have_already = False
+ for cur_related_ep in cur_ep_obj.relatedEps + [cur_ep_obj]:
+ if cur_related_ep in ep_obj_rename_list:
+ have_already = True
+ break
+ if not have_already:
+ ep_obj_rename_list.append(cur_ep_obj)
+
else:
ep_obj_rename_list.append(cur_ep_obj)
@@ -371,6 +378,7 @@ def execute(self):
self.inProgress = False
+
class QueueItemUpdate(ShowQueueItem):
def __init__(self, show=None):
ShowQueueItem.__init__(self, ShowQueueActions.UPDATE, show)
View
@@ -2573,9 +2573,15 @@ def testRename(self, show=None):
# Only want to rename if we have a location
if cur_ep_obj.location:
if cur_ep_obj.relatedEps:
- for cur_related_ep in cur_ep_obj.relatedEps:
- if cur_related_ep not in ep_obj_rename_list:
- ep_obj_rename_list.append(cur_ep_obj)
+ # do we have one of multi-episodes in the rename list already
+ have_already = False
+ for cur_related_ep in cur_ep_obj.relatedEps + [cur_ep_obj]:
+ if cur_related_ep in ep_obj_rename_list:
+ have_already = True
+ break
+ if not have_already:
+ ep_obj_rename_list.append(cur_ep_obj)
+
else:
ep_obj_rename_list.append(cur_ep_obj)

0 comments on commit 45f1628

Please sign in to comment.