Kodi Community Forum
Python and MythTV (a MythTV Front-End) - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Python and MythTV (a MythTV Front-End) (/showthread.php?tid=2349)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39


- elminster - 2005-01-04

am i correct in saying that the latest cvs of mythtv is using protocol 14?

because the above python scripts are built for protocol 13 right?

any one able to shed some light on this?


- iawia - 2005-01-04

(elminster @ jan. 04 2005,10:36 Wrote:am i correct in saying that the latest cvs of mythtv is using protocol 14?

because the above python scripts are built for protocol 13 right?
yes, the scripts work only up to protocol version 13, from what i've seen.
i installed a new xbmc (1.1 release) and the 0.9 mythtv scripts yesterday.
the scripts do work partly (if you use the settings to set the protocol version to 14), allowing you to browse the tv guide (with some weird overlapping text effects, though), and to take a look at the recorded programs.
it wasn't possible to play any recordings, though, giving me a 'not allowed for this protocol version' error. not that it would've worked, since i still record with a simple bttv card, and have either mpeg1 or mpeg2 streams in my .nuvs.

i would be intereseted in getting the mplayer patch for myth .nuvs working, which means i'll probably will have to install windows somewhere to compile it.
does anyone know if it's possible to load libraries/call external programs from within a xbmc python script?
i'll start reading docs...


- cyberplague - 2005-01-04

(euphorical @ dec. 30 2004,00:41 Wrote:i had a play for a couple of hours to try and get livetv working...(almost)

1. i added setup and config for a livetv samba folder to point to the myth livetv buffer folder
2. added a extra menu item
3. i figured out the commands to start a live recording..steps are:
"get_next_free_recorder"
"query_recorder 1[]:[]setup_ring_buffer"
"query_recorder 1[]:[]spawn_livetv"
4. display the stream:
file = 'smb://10.0.0.120/livetv/ringbuf1.nuv'
xbmc.player().play(file)
which works fine...very smooth etc

the myth protocol is pretty simple to understand, just a case of tracing the c source.
so, bascially i've got stuck at xbmc stuff...how would you capture a button press to display a osd with guide data and then allow the changing of the channel...

if anyone wants to see my random hacks, i've uploaded them to:
http://www.comp.lancs.ac.uk/computi....tch.zip
but its just proof-of-concept, not even close to a proper livetv option...
great work figuring atleast that much out. but if i remember correctly the issue was that once you started playing the live buffer there was no way for python to capture the input and/or display some kind of osd...

please someone correct me if i am wrong...

cp


- iawia - 2005-01-04

(cyberplague @ jan. 04 2005,16:45 Wrote:great work figuring atleast that much out.  but if i remember correctly the issue was that once you started playing the live buffer there was no way for python to capture the input and/or display some kind of osd...

please someone correct me if i am wrong...

cp
i haven't tried the script, but from the post it looks like the script just tells myth to start 'live tv' mode for a certain channel, and then points xbmc to the (smb mounted) file containing the ringbuffer. that way, python doesn't have to play anything!


- EuphoricaL - 2005-01-04

hi guys, i've packaged some of my changes at:
http://www.comp.lancs.ac.uk/computing/users/leek/xbmc_mythtv-0.15.zip
to try it out just overwrite the python and scripts folders as usual.

live tv now bascially works, with a simple interface allowing changing channel up and down and some channel numbers.

to get live tv working, export your mythtv livetv folder in samba the same as recordings. use the settings panel to set the correct share. you can now go to the livetv option and switch livetv on and off, change channel up and down, channel numbers and start viewing the stream. because of the lack of any osd, you have to press stop or display to access the interface to change channel etc...

i've also added support for myth protocol 14, which is current mythtv cvs.

if anyone wants to have a go at other bits, these are the things that need to be done:
scheduling working...
delete doesn't work anymore
parsing channel data from database and use this as basis for livetv selection.
osdHuh
improve livetv stuff so it uses getnextfreerecorder, for people who have more than one card and also recordinginprogress

i honestly don't think it would be a huge amount of work to get these scripts pretty much finished (bar osd), i'll carry on hacking, but i don't have a huge amount of time.


- juski - 2005-01-04

deleted my drivel Confused


- EuphoricaL - 2005-01-04

i noticed the stream corruption when changing channel in the version i just posted...
i've been getting round this by just pressing stop when i want to change a channel, this could be automatic in a osd. mythfrontend does stop the playback whilst changing channel. if mythfrontend can do it, we can in xbmc...

it would be nice as a start to press the select button during playback and get a small window over the video the same as the livetv panel i've done for changing channel.


- juski - 2005-01-04

i don't know what exactly goes on in xbmc when a file is playing, but i suspect that it'd be possible to trap remote keypresses & overlay something on top of the video.

i don't think mplayer (which xbmc uses to play files) monitors for key presses - all it probably does is do what xbmc tells it to do - so as far as i know, xbmc traps & interprets the keypresses itself, then relays commands to the player.

one thing which could possibly upset all of this is the stream corruption when you change channels. i've tried playing the ringbuffer in mplayer on my windows pc while the mythfrontend runs on my linux box - changing channels broke the stream so much that mplayer had to be restarted. maybe you'd have to stop playing the ringbuffer before issuing the command to change channels, then wait for a while before restarting playback of the live stream. i suspect that's what the mythfrontend does. i've not looked at the source for the frontend yet, but it looks like that's what happens.

(drivel undeleted) Wink

>>> dives into the xbmc code for a while....


- juski - 2005-01-04

silly question time. is xbmc based almost entirely on python? apart from the obvious things like mplayer i mean.

i've been trawling though the install folders & i can't find anything which actually does anything. i'm assuming that all the core stuff is in the archive in the main python folder, yes?

i couldn't find a util to let me take the archive apart so now i'm downloading the xbmc source. i feel very naughty now!!


- EuphoricaL - 2005-01-04

i second the confusion...i'd like to know where the api for the xbmc python scripts are.
i.e. things like:
xbmc.player().play(file)
anyone any idea?

edit:
i found the apis at /docs/python folder of the 1.1.0 xbmc
they are a bit thin :-(


- juski - 2005-01-04

(euphorical @ jan. 04 2005,20:38 Wrote:i second the confusion...i'd like to know where the api for the xbmc python scripts are.
i.e. things like:
xbmc.player().play(file)
anyone any idea?

edit:
i found the apis at /docs/python folder of the 1.1.0 xbmc
they are a bit thin :-(
i've got the sourcecode now & i'm going through the whole lot searching for xbmc.player to find out where it's mentioned.

from what i've seen of the code so far there's not much in the way of comments :-(


- juski - 2005-01-04

nuts.

i've looked through the source quite a bit, and although i can't find any mention of xbmc.player i've noticed that all the player actions are in the main sourcecode - that is to say i've not found a single instance where a python script controls the player.

but i found an itunes.py for xbmc and gleaned something useful... have you tried xbmc.player().stop() for stopping the playback between channel changes?

and i don't know if you've seen this yet... http://www.xboxmediaplayer.de/cgi-bin....;st=150


- EuphoricaL - 2005-01-05

using xbmc.player().stop() will stop the buffer problem :-)

dreambox looks to be a similar style thing to ours...
from the screenshots, looks if they just minimise the video to use the control, i suppose this isn't a bad solution. my pioneer stb does this for the full epg.

so its just a case of parsing available channels and cleaning up the interface a bit...

i was debating combining the schedule with the livetv panel, so you could go to the guide then use the listing to select a channel or create a recordind.


- juski - 2005-01-05

good plan.

i've been thinking though that it must be possible to have a window where there's a small video portal and an epg. after all if we play a video from my videos etc then hit menu you can see a small video window and the onscreen menu... tantalising isn't it?

i've not yet had a chance to try out your latest script - do you draw the dialogs on top of the video window while it's playing?

edit:

just had a try of the new scripts - live tv doesn't work. the backend starts the ringbuffer etc but when i press the button on xbmc to watch livetv nothing happens.


- EuphoricaL - 2005-01-05

if the backend starts the ringbuffer and starts livetv, check your getting data in the livetv file (ringbuf1.nuv). if you are then the problem is with the setup of the livetv samba share. check your settings for the livetv folder on the server and xbmc settings.