XBMC Python Script (1 Viewer)

jez

Portal Member
November 5, 2008
29
0
Melbourne
Home Country
The patch looks good. If it works for you, then I'll run it past EvilDude (who's done all the work on this) to get it incorporated.

My capabilities? I'm a UNIX sysadmin, and not a professional coder. I haven't even learnt C programming, unlike most CompSci graduates. But I've done a lot of coding in my time (mostly in perl, some in Pascal) so I'll have a dabble at anything. Dabble is all I've been doing here. I'm happy to concentrate on the Python/XBMC side of things, to match up with whatever you can do on the MP side.

What do you have in mind? I suppose the program guide and recording schedules are the two big deficiencies. It might also be neat to have the Python script talk the native MP API for streaming video, but as we have a reasonable work-around, I don't see it as a priority. I just wish there was more info on the consolidated PVR API for XBMC. Then we could try to keep things aligned with how that's going to work.
 

Redth

Portal Member
July 3, 2007
40
6
39
Sorry for taking so long.... Been a busy last couple days...

Anyways, I finally tested the patch, and it works. I tried using stoptimeshifting many times, and there are no more errors of that sort in my logs... Also now when you switch channels, it works as expected, not going to the beginning of the timeshift file as it was before, since timeshifting was not actually being stopped. So I'd say go ahead with the patch, working great for me!

As for the future, what I have in mind is really just a proper EPG. I'd be happy if I could view a proper epg on my xbmc for TVServer. Really, most of the TVServer stuff is already there. I may need to make a new method for you to get all the right EPG entries, in order, to minimize the processing time on the xbmc side of things, but the hard work imo is on the xbmc. Basically if you're interested, you'd need to make the GUI for it. Making it look like the EPG does in MediaPortal would be ideal (and by that I just mean the general rows of channels, columns of program times).

Let me know if you're interested... As far as the mp streaming stuff, xbmc is already playing back the rtsp stream right? I don't see any need to change this, it works great! I agree though, it would be nice to have more Myth unified PVR info, but it's not there, and development looks stalled. I think if we wait for it, we'll be waiting a LOOOOONG time...

Anyways thanks for your work so far again!
 

jez

Portal Member
November 5, 2008
29
0
Melbourne
Home Country
Nice one. I'll see about getting the patch incorporated into the plug-in source.

I'd love to work on the XBMC side of an EPG. My two main problems are: a) I'm time-poor, and b) I'm very unfamiliar with the XBMC scripting environment. I'd probably start with an EPG from one of the other XBMC scripts, like the MythTV script, and then migrate the back-end calls from MySQL queries to calls to the plug-in on the MP server. This would take some time. The best I can say at this stage is that I'll get to it as soon as I can, but I'd welcome other people taking it on instead.

Yes, you're probably right that XBMC plays the Live TV using RTSP. But the recorded shows are played by accessing the recorded file over SMB, requiring a share to be created on the MP server. It's not a problem, it just would be nice to avoid having the share.
 

Johnmen

Portal Member
January 12, 2009
8
0
Home Country
New Zealand New Zealand
Hi Jez, I wonder if I can get some help from you about your instructions of setting up MP TV server client on XBMC.

I have followed your instructions but I don't seem to get it working.

At the moment I press the XBMC TV server from the Video plugins in the XBMC interface, the screen quickly showed me a window and returned to what it was. I tried it many times and managed to read what is saying in the quick window was: retreived 0 items bluh bluh bluh.

It looks to me that the XBMC TV server client gets nothing when it is being launched. That leads to a question that I can not answer: how to specify the address of the TV server? If that is not needed, how does the XBMC client finds the TV server?

I found under the resources folder there is a settings.xml file, that looks like the setting file that specifies where to find the TV server. But I have question about the TVserver port in that xml file. As my research tells me that media portal tv server doesn't use the port number 9596 that is specified in the xml file.

I tried running the xbmctvserver.exe on the media portal TV server but I got error saying something like TV controller could not be found.

PS, I found two versions of xbmctvserver.dll, one sized 36kb, one sized 19kb. which one is the right one?
 

jez

Portal Member
November 5, 2008
29
0
Melbourne
Home Country
Did you turn on "Enable Debug Logging" in XBMC Settings/System? Not sure if it will give any indication of the problem, but it's worth turning it on to see if anything interesting shows up. The logging all goes into xbmc.log in the XBMC directory. Please don't post it here - I'm unlikely to find anything that you wouldn't. But report back anything that looks sinister.

You configure the plug-in after adding it, by highlighting (but not clicking on) the plug-in by name and bringing up the context menu. In XBMC for Windows that's a right-click on the plug-in name; on XBMC for XBox it's the white button on your controller. From there, choose "Plugin Settings" and you should see a screen asking for hostname, port and sharename.

The settings.xml file you found does not hold the actual settings, and instead defines how the settings page works. It holds the default values as well as GUI object types and numbers. The actual settings used and configured are saved in "XBMC\userdata\plugin_data\video\TVServer\" in a file that's also named settings.xml. You're welcome to change the settings in that file, if you can't find the context menu.

Port 9596 is the port used by the "XBMC TV Server" plug-in for MediaPortal, and not MediaPortal itself. XBMC isn't emulating a MP client, and instead it has to talk to a corresponding plug-in on the MP server. This XBMC-to-MP integration works by having a plug-in at each end, and they talk to each other over port 9596. The MP-side plug-in (the DLL) accepts a connection on port 9596 from the plug-in on the XBMC side, and translates the requests from the XBMC plug-in into MP function calls.

The XBMCTvServer.DLL I have is 36kb, dated 2008-11-14.
 

Johnmen

Portal Member
January 12, 2009
8
0
Home Country
New Zealand New Zealand
Thanks! I tried it. And, I made great progress. I am now able to see the TV channels listed as folders once I click the "MP TV server" within the Video plugins. And if I click any channel, it will show me two items: "Stop Timeshifting" and "steam 1.0". I am now stuck in here. If I click the "steam 1.0" more than one time which I presume I will start the streaming, but I only get:

Paylist playback aborted
Too many consecutive failed items

In fact, by looking into the manual control interface of TV server, I found that at the moment when you click the channel name, the timeshifting is started. In the mean time, a temporary buffer file is created in the timeshifting folder on TV server. I can watch the temporary buffer file if I added that timeshifting folder as one of my video source in XBMC.

Apart from that, I still haven't got the idea how to watch the live tv. :(

Also, the most important part - EPG is still missing. Not sure if that is maximum it can do as far as programming is concerned?
 

toastboy

New Member
January 14, 2009
2
0
Home Country
United Kingdom United Kingdom
great success

I just managed to build the SVN tree into a DLL and get this working between my MP server and xbox using the python plugin.

It's exactly what I was hoping for, huge thanks to the developers. :D

Teething problems are :
- english subs appearing on lots of programs, not sure if this can be switched off in XMBC, still looking [edit] found it - hit "start" on xbox while playing video, select audio options, disable subs
- starting a channel always seems to go back to the start of the timeshift buffer, unless I go to the top of the channel tree and select "stop timeshifting". still fiddling with this to see if I can stop it happening

These are minor annoyances that I'm sure I can find ways around though. Congrats on the progress so far.

[edit]
Thought I'd best try to do something to help people get this working, so I've uploaded an archive to RapidShare and written a simple guide to smooth the installation for others.
http://rapidshare.com/files/183360314/MP_XBMC_PLUGIN.zip.html

1 - Download and extract the archive from the RapidShare link above
2 - Copy TVServerXMBC.dll to "C:\Program Files\Team MediaPortal\MediaPortal TV Server\Plugins" on your MediaPortal server machine.
3 - Run MediaPortal "TV-Server Configuration" on the MediaPortal server
4 - Select plugins and click the checkbox next to "XBMC Server"
5 - Click "OK" to close the config
6 - If you want to watch recorded content, share the recordings dir from your MediaPortal server and make sure the share is named "recordings"
7 - Reboot your MediaPortal server machine (or stop/start the "TV Service" service)
8 - In the "TVServer" directory you extracted from the archive edit the file "TVServer\resources\settings.xml"
9 - Change "192.168.1.2" for the IP address of your MediaPortal Server and save the file
10 - FTP the "TVServer" directory to your xbox into the dir "Plugins\Video" under the XBMC installation directory (e.g. e:\apps\xbmc\plugins\video")
12 - In the XBMC menus, goto "Videos", select "VideoPlugins", "TV Server", "Live TV" then "all channels"
You should see a list of channels and be able to play them. If a channel doesn't work first time, try again as sometimes it fails even with the full MediaPortal Client on a PC.

If the plugin won't show up in XBMC, be sure it's uploaded to the right place (e.g. the "e:\apps\xbmc\plugins\video\tvservice" dir contains default.py, default.tbn, MPTv and Resources) and that you have the latest T3CH XBMC. I tried this on an older version and no videoplugins would work at all.
 

Johnmen

Portal Member
January 12, 2009
8
0
Home Country
New Zealand New Zealand
Good to see you have gone further than I did. I have downloaded your zip file and tried it again, unfortunately I got the exact same result as I did before.

At the moment you click any channel within the "All Channels" folder, the XBMC displayed a short while "retrieving x items" then showed me two folder items:

Stop timeshifting
Stream 1.0

I can see the timeshifting has been started on TV server, but the Xbox still stays in the folder view. Not sure if I should upgrade the MP TV server to version 1.0, I am currently using 1.0 RC3.
 

toastboy

New Member
January 14, 2009
2
0
Home Country
United Kingdom United Kingdom
Johnmen
I'm running 1.0 RC3 also, I really should update but if it ain't broke......

I do see the same behaviour you describe when attempting to view channels about 30-40% of the time, but exiting back to the channel list, then retrying the channel normally works for me. I use the MP TV client 1.3.2 (here: https://forum.team-mediaportal.com/mp-tv-client-262/always-most-recent-binary-download-36229/) on a PC also, and it gives roughly the same result - "no audio/video" on 30-40% of tuning attempts.

I think a small delay between requesting timeshift and playing the stream might help, especially if your MediaPortal server is an older slower machine (mine's a tiddly P3 laptop). I'll fiddle with the python script to introduce a delay and see if it gives any improvement.
 

Users who are viewing this thread

Top Bottom