Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def XBMC_OriginalTitle(title):
- OriginalTitle = title
- json_query = xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"Player.GetItem", "params": { "playerid": 1} ,"id":1}' )
- json_player_getitem = simplejson.loads(unicode(json_query, 'utf-8', errors='ignore'))
- if json_player_getitem.has_key('result') and json_player_getitem['result'].has_key('item') and json_player_getitem['result']['item'].has_key('id') and json_player_getitem['result']['item'].has_key('type'):
- if json_player_getitem['result']['item']['type'] == "movie":
- json_query = xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"VideoLibrary.GetMovieDetails", "params": { "movieid": %s, "properties": ["originaltitle"]} ,"id":1}' % (json_player_getitem['result']['item']['id']) )
- json_getmoviedetails = simplejson.loads(unicode(json_query, 'utf-8', errors='ignore'))
- if json_getmoviedetails.has_key('result') and json_getmoviedetails['result'].has_key('moviedetails') and json_getmoviedetails['result']['moviedetails'].has_key('originaltitle'):
- OriginalTitle = json_getmoviedetails['result']['moviedetails']['originaltitle']
- elif json_player_getitem['result']['item']['type'] == "episode":
- json_query = xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"VideoLibrary.GetEpisodeDetails", "params": { "episodeid": %s, "properties": ["originaltitle", "tvshowid"]} ,"id":1}' % (json_player_getitem['result']['item']['id']) )
- json_getepisodedetails = simplejson.loads(unicode(json_query, 'utf-8', errors='ignore'))
- if json_getepisodedetails.has_key('result') and json_getepisodedetails['result'].has_key('episodedetails') and json_getepisodedetails['result']['episodedetails'].has_key('tvshowid'):
- json_query = xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"VideoLibrary.GetTVShowDetails", "params": { "tvshowid": %s, "properties": ["originaltitle", "imdbnumber"]} ,"id":1}' % (json_getepisodedetails['result']['episodedetails']['tvshowid']) )
- json_gettvshowdetails = simplejson.loads(unicode(json_query, 'utf-8', errors='ignore'))
- if json_gettvshowdetails.has_key('result') and json_gettvshowdetails['result'].has_key('tvshowdetails') and json_gettvshowdetails['result']['tvshowdetails'].has_key('imdbnumber'):
- thetvdb = json_gettvshowdetails['result']['tvshowdetails']['imdbnumber']
- HTTPResponse = urllib2.urlopen("http://www.thetvdb.com/data/series/"+str(thetvdb)+"/").read()
- if re.search("<SeriesName>(.*?)</SeriesName>", HTTPResponse):
- OriginalTitle = re.findall("<SeriesName>(.*?)</SeriesName>", HTTPResponse)[0]
- return OriginalTitle
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement