示例#1
0
    def run(self, force=False):
        """
        Runs the daily searcher, queuing selected episodes for search
        :param force: Force search
        """
        if self.amActive or sickrage.app.developer and not force:
            return

        self.amActive = True

        # set thread name
        threading.currentThread().setName(self.name)

        # find new released episodes and update their statuses
        new_episode_finder()

        for curShow in sickrage.app.showlist:
            if curShow.paused:
                sickrage.app.log.debug("Skipping search for {} because the show is paused".format(curShow.name))
                continue

            segments = self._get_segments(curShow, datetime.date.today())
            sickrage.app.search_queue.put(DailySearchQueueItem(curShow, segments))

            if not segments:
                sickrage.app.log.debug("Nothing needs to be downloaded for {}, skipping".format(curShow.name))

        self.amActive = False
示例#2
0
    def run(self, force=False):
        """
        Runs the daily searcher, queuing selected episodes for search
        :param force: Force search
        """
        if self.amActive or sickrage.app.developer and not force:
            return

        self.amActive = True

        # set thread name
        threading.currentThread().setName(self.name)

        # find new released episodes and update their statuses
        new_episode_finder()

        for curShow in sickrage.app.showlist:
            if curShow.paused:
                sickrage.app.log.debug("Skipping search for {} because the show is paused".format(curShow.name))
                continue

            segments = self._get_segments(curShow, datetime.date.today())
            if segments:
                sickrage.app.search_queue.put(DailySearchQueueItem(curShow, segments))
            else:
                sickrage.app.log.debug("Nothing needs to be downloaded for {}, skipping".format(curShow.name))

        self.amActive = False
示例#3
0
    def search_backlog(self, which_shows=None):
        if self.amActive:
            sickrage.app.log.debug(
                "Backlog is still running, not starting it again")
            return

        self.amActive = True
        self.amPaused = False

        show_list = sickrage.app.showlist
        if which_shows:
            show_list = which_shows

        cur_date = datetime.date.today().toordinal()
        from_date = datetime.date.fromordinal(1)

        if not which_shows and self.forced:
            sickrage.app.log.info(
                "Running limited backlog on missed episodes " +
                str(sickrage.app.config.backlog_days) + " day(s) old")
            from_date = datetime.date.today() - datetime.timedelta(
                days=sickrage.app.config.backlog_days)
        else:
            sickrage.app.log.info(
                'Running full backlog search on missed episodes for selected shows'
            )

        # find new released episodes and update their statuses
        new_episode_finder()

        # go through non air-by-date shows and see if they need any episodes
        for curShow in show_list:
            if curShow.paused:
                sickrage.app.log.debug(
                    "Skipping search for {} because the show is paused".format(
                        curShow.name))
                continue

            self._last_backlog_search = self._get_last_backlog_search(
                curShow.indexerid)

            segments = self._get_segments(curShow, from_date)
            if segments:
                sickrage.app.search_queue.put(
                    BacklogQueueItem(curShow, segments))
            else:
                sickrage.app.log.debug(
                    "Nothing needs to be downloaded for {}, skipping".format(
                        curShow.name))

            # don't consider this an actual backlog search if we only did recent eps
            # or if we only did certain shows
            if from_date == datetime.date.fromordinal(1) and not which_shows:
                self._set_last_backlog_search(curShow.indexerid, cur_date)

        self.amActive = False
示例#4
0
    def search_backlog(self, which_shows=None):
        if self.amActive:
            sickrage.app.log.debug("Backlog is still running, not starting it again")
            return

        self.amActive = True
        self.amPaused = False

        show_list = sickrage.app.showlist
        if which_shows:
            show_list = which_shows

        cur_date = datetime.date.today().toordinal()
        from_date = datetime.date.fromordinal(1)

        if not which_shows and self.forced:
            sickrage.app.log.info("Running limited backlog on missed episodes " + str(
                sickrage.app.config.backlog_days) + " day(s) old")
            from_date = datetime.date.today() - datetime.timedelta(days=sickrage.app.config.backlog_days)
        else:
            sickrage.app.log.info('Running full backlog search on missed episodes for selected shows')

        # find new released episodes and update their statuses
        new_episode_finder()

        # go through non air-by-date shows and see if they need any episodes
        for curShow in show_list:
            if curShow.paused:
                sickrage.app.log.debug("Skipping search for {} because the show is paused".format(curShow.name))
                continue

            self._last_backlog_search = self._get_last_backlog_search(curShow.indexerid)

            segments = self._get_segments(curShow, from_date)
            if segments:
                sickrage.app.search_queue.put(BacklogQueueItem(curShow, segments))
            else:
                sickrage.app.log.debug("Nothing needs to be downloaded for {}, skipping".format(curShow.name))

            # don't consider this an actual backlog search if we only did recent eps
            # or if we only did certain shows
            if from_date == datetime.date.fromordinal(1) and not which_shows:
                self._set_last_backlog_search(curShow.indexerid, cur_date)

        self.amActive = False
示例#5
0
    def run(self, force=False, session=None):
        """
        Runs the daily searcher, queuing selected episodes for search
        :param force: Force search
        """
        if self.amActive and not force:
            return

        self.amActive = True

        # set thread name
        threading.currentThread().setName(self.name)

        # find new released episodes and update their statuses
        new_episode_finder()

        for curShow in get_show_list(session=session):
            if curShow.paused:
                sickrage.app.log.debug(
                    "Skipping search for {} because the show is paused".format(
                        curShow.name))
                continue

            wanted = self._get_wanted(curShow, datetime.date.today())
            if not wanted:
                sickrage.app.log.debug(
                    "Nothing needs to be downloaded for {}, skipping".format(
                        curShow.name))
                continue

            for season, episode in wanted:
                if (curShow.indexer_id, season,
                        episode) in sickrage.app.search_queue.SNATCH_HISTORY:
                    sickrage.app.search_queue.SNATCH_HISTORY.remove(
                        (curShow.indexer_id, season, episode))

                sickrage.app.io_loop.add_callback(
                    sickrage.app.search_queue.put,
                    DailySearchQueueItem(curShow.indexer_id, season, episode))

        self.amActive = False