def startup(): tv_results=tmdb.get_tv_shows(source,page) tv_ids=tv_results['results'] total_pages=tv_results['total_pages'] if total_pages > page: tv_ids.append(tmdb.get_tv_shows(source,page+1)['results'][0]) show_tv(tv_ids,source,page)
def onClick(self,control): global exit_requested global source global query global page global maxpage do_tv_shows=False do_movies=False popular = 32101 top_rated = 32102 on_the_air = 32103 airing_today = 32104 query_btn = 32110 previous = 32116 next =32117 movies_btn = 32113 tv_btn=32114 people_btn=32115 if control == popular and source!='popular': source='popular' page=1 do_tv_shows=True if control == top_rated and source!='top_rated': source='top_rated' do_tv_shows=True page=1 if control == on_the_air and source!='on_the_air': source='on_the_air' do_tv_shows=True page=1 if control == airing_today and source!='airing_today': source='airing_today' do_tv_shows=True page=1 if control == query_btn: source='query' do_tv_shows=True page=1 if control == next: if page < maxpage: page=page+1 do_tv_shows=True if control == previous: if page > 1: page=page-1 do_tv_shows=True if control == movies_btn: do_movies=True if control == people_btn: do_people=True xbmc.log('source ='+source) if do_tv_shows: if source=='query': if control==query_btn: k=xbmc.Keyboard('','Enter TV Show Name to Search For') k.doModal() query=k.getText() if query!='': tv_shows=tmdb.search_tv_shows(query,page) maxpage=tv_shows['total_pages'] tv_shows=tv_shows['results'] if maxpage > page: tv_shows.append(tmdb.search_tv_shows(query,page+1)['results'][0]) self.close() show_tv(tv_shows,source,page) else: query='' tv_shows=tmdb.get_tv_shows(source,page) maxpage=10 if source=='airing_today' or source=='on_the_air':maxpage=tv_shows['total_pages'] total_pages=tv_shows['total_pages'] tv_shows=tv_shows['results'] if total_pages > page: tv_shows.append(tmdb.get_tv_shows(source,page+1)['results'][0]) self.close() show_tv(tv_shows,source,page) if do_movies: from resources.lib import movies movies.source='popular' movies.startup() if do_people: from resources.lib import people people.source='popular' people.startup()