Пример #1
0
    def _getTVRageInfo(self, season=None, episode=None, full=False):

        url = "http://services.tvrage.com/tools/quickinfo.php?"

        if full or self.show.tvrid == 0:
            # for some reason, the previous code here forced the use of the tvrage slug
            # rather than the tvrage_id when 'full' was True.  I expect there was a
            # reason for this, so best to do the same.
            if self.show.tvrname != "" and self.show.tvrname != None:
                showName = self.show.tvrname
            else:
                showName = self.show.name
            urlData = {'show': showName.encode('utf-8')}

            if not full:  # as per above, only use tvtumbler if not 'full'
                tvtumb = tvtumbler.show_info(self.show.tvdbid)
                if tvtumb and 'tvrage_id' in tvtumb and tvtumb['tvrage_id']:
                    urlData = {'sid': tvtumb['tvrage_id']}

        # if we don't need full info and we have a tvrage id, use it
        else:
            urlData = {'sid': self.show.tvrid}

        if season != None and episode != None:
            urlData['ep'] = str(season) + 'x' + str(episode)

        # build the URL
        url += urllib.urlencode(urlData)

        logger.log(u"Loading TVRage info from URL: " + url, logger.DEBUG)
        result = helpers.getURL(url)

        if result is None:
            raise exceptions.TVRageException("urlopen call to " + url +
                                             " failed")
        else:
            result = result.decode('utf-8')

        urlData = result.splitlines()

        info = {}

        for x in urlData:
            if x.startswith("No Show Results Were Found"):
                logger.log(x.encode('utf-8'), logger.WARNING)
                return info
            key, value = x.split("@")
            key = key.replace('<pre>', '')
            info[key] = value.strip()

        # save it for later in case somebody is curious
        if info.has_key('Show ID'):
            self._tvrid = info['Show ID']

        if info.has_key('Show Name'):
            self._tvrname = info['Show Name']

        return info
Пример #2
0
    def _getTVRageInfo(self, season=None, episode=None, full=False):

        url = "http://services.tvrage.com/tools/quickinfo.php?"

        if full or self.show.tvrid == 0:
            # for some reason, the previous code here forced the use of the tvrage slug
            # rather than the tvrage_id when 'full' was True.  I expect there was a
            # reason for this, so best to do the same.
            if self.show.tvrname != "" and self.show.tvrname != None:
                showName = self.show.tvrname
            else:
                showName = self.show.name
            urlData = {'show': showName.encode('utf-8')}

            if not full:  # as per above, only use tvtumbler if not 'full'
                tvtumb = tvtumbler.show_info(self.show.tvdbid)
                if tvtumb and 'tvrage_id' in tvtumb and tvtumb['tvrage_id']:
                    urlData = {'sid': tvtumb['tvrage_id']}

        # if we don't need full info and we have a tvrage id, use it
        else:
            urlData = {'sid': self.show.tvrid}

        if season != None and episode != None:
            urlData['ep'] = str(season)+'x'+str(episode)

        # build the URL
        url += urllib.urlencode(urlData)

        logger.log(u"Loading TVRage info from URL: " + url, logger.DEBUG)
        result = helpers.getURL(url)

        if result is None:
            raise exceptions.TVRageException("urlopen call to " + url + " failed")
        else:
            result = result.decode('utf-8')

        urlData = result.splitlines()

        info = {}

        for x in urlData:
            if x.startswith("No Show Results Were Found"):
                logger.log(x.encode('utf-8'), logger.WARNING)
                return info
            key, value = x.split("@")
            key = key.replace('<pre>','')
            info[key] = value.strip()

        # save it for later in case somebody is curious
        if info.has_key('Show ID'):
            self._tvrid = info['Show ID']

        if info.has_key('Show Name'):
            self._tvrname = info['Show Name']

        return info
Пример #3
0
 def _get_showrss_id(cls, tvdb_id):
     tvt_info = tvtumbler.show_info(tvdb_id)
     if tvt_info and 'showrss_id' in tvt_info:
         return tvt_info['showrss_id']
     else:
         return None
Пример #4
0
 def _get_showrss_id(cls, tvdb_id):
     tvt_info = tvtumbler.show_info(tvdb_id)
     if tvt_info and 'showrss_id' in tvt_info:
         return tvt_info['showrss_id']
     else:
         return None