Win [RELEASE] Python based Now-Playing script for XBMC 12 "Frodo" [Please move to tools]
#1
(To Moderators: This looks more like a Supplementary Tool, please move it for me!)

Since the only Now playing script I found was not working anymore, I decided to make my own.
The result was a fully customizable NowPlaying Program for Windows XP and Higher, built with Python 2.7. Which supports UTF-8 for Japanese and other non ASCII Languages, different formats for Movie/TV Show/Song and runs as pseudo-service on Windows.

Supported Programs: mIRC and generally every other program that can read a simple text file.

Current Version: 1.2 (29.03.2013)
(Change notes:- Couple bug fixes)

Thanks to ezechiel1917 for bug reporting.

Download: XBMC_NowPlaying1_2.rar

Tutorial on how to: http://moreit.eu/category/xbmc-2/

Also check out my HTML Generator: http://forum.xbmc.org/showthread.php?tid=160863

If you find any bug, please post them here and I will fix them asap. (Don't forget posting the error output of python,to debug the script
use the command argument: "debug" for example: ">xbmc_now_playing.py debug")
Reply
#2
Author of the old script here. Thanks for doing this, works nicely!
Reply
#3
Thank you! I'll try it out later.
Reply
#4
Hi DeadSix27,
it seems when xbmc is playing non library media (like pvr channel or media file not added to library) python process quits. when i execute "xbmc_now_playing_arc.py start" in such a case only .pid is created and nowplaying.txt is not even created.

Code:
File "C:\Python27\Scripts\xbmc_now_playing.py", line 318, in <module>
    np = XBMCnowPlaying()
  File "C:\Python27\Scripts\xbmc_now_playing.py", line 87, in __init__
    self.writeStringToFile()
  File "C:\Python27\Scripts\xbmc_now_playing.py", line 164, in writeStringToFile

    nowPlayingString = self.getNowPlayingString()
  File "C:\Python27\Scripts\xbmc_now_playing.py", line 277, in getNowPlayingStri
ng
    audioChannels = jsonData['result']['item']['streamdetails']['audio'][0]['cha
nnels']
IndexError: list index out of range
Reply
#5
I will fix that asap, sorry was a bit busy the last days.

As I have no PVR at home, I cant test that myself.
But I will try to create a working mode for PVR and non Libary files later.
Reply
#6
Version: 1.2 Uploaded. See first post for information.
Reply
#7
(2013-03-29, 02:50)DeadSix27 Wrote: Version: 1.2 Uploaded. See first post for information.

Thank you, non library files works ok now, when I play Live TV channel txt file is being updated with some strings, but when I stop playing that channel python process quits.
Reply
#8
(2013-03-29, 23:04)ezechiel1917 Wrote: Thank you, non library files works ok now, when I play Live TV channel txt file is being updated with some strings, but when I stop playing that channel python process quits.

Well I don't know how PVR works, I dont even know what that is, it's probably a TV Tuner feature right? I don't have such in my computer.

Can you post the stuff which gets written to channel.txt, as I do not know that file, is that your now playing txt file and you just changed the name in config? or what is that?
Reply
#9
Yes, it's a tv tuner feature, xbmc acts as frontend client for receiving streams from backend pvr server(s).
I think pvr channel provides limited information through JSON (would be nice to find out list of infolabels available) compared to standard library or non-library media and maybe that is a cause of python crash when you stop watching live tv channel.

This is nowPlaying.txt sample when I stopped playing Live channel:

Code:
npShow: N/A - Nová noční můra (Season: N/A,Episode: N/A) [N/A-N/A (N/A)|N/A-N/A-N/A Channels]
Reply
#10
could you post 2 json outputs for me?
Start PVR thingy and open a random channel and request this page:
Code:
http://yourhost:yourport/jsonrpc?request={"jsonrpc":"2.0","method":"Player.GetActivePlayers​","id":1}
Reply
#11
Hi,

here are some outputs from few json requests, I've marked bold useful information

active player query
Code:
jsonrpc?request={"jsonrpc":"2.0","method":"Player.GetActivePlayers​","id":1}
{"id":1,"jsonrpc":"2.0","result":[{"playerid":1,"type":"video"}]}

episode query
Code:
jsonrpc?request={"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":1,"properties":["title","season","episode","firstaired"]},"id":"1"}
{"id":"1","jsonrpc":"2.0","result":{"item":{"filetype":"file","firstaired":"1970-01-01","id":1,"label":"CT1 HD","title":"Události","type":"channel"}}}
-> channel number | channel name | event title | type

movie query
Code:
jsonrpc?request={"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":1,"properties":["title","year","director","genre","rating","votes"]},"id":"1"}
{"id":"1","jsonrpc":"2.0","result":{"item":{"filetype":"file","genre":["Other/Unknown"],"id":1,"label":"CT1 HD","rating":0,"title":"Události","type":"channel"}}}
-> genre | channel number | channel name | event title | type

current time/total time query
Code:
jsonrpc?request={"jsonrpc":"2.0","method":"Player.GetProperties","params":{"playerid":1,"properties":["time","totaltime"]},"id":"1"}
{"id":"1","jsonrpc":"2.0","result":{"time":{"hours":0,"milliseconds":0,"minutes":21,"seconds":17},"totaltime":{"hours":0,"milliseconds":0,"minutes":45,"seconds":0}}}
-> current time | total time
Reply
#12
(2013-03-31, 19:32)ezechiel1917 Wrote: Hi,

here are some outputs from few json requests, I've marked bold useful information

active player query
Code:
jsonrpc?request={"jsonrpc":"2.0","method":"Player.GetActivePlayers​","id":1}
{"id":1,"jsonrpc":"2.0","result":[{"playerid":1,"type":"video"}]}

episode query
Code:
jsonrpc?request={"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":1,"properties":["title","season","episode","firstaired"]},"id":"1"}
{"id":"1","jsonrpc":"2.0","result":{"item":{"filetype":"file","firstaired":"1970-01-01","id":1,"label":"CT1 HD","title":"Události","type":"channel"}}}
-> channel number | channel name | event title | type

movie query
Code:
jsonrpc?request={"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":1,"properties":["title","year","director","genre","rating","votes"]},"id":"1"}
{"id":"1","jsonrpc":"2.0","result":{"item":{"filetype":"file","genre":["Other/Unknown"],"id":1,"label":"CT1 HD","rating":0,"title":"Události","type":"channel"}}}
-> genre | channel number | channel name | event title | type

current time/total time query
Code:
jsonrpc?request={"jsonrpc":"2.0","method":"Player.GetProperties","params":{"playerid":1,"properties":["time","totaltime"]},"id":"1"}
{"id":"1","jsonrpc":"2.0","result":{"time":{"hours":0,"milliseconds":0,"minutes":21,"seconds":17},"totaltime":{"hours":0,"milliseconds":0,"minutes":45,"seconds":0}}}
-> current time | total time
I will look into it later and sorry for the late reply, i really have to enable subscriptions to my threads :| I pay the most attention to my other big thread
Reply
#13
Is this script working for Kodi? Link is dead, does anyone have the rar file? thanks
Reply
#14
Link is dead, yes, sorry, if there is a New script out now, use that, otherwise I MAYBE come back to this and re-create the entire thing more modern, but since I also stopped working on my other project the chance is low, since I actually do not use Kodi anymore at all.
Reply

Logout Mark Read Team Forum Stats Members Help
[RELEASE] Python based Now-Playing script for XBMC 12 "Frodo" [Please move to tools]1