def run(self): self.started = True try: sickrage.app.log.info("Starting failed download search for: [" + self.show.name + "]") for epObj in self.segment: sickrage.app.log.info("Marking episode as bad: [" + epObj.pretty_name() + "]") FailedHistory.markFailed(epObj) (release, provider) = FailedHistory.findFailedRelease(epObj) if release: FailedHistory.logFailed(release) History.logFailed(epObj, release, provider) FailedHistory.revertFailedEpisode(epObj) search_result = searchProviders(self.show, self.segment, manualSearch=True, downCurQuality=False) if search_result: for result in search_result: # just use the first result for now sickrage.app.log.info("Downloading " + result.name + " from " + result.provider.name) snatchEpisode(result) # give the CPU a break time.sleep(cpu_presets[sickrage.app.config.cpu_preset]) except Exception: sickrage.app.log.debug(traceback.format_exc()) finally: sickrage.app.log.info("Finished failed download search for: [" + self.show.name + "]") # Keep a list with the 100 last executed searches fifo(MANUAL_SEARCH_HISTORY, self, MANUAL_SEARCH_HISTORY_SIZE)
def run(self): self.started = True try: sickrage.app.log.info("Starting backlog search for: [" + self.show.name + "]") search_result = searchProviders(self.show, self.segment, manualSearch=False, updateCache=False) if search_result: for result in search_result: # just use the first result for now sickrage.app.log.info("Downloading " + result.name + " from " + result.provider.name) snatchEpisode(result) # give the CPU a break time.sleep(cpu_presets[sickrage.app.config.cpu_preset]) else: sickrage.app.log.info( "No needed episodes found during backlog search for: [" + self.show.name + "]") except Exception: sickrage.app.log.debug(traceback.format_exc()) finally: sickrage.app.log.info("Finished backlog search for: [" + self.show.name + "]")
def run(self): self.started = True try: sickrage.app.log.info("Starting daily search for: [" + self.show.name + "]") search_result = searchProviders( self.show, self.segment, cacheOnly=sickrage.app.config.enable_rss_cache) if search_result: for result in search_result: # just use the first result for now sickrage.app.log.info("Downloading " + result.name + " from " + result.provider.name) snatchEpisode(result) # give the CPU a break time.sleep(cpu_presets[sickrage.app.config.cpu_preset]) else: sickrage.app.log.info("Unable to find search results for: [" + self.show.name + "]") except Exception: sickrage.app.log.debug(traceback.format_exc()) finally: sickrage.app.log.info("Finished daily search for: [" + self.show.name + "]")
def run(self): super(FailedQueueItem, self).run() self.started = True try: for epObj in self.segment: sickrage.srCore.srLogger.info("Marking episode as bad: [" + epObj.prettyName() + "]") FailedHistory.markFailed(epObj) (release, provider) = FailedHistory.findFailedRelease(epObj) if release: FailedHistory.logFailed(release) History.logFailed(epObj, release, provider) FailedHistory.revertFailedEpisode(epObj) sickrage.srCore.srLogger.info("Beginning failed download search for: [" + epObj.prettyName() + "]") # If it is wanted, self.downCurQuality doesnt matter # if it isnt wanted, we need to make sure to not overwrite the existing ep that we reverted to! searchResult = searchProviders(self.show, self.segment, True, False) if searchResult: for result in searchResult: # just use the first result for now sickrage.srCore.srLogger.info("Downloading " + result.name + " from " + result.provider.name) snatchEpisode(result) # give the CPU a break time.sleep(cpu_presets[sickrage.srCore.srConfig.CPU_PRESET]) except Exception: sickrage.srCore.srLogger.debug(traceback.format_exc()) ### Keep a list with the 100 last executed searches fifo(MANUAL_SEARCH_HISTORY, self, MANUAL_SEARCH_HISTORY_SIZE)
def run(self): QueueItem.run(self) if not self.show.paused: try: sickrage.LOGGER.info("Beginning backlog search for: [" + self.show.name + "]") searchResult = searchProviders(self.show, self.segment, False) if searchResult: for result in searchResult: # just use the first result for now sickrage.LOGGER.info("Downloading " + result.name + " from " + result.provider.name) snatchEpisode(result) # give the CPU a break gen.sleep(cpu_presets[sickrage.CPU_PRESET]) else: sickrage.LOGGER.info( "No needed episodes found during backlog search for: [" + self.show.name + "]") except Exception: sickrage.LOGGER.debug(traceback.format_exc()) self.finish()
def run(self): self.started = True if not self.show.paused: try: sickrage.srCore.srLogger.info( "Starting backlog search for: [" + self.show.name + "]") searchResult = searchProviders(self.show, self.segment, False) if searchResult: for result in searchResult: # just use the first result for now sickrage.srCore.srLogger.info("Downloading " + result.name + " from " + result.provider.name) snatchEpisode(result) # give the CPU a break time.sleep( cpu_presets[sickrage.srCore.srConfig.CPU_PRESET]) except Exception: sickrage.srCore.srLogger.debug(traceback.format_exc()) finally: sickrage.srCore.srLogger.info( "Finished backlog search for: [" + self.show.name + "]")
def _downloadPropers(self, properList): """ Download proper (snatch it) :param properList: """ for curProper in properList: historyLimit = datetime.datetime.today() - datetime.timedelta(days=30) # make sure the episode has been downloaded before historyResults = [x for x in MainDB().db.get_many('history', curProper.indexerid, with_doc=True) if x['doc']['season'] == curProper.season and x['doc']['episode'] == curProper.episode and x['doc']['quality'] == curProper.quality and x['doc']['date'] >= historyLimit.strftime(History.date_format) and x['doc']['action'] in Quality.SNATCHED + Quality.DOWNLOADED] # if we didn't download this episode in the first place we don't know what quality to use for the proper so we can't do it if len(historyResults) == 0: sickrage.srCore.srLogger.info( "Unable to find an original history entry for proper " + curProper.name + " so I'm not downloading it.") continue else: # make sure that none of the existing history downloads are the same proper we're trying to download clean_proper_name = self._genericName(remove_non_release_groups(curProper.name)) isSame = False for curResult in historyResults: # if the result exists in history already we need to skip it if self._genericName( remove_non_release_groups(curResult["resource"])) == clean_proper_name: isSame = True break if isSame: sickrage.srCore.srLogger.debug("This proper is already in history, skipping it") continue # get the episode object epObj = curProper.show.getEpisode(curProper.season, curProper.episode) # make the result object result = curProper.provider.getResult([epObj]) result.show = curProper.show result.url = curProper.url result.name = curProper.name result.quality = curProper.quality result.release_group = curProper.release_group result.version = curProper.version result.content = curProper.content result.size = curProper.provider._get_size(curProper.url) result.files = curProper.provider._get_files(curProper.url) # snatch it snatchEpisode(result, SNATCHED_PROPER) time.sleep(cpu_presets[sickrage.srCore.srConfig.CPU_PRESET])
def _downloadPropers(self, properList): """ Download proper (snatch it) :param properList: """ for curProper in properList: historyLimit = datetime.datetime.today() - datetime.timedelta(days=30) # make sure the episode has been downloaded before historyResults = [x for x in sickrage.app.main_db.get_many('history', curProper.indexerid) if x['season'] == curProper.season and x['episode'] == curProper.episode and x['quality'] == curProper.quality and x['date'] >= historyLimit.strftime(History.date_format) and x['action'] in Quality.SNATCHED + Quality.DOWNLOADED] # if we didn't download this episode in the first place we don't know what quality to use for the proper so we can't do it if len(historyResults) == 0: sickrage.app.log.info( "Unable to find an original history entry for proper " + curProper.name + " so I'm not downloading it.") continue else: # make sure that none of the existing history downloads are the same proper we're trying to download clean_proper_name = self._genericName(remove_non_release_groups(curProper.name)) isSame = False for curResult in historyResults: # if the result exists in history already we need to skip it if self._genericName( remove_non_release_groups(curResult["resource"])) == clean_proper_name: isSame = True break if isSame: sickrage.app.log.debug("This proper is already in history, skipping it") continue # make the result object result = curProper.provider.getResult([curProper.show.get_episode(curProper.season, curProper.episode)]) result.show = curProper.show result.url = curProper.url result.name = curProper.name result.quality = curProper.quality result.release_group = curProper.release_group result.version = curProper.version result.seeders = curProper.seeders result.leechers = curProper.leechers result.size = curProper.size result.files = curProper.files result.content = curProper.content # snatch it snatchEpisode(result, SNATCHED_PROPER) time.sleep(cpu_presets[sickrage.app.config.cpu_preset])
def _downloadPropers(self, properList): """ Download proper (snatch it) :param properList: """ for curProper in properList: historyLimit = datetime.datetime.today() - datetime.timedelta(days=30) # make sure the episode has been downloaded before historyResults = main_db.MainDB().select( "SELECT resource FROM history " + "WHERE showid = ? AND season = ? AND episode = ? AND quality = ? AND date >= ? " + "AND action IN (" + ",".join([str(x) for x in Quality.SNATCHED + Quality.DOWNLOADED]) + ")", [curProper.indexerid, curProper.season, curProper.episode, curProper.quality, historyLimit.strftime(History.date_format)]) # if we didn't download this episode in the first place we don't know what quality to use for the proper so we can't do it if len(historyResults) == 0: sickrage.srCore.srLogger.info( "Unable to find an original history entry for proper " + curProper.name + " so I'm not downloading it.") continue else: # make sure that none of the existing history downloads are the same proper we're trying to download clean_proper_name = self._genericName(remove_non_release_groups(curProper.name)) isSame = False for curResult in historyResults: # if the result exists in history already we need to skip it if self._genericName( remove_non_release_groups(curResult["resource"])) == clean_proper_name: isSame = True break if isSame: sickrage.srCore.srLogger.debug("This proper is already in history, skipping it") continue # get the episode object epObj = curProper.show.getEpisode(curProper.season, curProper.episode) # make the result object result = curProper.provider.getResult([epObj]) result.show = curProper.show result.url = curProper.url result.name = curProper.name result.quality = curProper.quality result.release_group = curProper.release_group result.version = curProper.version result.content = curProper.content # snatch it snatchEpisode(result, SNATCHED_PROPER) time.sleep(cpu_presets[sickrage.srCore.srConfig.CPU_PRESET])
def run(self): QueueItem.run(self) try: sickrage.LOGGER.info("Beginning manual search for: [" + self.segment.prettyName() + "]") self.started = True searchResult = searchProviders(self.show, [self.segment], True, self.downCurQuality) if searchResult: # just use the first result for now sickrage.LOGGER.info("Downloading " + searchResult[0].name + " from " + searchResult[0].provider.name) self.success = snatchEpisode(searchResult[0]) # give the CPU a break gen.sleep(cpu_presets[sickrage.CPU_PRESET]) else: notifications.message('No downloads were found', "Couldn't find a download for <i>%s</i>" % self.segment.prettyName()) sickrage.LOGGER.info("Unable to find a download for: [" + self.segment.prettyName() + "]") except Exception: sickrage.LOGGER.debug(traceback.format_exc()) ### Keep a list with the 100 last executed searches fifo(MANUAL_SEARCH_HISTORY, self, MANUAL_SEARCH_HISTORY_SIZE) if self.success is None: self.success = False self.finish()
def run(self): QueueItem.run(self) try: sickrage.LOGGER.info("Beginning daily search for new episodes") foundResults = searchForNeededEpisodes() if not len(foundResults): sickrage.LOGGER.info("No needed episodes found") else: for result in foundResults: # just use the first result for now sickrage.LOGGER.info("Downloading " + result.name + " from " + result.provider.name) self.success = snatchEpisode(result) # give the CPU a break gen.sleep(cpu_presets[sickrage.CPU_PRESET]) QueueItem.finish(self) except Exception: sickrage.LOGGER.debug(traceback.format_exc()) if self.success is None: self.success = False self.finish()
def run(self): self.started = True try: sickrage.app.log.info("Starting manual search for: [" + self.segment.pretty_name() + "]") search_result = searchProviders(self.show, [self.segment], manualSearch=True, downCurQuality=self.downCurQuality) if search_result: # just use the first result for now sickrage.app.log.info( "Downloading " + search_result[0].name + " from " + search_result[0].provider.name) self.success = snatchEpisode(search_result[0]) # give the CPU a break time.sleep(cpu_presets[sickrage.app.config.cpu_preset]) else: sickrage.app.alerts.message( _('No downloads were found'), _("Couldn't find a download for <i>%s</i>") % self.segment.pretty_name() ) sickrage.app.log.info("Unable to find a download for: [" + self.segment.pretty_name() + "]") except Exception: sickrage.app.log.debug(traceback.format_exc()) finally: sickrage.app.log.info("Finished manual search for: [" + self.segment.pretty_name() + "]") # Keep a list with the 100 last executed searches fifo(MANUAL_SEARCH_HISTORY, self, MANUAL_SEARCH_HISTORY_SIZE)
def run(self): super(ManualSearchQueueItem, self).run() self.started = True try: sickrage.srCore.srLogger.info("Beginning manual search for: [" + self.segment.prettyName() + "]") searchResult = searchProviders(self.show, [self.segment], True, self.downCurQuality) if searchResult: # just use the first result for now sickrage.srCore.srLogger.info("Downloading " + searchResult[0].name + " from " + searchResult[0].provider.name) self.success = snatchEpisode(searchResult[0]) # give the CPU a break time.sleep(cpu_presets[sickrage.srCore.srConfig.CPU_PRESET]) else: sickrage.srCore.srNotifications.message('No downloads were found', "Couldn't find a download for <i>%s</i>" % self.segment.prettyName()) sickrage.srCore.srLogger.info("Unable to find a download for: [" + self.segment.prettyName() + "]") except Exception: sickrage.srCore.srLogger.debug(traceback.format_exc()) ### Keep a list with the 100 last executed searches fifo(MANUAL_SEARCH_HISTORY, self, MANUAL_SEARCH_HISTORY_SIZE)
def run(self): super(BacklogQueueItem, self).run() self.started = True if not self.show.paused: try: sickrage.srCore.srLogger.info("Beginning backlog search for: [" + self.show.name + "]") searchResult = searchProviders(self.show, self.segment, False) if searchResult: for result in searchResult: # just use the first result for now sickrage.srCore.srLogger.info("Downloading " + result.name + " from " + result.provider.name) snatchEpisode(result) # give the CPU a break time.sleep(cpu_presets[sickrage.srCore.srConfig.CPU_PRESET]) else: sickrage.srCore.srLogger.info("No needed episodes found during backlog search for: [" + self.show.name + "]") except Exception: sickrage.srCore.srLogger.debug(traceback.format_exc())
def run(self): self.started = True if not self.show.paused: try: sickrage.srCore.srLogger.info("Starting backlog search for: [" + self.show.name + "]") searchResult = searchProviders(self.show, self.segment, False) if searchResult: for result in searchResult: # just use the first result for now sickrage.srCore.srLogger.info("Downloading " + result.name + " from " + result.provider.name) snatchEpisode(result) # give the CPU a break time.sleep(cpu_presets[sickrage.srCore.srConfig.CPU_PRESET]) except Exception: sickrage.srCore.srLogger.debug(traceback.format_exc()) finally: sickrage.srCore.srLogger.info("Finished backlog search for: [" + self.show.name + "]")
def run(self): self.started = True try: sickrage.app.log.info("Starting backlog search for: [" + self.show.name + "]") search_result = searchProviders(self.show, self.segment, manualSearch=False) if search_result: for result in search_result: # just use the first result for now sickrage.app.log.info("Downloading " + result.name + " from " + result.provider.name) snatchEpisode(result) # give the CPU a break time.sleep(cpu_presets[sickrage.app.config.cpu_preset]) else: sickrage.app.log.info("Unable to find search results for: [" + self.show.name + "]") except Exception: sickrage.app.log.debug(traceback.format_exc()) finally: sickrage.app.log.info("Finished backlog search for: [" + self.show.name + "]")
def run(self): QueueItem.run(self) if not self.show.paused: try: sickrage.LOGGER.info("Beginning backlog search for: [" + self.show.name + "]") searchResult = searchProviders(self.show, self.segment, False) if searchResult: for result in searchResult: # just use the first result for now sickrage.LOGGER.info("Downloading " + result.name + " from " + result.provider.name) snatchEpisode(result) # give the CPU a break gen.sleep(cpu_presets[sickrage.CPU_PRESET]) else: sickrage.LOGGER.info("No needed episodes found during backlog search for: [" + self.show.name + "]") except Exception: sickrage.LOGGER.debug(traceback.format_exc()) self.finish()
def run(self): super(DailySearchQueueItem, self).run() self.started = True try: sickrage.srCore.srLogger.info("Beginning daily search for new episodes") foundResults = searchForNeededEpisodes() if foundResults: for result in foundResults: # just use the first result for now sickrage.srCore.srLogger.info("Downloading " + result.name + " from " + result.provider.name) self.success = snatchEpisode(result) # give the CPU a break time.sleep(cpu_presets[sickrage.srCore.srConfig.CPU_PRESET]) else: sickrage.srCore.srLogger.info("No needed episodes found") except Exception: sickrage.srCore.srLogger.debug(traceback.format_exc())
def run(self): self.started = True try: sickrage.app.log.info("Starting daily search for new episodes") foundResults = searchForNeededEpisodes() if foundResults: for result in foundResults: # just use the first result for now sickrage.app.log.info("Downloading " + result.name + " from " + result.provider.name) self.success = snatchEpisode(result) # give the CPU a break time.sleep(cpu_presets[sickrage.app.config.cpu_preset]) else: sickrage.app.log.info("No needed episodes found") except Exception: sickrage.app.log.debug(traceback.format_exc()) finally: sickrage.app.log.info("Finished daily search for new episodes")
def _downloadPropers(self, properList): """ Download proper (snatch it) :param properList: """ for curProper in properList: historyLimit = datetime.datetime.today() - datetime.timedelta( days=30) # make sure the episode has been downloaded before historyResults = main_db.MainDB().select( "SELECT resource FROM history " + "WHERE showid = ? AND season = ? AND episode = ? AND quality = ? AND date >= ? " + "AND action IN (" + ",".join( [str(x) for x in Quality.SNATCHED + Quality.DOWNLOADED]) + ")", [ curProper.indexerid, curProper.season, curProper.episode, curProper.quality, historyLimit.strftime(History.date_format) ]) # if we didn't download this episode in the first place we don't know what quality to use for the proper so we can't do it if len(historyResults) == 0: sickrage.srCore.srLogger.info( "Unable to find an original history entry for proper " + curProper.name + " so I'm not downloading it.") continue else: # make sure that none of the existing history downloads are the same proper we're trying to download clean_proper_name = self._genericName( remove_non_release_groups(curProper.name)) isSame = False for curResult in historyResults: # if the result exists in history already we need to skip it if self._genericName( remove_non_release_groups( curResult["resource"])) == clean_proper_name: isSame = True break if isSame: sickrage.srCore.srLogger.debug( "This proper is already in history, skipping it") continue # get the episode object epObj = curProper.show.getEpisode(curProper.season, curProper.episode) # make the result object result = curProper.provider.getResult([epObj]) result.show = curProper.show result.url = curProper.url result.name = curProper.name result.quality = curProper.quality result.release_group = curProper.release_group result.version = curProper.version result.content = curProper.content # snatch it snatchEpisode(result, SNATCHED_PROPER) time.sleep(cpu_presets[sickrage.srCore.srConfig.CPU_PRESET])