v14 TV Show Vs Movie
#1
Video 
Is it at all possible to easily discern if Kodi is playing a TV show or a Movie during play back? If so how would you do it using Python?
Reply
#2
This is what I use in my add-on. If the video is in the library it should work.

Code:
import json
import xbmc

query = {'jsonrpc': '2.0', 'method': 'Player.GetItem', 'params': { 'properties': ['showtitle', 'season', 'episode'], 'playerid': 1 }, 'id': 'VideoGetItem'}
response = json.loads(xbmc.executeJSONRPC(json.dumps(query)))

if response['result']['item']['season'] == -1:
    xbmc.log(msg='Movie', level=xbmc.LOGDEBUG)
else:
    xbmc.log(msg='TV', level=xbmc.LOGDEBUG)
Reply
#3
ok kewl thanks... I realy wish I understood this JSON stuff better.. I'm still learning python, but somehow everything I a trying to do with this plugin involves JSON so far. I will let you know if I have any troubles.
Reply
#4
Where am I looking for the log that xbmc.LOGDEBUG is being put?
Reply
#5
(2015-03-24, 09:49)phoniclynx Wrote: Where am I looking for the log that xbmc.LOGDEBUG is being put?

You can change xbmc.log(...) to some other action but if you would like to view the log file: http://kodi.wiki/view/log_file
Reply
#6
cool cool found it.. found my bug.. in amongst a bazillion other lines. cheers Big Grin
Reply
#7
Here's an idea... how would I find out how many seconds a video has before it ends... IE I'd like to run a script 15 seconds just before t ends.
Reply

Logout Mark Read Team Forum Stats Members Help
TV Show Vs Movie0