• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python helpers.sanitizeSceneName函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sickbeard.helpers.sanitizeSceneName函数的典型用法代码示例。如果您正苦于以下问题:Python sanitizeSceneName函数的具体用法?Python sanitizeSceneName怎么用?Python sanitizeSceneName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了sanitizeSceneName函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _get_season_search_strings

    def _get_season_search_strings(self, ep_obj):

        to_return = []
        cur_params = {}

        cur_params['maxage'] = (datetime.datetime.now() - datetime.datetime.combine(ep_obj.airdate, datetime.datetime.min.time())).days + 1

        # season
        if ep_obj.show.air_by_date or ep_obj.show.sports:
            date_str = str(ep_obj.airdate).split('-')[0]
            cur_params['season'] = date_str
            cur_params['q'] = date_str.replace('-', '.')
        elif ep_obj.show.is_anime:
            cur_params['season'] = "%d" % ep_obj.scene_absolute_number
        else:
            cur_params['season'] = str(ep_obj.scene_season)

        # search
        rid = helpers.mapIndexersToShow(ep_obj.show)[2]
        if rid:
            cur_params['rid'] = rid
        elif 'rid' in cur_params:
            cur_params.pop('rid')

        # add new query strings for exceptions
        name_exceptions = list(
            set(scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name]))
        for cur_exception in name_exceptions:
            if 'q' in cur_params:
                cur_params['q'] = helpers.sanitizeSceneName(cur_exception) + '.' + cur_params['q']
            else:
                cur_params['q'] = helpers.sanitizeSceneName(cur_exception)
            to_return.append(cur_params)

        return to_return
开发者ID:Goeny,项目名称:SickRage,代码行数:35,代码来源:newznab.py


示例2: test_formating

    def test_formating(self):
        self.loadFromDB()
        show = sickbeard.helpers.findCertainShow(sickbeard.showList, 75978)
        ep = show.getEpisode(7, 6)
        ep.airdate = datetime.datetime.now()

        print format(ep.episode, '02d')
        print format(ep.scene_episode, '02d')

        search_string = {'Episode':[]}
        episode = ep.airdate
        str(episode).replace('-', '|')
        ep_string = sanitizeSceneName(show.name) + ' ' + \
                    str(episode).replace('-', '|') + '|' + \
                    sickbeard.helpers.custom_strftime('%b', episode)

        search_string['Episode'].append(ep_string)

        scene_ep_string = sanitizeSceneName(show.name) + ' ' + \
                    sickbeard.config.naming_ep_type[2] % {'seasonnumber': ep.scene_season,
                                                          'episodenumber': ep.scene_episode} + '|' + \
                    sickbeard.config.naming_ep_type[0] % {'seasonnumber': ep.scene_season,
                                                          'episodenumber': ep.scene_episode} + '|' + \
                    sickbeard.config.naming_ep_type[3] % {'seasonnumber': ep.scene_season,
                                                          'episodenumber': ep.scene_episode} + ' %s category:tv' % ''

        scene_season_string = show.name + ' S%02d' % int(ep.scene_season) + ' -S%02d' % int(ep.scene_season) + 'E' + ' category:tv'  #1) ShowName SXX -SXXE


        print(
            u'Searching "%s" for "%s" as "%s"' % (show.name, ep.prettyName(), ep.scene_prettyName()))

        print('Scene episode search strings: %s' % (scene_ep_string))

        print('Scene season search strings: %s' % (scene_season_string))
开发者ID:WoLpH,项目名称:SickBeard-TVRage,代码行数:35,代码来源:xem_tests.py


示例3: _get_episode_search_strings

    def _get_episode_search_strings(self, ep_obj, add_string=''):

        search_strings = []

        if not ep_obj:
            return []

        for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
            if self.show.air_by_date:
                ep_string = sanitizeSceneName(show_name) + ' ' + str(ep_obj.airdate).replace('-', '.')
            elif self.show.sports:
                ep_string = sanitizeSceneName(show_name) + ' ' + str(ep_obj.airdate).replace('-', '.') + '|' + \
                        ep_obj.airdate.strftime('%b')
            elif self.show.anime:
                ep_string = sanitizeSceneName(show_name) + ' %i' % int(ep_obj.scene_absolute_number)
            else:
                ep_string = sanitizeSceneName(show_name) + ' ' + \
                        sickbeard.config.naming_ep_type[2] % {'seasonnumber': ep_obj.scene_season,
                                                                  'episodenumber': ep_obj.scene_episode}

            if len(add_string):
                ep_string += ' %s' % add_string

            search_strings.append(ep_string)

        return search_strings
开发者ID:bbbenja,项目名称:SickRage,代码行数:26,代码来源:scc.py


示例4: _get_season_search_strings

    def _get_season_search_strings(self, show, season=None):
        search_string = []

        if not (show and season):
            return []

        myDB = db.DBConnection()

        if show.air_by_date:
            (min_date, max_date) = self._get_airbydate_season_range(season)
            sqlResults = myDB.select(
                "SELECT DISTINCT airdate FROM tv_episodes WHERE showid = ? AND airdate >= ? AND airdate <= ? AND status = ?",
                [show.tvdbid, min_date.toordinal(), max_date.toordinal(), WANTED],
            )
        else:
            sqlResults = myDB.select(
                "SELECT DISTINCT season FROM tv_episodes WHERE showid = ? AND season = ? AND status = ?",
                [show.tvdbid, season, WANTED],
            )

        for sqlEp in sqlResults:
            for show_name in set(show_name_helpers.allPossibleShowNames(show)):
                if show.air_by_date:
                    ep_string = (
                        sanitizeSceneName(show_name)
                        + " "
                        + str(datetime.date.fromordinal(sqlEp["airdate"])).replace("-", ".")
                    )
                    search_string.append(ep_string)
                else:
                    ep_string = sanitizeSceneName(show_name) + " S%02d" % sqlEp["season"]
                    search_string.append(ep_string)

        return search_string
开发者ID:normtown,项目名称:SickRage,代码行数:34,代码来源:btdigg.py


示例5: _get_episode_search_strings

    def _get_episode_search_strings(self, ep_obj,french=None):
    
        params = {}
        
        global lang
        
        if not ep_obj:
            return [params]

        params['show_name'] = helpers.sanitizeSceneName(ep_obj.show.name).replace('.',' ').encode('utf-8')
        
        if ep_obj.show.air_by_date:
            params['date'] = str(ep_obj.airdate)
        else:
            params['season'] = ep_obj.season
            params['episode'] = ep_obj.episode

        to_return = [params]

        # add new query strings for exceptions
        name_exceptions = scene_exceptions.get_scene_exceptions(ep_obj.show.tvdbid)
        for name_exception in name_exceptions:
            # don't add duplicates
            if name_exception != ep_obj.show.name:
                # only change show name
                cur_return = params.copy()
                cur_return['show_name'] = helpers.sanitizeSceneName(name_exception)
                to_return.append(cur_return)

        logger.log(u"KAT _get_episode_search_strings for %s is returning %s" % (repr(ep_obj), repr(params)), logger.DEBUG)
        if french:
            lang='fr'
        else:
            lang = ep_obj.show.audio_lang
        return to_return
开发者ID:Guilde,项目名称:Sick-Beard,代码行数:35,代码来源:kat.py


示例6: _get_episode_search_strings

    def _get_episode_search_strings(self, ep_obj, add_string=""):
        if not ep_obj:
            return []

        search_strings = []
        for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
            if self.show.air_by_date:
                ep_string = sanitizeSceneName(show_name) + " " + str(ep_obj.airdate).replace("-", "|")
            elif self.show.sports:
                ep_string = (
                    sanitizeSceneName(show_name)
                    + " "
                    + str(ep_obj.airdate).replace("-", "|")
                    + "|"
                    + ep_obj.airdate.strftime("%b")
                )
            elif self.show.anime:
                ep_string = sanitizeSceneName(show_name) + " " + "%i" % int(ep_obj.scene_absolute_number)
            else:
                ep_string = (
                    sanitizeSceneName(show_name)
                    + " "
                    + sickbeard.config.naming_ep_type[2]
                    % {"seasonnumber": ep_obj.scene_season, "episodenumber": ep_obj.scene_episode}
                )
            if add_string:
                ep_string += " %s" % add_string

            search_strings.append(ep_string)

        return [search_strings]
开发者ID:OneDegreeOffCenter,项目名称:SickRage,代码行数:31,代码来源:hdtorrents.py


示例7: _get_episode_search_strings

    def _get_episode_search_strings(self, show, season, episode, add_string=''):

        search_string = {'Episode': []}

        if not episode:
            return []

        if show.air_by_date:
            for show_name in set(show_name_helpers.allPossibleShowNames(show)):
                ep_string = sanitizeSceneName(show_name) + ' ' + \
                            str(episode).replace('-', '|') + '|' + \
                            episode.strftime('%b')
                search_string['Episode'].append(ep_string)
        elif show.sports:
            for show_name in set(show_name_helpers.allPossibleShowNames(show)):
                ep_string = sanitizeSceneName(show_name) + ' ' + \
                            str(episode).replace('-', '|') + '|' + \
                            episode.strftime('%b')
                search_string['Episode'].append(ep_string)
        else:
            for show_name in set(show_name_helpers.allPossibleShowNames(show)):
                ep_string = show_name_helpers.sanitizeSceneName(show_name) + ' ' + \
                            sickbeard.config.naming_ep_type[2] % {'seasonnumber': season,
                                                                  'episodenumber': episode}

                search_string['Episode'].append(re.sub('\s+', ' ', ep_string))

        return [search_string]
开发者ID:Wizkidje,项目名称:SickBeard-TVRage,代码行数:28,代码来源:scc.py


示例8: _get_episode_search_strings

    def _get_episode_search_strings(self, ep_obj, add_string=""):

        search_string = {"Episode": []}

        if not ep_obj:
            return []

        if self.show.air_by_date:
            for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
                ep_string = sanitizeSceneName(show_name) + " " + str(ep_obj.airdate).replace("-", "|")
                search_string["Episode"].append(ep_string)
        elif self.show.sports:
            for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
                ep_string = (
                    sanitizeSceneName(show_name)
                    + " "
                    + str(ep_obj.airdate).replace("-", "|")
                    + "|"
                    + ep_obj.airdate.strftime("%b")
                )
                search_string["Episode"].append(ep_string)
        else:
            for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
                ep_string = (
                    show_name_helpers.sanitizeSceneName(show_name)
                    + " "
                    + sickbeard.config.naming_ep_type[2]
                    % {"seasonnumber": ep_obj.scene_season, "episodenumber": ep_obj.scene_episode}
                )

                search_string["Episode"].append(re.sub("\s+", " ", ep_string))

        return [search_string]
开发者ID:JMnITup,项目名称:SickRage,代码行数:33,代码来源:torrentday.py


示例9: _get_episode_search_strings

    def _get_episode_search_strings(self, ep_obj, add_string=''):

        search_string = {'Episode': []}

        if not ep_obj:
            return []

        if self.show.air_by_date:
            for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
                ep_string = sanitizeSceneName(show_name) + '.' + \
                            str(ep_obj.airdate).replace('-', '|')
                search_string['Episode'].append(ep_string)
        elif self.show.sports:
            for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
                ep_string = sanitizeSceneName(show_name) + '.' + \
                            str(ep_obj.airdate).replace('-', '|') + '|' + \
                            ep_obj.airdate.strftime('%b')
                search_string['Episode'].append(ep_string)
        elif self.show.anime:
            for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
                ep_string = sanitizeSceneName(show_name) + '.' + \
                            "%i" % int(ep_obj.scene_absolute_number)
                search_string['Episode'].append(ep_string)
        else:
            for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
                ep_string = show_name_helpers.sanitizeSceneName(show_name) + '.' + \
                            sickbeard.config.naming_ep_type[2] % {'seasonnumber': ep_obj.scene_season,
                                                                  'episodenumber': ep_obj.scene_episode} + ' %s' % add_string

                search_string['Episode'].append(re.sub('\s+', '.', ep_string))

        return [search_string]
开发者ID:Hellowlol,项目名称:SickRage,代码行数:32,代码来源:t411.py


示例10: _get_episode_search_strings

    def _get_episode_search_strings(self, ep_obj, french=None):
        showNames = show_name_helpers.allPossibleShowNames(ep_obj.show)
        for show_name in showNames:
            ep_obj.show.sname=show_name
            params = {}

            if not ep_obj:
                return [params]
        
        # search directly by tvrage id
            if ep_obj.show.tvrid:
                params['rid'] = ep_obj.show.tvrid
                if ep_obj.show.audio_lang=="fr" or french:
                    params['q'] = "french"
                else:
                    params['q'] = helpers.sanitizeSceneName(ep_obj.show.sname)
        # if we can't then fall back on a very basic name search
            else:
                if ep_obj.show.audio_lang=="fr" or french:
                    params['q'] = helpers.sanitizeSceneName(ep_obj.show.sname) + " french"
                else:
                    params['q'] = helpers.sanitizeSceneName(ep_obj.show.sname)

            if ep_obj.show.air_by_date:
                date_str = str(ep_obj.airdate)

                params['season'] = date_str.partition('-')[0]
                params['ep'] = date_str.partition('-')[2].replace('-', '/')
                
            else:
                params['season'] = ep_obj.scene_season
                params['ep'] = ep_obj.scene_episode

                to_return = [params]

        # only do exceptions if we are searching by name
            if 'q' in params:

            # add new query strings for exceptions
                name_exceptions = scene_exceptions.get_scene_exceptions(ep_obj.show.tvdbid)
                for cur_exception in name_exceptions:

                # don't add duplicates
                    if cur_exception == ep_obj.show.sname:
                        continue

                    cur_return = params.copy()
                    cur_return['q'] = helpers.sanitizeSceneName(cur_exception)
                    to_return.append(cur_return)

        return to_return
开发者ID:WuzUrDaddy,项目名称:SickBeardVF,代码行数:51,代码来源:newznab.py


示例11: _get_episode_search_strings

    def _get_episode_search_strings(self, ep_obj, add_string=''):

        if not ep_obj:
            return [{}]

        search_params = {'category': 'Episode'}

        if self.show.indexer == 1:
            search_params['tvdb'] = self.show.indexerid
        elif self.show.indexer == 2:
            search_params['tvrage'] = self.show.indexerid
        else:
            search_params['series'] = sanitizeSceneName(self.show.name)

        if self.show.air_by_date:
            date_str = str(ep_obj.airdate)

            # BTN uses dots in dates, we just search for the date since that
            # combined with the series identifier should result in just one episode
            search_params['name'] = date_str.replace('-', '.')
        elif self.show.sports:
            date_str = str(ep_obj.airdate)

            # BTN uses dots in dates, we just search for the date since that
            # combined with the series identifier should result in just one episode
            search_params['name'] = ep_obj.airdate.strftime('%b')
        elif self.show.anime:
            search_params['name'] = "%i" % int(ep_obj.scene_absolute_number)
        else:
            # Do a general name search for the episode, formatted like SXXEYY
            search_params['name'] = "S%02dE%02d" % (ep_obj.scene_season, ep_obj.scene_episode)

        to_return = [search_params]

        # only do scene exceptions if we are searching by name
        if 'series' in search_params:

            # add new query string for every exception
            name_exceptions = scene_exceptions.get_scene_exceptions(self.show.indexerid)
            for cur_exception in name_exceptions:

                # don't add duplicates
                if cur_exception == self.show.name:
                    continue

                # copy all other parameters before setting the show name for this exception
                cur_return = search_params.copy()
                cur_return['series'] = sanitizeSceneName(cur_exception)
                to_return.append(cur_return)

        return to_return
开发者ID:constantlee,项目名称:SickRage,代码行数:51,代码来源:btn.py


示例12: _get_episode_search_strings

    def _get_episode_search_strings(self, show, season, episode, add_string=""):

        if not episode:
            return [{}]

        search_params = {"category": "Episode"}

        if show.indexer == 1:
            search_params["tvdb"] = show.indexerid
        elif show.indexer == 2:
            search_params["tvrage"] = show.indexerid
        else:
            search_params["series"] = sanitizeSceneName(show.name)

        if show.air_by_date:
            date_str = str(episode)

            # BTN uses dots in dates, we just search for the date since that
            # combined with the series identifier should result in just one episode
            search_params["name"] = date_str.replace("-", ".")
        if show.sports:
            date_str = str(episode)

            # BTN uses dots in dates, we just search for the date since that
            # combined with the series identifier should result in just one episode
            search_params["name"] = date_str.replace("-", ".")
        else:
            # Do a general name search for the episode, formatted like SXXEYY
            search_params["name"] = "S%02dE%02d" % (season, episode)

        to_return = [search_params]

        # only do scene exceptions if we are searching by name
        if "series" in search_params:

            # add new query string for every exception
            name_exceptions = scene_exceptions.get_scene_exceptions(show.indexerid)
            for cur_exception in name_exceptions:

                # don't add duplicates
                if cur_exception == show.name:
                    continue

                # copy all other parameters before setting the show name for this exception
                cur_return = search_params.copy()
                cur_return["series"] = sanitizeSceneName(cur_exception)
                to_return.append(cur_return)

        return to_return
开发者ID:Wizkidje,项目名称:SickBeard-TVRage,代码行数:49,代码来源:btn.py


示例13: _get_episode_search_strings

    def _get_episode_search_strings(self, ep_obj, add_string=""):

        if not ep_obj:
            return [{}]

        to_return = []
        search_params = {"category": "Episode"}

        # episode
        if ep_obj.show.air_by_date or ep_obj.show.sports:
            date_str = str(ep_obj.airdate)

            # BTN uses dots in dates, we just search for the date since that
            # combined with the series identifier should result in just one episode
            search_params["name"] = date_str.replace("-", ".")
        elif ep_obj.show.anime:
            search_params["name"] = "%i" % int(ep_obj.scene_absolute_number)
        else:
            # Do a general name search for the episode, formatted like SXXEYY
            search_params["name"] = "S%02dE%02d" % (ep_obj.scene_season, ep_obj.scene_episode)

        # search
        if ep_obj.show.indexer == 1:
            search_params["tvdb"] = ep_obj.show.indexerid
            to_return.append(search_params)
        else:
            # add new query string for every exception
            name_exceptions = list(
                set(scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name])
            )
            for cur_exception in name_exceptions:
                search_params["series"] = sanitizeSceneName(cur_exception)
                to_return.append(search_params)

        return to_return
开发者ID:feld,项目名称:SickRage,代码行数:35,代码来源:btn.py


示例14: _get_season_search_strings

    def _get_season_search_strings(self, ep_obj):

        to_return = []

        # add new query strings for exceptions
        name_exceptions = scene_exceptions.get_scene_exceptions(self.show.indexerid) + [self.show.name]
        for cur_exception in name_exceptions:

            cur_params = {}

            # search
            cur_params['q'] = helpers.sanitizeSceneName(cur_exception)

            # season
            if not (ep_obj.show.air_by_date or ep_obj.show.sports):
                cur_params['season'] = str(ep_obj.scene_season)

            to_return.append(cur_params)

        cur_params = {}
        if ep_obj.show.air_by_date or ep_obj.show.sports:
            cur_params['season'] = self._get_episode_search_strings(ep_obj)[0]['season']

        #cur_params['episode'] = self._get_episode_search_strings(ep_obj)[0]['ep']

        to_return.append(cur_params)

        return to_return
开发者ID:Weiry,项目名称:SickRage,代码行数:28,代码来源:newznab.py


示例15: _get_episode_search_strings

    def _get_episode_search_strings(self, ep_obj, add_string=''):
        to_return = []
        params = {}

        if not ep_obj:
            return [params]

        if ep_obj.show.air_by_date or ep_obj.show.sports:
            date_str = str(ep_obj.airdate)
            params['season'] = date_str.partition('-')[0]
            params['ep'] = date_str.partition('-')[2].replace('-', '/')
        elif ep_obj.show.anime:
            params['ep'] = "%i" % int(ep_obj.scene_absolute_number)
        else:
            params['season'] = ep_obj.scene_season
            params['ep'] = ep_obj.scene_episode

        # search
        rid = helpers.mapIndexersToShow(ep_obj.show)[2]
        if rid:
            cur_return = params.copy()
            cur_return['rid'] = rid
            to_return.append(cur_return)

        # add new query strings for exceptions
        name_exceptions = list(
            set(scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name]))
        for cur_exception in name_exceptions:
            params['q'] = helpers.sanitizeSceneName(cur_exception)
            to_return.append(params)

        return to_return
开发者ID:kob04,项目名称:SickRage,代码行数:32,代码来源:newznab.py


示例16: get_scene_exception_by_name

def get_scene_exception_by_name(show_name):
    """
    Given a show name, return the tvdbid of the exception, None if no exception
    is present.
    """

    myDB = db.DBConnection("cache.db")

    # try the obvious case first
    exception_result = myDB.select(u"SELECT tvdb_id FROM scene_exceptions WHERE LOWER(show_name) = ?", [show_name.lower()])
    if exception_result:
        return int(exception_result[0]["tvdb_id"])

    all_exception_results = myDB.select(u"SELECT show_name, tvdb_id FROM scene_exceptions")
    for cur_exception in all_exception_results:

        cur_exception_name = cur_exception["show_name"]
        cur_tvdb_id = int(cur_exception["tvdb_id"])

        if show_name.lower() in (cur_exception_name.lower(), helpers.sanitizeSceneName(cur_exception_name).lower().replace('.', ' ')):
            logger.log(u"Scene exception lookup got tvdb id "+str(cur_tvdb_id)+u", using that", logger.DEBUG)
            return cur_tvdb_id
        
    
    # if we get to here, try custom_exceptions instead
    return get_custom_exception_by_name(show_name)
开发者ID:AbhieSpeaks,项目名称:Sick-Beard,代码行数:26,代码来源:scene_exceptions.py


示例17: _get_season_search_strings

    def _get_season_search_strings(self, ep_obj):

        to_return = []
        cur_params = {}
        cur_params['Langcat']=ep_obj.show.audio_lang
        # season
        if ep_obj.show.air_by_date or ep_obj.show.sports:
            date_str = str(ep_obj.airdate).split('-')[0]
            cur_params['season'] = date_str
            cur_params['q'] = date_str.replace('-', '.')
        elif ep_obj.show.is_anime:
            cur_params['season'] = "%d" % ep_obj.scene_absolute_number
        else:
            cur_params['season'] = str(ep_obj.scene_season)

        # search
        rid = helpers.mapIndexersToShow(ep_obj.show)[2]
        if rid:
            cur_return = cur_params.copy()
            cur_return['rid'] = rid
            to_return.append(cur_return)

        # add new query strings for exceptions
        name_exceptions = list(
            set(scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name]))
        for cur_exception in name_exceptions:
            if 'q' in cur_params:
                cur_params['q'] = helpers.sanitizeSceneName(cur_exception) + '.' + cur_params['q']
            to_return.append(cur_params)

        return to_return
开发者ID:WuzUrDaddy,项目名称:SickRageVF,代码行数:31,代码来源:newznab.py


示例18: _get_season_search_strings

    def _get_season_search_strings(self, ep_obj):
        """
        Makes objects to pass to _doSearch for manual and backlog season pack searching
        Returns a list containing dicts of search parameters
        """
        to_return = []
        params = {}
        if not ep_obj:
            return to_return

        params['maxage'] = (datetime.datetime.now() - datetime.datetime.combine(ep_obj.airdate, datetime.datetime.min.time())).days + 1
        params['tvdbid'] = ep_obj.show.indexerid

        if ep_obj.show.air_by_date or ep_obj.show.sports:
            date_str = str(ep_obj.airdate).split('-')[0]
            params['season'] = date_str
            params['q'] = date_str.replace('-', '.')
        else:
            params['season'] = str(ep_obj.scene_season)

        save_q = ' ' + params['q'] if 'q' in params else ''

        name_exceptions = list(set([ep_obj.show.name] + scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid)))
        for cur_exception in name_exceptions:
            params['q'] = helpers.sanitizeSceneName(cur_exception) + save_q
            to_return.append(dict(params))

        return to_return
开发者ID:feld,项目名称:SickRage,代码行数:28,代码来源:newznab.py


示例19: _get_episode_search_strings

    def _get_episode_search_strings(self, ep_obj, add_string=''):
        to_return = []
        params = {}
        if not ep_obj:
            return to_return

        params['maxage'] = (datetime.datetime.now() - datetime.datetime.combine(ep_obj.airdate, datetime.datetime.min.time())).days + 1
        params['tvdbid'] = ep_obj.show.indexerid

        if ep_obj.show.air_by_date or ep_obj.show.sports:
            date_str = str(ep_obj.airdate)
            params['season'] = date_str.partition('-')[0]
            params['ep'] = date_str.partition('-')[2].replace('-', '/')
        else:
            params['season'] = ep_obj.scene_season
            params['ep'] = ep_obj.scene_episode

        # add new query strings for exceptions
        name_exceptions = list(
            set([ep_obj.show.name] + scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid)))
        for cur_exception in name_exceptions:
            params['q'] = helpers.sanitizeSceneName(cur_exception)
            if add_string:
                params['q'] += ' ' + add_string

            to_return.append(dict(params))

        return to_return
开发者ID:repmeer,项目名称:SickRage,代码行数:28,代码来源:newznab.py


示例20: _get_season_search_strings

    def _get_season_search_strings(self, ep_obj):
        search_params = []
        current_params = {'category': 'Season'}

        # Search for entire seasons: no need to do special things for air by date or sports shows
        if ep_obj.show.air_by_date or ep_obj.show.sports:
            # Search for the year of the air by date show
            current_params['name'] = str(ep_obj.airdate).split('-')[0]
        elif ep_obj.show.is_anime:
            current_params['name'] = "%d" % ep_obj.scene_absolute_number
        else:
            current_params['name'] = 'Season ' + str(ep_obj.scene_season)

        # search
        if ep_obj.show.indexer == 1:
            current_params['tvdb'] = ep_obj.show.indexerid
            search_params.append(current_params)
        elif ep_obj.show.indexer == 2:
            current_params['tvrage'] = ep_obj.show.indexerid
            search_params.append(current_params)
        else:
            name_exceptions = list(
                set(scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name]))
            for name in name_exceptions:
                # Search by name if we don't have tvdb or tvrage id
                current_params['series'] = sanitizeSceneName(name)
                search_params.append(current_params)

        return search_params
开发者ID:brusilva,项目名称:SickRage,代码行数:29,代码来源:btn.py



注:本文中的sickbeard.helpers.sanitizeSceneName函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python helpers.searchDBForShow函数代码示例发布时间:2022-05-27
下一篇:
Python helpers.sanitizeFileName函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap