예제 #1
0
파일: interfaces.py 프로젝트: bialagary/mw
    def __init__(self):
        import os

        if not self.img:
            self.img = common.get_themed_icon(self.name + ".png")
        if not self.fanart:
            self.fanart = common.get_themed_icon(self.name + "_art.png")
    def GetSection(self, indexer, section, url, type, list, page='', total_pages='', sort_by='', sort_order=''): 
        url_type = ''
        #added filters
        url_filter = ''
        url_filter_less = ''
        url_filter_rated = ''
        url_filter_small = ''

        if indexer == common.indxr_Movies:
            url_type = 'title_type=feature,tv_movie&'

            #added filters movies.
            #request: add some of the values as user settings variables.
            #moviemeter_default_movies = 50000
            #num_votes_default_movies = 3000
            #num_votes_small_collection_movies = 200
            #num_votes_rated_movies = 25000

            url_filter = 'has=technical&moviemeter=,50000&num_votes=3000,&production_status=released&'
            url_filter_less = 'has=technical&moviemeter=,200000&num_votes=1000,&production_status=released&'
            url_filter_small = 'has=technical&moviemeter=,200000&num_votes=200,&production_status=released&'
            url_filter_rated = 'has=technical&moviemeter=,50000&num_votes=25000,&production_status=released&'

        elif indexer == common.indxr_TV_Shows:
            url_type = 'title_type=tv_series,mini_series&'

            #num_votes_default_tv_shows = 1500
            #num_votes_small_collection_tv_shows = 200
            #num_votes_rated_tv_shows = 25000

            #added filters tv shows.
            url_filter = 'has=technical&moviemeter=,50000&num_votes=1500,&'
            url_filter_less = 'has=technical&moviemeter=,200000&num_votes=500,&'
            url_filter_small = 'has=technical&moviemeter=,200000&num_votes=200,&'
            url_filter_rated = 'has=technical&moviemeter=,50000&num_votes=25000,&'

        elif indexer == common.indxr_Lists:
            url_type = ''#title_type=feature,tv_movie,tv_series,mini_series&'

        if section == 'main':
            user_number = self.Settings().get_setting('imdb_user_number')
            
            if user_number:
                list_url_type = ''#title_type=feature,tv_movie,tv_series,mini_series&'
                if self.Settings().get_setting('watch_list_main')=='true':
                    self.AddSection(list, indexer, 'watchlist', 'Watchlist', self.get_url()+'user/' + user_number + '/watchlist?' + list_url_type + 'view=detail', indexer)

                from entertainment.net import Net
                net = Net(cached=False)
                import re

                named_lists_url = self.get_url()+'user/' + user_number + '/lists?tab=public'
                named_lists = net.http_GET(named_lists_url).content
               
                match = re.compile('<div class="list_name"><b><a.+?href="(.+?)".+?>(.+?)</a>.+?\n.+?div class="list_meta">(.+?)</div>').findall(named_lists)
                for url, name ,TYPE in match:
                    custom_name='%s List' % name   
                    url=str(url).replace('/list','list')
                    if 'people' in TYPE:
                        custom_url=self.get_url() + str(url)  +'?view=grid&sort=listorian:asc'             
                        self.AddSection(list, indexer, 'watchlist_people', '%s' % custom_name, custom_url, indexer, hlevel=1)
                    else:
                        custom_url=self.get_url() + str(url) + '?' + list_url_type + 'view=detail'
                        self.AddSection(list, indexer, 'watchlist', '%s' % custom_name, custom_url, indexer, hlevel=1) 
                            
            #seperated movies and tv shows.
            #added filters to commands for movies.
            if indexer == common.indxr_Movies:
                #self.AddSection(list, indexer, 'a_z', 'A-Z')
                
                self.AddSection(list, indexer, 'moviemeter', 'Most Popular', self.get_url()+'search/title?' + url_filter + url_type, indexer, img=common.get_themed_icon('imdb_pop.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'genres', 'Genres', img=common.get_themed_icon('imdb_genres.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'boxoffice_gross_us', 'Box Office', self.get_url()+'search/title?' + url_filter + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_box.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'year', 'Box Office By Year', img=common.get_themed_icon('imdb_year.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'decade', 'Box Office By Decade', img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'user_rating', 'Highly Rated', self.get_url()+'search/title?' + url_filter_rated + url_type + 'sort=user_rating,desc', indexer, img=common.get_themed_icon('imdb_high.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'top_250', 'IMDb Top 250', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=top_250&sort=user_rating,desc', indexer, img=common.get_themed_icon('imdb_250.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'num_votes', 'Most Voted', self.get_url()+'search/title?' + url_filter + url_type + 'sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_vote.png'), fanart=common.get_themed_fanart('imdb.jpg'))

                self.AddSection(list, indexer, 'kids', 'Kids Zone', self.get_url()+'search/title?' + url_filter_small + 'certificates=us:g&genres=family&' + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_kids.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'now-playing-us', 'Now Playing', self.get_url()+'search/title?' + url_filter_less + url_type + 'groups=now-playing-us&sort=release_date_us,desc', indexer, img=common.get_themed_icon('imdb_play.png'), fanart=common.get_themed_fanart('imdb.jpg'))

                #added list of companies and award list
                self.AddSection(list, indexer, 'company', 'Company Lists', img=common.get_themed_icon('imdb_comp.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'award_lists', 'Award Lists', img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'search_celeb', 'Celebrity Search', self.get_url()+'find?q=', indexer, img=common.get_themed_icon('imdb_cel.png'), fanart=common.get_themed_fanart('imdb.jpg'))

            #added filters to commands for tv shows.
            elif indexer == common.indxr_TV_Shows:
                #self.AddSection(list, indexer, 'a_z', 'A-Z')
                self.AddSection(list, indexer, 'moviemeter', 'Most Popular', self.get_url()+'search/title?' + url_filter + url_type, indexer, img=common.get_themed_icon('imdb_pop.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'genres', 'Genres', img=common.get_themed_icon('imdb_genres.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'num_votes', 'Most Voted', self.get_url()+'search/title?' + url_filter + url_type + 'sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_vote.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'year', 'Most Voted By Year', img=common.get_themed_icon('imdb_year.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'decade', 'Most Voted By Decade', img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'user_rating', 'Highly Rated', self.get_url()+'search/title?' + url_filter_rated + url_type + 'sort=user_rating,desc', indexer, img=common.get_themed_icon('imdb_high.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'award_lists', 'Award Lists', img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'search_celeb', 'Celebrity Search', self.get_url()+'find?q=', indexer, img=common.get_themed_icon('imdb_cel.png'), fanart=common.get_themed_fanart('imdb.jpg'))
              
                
        elif section == 'genres':
            
            import re
            
            from entertainment.net import Net
            net = Net()
            
            genre_url = self.get_url()         
            genre_re = ''
            
            genre_url = genre_url + 'genre/'

            #genre different for movies and tv shows.
            if indexer == common.indxr_Movies:
                genre_re = '(?s)<h2>On Amazon Prime Instant Video.+?<table(.+?)</table>'
            elif indexer == common.indxr_TV_Shows:
                genre_re = '(?s)<h2>Television.+?<table(.+?)</table>'

            content = net.http_GET(genre_url).content
            
            genres = re.search(genre_re, content)
            if genres:
                genres = genres.group(1)
                for genre in re.finditer('<a href=".+?">(.+?)</a>', genres):                    
                    genre_title = genre.group(1)
                    genre_section = genre_title.lower()

                    #added filter for movies and tv shows
                    #solved - sign problem in url
                    #request: some of the genres are empty, empty genres shouldn't be visible, by example game-show for movies.
                    genre_section = genre_section.replace("-", "_")

                    if indexer == common.indxr_TV_Shows and genre_section == 'sitcom':
                        genre_section = 'comedy&keywords=sitcom'
                    if indexer == common.indxr_Movies and genre_section == 'documentary':
                        url_type2 = 'title_type=documentary&'
                        genre_url = self.get_url() +'search/title?' + url_filter_less + url_type2 + 'genres=' + genre_section + '&sort=boxoffice_gross_us,desc'
                    elif indexer == common.indxr_Movies:
                        genre_url = self.get_url() +'search/title?' + url_filter_less + url_type + 'genres=' + genre_section + '&sort=boxoffice_gross_us,desc'
                    elif indexer == common.indxr_TV_Shows:
                        genre_url = self.get_url() +'search/title?' + url_filter_less + url_type + 'genres=' + genre_section + '&sort=num_votes,desc'

                    self.AddSection(list, indexer, genre_section, genre_title, genre_url, indexer, img=common.get_themed_icon('genres.png'))

        #not working a-z.
        elif section == 'a_z':
            self.AddSection(list, indexer, '123', '#123', self.get_url()+'?' + url_type + 'letter=123', indexer)
            A2Z=[chr(i) for i in xrange(ord('A'), ord('Z')+1)]
            for letter in A2Z:
                self.AddSection(list, indexer, letter.lower(), letter, self.get_url()+'?' + url_type + 'letter=' + letter.lower(), indexer)                
        elif section == 'year':
            start = 1900
            import datetime
            end   = datetime.datetime.today().year
            year = []
            for yr in range(end, start-1, -1):
                str_year = str(yr)
                #added filter for movies and tv shows
                #changed to one line, removed sort method moviemeter, sort method is default moviemeter, but the user can also sort on rated, alphabet.

                if indexer == common.indxr_Movies:
                    self.AddSection(list, indexer, str_year, str_year, self.get_url()+'search/title?' + url_filter_less + 'year=' + str_year+','+str_year + '&' + url_type + 'sort=boxoffice_gross_us,desc', indexer)
                elif indexer == common.indxr_TV_Shows:
                    self.AddSection(list, indexer, str_year, str_year, self.get_url()+'search/title?' + url_filter_less + 'year=' + str_year+','+str_year + '&' + url_type + 'sort=num_votes,desc', indexer)

        #added decade lists.
        #the sort order can be changed by all of the lists.
        elif section == 'decade':
                if indexer == common.indxr_Movies:
                    self.AddSection(list, indexer, '2010s', '2010-2016', self.get_url()+'search/title?' +'release_date=2010,2016&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '2000s', '2000-2009', self.get_url()+'search/title?' +'release_date=2000,2009&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1990s', '1990-1999', self.get_url()+'search/title?' +'release_date=1990,1999&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1980s', '1980-1989', self.get_url()+'search/title?' +'release_date=1980,1989&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1970s', '1970-1979', self.get_url()+'search/title?' +'release_date=1970,1979&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1960s', '1960-1969', self.get_url()+'search/title?' +'release_date=1960,1969&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1950s', '1950-1959', self.get_url()+'search/title?' +'release_date=1950,1959&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1940s', '1940-1949', self.get_url()+'search/title?' +'release_date=1940,1949&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1930s', '1930-1939', self.get_url()+'search/title?' +'release_date=1930,1939&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1920s', '1920-1929', self.get_url()+'search/title?' +'release_date=1920,1929&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1910s', '1910-1919', self.get_url()+'search/title?' +'release_date=1910,1919&' + url_filter_small + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))

                elif indexer == common.indxr_TV_Shows:
                    self.AddSection(list, indexer, '2010s', '2010-2016', self.get_url()+'search/title?' +'release_date=2010,2016&' + url_filter_less + url_type + 'sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '2000s', '2000-2009', self.get_url()+'search/title?' +'release_date=2000,2009&' + url_filter_less + url_type + 'sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1990s', '1990-1999', self.get_url()+'search/title?' +'release_date=1990,1999&' + url_filter_less + url_type + 'sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1980s', '1980-1989', self.get_url()+'search/title?' +'release_date=1980,1989&' + url_filter_less + url_type + 'sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1970s', '1970-1979', self.get_url()+'search/title?' +'release_date=1970,1979&' + url_filter_less + url_type + 'sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1960s', '1960-1969', self.get_url()+'search/title?' +'release_date=1960,1969&' + url_filter_less + url_type + 'sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1950s', '1949-1959', self.get_url()+'search/title?' +'release_date=1949,1959&' + url_filter_less + url_type + 'sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))

        #added companies lists.
        #the sort order can be changed by all of the lists.
        elif section == 'company':
                if indexer == common.indxr_Movies:
                    self.AddSection(list, indexer, 'fox', '20th Century Fox', self.get_url()+'search/title?' + url_filter_small + 'companies=fox&' + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_comp.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'dreamworks', 'DreamWorks', self.get_url()+'search/title?' + url_filter_small + 'companies=dreamworks&' + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_comp.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'mgm', 'MGM', self.get_url()+'search/title?' + url_filter_small + 'companies=mgm&' + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_comp.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'paramount', 'Paramount', self.get_url()+'search/title?' + url_filter_small + 'companies=paramount&' + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_comp.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'columbia', 'Sony', self.get_url()+'search/title?' + url_filter_small + 'companies=columbia&' + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_comp.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'universal', 'Universal', self.get_url()+'search/title?' + url_filter_small + 'companies=universal&' + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_comp.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'disney', 'Walt Disney', self.get_url()+'search/title?' + url_filter_small + 'companies=disney&' + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_comp.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'warner', 'Warner Bros.', self.get_url()+'search/title?' + url_filter_small + 'companies=warner&' + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_comp.png'), fanart=common.get_themed_fanart('imdb.jpg'))

        #added additional lists.
        #the sort order can be changed by most of the lists.
        #not all lists need filters.
        elif section == 'award_lists':
                if indexer == common.indxr_Movies:
                    #changed name to Best Picture-Winning, so I could add oscar winners list.
                    self.AddSection(list, indexer, 'oscar_best_picture_winners', 'Best Picture-Winning', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=oscar_best_picture_winners&sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'oscar_winners', 'Oscar-Winning', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=oscar_winners&sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'oscar_nominees', 'Oscar-Nominated', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=oscar_nominees&sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'golden_globe_winners', 'Golden Globe-Winning', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=golden_globe_winners&sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'golden_g lobe_nominees', 'Golden Globe-Nominated', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=golden_globe_nominees&sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))

                elif indexer == common.indxr_TV_Shows:
                    self.AddSection(list, indexer, 'emmy_winners', 'Emmy Award-Winning', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=emmy_winners&sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'emmy_nominees', 'Emmy Award-Nominated', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=emmy_nominees&sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'golden_globe_winners', 'Golden Globe-Winning', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=golden_globe_winners&sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'golden_globe_nominees', 'Golden Globe-Nominated', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=golden_globe_nominees&sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))

        else:
             self.ExtractContentAndAddtoList(indexer, section, url, type, list, page, total_pages, sort_by, sort_order)
class IMDb(MovieIndexer, TVShowIndexer, CustomSettings, ListIndexer):
    implements = [MovieIndexer, TVShowIndexer, CustomSettings, ListIndexer]

    name = "IMDb"
    display_name = "IMDb"
    
    
    img = common.get_themed_icon('imdb.png')
    fanart = common.get_themed_fanart('imdb.jpg')
    
    default_indexer_enabled = 'true'
    
    def __init__(self):
        xml = '<settings>\n'
        xml += '<category label="IMDb SETTINGS">\n'
        xml += '<setting id="en_us" type="bool" label="Show English Language Only" default="true" />\n'        
        xml += '<setting id="get_url()" label="Base Url" type="labelenum" default="http://www.imdb.com/" values="http://www.imdb.com/|http://akas.imdb.com/" />\n'
        xml += '<setting id="imdb_user_number" label="User Number" type="text" default="" />\n'
        xml += '<setting id="future" type="bool" label="Show Future Episodes" default="false" />\n'
        xml += '<setting id="watch_list_main" type="bool" label="Show Main Watchlist" default="true" />\n'
        xml += '</category>\n' 
        xml += '</settings>\n'
        
        self.CreateSettings(self.name, self.display_name, xml)


    def get_url(self):
        url = self.Settings().get_setting('get_url()')
        if '//imdb' in url:
            url=url.replace('//','//www.')
        return url
    
    def ExtractContentAndAddtoList(self, indexer, section, url, type, list, page='', total_pages='', sort_by='', sort_order=''): 
        
        import urllib

            
       
        if section != 'search':
            url = urllib.unquote_plus(url)
            
            
            
        if section == 'search_celeb':
            import xbmc
            search_entered = ''
            keyboard = xbmc.Keyboard(search_entered, '[COLOR blue]i[/COLOR]Stream')
            keyboard.doModal()
            if keyboard.isConfirmed():
                search_entered = keyboard.getText()
            if search_entered=='':return    
            url = urllib.unquote_plus(url)+search_entered.replace(' ','+')
            
        
        import re
        
        new_url = url
        
         
        if not new_url.startswith(self.get_url()):
            new_url = re.sub("http\://.*?/", self.get_url(), url)

        if page == '':
            page = '1'

        #change page length to 100.
        page_item_count = (100 if section == 'watchlist' else 50)

        start = str( ( (int(page) - 1) * page_item_count ) + 1 )
        count = str(page_item_count)
        if section != 'watchlist_people':
            if not '?' in new_url:
                new_url = new_url + '?start=' + start + '&count=' + count
            else:
                new_url = new_url + '&start=' + start + '&count=' + count    

        if sort_by == '' and 'sort' not in new_url:
            sort_by = 'moviemeter'
        if sort_order == '' and 'sort' not in new_url:
            sort_order = 'asc'
        
        if 'sort' not in new_url:
            new_url = new_url + '&sort=' + ('title' if section == 'watchlist' and sort_by == 'alpha' else sort_by) + (':' if section == 'watchlist' else ',') + sort_order

            #print 'new_url ' + new_url

        if sort_by == '' and 'sort=user_rating,desc' in new_url:
            sort_by = 'user_rating'
            sort_order = 'desc'
            url = url.replace("sort=user_rating,desc", "")
        elif sort_by == '' and 'sort=num_votes,desc' in new_url:
            sort_by = 'num_votes'
            sort_order = 'desc'
            url = url.replace("sort=num_votes,desc", "")
        elif sort_by == '' and 'sort=boxoffice_gross_us,desc' in new_url:
            sort_by = 'boxoffice_gross_us'
            sort_order = 'desc'
            url = url.replace("sort=boxoffice_gross_us,desc", "")
        elif sort_by == '' and 'sort=release_date_us,desc' in new_url:
            sort_by = 'release_date_us'
            sort_order = 'desc'
            url = url.replace("sort=release_date_us,desc", "")
        elif sort_by == '' and 'sort=year,desc' in new_url:
            sort_by = 'year'
            sort_order = 'desc'
            url = url.replace("sort=year,desc", "")

        from entertainment.net import Net
        cached = False if section == 'watchlist' else True
        net = Net(cached=cached)
        
        if self.Settings().get_setting('en_us')=='true':
            
            content = net.http_GET(new_url,{'Accept-Language':'en-US'}).content
        else:
            content = net.http_GET(new_url).content
            
        if total_pages == '':

            #page problem watchlist solved.
            #re_page =  '<span>\(.+? of ([0-9,]+)' if section == 'watchlist' else '(?s)<div id="left">.+? of ([0-9,]+)'
            if section == 'watchlist':
                if not 'watchlist?' in new_url:
                    re_page = '<span>\(.+? of ([0-9,]+)'
                else:
                    re_page = 'of ([0-9,]+) titles'

            else:
                re_page = 'of ([0-9,]+) titles'

            total_pages = re.search(re_page, content)
            if total_pages:
                total_count = total_pages.group(1)
                total_count = int ( total_count.replace(',', '') )
                total_pages = str( total_count / page_item_count + ( 1 if total_count % page_item_count > 0 else 0 ) )
            else:
                if re.search('0 items found', content):
                    page = '0'
                    total_pages = '0'
                else:
                    page = '1'
                    total_pages = '1'

        self.AddInfo(list, indexer, section, url, type, page, total_pages, sort_by, sort_order)

        
        if section == 'search_celeb':
            
            match=re.compile('<img src="(.+?)" /></a> </td> <td class="result_text"> <a href="(.+?)" >(.+?)<.+?<small>\((.+?),').findall(content)
            for img,url , name , gender in match:
                img=img.split(',')[0]
                if 'Actress' in gender or 'Actor' in gender:
                    self.AddSection(list, indexer, 'celeb_result', name+' (%s)'%gender, self.get_url()+url, indexer,img=img.replace('SX32','SX280'))


        if section == 'watchlist_people':
            
            match=re.compile('<a href="/(.+?)"><img src="(.+?)".+?alt="(.+?)">').findall(content)

            for url ,img, name in match:
                img=img.split(',')[0]
                self.AddSection(list, indexer, 'celeb_result', name, self.get_url()+url, indexer,img=img.replace('SX140','SX280'))

                    
                    
        mode = common.mode_File_Hosts
        if type == 'tv_shows':
            mode = common.mode_Content
            type = 'tv_seasons'
        
        item_re = r'<a href="/title/(.+?)/.+?"\n> <img alt="(.+?)"'
        if section == 'theaters':
            item_re = r'<h4 itemprop="name"><a href="/title/(.+?)/.+?title="(.+?)"'

        if section == 'watchlist':

            if not 'watchlist?' in new_url:
                item_re = r'(?s)<b><a.+?href="/title/(.+?)/".+?>(.+?)</a>.+?<span class="year_type">(.+?)<.+?<div class="(.+?)"'
            else:
                item_re= r'\{"href":"/title/([^"]+?)","year":\["(.+?)"\],"title":"([^"]+?)"\}'
                
                
        if section=='celeb_result':
            
            match=re.compile('<div class="filmo-row .+?" id=".+?">.+?span class="year_column">.+?nbsp;(.+?)</span>.+?<b><a href="/title/(.+?)/.+?>(.+?)</a>(.+?)<br/>',re.DOTALL).findall(content)
            for year , tt , title, id_type in match:

                if 'TV Series' in id_type:
                    type = 'tv_seasons'
                    mode = common.mode_Content
                    indexer = common.indxr_TV_Shows

                else:
                    type = common.indxr_Movies 
                    mode = common.mode_File_Hosts
                    indexer = common.indxr_Movies
                item_title = common.addon.unescape(title)
                item_url = self.get_url()+'title/'+tt+'/'
                year=year.strip()
                if '-' in year:
                    year=year.split('-')[0]
    
                self.AddContent(list, indexer, mode, item_title.strip(), '', type, url=item_url, name=item_title.strip(), year=year, imdb_id=tt)
        else:   
            for item in re.finditer(item_re, content):


                item_v_id = item.group(1)
                item_title = common.addon.unescape( item.group(3) if section == 'watchlist' and 'watchlist?' in new_url else item.group(2))

                item_type = item_title
                if section =='watchlist':
                    if not 'watchlist?' in new_url:
                        item_type = item.group(3)
                    else:
                        if '",' in item.group(2):
                            item_type = "(" + item.group(2).split('",')[0]+' ' + ")"
                        else:
                            item_type = "(" + item.group(2) + ")"
                
                item_type =item_type.replace(' Video)',')').replace(' Short Film)','')
                item_year = re.search("\(([0-9]+)", item_type)
                
                if item_year:
                    item_year = item_year.group(1)
                else:
                    r='>%s</a>\n    <span class=".+?">\((.+?)\)<'%item_title.replace('?','\?')
                    item_year=re.search(r, content)
                    item_year = re.search("([0-9]+)", item_year.group(1))
                    if item_year:
                        item_year = item_year.group(1)
                    else:
                        item_year=''
                    

                item_name = item_title if section == 'watchlist' else re.sub(" \([0-9]+.+?\)", "", item_title )
                
                item_title = item_name.strip()
                if item_year != '':
                    item_title = item_title + ' (' + item_year.replace('-','') + ')'
                
                item_url = self.get_url()+'title/'+item_v_id+'/'
               
                if total_pages == '':
                    total_pages = '1'
                
                if section == 'watchlist':                
                    if 'movie' in item_type.lower() or re.sub("[0-9]+", "", item_type) == "()":
                        type = common.indxr_Movies 
                        mode = common.mode_File_Hosts
                        indexer = common.indxr_Movies                     
                    elif 'series' in item_type.lower() or ' ' in item_type:
                        type = 'tv_seasons'
                        mode = common.mode_Content
                        indexer = common.indxr_TV_Shows 
                    else:
                        type = common.indxr_Movies 
                        mode = common.mode_File_Hosts
                        indexer = common.indxr_Movies
                
                self.AddContent(list, indexer, mode, item_title.strip(), '', type, url=item_url, name=item_name.strip(), year=item_year, imdb_id=item_v_id)
            
    def get_formated_date(self, date_str):
        
        import re
        import datetime
        item_air_date = common.unescape(date_str).replace('      ', '')
        item_fmtd_air_date = ""
        if 'Jan' in item_air_date: item_fmtd_air_date = '01-'
        elif 'Feb' in item_air_date: item_fmtd_air_date = '02-'
        elif 'Mar' in item_air_date: item_fmtd_air_date = '03-'
        elif 'Apr' in item_air_date: item_fmtd_air_date = '04-'
        elif 'May' in item_air_date: item_fmtd_air_date = '05-'
        elif 'Jun' in item_air_date: item_fmtd_air_date = '06-'
        elif 'Jul' in item_air_date: item_fmtd_air_date = '07-'
        elif 'Aug' in item_air_date: item_fmtd_air_date = '08-'
        elif 'Sep' in item_air_date: item_fmtd_air_date = '09-'
        elif 'Oct' in item_air_date: item_fmtd_air_date = '10-'
        elif 'Nov' in item_air_date: item_fmtd_air_date = '11-'
        elif 'Dec' in item_air_date: item_fmtd_air_date = '12-'
        else: item_fmtd_air_date = '12-'
        date=item_air_date.split('.')[0]

        date = re.search('([0-9]{1,2})', date)

        if date: 
            date = date.group(1)
            item_fmtd_air_date += "%02d-" % int(date)
        else:
            item_fmtd_air_date += "01-"
        year = re.search('([0-9]{4})', item_air_date)
        if year: 
            year = year.group(1)
            item_fmtd_air_date += year
        else:
            item_fmtd_air_date += "0001"
            
        try:
            item_fmtd_air_date = datetime.datetime.strptime(item_fmtd_air_date, "%m-%d-%Y")
        except TypeError:
            import time
            item_fmtd_air_date = datetime.datetime(*(time.strptime(item_fmtd_air_date, "%m-%d-%Y")[0:6]))
 
        return item_fmtd_air_date

    def GetContent(self, indexer, url, title, name, year, season, episode, type, list):      
        import urllib
        url = urllib.unquote_plus(url)
        title = urllib.unquote_plus(title)
        name = urllib.unquote_plus(name)
        
        import re
        
        new_url = url
        if not new_url.startswith(self.get_url()):
            new_url = re.sub("http\://.*?/", self.get_url(), url)
        
        from entertainment.net import Net
        net = Net(cached=False)
        print new_url
        print '########################################'
        content = net.http_GET(new_url).content
        
        import datetime
        todays_date = datetime.date.today()
        
        if type == 'tv_seasons':
            check_season = 0
            last_season = 0
            season_url = None
            seasons = re.search('<a href="/(title/.+?/episodes\?season=)([0-9]+)', content)
            if seasons:
                last_season = int(seasons.group(2))
                season_url = seasons.group(1)
            
            for season_num in xrange(last_season, 0, -1):
                item_v_id = str(season_num)
                item_url = self.get_url() + season_url + item_v_id
                
                if check_season < 2:
                    check_season += 1
                    item_content = net.http_GET(item_url).content
                    season_item = re.search('<div>S' + item_v_id +', Ep([0-9]+)</div>', item_content)
                    if not season_item: 
                        check_season -= 1
                        continue          
                    item_item = re.search('(?s)<div class="list_item.+?href="(.+?)".+?title="(.+?)".+?<div>S' + item_v_id +', Ep([0-9]+)</div>.+?<div class="airdate">(.+?)</div>', item_content)
                    if 'unknown' in item_item.group(4).lower(): continue 
                    item_fmtd_air_date = self.get_formated_date( item_item.group(4) )

                    if item_fmtd_air_date.date() > todays_date or item_fmtd_air_date.date() == '0001-12-01': continue
                
                
                item_title = 'Season ' + item_v_id
                
                item_id = common.CreateIdFromString(title + ' ' + item_title)
                
                self.AddContent(list, indexer, common.mode_Content, item_title.strip(), item_id, 'tv_episodes', url=item_url, name=name.strip(), year=year, season=item_v_id)
            
            
        elif type == 'tv_episodes':
            season_item = re.search('<div>S' + season +', Ep([0-9]+)</div>', content)
            if not season_item: 
                return

            for item in re.finditer('(?s)<div class="list_item.+?href="(.+?)".+?title="(.+?)".+?<div>S' + season +', Ep([0-9]+)</div>.+?<div class="airdate">(.+?)</div>', content):
                item_fmtd_air_date = self.get_formated_date( item.group(4) )

                if self.Settings().get_setting('future')=='false':
                    if item_fmtd_air_date.date() > todays_date: break
                
                item_url = self.get_url() + item.group(1)
                item_v_id = item.group(3)
                item_title = item.group(2).strip()
                if item_title == None:
                    item_title = ''
                
                item_id = common.CreateIdFromString(name + '_' + year + '_season_' + season + '_episode_' + item_v_id)
                
                self.AddContent(list, indexer, common.mode_File_Hosts, item_title.strip(), item_id, type, url=item_url, name=name.strip(), year=year, season=season, episode=item_v_id)
        
    def GetSection(self, indexer, section, url, type, list, page='', total_pages='', sort_by='', sort_order=''): 
        url_type = ''
        #added filters
        url_filter = ''
        url_filter_less = ''
        url_filter_rated = ''
        url_filter_small = ''

        if indexer == common.indxr_Movies:
            url_type = 'title_type=feature,tv_movie&'

            #added filters movies.
            #request: add some of the values as user settings variables.
            #moviemeter_default_movies = 50000
            #num_votes_default_movies = 3000
            #num_votes_small_collection_movies = 200
            #num_votes_rated_movies = 25000

            url_filter = 'has=technical&moviemeter=,50000&num_votes=3000,&production_status=released&'
            url_filter_less = 'has=technical&moviemeter=,200000&num_votes=1000,&production_status=released&'
            url_filter_small = 'has=technical&moviemeter=,200000&num_votes=200,&production_status=released&'
            url_filter_rated = 'has=technical&moviemeter=,50000&num_votes=25000,&production_status=released&'

        elif indexer == common.indxr_TV_Shows:
            url_type = 'title_type=tv_series,mini_series&'

            #num_votes_default_tv_shows = 1500
            #num_votes_small_collection_tv_shows = 200
            #num_votes_rated_tv_shows = 25000

            #added filters tv shows.
            url_filter = 'has=technical&moviemeter=,50000&num_votes=1500,&'
            url_filter_less = 'has=technical&moviemeter=,200000&num_votes=500,&'
            url_filter_small = 'has=technical&moviemeter=,200000&num_votes=200,&'
            url_filter_rated = 'has=technical&moviemeter=,50000&num_votes=25000,&'

        elif indexer == common.indxr_Lists:
            url_type = ''#title_type=feature,tv_movie,tv_series,mini_series&'

        if section == 'main':
            user_number = self.Settings().get_setting('imdb_user_number')
            
            if user_number:
                list_url_type = ''#title_type=feature,tv_movie,tv_series,mini_series&'
                if self.Settings().get_setting('watch_list_main')=='true':
                    self.AddSection(list, indexer, 'watchlist', 'Watchlist', self.get_url()+'user/' + user_number + '/watchlist?' + list_url_type + 'view=detail', indexer)

                from entertainment.net import Net
                net = Net(cached=False)
                import re

                named_lists_url = self.get_url()+'user/' + user_number + '/lists?tab=public'
                named_lists = net.http_GET(named_lists_url).content
               
                match = re.compile('<div class="list_name"><b><a.+?href="(.+?)".+?>(.+?)</a>.+?\n.+?div class="list_meta">(.+?)</div>').findall(named_lists)
                for url, name ,TYPE in match:
                    custom_name='%s List' % name   
                    url=str(url).replace('/list','list')
                    if 'people' in TYPE:
                        custom_url=self.get_url() + str(url)  +'?view=grid&sort=listorian:asc'             
                        self.AddSection(list, indexer, 'watchlist_people', '%s' % custom_name, custom_url, indexer, hlevel=1)
                    else:
                        custom_url=self.get_url() + str(url) + '?' + list_url_type + 'view=detail'
                        self.AddSection(list, indexer, 'watchlist', '%s' % custom_name, custom_url, indexer, hlevel=1) 
                            
            #seperated movies and tv shows.
            #added filters to commands for movies.
            if indexer == common.indxr_Movies:
                #self.AddSection(list, indexer, 'a_z', 'A-Z')
                
                self.AddSection(list, indexer, 'moviemeter', 'Most Popular', self.get_url()+'search/title?' + url_filter + url_type, indexer, img=common.get_themed_icon('imdb_pop.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'genres', 'Genres', img=common.get_themed_icon('imdb_genres.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'boxoffice_gross_us', 'Box Office', self.get_url()+'search/title?' + url_filter + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_box.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'year', 'Box Office By Year', img=common.get_themed_icon('imdb_year.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'decade', 'Box Office By Decade', img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'user_rating', 'Highly Rated', self.get_url()+'search/title?' + url_filter_rated + url_type + 'sort=user_rating,desc', indexer, img=common.get_themed_icon('imdb_high.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'top_250', 'IMDb Top 250', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=top_250&sort=user_rating,desc', indexer, img=common.get_themed_icon('imdb_250.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'num_votes', 'Most Voted', self.get_url()+'search/title?' + url_filter + url_type + 'sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_vote.png'), fanart=common.get_themed_fanart('imdb.jpg'))

                self.AddSection(list, indexer, 'kids', 'Kids Zone', self.get_url()+'search/title?' + url_filter_small + 'certificates=us:g&genres=family&' + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_kids.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'now-playing-us', 'Now Playing', self.get_url()+'search/title?' + url_filter_less + url_type + 'groups=now-playing-us&sort=release_date_us,desc', indexer, img=common.get_themed_icon('imdb_play.png'), fanart=common.get_themed_fanart('imdb.jpg'))

                #added list of companies and award list
                self.AddSection(list, indexer, 'company', 'Company Lists', img=common.get_themed_icon('imdb_comp.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'award_lists', 'Award Lists', img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'search_celeb', 'Celebrity Search', self.get_url()+'find?q=', indexer, img=common.get_themed_icon('imdb_cel.png'), fanart=common.get_themed_fanart('imdb.jpg'))

            #added filters to commands for tv shows.
            elif indexer == common.indxr_TV_Shows:
                #self.AddSection(list, indexer, 'a_z', 'A-Z')
                self.AddSection(list, indexer, 'moviemeter', 'Most Popular', self.get_url()+'search/title?' + url_filter + url_type, indexer, img=common.get_themed_icon('imdb_pop.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'genres', 'Genres', img=common.get_themed_icon('imdb_genres.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'num_votes', 'Most Voted', self.get_url()+'search/title?' + url_filter + url_type + 'sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_vote.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'year', 'Most Voted By Year', img=common.get_themed_icon('imdb_year.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'decade', 'Most Voted By Decade', img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'user_rating', 'Highly Rated', self.get_url()+'search/title?' + url_filter_rated + url_type + 'sort=user_rating,desc', indexer, img=common.get_themed_icon('imdb_high.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'award_lists', 'Award Lists', img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                self.AddSection(list, indexer, 'search_celeb', 'Celebrity Search', self.get_url()+'find?q=', indexer, img=common.get_themed_icon('imdb_cel.png'), fanart=common.get_themed_fanart('imdb.jpg'))
              
                
        elif section == 'genres':
            
            import re
            
            from entertainment.net import Net
            net = Net()
            
            genre_url = self.get_url()         
            genre_re = ''
            
            genre_url = genre_url + 'genre/'

            #genre different for movies and tv shows.
            if indexer == common.indxr_Movies:
                genre_re = '(?s)<h2>On Amazon Prime Instant Video.+?<table(.+?)</table>'
            elif indexer == common.indxr_TV_Shows:
                genre_re = '(?s)<h2>Television.+?<table(.+?)</table>'

            content = net.http_GET(genre_url).content
            
            genres = re.search(genre_re, content)
            if genres:
                genres = genres.group(1)
                for genre in re.finditer('<a href=".+?">(.+?)</a>', genres):                    
                    genre_title = genre.group(1)
                    genre_section = genre_title.lower()

                    #added filter for movies and tv shows
                    #solved - sign problem in url
                    #request: some of the genres are empty, empty genres shouldn't be visible, by example game-show for movies.
                    genre_section = genre_section.replace("-", "_")

                    if indexer == common.indxr_TV_Shows and genre_section == 'sitcom':
                        genre_section = 'comedy&keywords=sitcom'
                    if indexer == common.indxr_Movies and genre_section == 'documentary':
                        url_type2 = 'title_type=documentary&'
                        genre_url = self.get_url() +'search/title?' + url_filter_less + url_type2 + 'genres=' + genre_section + '&sort=boxoffice_gross_us,desc'
                    elif indexer == common.indxr_Movies:
                        genre_url = self.get_url() +'search/title?' + url_filter_less + url_type + 'genres=' + genre_section + '&sort=boxoffice_gross_us,desc'
                    elif indexer == common.indxr_TV_Shows:
                        genre_url = self.get_url() +'search/title?' + url_filter_less + url_type + 'genres=' + genre_section + '&sort=num_votes,desc'

                    self.AddSection(list, indexer, genre_section, genre_title, genre_url, indexer, img=common.get_themed_icon('genres.png'))

        #not working a-z.
        elif section == 'a_z':
            self.AddSection(list, indexer, '123', '#123', self.get_url()+'?' + url_type + 'letter=123', indexer)
            A2Z=[chr(i) for i in xrange(ord('A'), ord('Z')+1)]
            for letter in A2Z:
                self.AddSection(list, indexer, letter.lower(), letter, self.get_url()+'?' + url_type + 'letter=' + letter.lower(), indexer)                
        elif section == 'year':
            start = 1900
            import datetime
            end   = datetime.datetime.today().year
            year = []
            for yr in range(end, start-1, -1):
                str_year = str(yr)
                #added filter for movies and tv shows
                #changed to one line, removed sort method moviemeter, sort method is default moviemeter, but the user can also sort on rated, alphabet.

                if indexer == common.indxr_Movies:
                    self.AddSection(list, indexer, str_year, str_year, self.get_url()+'search/title?' + url_filter_less + 'year=' + str_year+','+str_year + '&' + url_type + 'sort=boxoffice_gross_us,desc', indexer)
                elif indexer == common.indxr_TV_Shows:
                    self.AddSection(list, indexer, str_year, str_year, self.get_url()+'search/title?' + url_filter_less + 'year=' + str_year+','+str_year + '&' + url_type + 'sort=num_votes,desc', indexer)

        #added decade lists.
        #the sort order can be changed by all of the lists.
        elif section == 'decade':
                if indexer == common.indxr_Movies:
                    self.AddSection(list, indexer, '2010s', '2010-2016', self.get_url()+'search/title?' +'release_date=2010,2016&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '2000s', '2000-2009', self.get_url()+'search/title?' +'release_date=2000,2009&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1990s', '1990-1999', self.get_url()+'search/title?' +'release_date=1990,1999&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1980s', '1980-1989', self.get_url()+'search/title?' +'release_date=1980,1989&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1970s', '1970-1979', self.get_url()+'search/title?' +'release_date=1970,1979&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1960s', '1960-1969', self.get_url()+'search/title?' +'release_date=1960,1969&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1950s', '1950-1959', self.get_url()+'search/title?' +'release_date=1950,1959&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1940s', '1940-1949', self.get_url()+'search/title?' +'release_date=1940,1949&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1930s', '1930-1939', self.get_url()+'search/title?' +'release_date=1930,1939&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1920s', '1920-1929', self.get_url()+'search/title?' +'release_date=1920,1929&' + url_filter_less + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1910s', '1910-1919', self.get_url()+'search/title?' +'release_date=1910,1919&' + url_filter_small + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))

                elif indexer == common.indxr_TV_Shows:
                    self.AddSection(list, indexer, '2010s', '2010-2016', self.get_url()+'search/title?' +'release_date=2010,2016&' + url_filter_less + url_type + 'sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '2000s', '2000-2009', self.get_url()+'search/title?' +'release_date=2000,2009&' + url_filter_less + url_type + 'sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1990s', '1990-1999', self.get_url()+'search/title?' +'release_date=1990,1999&' + url_filter_less + url_type + 'sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1980s', '1980-1989', self.get_url()+'search/title?' +'release_date=1980,1989&' + url_filter_less + url_type + 'sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1970s', '1970-1979', self.get_url()+'search/title?' +'release_date=1970,1979&' + url_filter_less + url_type + 'sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1960s', '1960-1969', self.get_url()+'search/title?' +'release_date=1960,1969&' + url_filter_less + url_type + 'sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, '1950s', '1949-1959', self.get_url()+'search/title?' +'release_date=1949,1959&' + url_filter_less + url_type + 'sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_dec.png'), fanart=common.get_themed_fanart('imdb.jpg'))

        #added companies lists.
        #the sort order can be changed by all of the lists.
        elif section == 'company':
                if indexer == common.indxr_Movies:
                    self.AddSection(list, indexer, 'fox', '20th Century Fox', self.get_url()+'search/title?' + url_filter_small + 'companies=fox&' + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_comp.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'dreamworks', 'DreamWorks', self.get_url()+'search/title?' + url_filter_small + 'companies=dreamworks&' + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_comp.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'mgm', 'MGM', self.get_url()+'search/title?' + url_filter_small + 'companies=mgm&' + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_comp.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'paramount', 'Paramount', self.get_url()+'search/title?' + url_filter_small + 'companies=paramount&' + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_comp.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'columbia', 'Sony', self.get_url()+'search/title?' + url_filter_small + 'companies=columbia&' + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_comp.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'universal', 'Universal', self.get_url()+'search/title?' + url_filter_small + 'companies=universal&' + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_comp.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'disney', 'Walt Disney', self.get_url()+'search/title?' + url_filter_small + 'companies=disney&' + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_comp.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'warner', 'Warner Bros.', self.get_url()+'search/title?' + url_filter_small + 'companies=warner&' + url_type + 'sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_comp.png'), fanart=common.get_themed_fanart('imdb.jpg'))

        #added additional lists.
        #the sort order can be changed by most of the lists.
        #not all lists need filters.
        elif section == 'award_lists':
                if indexer == common.indxr_Movies:
                    #changed name to Best Picture-Winning, so I could add oscar winners list.
                    self.AddSection(list, indexer, 'oscar_best_picture_winners', 'Best Picture-Winning', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=oscar_best_picture_winners&sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'oscar_winners', 'Oscar-Winning', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=oscar_winners&sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'oscar_nominees', 'Oscar-Nominated', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=oscar_nominees&sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'golden_globe_winners', 'Golden Globe-Winning', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=golden_globe_winners&sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'golden_g lobe_nominees', 'Golden Globe-Nominated', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=golden_globe_nominees&sort=boxoffice_gross_us,desc', indexer, img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))

                elif indexer == common.indxr_TV_Shows:
                    self.AddSection(list, indexer, 'emmy_winners', 'Emmy Award-Winning', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=emmy_winners&sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'emmy_nominees', 'Emmy Award-Nominated', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=emmy_nominees&sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'golden_globe_winners', 'Golden Globe-Winning', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=golden_globe_winners&sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))
                    self.AddSection(list, indexer, 'golden_globe_nominees', 'Golden Globe-Nominated', self.get_url()+'search/title?' + url_filter_small + url_type + 'groups=golden_globe_nominees&sort=num_votes,desc', indexer, img=common.get_themed_icon('imdb_awa.png'), fanart=common.get_themed_fanart('imdb.jpg'))

        else:
             self.ExtractContentAndAddtoList(indexer, section, url, type, list, page, total_pages, sort_by, sort_order)

    #request: it would be nice when you select user rating that the sort order would change to descending automatic.
    #sorting alphabet is not working 100%.

    def GetSortByOptions(self): 

        from entertainment import odict
        sort_by_dict = odict.odict()
        
        sort_by_dict['alpha'] = 'Alphabet'
        sort_by_dict['user_rating'] = 'Ratings'
        sort_by_dict['boxoffice_gross_us'] = 'US Box Office'
        sort_by_dict['moviemeter'] = 'Views'
        sort_by_dict['num_votes'] = 'Votes'
        sort_by_dict['year'] = 'Year'
        sort_by_dict['release_date_us'] = 'Release Date US'
        
        return sort_by_dict
    
    def GetSortOrderOptions(self): 
        
        from entertainment import odict
        sort_order_dict = odict.odict()
        
        sort_order_dict['asc'] = 'Ascending'
        sort_order_dict['desc'] = 'Descending'
        
        return sort_order_dict
        
    def Search(self, indexer, keywords, type, list, lock, message_queue, page='', total_pages=''): 

        from entertainment.net import Net
        net = Net() 
        
        keywords = self.CleanTextForSearch(keywords) 
        
        keywords_lower = keywords.lower().split(' ')
        match_total = float( len(keywords_lower) )
        
        from entertainment import odict
        search_dict = odict.odict({ 's' : 'tt', 'q' : keywords})
        
        if indexer == common.indxr_Movies:
            search_dict.update({'ttype':'ft'})
        elif indexer == common.indxr_TV_Shows:
            search_dict.update({'ttype':'tv'})
        
        search_dict.sort(key=lambda x: x[0].lower())
                
        import urllib
        search_for_url = self.get_url() + 'find?' + urllib.urlencode(search_dict)
        
        content = net.http_GET(search_for_url).content        
        
        if '<h1 class="findHeader">No results found' in content:            
            return
            
        self.AddInfo(list, indexer, 'search', self.get_url(), type, '1', '1')
      
        
        mode = common.mode_File_Hosts
        if type == 'tv_shows':
            mode = common.mode_Content
            type = 'tv_seasons'
        
        import re
        
        search_results = re.search('(?s)<table class="findList">(.+?)</table>', content)
        
        if search_results:            
            search_results = search_results.group(1)
            
            search_term_not_found_count = 0
            for search_item in re.finditer('<td class="result_text"> <a href="/title/(.+?)/.+?" >(.+?)</a> (.+?) </td>', content):
            
                item_id = search_item.group(1)
                item_url = self.get_url() + 'title/' + item_id
                
                item_name = search_item.group(2).strip()
                item_name_lower = item_name.lower().strip()
                
                match_count = 0
                for kw in keywords_lower:
                    if kw in item_name_lower:
                        match_count = match_count + 1

                match_fraction = ( match_count / match_total )

                if not ( match_fraction >= 0.8  ):

                    aka_item = search_item.group(4)

                    aka_name = re.search('aka <i>"(.+?)"</i>', aka_item)
                    if aka_name:
                        item_name = aka_name.group(1)
                        item_name_lower = item_name.lower()
                        match_count = 0
                        for kw in keywords_lower:
                            if kw in item_name_lower:
                                match_count = match_count + 1
                        match_fraction = ( match_count / match_total )
                        if not ( match_fraction >= 0.8  ):
                            search_term_not_found_count += 1
                            if search_term_not_found_count >= 2:
                                break
                            else:
                                continue
                    else:
                        search_term_not_found_count += 1
                        if search_term_not_found_count >= 2:
                            break
                        else:
                            continue
                
                item_title = item_name.strip()
                item_other_info = search_item.group(3)
                item_year = re.search('\(([0-9]+)\)', item_other_info)
                if item_year:
                    item_year = item_year.group(1)
                    item_title += ' (' + item_year + ')'
                else:
                    item_year = ''
        
        
                if 'movie' in item_other_info.lower():
                    type = common.indxr_Movies 
                    mode = common.mode_File_Hosts
                    indexer = common.indxr_Movies                     
                elif 'series' in item_other_info.lower():
                    type = 'tv_seasons'
                    mode = common.mode_Content
                    indexer = common.indxr_TV_Shows 
                    
                self.AddContent(list, indexer, mode, item_title.strip(), '', type, url=item_url, name=item_name.strip(), year=item_year, imdb_id=item_id)
예제 #4
0
    def GetSection(self,
                   indexer,
                   section,
                   url,
                   type,
                   list,
                   page='',
                   total_pages='',
                   sort_by='',
                   sort_order=''):

        from md_request import open_url

        if section == 'main':

            if indexer == common.indxr_Movies:

                self.AddSection(list,
                                indexer,
                                'featured',
                                'Featured',
                                self.base_url + 'featured/',
                                indexer,
                                img=common.get_themed_icon('m25_feat.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'new-release',
                                'New Releases',
                                self.base_url + 'new-release/',
                                indexer,
                                img=common.get_themed_icon('m25_rel.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'latest-added',
                                'Latest Added',
                                self.base_url + 'latest-added/',
                                indexer,
                                img=common.get_themed_icon('m25_late.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'latest-hd',
                                'Latest HD',
                                self.base_url + 'latest-hd/',
                                indexer,
                                img=common.get_themed_icon('m25_hd.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'latest-ts',
                                'Latest TS',
                                self.base_url + 'latest-ts/',
                                indexer,
                                img=common.get_themed_icon('m25_ts.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'most-popular',
                                'Most Popular',
                                self.base_url + 'most-popular/',
                                indexer,
                                img=common.get_themed_icon('m25_pop.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'popular-today',
                                'Popular Today',
                                self.base_url + 'popular-today/',
                                indexer,
                                img=common.get_themed_icon('m25_pop2day.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'top-rated',
                                'Top Rated',
                                self.base_url + 'top-rated/',
                                indexer,
                                img=common.get_themed_icon('m25_toprate.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'most-voted',
                                'Most Voted',
                                self.base_url + 'most-voted/',
                                indexer,
                                img=common.get_themed_icon('m25_voted.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'az',
                                'A-Z',
                                self.base_url,
                                indexer,
                                img=common.get_themed_icon('m25_a_z.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'genres',
                                'Genres',
                                self.base_url,
                                indexer,
                                img=common.get_themed_icon('m25_genres.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'year',
                                'Release Year',
                                self.base_url,
                                indexer,
                                img=common.get_themed_icon('m25_year.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))

            elif indexer == common.indxr_TV_Shows:

                self.AddSection(list,
                                indexer,
                                'latest-added',
                                'Latest Added',
                                self.base_url + 'tv/latest-added/',
                                indexer,
                                img=common.get_themed_icon('m25_late.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'most-popular',
                                'Most Popular',
                                self.base_url + 'tv/most-popular/',
                                indexer,
                                img=common.get_themed_icon('m25_pop.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'popular-today',
                                'Popular Today',
                                self.base_url + 'tv/popular-today/',
                                indexer,
                                img=common.get_themed_icon('m25_pop2day.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'az',
                                'A-Z',
                                self.base_url + 'tv/',
                                indexer,
                                img=common.get_themed_icon('m25_a_z.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'genres',
                                'Genres',
                                self.base_url + 'tv/',
                                indexer,
                                img=common.get_themed_icon('m25_genres.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))

        elif section == 'az':

            if indexer == common.indxr_Movies:
                az_url = self.base_url
            elif indexer == common.indxr_TV_Shows:
                az_url = self.base_url + 'tv/'

            link = open_url(az_url).content
            get_all = common.md.regex_get_all(link, '>A-Z<', '</ul>')
            all_links = common.md.regex_get_all(str(get_all), '<li>', '</li>')

            for a in all_links:
                name = common.md.regex_from_to(a, 'title="', '"')
                url = common.md.regex_from_to(a, 'href="', '"')

                if url[1] == '/':
                    url = 'http:' + url
                if url[0] == '/':
                    url = url[1:]
                    url = self.base_url + url

                self.AddSection(list,
                                indexer,
                                name.split(' ')[0],
                                name,
                                url,
                                indexer,
                                img=common.get_themed_icon('m25_a_z.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))

        elif section == 'genres':

            if indexer == common.indxr_Movies:
                genres_url = self.base_url
            elif indexer == common.indxr_TV_Shows:
                genres_url = self.base_url + 'tv/'

            link = open_url(genres_url).content
            get_all = common.md.regex_get_all(link, '>Genres<', '</ul>')
            all_links = common.md.regex_get_all(str(get_all), '<li>', '</li>')

            for a in all_links:
                name = common.md.regex_from_to(a, 'title="', '"')
                url = common.md.regex_from_to(a, 'href="', '"')

                if url[1] == '/':
                    url = 'http:' + url
                if url[0] == '/':
                    url = url[1:]
                    url = self.base_url + url

                self.AddSection(list,
                                indexer,
                                name.split(' ')[0],
                                name,
                                url,
                                indexer,
                                img=common.get_themed_icon('m25_genres.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))

        elif section == 'year':

            if indexer == common.indxr_Movies:
                year_url = self.base_url

                link = open_url(year_url).content
                get_all = common.md.regex_get_all(link, '>Release Year<',
                                                  '</ul>')
                all_links = common.md.regex_get_all(str(get_all), '<li>',
                                                    '</li>')

                for a in all_links:
                    name = common.md.regex_from_to(a, 'title="', '"')
                    url = common.md.regex_from_to(a, 'href="', '"')

                    if url[1] == '/':
                        url = 'http:' + url
                    if url[0] == '/':
                        url = url[1:]
                        url = self.base_url + url

                    self.AddSection(list,
                                    indexer,
                                    'year/' + name.split(' ')[0],
                                    name,
                                    url,
                                    indexer,
                                    img=common.get_themed_icon('m25_year.png'),
                                    fanart=common.get_themed_fanart('m25.jpg'))

        else:
            self.ExtractContentAndAddtoList(indexer, section, url, type, list,
                                            page, total_pages, sort_by,
                                            sort_order)
예제 #5
0
class movie25(MovieIndexer, MovieSource, TVShowIndexer, TVShowSource):

    implements = [MovieIndexer, MovieSource, TVShowIndexer, TVShowSource]

    name = "movie25"
    display_name = "Movie25"
    base_url = 'http://5movies.to/'
    img = common.get_themed_icon('m25.png')
    fanart = common.get_themed_fanart('m25.jpg')
    default_indexer_enabled = 'true'
    source_enabled_by_default = 'true'

    def ExtractContentAndAddtoList(self,
                                   indexer,
                                   section,
                                   url,
                                   type,
                                   list,
                                   page='',
                                   total_pages='',
                                   sort_by='',
                                   sort_order=''):

        if page == '':
            page = '1'
        from md_request import open_url
        import re, urllib

        url = urllib.unquote_plus(url)

        new_url = url
        html = open_url(new_url + str(page)).content

        if total_pages == '':
            if type == 'tv_shows':
                lastlist = '/tv/' + section.lower() + '/'
            else:
                lastlist = '/' + section.lower() + '/'
            r = ">Next</a>&nbsp;&nbsp;&nbsp;<a href='%s(.+?)/'>Last</a>" % lastlist
            try:
                total_pages = re.compile(r).findall(html)[0]
            except:
                total_pages = '1'

        self.AddInfo(list, indexer, section, new_url, type, str(page),
                     total_pages)

        mode = common.mode_File_Hosts
        if type == 'tv_shows':
            mode = common.mode_Content
            type = 'tv_seasons'

        if section == 'featured' or 'new-release' or 'latest-added' or 'latest-hd' or 'latest-ts' or 'most-popular' or 'popular-today' or 'top-rated' or 'most-voted' or 'az' or 'genres' or 'year':
            match = re.compile(
                '<div class="ml-img"><a href="(.+?)".+?target="_self".+?title="Watch (.+?) \((.+?)\)',
                re.DOTALL).findall(html.replace(' Online Free', ''))
            for url, name, year in match:
                if url[1] == '/':
                    url = 'http:' + url
                if url[0] == '/':
                    url = url[1:]
                    url = self.base_url + url
                name = self.CleanTextForSearch(name)
                self.AddContent(list,
                                indexer,
                                mode,
                                name + ' (' + year + ')',
                                '',
                                type,
                                url=url,
                                name=name,
                                year=year)

    def GetContent(self, indexer, url, title, name, year, season, episode,
                   type, list):

        from md_request import open_url
        import re, urllib

        url = urllib.unquote_plus(url)

        content = open_url(url).content

        if type == 'tv_seasons':
            for item in re.finditer(
                    "<a data-id='.+?' class='season-toggle' href='(.+?)'.+?>.+? Season ([0-9]+)<",
                    content):
                item_url = item.group(1)
                if item_url[1] == '/':
                    item_url = 'http:' + item_url
                if item_url[0] == '/':
                    item_url = item_url[1:]
                    item_url = self.base_url + item_url

                item_v_id = item.group(2)
                item_title = 'Season ' + item_v_id

                item_id = common.CreateIdFromString(title + ' ' + item_title)

                self.AddContent(list,
                                indexer,
                                common.mode_Content,
                                item_title,
                                item_id,
                                'tv_episodes',
                                url=item_url,
                                name=name,
                                year=year,
                                season=item_v_id)

        elif type == 'tv_episodes':

            for item in re.finditer(
                    "<a href='(.+?)' title=.+?><strong>Episode</strong> ([0-9]+) .+?<",
                    content):
                item_url = item.group(1)
                if item_url[1] == '/':
                    item_url = 'http:' + item_url
                if item_url[0] == '/':
                    item_url = item_url[1:]
                    item_url = self.base_url + item_url
                item_v_id = item.group(2)
                #item_title = item.group(3)
                #if item_title == None:
                item_title = ''

                item_id = common.CreateIdFromString(name + '_' + year +
                                                    '_season_' + season +
                                                    '_episode_' + item_v_id)

                self.AddContent(list,
                                indexer,
                                common.mode_File_Hosts,
                                item_title,
                                item_id,
                                type,
                                url=item_url,
                                name=name,
                                year=year,
                                season=season,
                                episode=item_v_id)

    def GetSection(self,
                   indexer,
                   section,
                   url,
                   type,
                   list,
                   page='',
                   total_pages='',
                   sort_by='',
                   sort_order=''):

        from md_request import open_url

        if section == 'main':

            if indexer == common.indxr_Movies:

                self.AddSection(list,
                                indexer,
                                'featured',
                                'Featured',
                                self.base_url + 'featured/',
                                indexer,
                                img=common.get_themed_icon('m25_feat.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'new-release',
                                'New Releases',
                                self.base_url + 'new-release/',
                                indexer,
                                img=common.get_themed_icon('m25_rel.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'latest-added',
                                'Latest Added',
                                self.base_url + 'latest-added/',
                                indexer,
                                img=common.get_themed_icon('m25_late.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'latest-hd',
                                'Latest HD',
                                self.base_url + 'latest-hd/',
                                indexer,
                                img=common.get_themed_icon('m25_hd.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'latest-ts',
                                'Latest TS',
                                self.base_url + 'latest-ts/',
                                indexer,
                                img=common.get_themed_icon('m25_ts.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'most-popular',
                                'Most Popular',
                                self.base_url + 'most-popular/',
                                indexer,
                                img=common.get_themed_icon('m25_pop.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'popular-today',
                                'Popular Today',
                                self.base_url + 'popular-today/',
                                indexer,
                                img=common.get_themed_icon('m25_pop2day.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'top-rated',
                                'Top Rated',
                                self.base_url + 'top-rated/',
                                indexer,
                                img=common.get_themed_icon('m25_toprate.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'most-voted',
                                'Most Voted',
                                self.base_url + 'most-voted/',
                                indexer,
                                img=common.get_themed_icon('m25_voted.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'az',
                                'A-Z',
                                self.base_url,
                                indexer,
                                img=common.get_themed_icon('m25_a_z.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'genres',
                                'Genres',
                                self.base_url,
                                indexer,
                                img=common.get_themed_icon('m25_genres.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'year',
                                'Release Year',
                                self.base_url,
                                indexer,
                                img=common.get_themed_icon('m25_year.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))

            elif indexer == common.indxr_TV_Shows:

                self.AddSection(list,
                                indexer,
                                'latest-added',
                                'Latest Added',
                                self.base_url + 'tv/latest-added/',
                                indexer,
                                img=common.get_themed_icon('m25_late.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'most-popular',
                                'Most Popular',
                                self.base_url + 'tv/most-popular/',
                                indexer,
                                img=common.get_themed_icon('m25_pop.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'popular-today',
                                'Popular Today',
                                self.base_url + 'tv/popular-today/',
                                indexer,
                                img=common.get_themed_icon('m25_pop2day.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'az',
                                'A-Z',
                                self.base_url + 'tv/',
                                indexer,
                                img=common.get_themed_icon('m25_a_z.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))
                self.AddSection(list,
                                indexer,
                                'genres',
                                'Genres',
                                self.base_url + 'tv/',
                                indexer,
                                img=common.get_themed_icon('m25_genres.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))

        elif section == 'az':

            if indexer == common.indxr_Movies:
                az_url = self.base_url
            elif indexer == common.indxr_TV_Shows:
                az_url = self.base_url + 'tv/'

            link = open_url(az_url).content
            get_all = common.md.regex_get_all(link, '>A-Z<', '</ul>')
            all_links = common.md.regex_get_all(str(get_all), '<li>', '</li>')

            for a in all_links:
                name = common.md.regex_from_to(a, 'title="', '"')
                url = common.md.regex_from_to(a, 'href="', '"')

                if url[1] == '/':
                    url = 'http:' + url
                if url[0] == '/':
                    url = url[1:]
                    url = self.base_url + url

                self.AddSection(list,
                                indexer,
                                name.split(' ')[0],
                                name,
                                url,
                                indexer,
                                img=common.get_themed_icon('m25_a_z.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))

        elif section == 'genres':

            if indexer == common.indxr_Movies:
                genres_url = self.base_url
            elif indexer == common.indxr_TV_Shows:
                genres_url = self.base_url + 'tv/'

            link = open_url(genres_url).content
            get_all = common.md.regex_get_all(link, '>Genres<', '</ul>')
            all_links = common.md.regex_get_all(str(get_all), '<li>', '</li>')

            for a in all_links:
                name = common.md.regex_from_to(a, 'title="', '"')
                url = common.md.regex_from_to(a, 'href="', '"')

                if url[1] == '/':
                    url = 'http:' + url
                if url[0] == '/':
                    url = url[1:]
                    url = self.base_url + url

                self.AddSection(list,
                                indexer,
                                name.split(' ')[0],
                                name,
                                url,
                                indexer,
                                img=common.get_themed_icon('m25_genres.png'),
                                fanart=common.get_themed_fanart('m25.jpg'))

        elif section == 'year':

            if indexer == common.indxr_Movies:
                year_url = self.base_url

                link = open_url(year_url).content
                get_all = common.md.regex_get_all(link, '>Release Year<',
                                                  '</ul>')
                all_links = common.md.regex_get_all(str(get_all), '<li>',
                                                    '</li>')

                for a in all_links:
                    name = common.md.regex_from_to(a, 'title="', '"')
                    url = common.md.regex_from_to(a, 'href="', '"')

                    if url[1] == '/':
                        url = 'http:' + url
                    if url[0] == '/':
                        url = url[1:]
                        url = self.base_url + url

                    self.AddSection(list,
                                    indexer,
                                    'year/' + name.split(' ')[0],
                                    name,
                                    url,
                                    indexer,
                                    img=common.get_themed_icon('m25_year.png'),
                                    fanart=common.get_themed_fanart('m25.jpg'))

        else:
            self.ExtractContentAndAddtoList(indexer, section, url, type, list,
                                            page, total_pages, sort_by,
                                            sort_order)

    def GetFileHosts(self, url, list, lock, message_queue, season, episode,
                     type, year, name):

        from md_request import open_url
        import urlresolver, re

        headers = {
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36'
        }

        if type == 'tv_episodes':
            link = open_url(url, headers=headers).content
            data = re.findall(r"<a href='([^']*)'.*?'><strong>Episode<",
                              str(link), re.I | re.DOTALL)
            for epi in data:
                if 'season-%s-episode-%s' % (season, episode) in epi:
                    url = epi
        else:
            url = url

        if url[1] == '/':
            url = 'http:' + url
        if url[0] == '/':
            url = url[1:]
            url = self.base_url + url

        content = open_url(url, headers=headers, timeout=3).content
        content = content.replace('\r', '').replace('\n', '').replace(
            '\t', '').replace('\b', '')

        try:
            QUALITY = content.split('>Links - Quality')[1]
            RES = QUALITY.split('</h1')[0].strip()
        except:
            RES = 'SD'

        data = re.findall(r'"links">(.*?)</div>', str(content),
                          re.I | re.DOTALL)[0]
        match = re.findall(
            r'"link-name">(.*?)<li.*?class="link-button"><a.*?href="([^"]*)"',
            str(data), re.I | re.DOTALL)
        for host, host_id in match:

            host = host.replace('</li>', '')

            try:

                if '4K' in RES.upper():
                    res = '4K'
                elif '3D' in RES.upper():
                    res = '3D'
                elif '1080' in RES.upper():
                    res = '1080P'
                elif '720' in RES.upper():
                    res = '720P'
                elif 'HD' in RES.upper():
                    res = 'HD'
                elif 'DVD' in RES.upper():
                    res = 'DVD'
                elif 'HDTS' in RES.upper():
                    res = 'TS'
                elif '-TS-' in RES.upper():
                    res = 'TS'
                elif 'TS' in RES.upper():
                    res = 'TS'
                elif 'CAM' in RES.upper():
                    res = 'CAM'
                elif 'HDCAM' in RES.upper():
                    res = 'CAM'
                else:
                    res = 'SD'

                if urlresolver.HostedMediaFile(host=host,
                                               media_id='ABC123XYZ'):
                    self.AddFileHost(list, res, host_id, host.upper())

            except:
                pass

    def GetFileHostsForContent(self, title, name, year, season, episode, type,
                               list, lock, message_queue):

        from md_request import open_url
        import re

        name = self.CleanTextForSearch(name).lower().strip()

        headers = {
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36'
        }

        search = '%ssearch.php?q=%s+%s' % (self.base_url, name.replace(
            ' ', '+'), year)

        link = open_url(search, headers=headers, timeout=3).content
        links = link.split('list">')[1:]

        for p in links:

            try:

                media_url = re.compile('a href="([^"]+)"',
                                       re.DOTALL).findall(p)[0]
                if media_url[1] == '/':
                    media_url = 'http:' + media_url
                if media_url[0] == '/':
                    media_url = media_url[1:]
                    media_url = self.base_url + media_url
                media_title = re.compile('title="([^"]+)"',
                                         re.DOTALL).findall(p)[0]
                if type == 'tv_episodes':
                    if name in self.CleanTextForSearch(media_title.lower()):
                        if year in media_title.lower():
                            self.GetFileHosts(media_url, list, lock,
                                              message_queue, season, episode,
                                              type, year, name)
                else:
                    if name in self.CleanTextForSearch(media_title.lower()):
                        if year in media_title.lower():
                            self.GetFileHosts(media_url, list, lock,
                                              message_queue, season, episode,
                                              type, year, name)

            except:
                pass

    def Resolve(self, url):

        from md_request import open_url
        import re

        headers = {
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36'
        }
        request_url = '%s/getlink.php' % self.base_url
        link_id = url.split('=')
        form_data = {'Action': 'get', link_id[0].replace('?', ''): link_id[1]}
        play_url = open_url(request_url,
                            method='post',
                            data=form_data,
                            headers=headers,
                            timeout=3).text
        if play_url[1] == '/':
            play_url = 'http:' + play_url
        if play_url[0] == '/':
            play_url = play_url[1:]
            play_url = self.base_url + play_url

        from entertainment import duckpool
        play_url = duckpool.ResolveUrl(play_url.strip())
        return play_url
예제 #6
0
    def GetSection(self,
                   indexer,
                   section,
                   url,
                   type,
                   list,
                   page='',
                   total_pages='',
                   sort_by='',
                   sort_order=''):

        from md_request import open_url

        if section == 'main':

            if indexer == common.indxr_Movies:

                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Superhero Movies Ever Made',
                                self.base_url % '315081',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Movies Based on Marvel Comics',
                                self.base_url % '355348',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best PG-13 Teen Movies',
                                self.base_url % '1064127',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best PG-13 Family Movies',
                                self.base_url % '1063791',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best PG-13 Horror Movies',
                                self.base_url % '1064003',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best PG-13 Action Movies',
                                self.base_url % '1063981',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best \'00s Kids Movies',
                                self.base_url % '2187563',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best \'80s Teen Movies',
                                self.base_url % '1407499',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best \'80s Kids Movies',
                                self.base_url % '2187569',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Good Movies for 10 Year Olds',
                                self.base_url % '1697939',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Family Movies Streaming on Hulu',
                                self.base_url % '2180319',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Movies for Kids',
                                self.base_url % '693864',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Movies for Toddlers',
                                self.base_url % '1443218',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(
                    list,
                    indexer,
                    'index',
                    'Greatest Classic Films the Whole Family Will Love',
                    self.base_url % '2547513',
                    indexer,
                    img=common.get_themed_icon('kids.png'),
                    fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Dinosaur Movies',
                                self.base_url % '370068',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Live Action Animal Movies for Kids',
                                self.base_url % '858027',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Adventure Movies for Kids',
                                self.base_url % '1754597',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Halloween Movies for Kids',
                                self.base_url % '371510',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Sports Movies for Kids',
                                self.base_url % '2472516',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Live Action Kids Fantasy Movies',
                                self.base_url % '2502919',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Science Fiction Family Movies',
                                self.base_url % '2513062',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(
                    list,
                    indexer,
                    'index',
                    'Great "Horror" Movies the Whole Family Can Enjoy',
                    self.base_url % '2548835',
                    indexer,
                    img=common.get_themed_icon('kids.png'),
                    fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Movies for Tweens',
                                self.base_url % '1443219',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'All Pixar Films, Ranked Best to Worst',
                                self.base_url % '811686',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Disney Live-Action Movies',
                                self.base_url % '857009',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Disney Animated Movies of All Time',
                                self.base_url % '2086672',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best and Worst Disney Animated Movies',
                                self.base_url % '366769',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Walt Disney Company Movies List',
                                self.base_url % '165569',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Disney Princess Movies',
                                self.base_url % '687771',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Fairy Tale Movies',
                                self.base_url % '829312',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Movies for Young Girls',
                                self.base_url % '1697936',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Princess Movies',
                                self.base_url % '360874',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Movies for Boys',
                                self.base_url % '1697944',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best CGI Animated Films Ever Made',
                                self.base_url % '338412',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))

        else:
            self.ExtractContentAndAddtoList(indexer, section, url, type, list,
                                            page, total_pages, sort_by,
                                            sort_order)
예제 #7
0
class rankerkids(MovieIndexer):

    implements = [MovieIndexer]

    name = "rankerkids"
    display_name = "Kids Zone"
    base_url = 'http://cache.api.ranker.com/lists/%s/items?limit=50&offset=0&include=votes,wikiText'
    img = common.get_themed_icon('kids.png')
    fanart = common.get_themed_fanart('kids.jpg')
    default_indexer_enabled = 'true'
    source_enabled_by_default = 'true'

    def ExtractContentAndAddtoList(self,
                                   indexer,
                                   section,
                                   url,
                                   type,
                                   list,
                                   page='',
                                   total_pages='',
                                   sort_by='',
                                   sort_order=''):

        if page == '':
            page = '1'
        from md_request import open_url
        import re, urllib

        new_url = urllib.unquote_plus(url)

        link = open_url(new_url).json()

        if len(link['listItems']) == 50:
            offset = re.compile('offset=(.*?)&').findall(url)[0]
            new_offset = 50 + int(offset)
            new_url = url.replace('offset=%s&' % offset,
                                  'offset=%s&' % new_offset)

        self.AddInfo(list, indexer, section, new_url, type, page, '')

        mode = common.mode_File_Hosts

        if section == 'index' or 'new-release' or 'latest-added' or 'latest-hd' or 'latest-ts' or 'most-popular' or 'popular-today' or 'top-rated' or 'most-voted' or 'az' or 'genres' or 'year':
            for a in link['listItems']:
                year = ''
                name = a['name']
                title = self.CleanTextForSearch(name)
                match = re.compile('%s is a (.*?) ' % name, re.DOTALL).findall(
                    str(a['node']['nodeWiki']))
                for year in match:
                    name = name + ' (' + year + ')'

                self.AddContent(list,
                                indexer,
                                mode,
                                name.replace('()', ''),
                                '',
                                type,
                                url=new_url,
                                name=title,
                                year=year)

    def GetSection(self,
                   indexer,
                   section,
                   url,
                   type,
                   list,
                   page='',
                   total_pages='',
                   sort_by='',
                   sort_order=''):

        from md_request import open_url

        if section == 'main':

            if indexer == common.indxr_Movies:

                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Superhero Movies Ever Made',
                                self.base_url % '315081',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Movies Based on Marvel Comics',
                                self.base_url % '355348',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best PG-13 Teen Movies',
                                self.base_url % '1064127',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best PG-13 Family Movies',
                                self.base_url % '1063791',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best PG-13 Horror Movies',
                                self.base_url % '1064003',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best PG-13 Action Movies',
                                self.base_url % '1063981',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best \'00s Kids Movies',
                                self.base_url % '2187563',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best \'80s Teen Movies',
                                self.base_url % '1407499',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best \'80s Kids Movies',
                                self.base_url % '2187569',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Good Movies for 10 Year Olds',
                                self.base_url % '1697939',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Family Movies Streaming on Hulu',
                                self.base_url % '2180319',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Movies for Kids',
                                self.base_url % '693864',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Movies for Toddlers',
                                self.base_url % '1443218',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(
                    list,
                    indexer,
                    'index',
                    'Greatest Classic Films the Whole Family Will Love',
                    self.base_url % '2547513',
                    indexer,
                    img=common.get_themed_icon('kids.png'),
                    fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Dinosaur Movies',
                                self.base_url % '370068',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Live Action Animal Movies for Kids',
                                self.base_url % '858027',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Adventure Movies for Kids',
                                self.base_url % '1754597',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Halloween Movies for Kids',
                                self.base_url % '371510',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Sports Movies for Kids',
                                self.base_url % '2472516',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Live Action Kids Fantasy Movies',
                                self.base_url % '2502919',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Science Fiction Family Movies',
                                self.base_url % '2513062',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(
                    list,
                    indexer,
                    'index',
                    'Great "Horror" Movies the Whole Family Can Enjoy',
                    self.base_url % '2548835',
                    indexer,
                    img=common.get_themed_icon('kids.png'),
                    fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Movies for Tweens',
                                self.base_url % '1443219',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'All Pixar Films, Ranked Best to Worst',
                                self.base_url % '811686',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Disney Live-Action Movies',
                                self.base_url % '857009',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Disney Animated Movies of All Time',
                                self.base_url % '2086672',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best and Worst Disney Animated Movies',
                                self.base_url % '366769',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Walt Disney Company Movies List',
                                self.base_url % '165569',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Disney Princess Movies',
                                self.base_url % '687771',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Fairy Tale Movies',
                                self.base_url % '829312',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Movies for Young Girls',
                                self.base_url % '1697936',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Princess Movies',
                                self.base_url % '360874',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best Movies for Boys',
                                self.base_url % '1697944',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))
                self.AddSection(list,
                                indexer,
                                'index',
                                'Best CGI Animated Films Ever Made',
                                self.base_url % '338412',
                                indexer,
                                img=common.get_themed_icon('kids.png'),
                                fanart=common.get_themed_fanart('kids.jpg'))

        else:
            self.ExtractContentAndAddtoList(indexer, section, url, type, list,
                                            page, total_pages, sort_by,
                                            sort_order)
예제 #8
0
    def GetSection(self,
                   indexer,
                   section,
                   url,
                   type,
                   list,
                   page='',
                   total_pages='',
                   sort_by='',
                   sort_order=''):

        base_api = 'https://api.themoviedb.org/3/'
        key = '?api_key=3c31868688cafdc8d01a799aef97c69f'

        if section == 'main':
            if indexer == common.indxr_Movies:
                self.AddSection(list,
                                indexer,
                                'popular',
                                'Popular',
                                base_api + 'movie/popular' + key,
                                indexer,
                                img=common.get_themed_icon('tmdb_pop.png'),
                                fanart=common.get_themed_fanart('tmdb.jpg'))
                self.AddSection(list,
                                indexer,
                                'top_rated',
                                'Top Rated',
                                base_api + 'movie/top_rated' + key,
                                indexer,
                                img=common.get_themed_icon('tmdb_rated.png'),
                                fanart=common.get_themed_fanart('tmdb.jpg'))
                self.AddSection(list,
                                indexer,
                                'genres',
                                'Genres',
                                img=common.get_themed_icon('tmdb_gen.png'),
                                fanart=common.get_themed_fanart('tmdb.jpg'))
                self.AddSection(list,
                                indexer,
                                'studio',
                                'Studios',
                                img=common.get_themed_icon('tmdb_stud.png'),
                                fanart=common.get_themed_fanart('tmdb.jpg'))
                self.AddSection(list,
                                indexer,
                                'mpaa',
                                'MPAA Ratings',
                                img=common.get_themed_icon('tmdb_mpaa.png'),
                                fanart=common.get_themed_fanart('tmdb.jpg'))
                self.AddSection(
                    list,
                    indexer,
                    'new_releases',
                    'New Releases (DVD)',
                    'http://api.rottentomatoes.com/api/public/v1.0/lists/dvds/new_releases.json?page_limit=50&page=1&country=us&apikey=45nbuknsud2wjrp4tmhs6typ',
                    indexer,
                    img=common.get_themed_icon('tmdb_new.png'),
                    fanart=common.get_themed_fanart('tmdb.jpg'))
            if self.Settings().get_setting('trakt_wl') == 'true':
                self.AddSection(
                    list, indexer, 'trakt_watchlist', 'Trakt Watchlist',
                    'http://api.trakt.tv/user/watchlist/movies.json/fa6f7ac72530fe6393b5fb5d3a772198/'
                    + self.Settings().get_setting('username'), indexer)
                self.AddSection(
                    list, indexer, 'trakt_lists', 'Trakt Lists',
                    'http://trakt.tv/user/%s/lists/' %
                    self.Settings().get_setting('username'), indexer)

        elif section == 'genres':
            base_genre = base_api + 'discover/movie' + key + '&sort_by=popularity.desc&with_genres='
            self.AddSection(list,
                            indexer,
                            'action',
                            'Action',
                            base_genre + '28',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'adventure',
                            'Adventure',
                            base_genre + '12',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'animation',
                            'Animation',
                            base_genre + '16',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'comedy',
                            'Comedy',
                            base_genre + '35',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'crime',
                            'Crime',
                            base_genre + '80',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'disaster',
                            'Disaster',
                            base_genre + '105',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'documentary',
                            'Documentary',
                            base_genre + '99',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'drama',
                            'Drama',
                            base_genre + '18',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'eastern',
                            'Eastern',
                            base_genre + '82',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'family',
                            'Family',
                            base_genre + '10751',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'fanfilm',
                            'Fan Film',
                            base_genre + '10750',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'fantasy',
                            'Fantasy',
                            base_genre + '14',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'filmnoir',
                            'Film Noir',
                            base_genre + '10753',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'foreign',
                            'Foreign',
                            base_genre + '10769',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'history',
                            'History',
                            base_genre + '36',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'holiday',
                            'Holiday',
                            base_genre + '10595',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'horror',
                            'Horror',
                            base_genre + '27',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'indie',
                            'Indie',
                            base_genre + '10756',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'music',
                            'Music',
                            base_genre + '10402',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'musical',
                            'Musical',
                            base_genre + '22',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'mystery',
                            'Mystery',
                            base_genre + '9648',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'neo-noir',
                            'Neo-noir',
                            base_genre + '10754',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'roadmovie',
                            'Road Movie',
                            base_genre + '1115',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'romance',
                            'Romance',
                            base_genre + '10749',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'sci-fi',
                            'Sci-Fi',
                            base_genre + '878',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'short',
                            'Short',
                            base_genre + '10755',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'sport',
                            'Sport',
                            base_genre + '9805',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'suspense',
                            'Suspense',
                            base_genre + '10748',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'tvmovie',
                            'TV movie',
                            base_genre + '10770',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'thriller',
                            'Thriller',
                            base_genre + '53',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'war',
                            'War',
                            base_genre + '10752',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'western',
                            'Western',
                            base_genre + '37',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))

        elif section == 'studio':
            base_studio = base_api + 'discover/movie' + key + '&sort_by=popularity.desc&with_companies='
            self.AddSection(list,
                            indexer,
                            'warner_bros',
                            'Warner Bros.',
                            base_studio + '6194',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'universal ',
                            'Universal',
                            base_studio + '33',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'disney_Pictures',
                            'Walt Disney Pictures',
                            base_studio + '2',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'disney_productions',
                            'Walt Disney Productions',
                            base_studio + '3166',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'columbia',
                            'Columbia',
                            base_studio + '5',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'fox',
                            '20th Century Fox',
                            base_studio + '25',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'paramount',
                            'Paramount',
                            base_studio + '4',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'lionsgate',
                            'Lionsgate',
                            base_studio + '1632',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'dreamworks',
                            'DreamWorks',
                            base_studio + '27',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'mgm',
                            'Metro Goldwyn Mayer',
                            base_studio + '21',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'new_line',
                            'New Line Cinema',
                            base_studio + '12',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'pixar',
                            'Pixar',
                            base_studio + '3',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'Lucasfilm',
                            'Lucasfilm',
                            base_studio + '1',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'rko',
                            'RKO Radio',
                            base_studio + '6',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'miramax',
                            'Miramax',
                            base_studio + '14',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'weinstein',
                            'Weinstein Company',
                            base_studio + '308',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'relativity_media',
                            'Relativity Media',
                            base_studio + '7295',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))

        elif section == 'mpaa':
            base_mpaa = base_api + 'discover/movie' + key + '&sort_by=popularity.desc&certification_country=US&certification='
            self.AddSection(list,
                            indexer,
                            'g',
                            'G',
                            base_mpaa + 'G',
                            indexer,
                            img=common.get_themed_icon('tmdb_mpaa.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'pgl ',
                            'PG',
                            base_mpaa + 'PG',
                            indexer,
                            img=common.get_themed_icon('tmdb_mpaa.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'pg13',
                            'PG-13',
                            base_mpaa + 'PG-13',
                            indexer,
                            img=common.get_themed_icon('tmdb_mpaa.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'r',
                            'R',
                            base_mpaa + 'R',
                            indexer,
                            img=common.get_themed_icon('tmdb_mpaa.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))

        elif section == 'trakt_lists':
            net = Net(cached=False)
            response = net.http_GET(url).content
            stuff = re.compile(
                '<div class="title-overflow"></div>\n.+?<a href="/user/(.+?)/lists/(.+?)">(.+?)</a>'
            ).findall(response)
            for user, slug, list_name in stuff:
                self.AddSection(
                    list, indexer, 'list_name', list_name,
                    'http://api.trakt.tv/user/list.json/fa6f7ac72530fe6393b5fb5d3a772198/%s/%s'
                    % (user, slug), indexer)
            response_two = net.http_GET(url + 'liked').content
            stuff_two = re.compile(
                '<div class="title-overflow"></div>\n.+?<a href="/user/(.+?)/lists/(.+?)">(.+?)</a>'
            ).findall(response_two)
            for user, slug, list_name in stuff_two:
                self.AddSection(
                    list, indexer, 'list_name', '%s (%s)' % (list_name, user),
                    'http://api.trakt.tv/user/list.json/fa6f7ac72530fe6393b5fb5d3a772198/%s/%s'
                    % (user, slug), indexer)

        else:
            self.ExtractContentAndAddtoList(indexer, section, url, type, list,
                                            page, total_pages, sort_by,
                                            sort_order)
예제 #9
0
class tmdb(MovieIndexer, CustomSettings, ListIndexer):
    implements = [MovieIndexer, CustomSettings, ListIndexer]

    name = "tmdb"
    display_name = "TMDb"
    base_url = 'https://www.themoviedb.org'
    img = common.get_themed_icon('tmdb.png')
    fanart = common.get_themed_fanart('tmdb.jpg')
    default_indexer_enabled = 'true'

    def __init__(self):
        xml = '<settings>\n'
        xml += '<category label="Account">\n'
        xml += '<setting id="trakt_wl" type="bool" label="Enable Trakt.tv Watchlist:" default="false" />\n'
        xml += '<setting id="username" type="text" label="Trakt Username:"******"Enter your trakt username" enable="eq(-1,true)" />\n'
        xml += '</category>\n'
        xml += '</settings>\n'
        self.CreateSettings(self.name, self.display_name, xml)

    def ExtractContentAndAddtoList(self,
                                   indexer,
                                   section,
                                   url,
                                   type,
                                   list,
                                   page='',
                                   total_pages='',
                                   sort_by='',
                                   sort_order=''):
        net = Net(cached=False)
        type = common.indxr_Movies
        mode = common.mode_File_Hosts
        indexer = common.indxr_Movies
        if section == 'new_releases':
            response = net.http_GET(url).content
            stuff = json.loads(response)
            for movies in stuff['movies']:
                title = movies['title']
                num = movies['year']
                name = title.encode('utf8')
                year = str(num)
                self.AddContent(list, indexer, common.mode_File_Hosts,
                                name + ' (' + year + ')', '', type, '', name,
                                year)
        elif section == 'trakt_watchlist':
            response = net.http_GET(url).content
            stuff = json.loads(response)
            for movies in stuff:
                name = movies['title']
                if name:
                    name = name.encode('utf8')
                    year = str(movies['year'])
                    self.AddContent(list, indexer, mode,
                                    name + ' (' + year + ')', '', type, '',
                                    name, year)
        elif section == 'list_name':
            response = net.http_GET(url).content
            stuff = json.loads(response)
            for items in stuff['items']:
                movies = items['movie']
                name = movies['title']
                if name:
                    name = name.encode('utf8')
                    year = str(movies['year'])
                    self.AddContent(list, indexer, mode,
                                    name + ' (' + year + ')', '', type, '',
                                    name, year)
        else:
            if page == '':
                page = '1'
            else:
                page = str(int(page))
                url = url + '&page=' + page
            response = net.http_GET(url).content
            stuff = json.loads(response)
            total_pages = stuff['total_pages']
            self.AddInfo(list, indexer, section, url, type, str(page),
                         str(total_pages))
            for movies in stuff['results']:
                name = movies['title']
                date = movies['release_date']
                year = str(date)[0:4]
                name = name.encode('utf8')
                self.AddContent(list, indexer, common.mode_File_Hosts,
                                name + ' (' + year + ')', '', type, '', name,
                                year)

    def GetSection(self,
                   indexer,
                   section,
                   url,
                   type,
                   list,
                   page='',
                   total_pages='',
                   sort_by='',
                   sort_order=''):

        base_api = 'https://api.themoviedb.org/3/'
        key = '?api_key=3c31868688cafdc8d01a799aef97c69f'

        if section == 'main':
            if indexer == common.indxr_Movies:
                self.AddSection(list,
                                indexer,
                                'popular',
                                'Popular',
                                base_api + 'movie/popular' + key,
                                indexer,
                                img=common.get_themed_icon('tmdb_pop.png'),
                                fanart=common.get_themed_fanart('tmdb.jpg'))
                self.AddSection(list,
                                indexer,
                                'top_rated',
                                'Top Rated',
                                base_api + 'movie/top_rated' + key,
                                indexer,
                                img=common.get_themed_icon('tmdb_rated.png'),
                                fanart=common.get_themed_fanart('tmdb.jpg'))
                self.AddSection(list,
                                indexer,
                                'genres',
                                'Genres',
                                img=common.get_themed_icon('tmdb_gen.png'),
                                fanart=common.get_themed_fanart('tmdb.jpg'))
                self.AddSection(list,
                                indexer,
                                'studio',
                                'Studios',
                                img=common.get_themed_icon('tmdb_stud.png'),
                                fanart=common.get_themed_fanart('tmdb.jpg'))
                self.AddSection(list,
                                indexer,
                                'mpaa',
                                'MPAA Ratings',
                                img=common.get_themed_icon('tmdb_mpaa.png'),
                                fanart=common.get_themed_fanart('tmdb.jpg'))
                self.AddSection(
                    list,
                    indexer,
                    'new_releases',
                    'New Releases (DVD)',
                    'http://api.rottentomatoes.com/api/public/v1.0/lists/dvds/new_releases.json?page_limit=50&page=1&country=us&apikey=45nbuknsud2wjrp4tmhs6typ',
                    indexer,
                    img=common.get_themed_icon('tmdb_new.png'),
                    fanart=common.get_themed_fanart('tmdb.jpg'))
            if self.Settings().get_setting('trakt_wl') == 'true':
                self.AddSection(
                    list, indexer, 'trakt_watchlist', 'Trakt Watchlist',
                    'http://api.trakt.tv/user/watchlist/movies.json/fa6f7ac72530fe6393b5fb5d3a772198/'
                    + self.Settings().get_setting('username'), indexer)
                self.AddSection(
                    list, indexer, 'trakt_lists', 'Trakt Lists',
                    'http://trakt.tv/user/%s/lists/' %
                    self.Settings().get_setting('username'), indexer)

        elif section == 'genres':
            base_genre = base_api + 'discover/movie' + key + '&sort_by=popularity.desc&with_genres='
            self.AddSection(list,
                            indexer,
                            'action',
                            'Action',
                            base_genre + '28',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'adventure',
                            'Adventure',
                            base_genre + '12',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'animation',
                            'Animation',
                            base_genre + '16',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'comedy',
                            'Comedy',
                            base_genre + '35',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'crime',
                            'Crime',
                            base_genre + '80',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'disaster',
                            'Disaster',
                            base_genre + '105',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'documentary',
                            'Documentary',
                            base_genre + '99',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'drama',
                            'Drama',
                            base_genre + '18',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'eastern',
                            'Eastern',
                            base_genre + '82',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'family',
                            'Family',
                            base_genre + '10751',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'fanfilm',
                            'Fan Film',
                            base_genre + '10750',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'fantasy',
                            'Fantasy',
                            base_genre + '14',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'filmnoir',
                            'Film Noir',
                            base_genre + '10753',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'foreign',
                            'Foreign',
                            base_genre + '10769',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'history',
                            'History',
                            base_genre + '36',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'holiday',
                            'Holiday',
                            base_genre + '10595',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'horror',
                            'Horror',
                            base_genre + '27',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'indie',
                            'Indie',
                            base_genre + '10756',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'music',
                            'Music',
                            base_genre + '10402',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'musical',
                            'Musical',
                            base_genre + '22',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'mystery',
                            'Mystery',
                            base_genre + '9648',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'neo-noir',
                            'Neo-noir',
                            base_genre + '10754',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'roadmovie',
                            'Road Movie',
                            base_genre + '1115',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'romance',
                            'Romance',
                            base_genre + '10749',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'sci-fi',
                            'Sci-Fi',
                            base_genre + '878',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'short',
                            'Short',
                            base_genre + '10755',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'sport',
                            'Sport',
                            base_genre + '9805',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'suspense',
                            'Suspense',
                            base_genre + '10748',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'tvmovie',
                            'TV movie',
                            base_genre + '10770',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'thriller',
                            'Thriller',
                            base_genre + '53',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'war',
                            'War',
                            base_genre + '10752',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'western',
                            'Western',
                            base_genre + '37',
                            indexer,
                            img=common.get_themed_icon('tmdb_gen.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))

        elif section == 'studio':
            base_studio = base_api + 'discover/movie' + key + '&sort_by=popularity.desc&with_companies='
            self.AddSection(list,
                            indexer,
                            'warner_bros',
                            'Warner Bros.',
                            base_studio + '6194',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'universal ',
                            'Universal',
                            base_studio + '33',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'disney_Pictures',
                            'Walt Disney Pictures',
                            base_studio + '2',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'disney_productions',
                            'Walt Disney Productions',
                            base_studio + '3166',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'columbia',
                            'Columbia',
                            base_studio + '5',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'fox',
                            '20th Century Fox',
                            base_studio + '25',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'paramount',
                            'Paramount',
                            base_studio + '4',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'lionsgate',
                            'Lionsgate',
                            base_studio + '1632',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'dreamworks',
                            'DreamWorks',
                            base_studio + '27',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'mgm',
                            'Metro Goldwyn Mayer',
                            base_studio + '21',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'new_line',
                            'New Line Cinema',
                            base_studio + '12',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'pixar',
                            'Pixar',
                            base_studio + '3',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'Lucasfilm',
                            'Lucasfilm',
                            base_studio + '1',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'rko',
                            'RKO Radio',
                            base_studio + '6',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'miramax',
                            'Miramax',
                            base_studio + '14',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'weinstein',
                            'Weinstein Company',
                            base_studio + '308',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'relativity_media',
                            'Relativity Media',
                            base_studio + '7295',
                            indexer,
                            img=common.get_themed_icon('tmdb_stud.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))

        elif section == 'mpaa':
            base_mpaa = base_api + 'discover/movie' + key + '&sort_by=popularity.desc&certification_country=US&certification='
            self.AddSection(list,
                            indexer,
                            'g',
                            'G',
                            base_mpaa + 'G',
                            indexer,
                            img=common.get_themed_icon('tmdb_mpaa.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'pgl ',
                            'PG',
                            base_mpaa + 'PG',
                            indexer,
                            img=common.get_themed_icon('tmdb_mpaa.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'pg13',
                            'PG-13',
                            base_mpaa + 'PG-13',
                            indexer,
                            img=common.get_themed_icon('tmdb_mpaa.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))
            self.AddSection(list,
                            indexer,
                            'r',
                            'R',
                            base_mpaa + 'R',
                            indexer,
                            img=common.get_themed_icon('tmdb_mpaa.png'),
                            fanart=common.get_themed_fanart('tmdb.jpg'))

        elif section == 'trakt_lists':
            net = Net(cached=False)
            response = net.http_GET(url).content
            stuff = re.compile(
                '<div class="title-overflow"></div>\n.+?<a href="/user/(.+?)/lists/(.+?)">(.+?)</a>'
            ).findall(response)
            for user, slug, list_name in stuff:
                self.AddSection(
                    list, indexer, 'list_name', list_name,
                    'http://api.trakt.tv/user/list.json/fa6f7ac72530fe6393b5fb5d3a772198/%s/%s'
                    % (user, slug), indexer)
            response_two = net.http_GET(url + 'liked').content
            stuff_two = re.compile(
                '<div class="title-overflow"></div>\n.+?<a href="/user/(.+?)/lists/(.+?)">(.+?)</a>'
            ).findall(response_two)
            for user, slug, list_name in stuff_two:
                self.AddSection(
                    list, indexer, 'list_name', '%s (%s)' % (list_name, user),
                    'http://api.trakt.tv/user/list.json/fa6f7ac72530fe6393b5fb5d3a772198/%s/%s'
                    % (user, slug), indexer)

        else:
            self.ExtractContentAndAddtoList(indexer, section, url, type, list,
                                            page, total_pages, sort_by,
                                            sort_order)

    def Search(self,
               srcr,
               keywords,
               type,
               list,
               lock,
               message_queue,
               page='',
               total_pages=''):
        import urllib
        query = urllib.quote_plus(keywords)
        search_url = 'https://api.themoviedb.org/3/search/movie?api_key=3c31868688cafdc8d01a799aef97c69f&sort_by=popularity.desc&query=' + query
        self.ExtractContentAndAddtoList(srcr,
                                        'search',
                                        search_url,
                                        type,
                                        list,
                                        page=page,
                                        total_pages=total_pages)