Beispiel #1
0
    def run(self):
        self.started = True

        show_object = find_show(self.show_id)
        episode_object = show_object.get_episode(self.season, self.episode)

        try:
            sickrage.app.log.info("Starting failed download search for: [" +
                                  episode_object.name + "]")

            sickrage.app.log.info("Marking episode as bad: [" +
                                  episode_object.pretty_name() + "]")

            FailedHistory.mark_failed(self.show_id, self.season, self.episode)

            (release, provider) = FailedHistory.find_failed_release(
                self.show_id, self.season, self.episode)
            if release:
                FailedHistory.log_failed(release)
                History.log_failed(self.show_id, self.season, self.episode,
                                   release, provider)

            FailedHistory.revert_failed_episode(self.show_id, self.season,
                                                self.episode)

            search_result = search_providers(self.show_id,
                                             self.season,
                                             self.episode,
                                             manualSearch=True,
                                             downCurQuality=False)
            if search_result:
                snatch = all([(search_result.show_id, search_result.season,
                               episode)
                              not in sickrage.app.search_queue.SNATCH_HISTORY
                              for episode in search_result.episodes])

                if snatch:
                    [
                        sickrage.app.search_queue.fifo(
                            sickrage.app.search_queue.SNATCH_HISTORY,
                            (search_result.show_id, search_result.season,
                             episode),
                            sickrage.app.search_queue.SNATCH_HISTORY_SIZE)
                        for episode in search_result.episodes
                    ]

                    sickrage.app.log.info("Downloading " + search_result.name +
                                          " from " +
                                          search_result.provider.name)
                    snatch_episode(search_result)
        except Exception:
            sickrage.app.log.debug(traceback.format_exc())
        finally:
            sickrage.app.log.info("Finished failed download search for: [" +
                                  show_object.name + "]")
            sickrage.app.search_queue.fifo(
                sickrage.app.search_queue.MANUAL_SEARCH_HISTORY, self,
                sickrage.app.search_queue.MANUAL_SEARCH_HISTORY_SIZE)
Beispiel #2
0
    def run(self):
        self.started = True

        sickrage.app.search_queue.TASK_HISTORY[self.id] = {
            'season': self.season,
            'episode': self.episode
        }

        show_object = find_show(self.series_id, self.series_provider_id)
        if not show_object:
            return

        episode_object = show_object.get_episode(self.season, self.episode)

        try:
            sickrage.app.log.info("Starting failed download search for: [" +
                                  episode_object.name + "]")

            WebSocketMessage(
                'SEARCH_QUEUE_STATUS_UPDATED', {
                    'seriesSlug': show_object.slug,
                    'episodeId': episode_object.episode_id,
                    'searchQueueStatus': episode_object.search_queue_status
                }).push()

            sickrage.app.log.info("Marking episode as bad: [" +
                                  episode_object.pretty_name() + "]")

            FailedHistory.mark_failed(self.series_id, self.series_provider_id,
                                      self.season, self.episode)

            (release, provider) = FailedHistory.find_failed_release(
                self.series_id, self.series_provider_id, self.season,
                self.episode)
            if release:
                FailedHistory.log_failed(release)
                History.log_failed(self.series_id, self.series_provider_id,
                                   self.season, self.episode, release,
                                   provider)

            FailedHistory.revert_failed_episode(self.series_id,
                                                self.series_provider_id,
                                                self.season, self.episode)

            search_result = search_providers(self.series_id,
                                             self.series_provider_id,
                                             self.season,
                                             self.episode,
                                             manualSearch=True,
                                             downCurQuality=False)

            if search_result:
                snatch = all([(search_result.series_id, search_result.season,
                               episode)
                              not in sickrage.app.search_queue.SNATCH_HISTORY
                              for episode in search_result.episodes])

                if snatch:
                    [
                        sickrage.app.search_queue.SNATCH_HISTORY.append(
                            (search_result.series_id, search_result.season,
                             episode)) for episode in search_result.episodes
                    ]

                    sickrage.app.log.info("Downloading " + search_result.name +
                                          " from " +
                                          search_result.provider.name)
                    snatch_episode(search_result)
        except Exception:
            sickrage.app.log.debug(traceback.format_exc())
        finally:
            WebSocketMessage(
                'SEARCH_QUEUE_STATUS_UPDATED', {
                    'seriesSlug': show_object.slug,
                    'episodeId': episode_object.episode_id,
                    'searchQueueStatus': episode_object.search_queue_status
                }).push()

            sickrage.app.log.info("Finished failed download search for: [" +
                                  show_object.name + "]")