This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def metadata_from(args): | |
| metadata = { | |
| 'info': { | |
| 'title': args.get('title', ''), | |
| 'plot': args.get('plot', ''), | |
| 'genres': args.get('genre', ''), | |
| 'votes': args.get('votes', ''), | |
| 'rating': args.get('rating', ''), | |
| 'year': args.get('year', ''), | |
| 'mpaa': args.get('mpaa', ''), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo systemctl stop mediacenter | |
| ##addon.xml | |
| <item library="context3.py"> | |
| <label>TMDB Helper - Play</label> | |
| <visible>String.IsEqual(ListItem.dbtype,movie) | String.IsEqual(ListItem.dbtype,episode)</visible> | |
| </item> | |
| ##addon.xml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @ch.action('contextmenu', 500) | |
| def context_menu(self): | |
| Utils.show_busy() | |
| if self.listitem.getProperty('dbid') and self.listitem.getProperty('dbid') != 0: | |
| dbid = self.listitem.getProperty('dbid') | |
| else: | |
| dbid = 0 | |
| item_id = self.listitem.getProperty('id') | |
| if self.type == 'tv': | |
| imdb_id = Utils.fetch(TheMovieDB.get_tvshow_ids(item_id), 'imdb_id') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def list_play(self): | |
| # xbmc.log(str(tmdb_id)+'===>TMDB_HELPER_3', level=xbmc.LOGNOTICE) | |
| tmdb_id = '' | |
| if self.params.get('query') and self.params.get('type') == 'episode': | |
| tmdb_id = self.tmdb.get_tmdb_id(itemtype='tv', query=self.params.get('query')) | |
| if self.params.get('query') and self.params.get('type') == 'movie': | |
| movie_title = self.params.get('query') | |
| movie_year = self.params.get('year') | |
| tmdb_id = self.tmdb.get_tmdb_id(itemtype='movie', query=self.params.get('query')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def play(self, itemtype, tmdb_id, season=None, episode=None): | |
| self.itemtype, self.tmdb_id, self.season, self.episode = itemtype, tmdb_id, season, episode | |
| self.tmdbtype = 'tv' if self.itemtype in ['episode', 'tv'] else 'movie' | |
| self.details = self.tmdb.get_detailed_item(self.tmdbtype, tmdb_id, season=season, episode=episode) | |
| self.item['imdb_id'] = self.details.get('infolabels', {}).get('imdbnumber') | |
| self.item['originaltitle'] = self.details.get('infolabels', {}).get('originaltitle') | |
| self.item['title'] = self.details.get('infolabels', {}).get('tvshowtitle') or self.details.get('infolabels', {}).get('title') | |
| self.item['year'] = self.details.get('infolabels', {}).get('year') | |
| is_local = False | |
| # if self.details and self.itemtype == 'movie': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_recentlywatched(self, userslug, tmdbtype, limit=None, islistitem=True, months=360): | |
| start_at = datetime.date.today() - datetime.timedelta(months * 365 / 12) | |
| history = self.get_response_json('users', userslug, 'history', utils.type_convert(tmdbtype, 'trakt') + 's', page=1, limit=10000, start_at=start_at.strftime("%Y-%m-%d")) | |
| return self.get_limitedlist(history, tmdbtype, limit, islistitem) | |
| def get_inprogress(self, userslug, limit=None, episodes=False): | |
| """ | |
| Looks at user's most recently watched 200 episodes in last 3 years | |
| Adds each unique show to list in order then checks if show has an upnext episode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ####################################################### | |
| def get_sortedlist2(self, items): | |
| items = sorted(items, key=lambda x: x['infolabels']['premiered'], reverse=True) | |
| # for i in items2: | |
| # xbmc.log(str(i.infolabels['premiered'])+'===>TMDB HELPER', level=xbmc.LOGNOTICE) | |
| if not items: | |
| return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ##################################### | |
| LANGUAGES = [ | |
| {'id': '', 'name': ''}, | |
| {'id': 'bg', 'name': 'Bulgarian'}, | |
| {'id': 'cs', 'name': 'Czech'}, | |
| {'id': 'da', 'name': 'Danish'}, | |
| {'id': 'de', 'name': 'German'}, | |
| {'id': 'el', 'name': 'Greek'}, | |
| {'id': 'en', 'name': 'English'}, | |
| {'id': 'es', 'name': 'Spanish'}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| listitems = ['Play'] | |
| listitems += ['Play - Foxy Streams'] | |
| selection = xbmcgui.Dialog().select(heading='Choose option', list=listitems) | |
| if selection == 0: | |
| url = 'plugin://plugin.video.openmeta/tv/play/%s/%s/%s' % (Utils.fetch(TheMovieDB.get_tvshow_ids(self.tvshow_id), 'tvdb_id'), self.info['season'], episode_id) | |
| if self.listitem.getProperty('dbid'): | |
| dbid = self.listitem.getProperty('dbid') | |
| else: | |
| dbid = 0 | |
| PLAYER.play_from_button(url, listitem=None, window=self, type='episodeid', dbid=dbid) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import xbmc, xbmcgui | |
| from resources.lib import Utils | |
| from resources.lib.WindowManager import wm | |
| ####################################################################################### | |
| def play_media(self, url, listitem, window=False): | |
| # super(VideoPlayer, self).play(item=url, listitem=listitem, windowed=False, startpos=-1) | |
| xbmc.executebuiltin('PlayMedia(%s)' % url) | |
| Utils.hide_busy() |