예제 #1
0
 def movie(self, imdb, title, localtitle, aliases, year):
     try:
         url = self.__search(imdb, [localtitle] + source_utils.aliases_to_array(aliases), year)
         if not url and title != localtitle: url = self.__search(imdb,
                                                                 [title] + source_utils.aliases_to_array(aliases),
                                                                 year)
         return url
     except:
         return
예제 #2
0
 def tvshow(self, imdb, tvdb, tvshowtitle, localtvshowtitle, aliases, year):
     try:
         url = self.__search([localtvshowtitle] +
                             source_utils.aliases_to_array(aliases), year)
         if not url and tvshowtitle != localtvshowtitle:
             url = self.__search([tvshowtitle] +
                                 source_utils.aliases_to_array(aliases),
                                 year)
         return url
     except:
         return
예제 #3
0
    def episode(self, url, imdb, tvdb, title, premiered, season, episode):
        try:
            if not url:
                return

            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])

            url = self.__search(
                [data['tvshowtitle']] +
                source_utils.aliases_to_array(eval(data['aliases'])),
                data['year'], season)
            if not url: return

            r = client.request(urlparse.urljoin(self.base_link, url))

            r = dom_parser.parse_dom(r, 'div', attrs={'class': 'ep_link'})
            r = dom_parser.parse_dom(r, 'a', req='href')
            r = [(i.attrs['href'], i.content) for i in r if i]
            r = [(i[0], re.findall("^(?:episode)\s*(\d+)$", i[1], re.I))
                 for i in r]
            r = [(i[0], i[1][0] if i[1] else '0') for i in r]
            r = [i[0] for i in r if int(i[1]) == int(episode)][0]

            return source_utils.strip_domain(r)
        except:
            return
예제 #4
0
    def tvshow(self, imdb, tvdb, tvshowtitle, localtvshowtitle, aliases, year):
        try:
            t = [tvshowtitle] + source_utils.aliases_to_array(aliases)
            t = [cleantitle.get(i) for i in set(t) if i]

            url = [
                i[0] for i in cache.get(self.sezonlukdizi_tvcache, 120)
                if cleantitle.get(i[1]) in t
            ][0]

            return source_utils.strip_domain(url)
        except:
            return
예제 #5
0
    def tvshow(self, imdb, tvdb, tvshowtitle, localtvshowtitle, aliases, year):
        try:
            query = self.search_link % urllib.quote_plus(cleantitle.query(tvshowtitle))
            result = client.request(query)
            # tvshowtitle = cleantitle.get(tvshowtitle)
            t = [tvshowtitle] + source_utils.aliases_to_array(aliases)
            t = [cleantitle.get(i) for i in set(t) if i]
            result = re.compile('itemprop="url"\s+href="([^"]+).*?itemprop="name"\s+class="serie-title">([^<]+)',
                                re.DOTALL).findall(result)
            for i in result:
                if cleantitle.get(cleantitle.normalize(i[1])) in t and year in i[1]: url = i[0]

            url = url.encode('utf-8')
            return url
        except:
            return
예제 #6
0
    def episode(self, url, imdb, tvdb, title, premiered, season, episode):
        try:

            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data])
            tvshowtitle = data['tvshowtitle']
            aliases = source_utils.aliases_to_array(eval(data['aliases']))
            # maybe ignore the year because they use wrong dates on seasons
            url = self.__search([tvshowtitle] + aliases, data['year'], season)

            # if url == None: raise Exception()
            if not url: return

            url = url.replace('episode=0', 'episode=%01d' % int(episode))
            url = urlparse.urljoin(self.base_link, url)
            url = url.encode('utf-8')
            return url

        except:
            return
예제 #7
0
 def movie(self, imdb, title, localtitle, aliases, year):
     try:
         return self.__search([title] + source_utils.aliases_to_array(aliases), year)
     except:
         return