Merge branch 'origin/dev'

This commit is contained in:
echel0n 2014-05-07 02:04:10 -07:00
commit 3cfd593b38
3 changed files with 33 additions and 10 deletions

View file

@ -111,6 +111,11 @@ def snatchEpisode(result, endStatus=SNATCHED):
if result is None: return False
# don't notify when we re-download an episode
for curEpObj in result.episodes:
if curEpObj.status in Quality.SNATCHED + Quality.SNATCHED_PROPER + Quality.SNATCHED_BEST:
return 2
result.priority = 0 # -1 = low, 0 = normal, 1 = high
if sickbeard.ALLOW_HIGH_PRIORITY:
# if it aired recently make it high priority

View file

@ -126,11 +126,12 @@ class ManualSearchQueueItem(generic_queue.QueueItem):
for foundResult in [item for sublist in foundResults for item in sublist]:
time.sleep(0.01)
# just use the first result for now
logger.log(u"Downloading " + foundResult.name + " from " + foundResult.provider.name)
result = search.snatchEpisode(foundResult)
# duplicate snatch detected due to multithreading
if result == 2:
continue
providerModule = foundResult.provider
if not result:
ui.notifications.error(
@ -138,9 +139,10 @@ class ManualSearchQueueItem(generic_queue.QueueItem):
elif providerModule == None:
ui.notifications.error('Provider is configured incorrectly, unable to download')
self.success = result
# just use the first result for now
logger.log(u"Downloading " + foundResult.name + " from " + foundResult.provider.name)
self.finish()
self.success = result
def process(self, curProvider):
if self.ep_obj.show.air_by_date:
@ -154,8 +156,8 @@ class ManualSearchQueueItem(generic_queue.QueueItem):
# don't let this linger if something goes wrong
if self.success == None:
self.success = False
generic_queue.QueueItem.finish(self)
else:
generic_queue.QueueItem.finish(self)
class RSSSearchQueueItem(generic_queue.QueueItem):
def __init__(self):
@ -186,7 +188,11 @@ class RSSSearchQueueItem(generic_queue.QueueItem):
if len(foundResults):
for curResult in [item for sublist in foundResults for item in sublist]:
time.sleep(0.01)
search.snatchEpisode(curResult)
result = search.snatchEpisode(curResult)
# duplicate snatch detected due to multithreading
if result == 2:
continue
else:
logger.log(u"RSS Feed search found nothing to snatch ...")
@ -289,7 +295,12 @@ class BacklogQueueItem(generic_queue.QueueItem):
for curResult in [item for sublist in foundResults for item in sublist]:
time.sleep(0.01)
search.snatchEpisode(curResult)
result = search.snatchEpisode(curResult)
# duplicate snatch detected due to multithreading
if result == 2:
continue
else:
logger.log(u"Backlog search found nothing to snatch ...")
@ -365,7 +376,13 @@ class FailedQueueItem(generic_queue.QueueItem):
for curResult in [item for sublist in foundResults for item in sublist]:
time.sleep(0.01)
self.success = search.snatchEpisode(curResult)
result = search.snatchEpisode(curResult)
# duplicate snatch detected due to multithreading
if result == 2:
continue
self.success = result
else:
logger.log(u"Retry failed download search found nothing to snatch ...")

View file

@ -18,6 +18,7 @@
from __future__ import with_statement
import time
import os.path
import datetime
import threading