Exemple #1
0
    def build(self, show=None, force=False):
        """Build internal name cache

        :param show: Specify show to build name cache for, if None, just do all shows
        """

        if not show:
            retrieve_exceptions()
            for show in sickrage.srCore.SHOWLIST:
                self.build(show)
        elif self.should_update(show):
            self.lastUpdate[show.name] = datetime.fromtimestamp(
                int(time.mktime(datetime.today().timetuple())))

            sickrage.srCore.srLogger.debug(
                "Building internal name cache for [{}]".format(show.name))
            self.clear(show.indexerid)
            for curSeason in [-1] + get_scene_seasons(show.indexerid):
                for name in list(
                        set(
                            get_scene_exceptions(show.indexerid,
                                                 season=curSeason) +
                            [show.name])):
                    self.put(name, show.indexerid)

            sickrage.srCore.srLogger.debug(
                "Internal name cache for [{}] set to: [{}]".format(
                    show.name, [
                        key for key, value in self.cache.items()
                        if value == show.indexerid
                    ][0]))
Exemple #2
0
    def build(self, show):
        """Build internal name cache

        :param show: Specify show to build name cache for, if None, just do all shows
        """

        retrieve_exceptions()

        if self.should_update(show):
            self.last_update[show.name] = datetime.fromtimestamp(
                int(time.mktime(datetime.today().timetuple())))

            self.clear(show.indexerid)

            show_names = []
            for curSeason in [-1] + get_scene_seasons(show.indexerid):
                for name in list(
                        set(
                            get_scene_exceptions(show.indexerid,
                                                 season=curSeason) +
                            [show.name])):
                    show_names.append(name)
                    show_names.append(strip_accents(name))
                    show_names.append(strip_accents(name).replace("'", " "))

            for show_name in set(show_names):
                self.clear(show_name)
                self.put(show_name, show.indexerid)
Exemple #3
0
    def buildNameCache(self, show=None):
        """Build internal name cache

        :param show: Specify show to build name cache for, if None, just do all shows
        """

        if self.shouldUpdate():
            if not show:
                retrieve_exceptions()
                for show in sickrage.showList:
                    sickrage.LOGGER.info("Building internal name cache for all shows")
                    self.buildNameCache(show)
            else:
                self.lastUpdate = datetime.datetime.fromtimestamp(
                        int(time.mktime(datetime.datetime.today().timetuple()))
                )

                sickrage.LOGGER.debug("Building internal name cache for [{}]".format(show.name))
                self.clearCache(show.indexerid)
                for curSeason in [-1] + get_scene_seasons(show.indexerid):
                    for name in list(set(get_scene_exceptions(
                            show.indexerid, season=curSeason) + [show.name])):

                        name = full_sanitizeSceneName(name)
                        if name not in self.cache:
                            self.cache[name] = int(show.indexerid)

                sickrage.LOGGER.debug("Internal name cache for [{}] set to: [{}]".format(
                        show.name, [key for key, value in self.cache.items() if value == show.indexerid][0]))
Exemple #4
0
    def build(self, show):
        """Build internal name cache

        :param show: Specify show to build name cache for, if None, just do all shows
        """

        retrieve_exceptions()

        if self.should_update(show):
            self.last_update[show.name] = datetime.fromtimestamp(int(time.mktime(datetime.today().timetuple())))

            self.clear(show.indexerid)
            for curSeason in [-1] + get_scene_seasons(show.indexerid):
                for name in list(set(get_scene_exceptions(show.indexerid, season=curSeason) + [show.name])):
                    self.put(name, show.indexerid)
Exemple #5
0
    def build(self, show):
        """Build internal name cache

        :param show: Specify show to build name cache for, if None, just do all shows
        """

        retrieve_exceptions()

        if self.should_update(show):
            self.last_update[show.name] = datetime.fromtimestamp(
                int(time.mktime(datetime.today().timetuple())))

            self.clear(show.indexerid)

            show_names = []
            for curSeason in [-1] + get_scene_seasons(show.indexerid):
                for name in list(
                        set(
                            get_scene_exceptions(show.indexerid,
                                                 season=curSeason) +
                            [show.name])):
                    show_names.append(name)

                    # strip accents
                    try:
                        try:
                            name.decode('ascii')
                        except UnicodeEncodeError:
                            pass

                        show_names.append(
                            unicodedata.normalize('NFKD', name).encode(
                                'ASCII', 'ignore'))
                        show_names.append(
                            unicodedata.normalize('NFKD', name).encode(
                                'ASCII', 'ignore').replace("'", " "))
                    except UnicodeDecodeError:
                        pass

            for show_name in set(show_names):
                self.put(show_name, show.indexerid)
    def build(self, show=None, force=False):
        """Build internal name cache

        :param show: Specify show to build name cache for, if None, just do all shows
        """

        if not show:
            retrieve_exceptions()
            for show in sickrage.srCore.SHOWLIST:
                self.build(show)
        elif self.should_update(show):
            self.last_update[show.name] = datetime.fromtimestamp(int(time.mktime(datetime.today().timetuple())))

            sickrage.srCore.srLogger.debug("Building internal name cache for [{}]".format(show.name))
            self.clear(show.indexerid)
            for curSeason in [-1] + get_scene_seasons(show.indexerid):
                for name in list(set(get_scene_exceptions(show.indexerid, season=curSeason) + [show.name])):
                    self.put(name, show.indexerid)

            sickrage.srCore.srLogger.debug("Internal name cache for [{}] set to: [{}]".format(
                show.name, [key for key, value in self.cache.items() if value == show.indexerid][0]))
Exemple #7
0
    def buildNameCache(self, show=None):
        """Build internal name cache

        :param show: Specify show to build name cache for, if None, just do all shows
        """

        if self.shouldUpdate():
            if not show:
                retrieve_exceptions()
                for show in sickrage.showList:
                    sickrage.LOGGER.info(
                        "Building internal name cache for all shows")
                    self.buildNameCache(show)
            else:
                self.lastUpdate = datetime.datetime.fromtimestamp(
                    int(time.mktime(datetime.datetime.today().timetuple())))

                sickrage.LOGGER.debug(
                    "Building internal name cache for [{}]".format(show.name))
                self.clearCache(show.indexerid)
                for curSeason in [-1] + get_scene_seasons(show.indexerid):
                    for name in list(
                            set(
                                get_scene_exceptions(show.indexerid,
                                                     season=curSeason) +
                                [show.name])):

                        name = full_sanitizeSceneName(name)
                        if name not in self.cache:
                            self.cache[name] = int(show.indexerid)

                sickrage.LOGGER.debug(
                    "Internal name cache for [{}] set to: [{}]".format(
                        show.name, [
                            key for key, value in self.cache.items()
                            if value == show.indexerid
                        ][0]))