XBMC Community Forum  

Go Back   XBMC Community Forum > Development > Plugin/Script (Python) Development

Plugin/Script (Python) Development Developers forum for XBMC Python Plugins/Scripts. Scripters/coders only!
Not for posting feature requests, bugs, or end-user support requests!

Reply
 
Thread Tools Search this Thread Display Modes
Old 2004-03-23, 22:10   #1
madtw
Senior Member
 
Join Date: Mar 2004
Posts: 174
madtw is on a distinguished road
Default

i recently setup mythtv and am waiting for my pvr-250 tv tuner card to arrive. while i wait, i have setup the xbox version of mythtv that runs linux but was a bit disappointed. it takes a long time to boot up and a lot of the features are already handled by xbmc (e.g. weather, games, music, videos, dvd). the only additional feature that i currently want to use is the ability to view recorded tv shows, program recordings, delete recordings, look at tv schedule. as a result, i started playing with the python interpreter in xbmc.

after writing some scripts, i have a few questions. i'm new to python (just learned it on the weekend) so if the language supports something natively, i might not have discovered this yet so go easy on me.

1. does the xbmc version of python provide hooks to access smb shares natively? i found a pure python implementation of the smb client side protocol and have been able to get that working nicely but i was just wondering if there already exists a way to do this? i know that xbmc.player() can access files over smb shares if the "url" is constructed properly but i haven't found a way to do this using, for example, nt.listdir(dir).

2. xbmc obviously parses xml. is this exposed anywhere in the python interpreter? in order to bootstrap to the mysql database, i need a place to store the hostname, database name, user, and password. i was thinking of adding this to my xboxmediacenter.xml file. if there was a way for python scripts to get access to the parsed config file or to call the xml parser on a file, that would be handy.

3. does anyone know of a pure python mysql client interface module? in order to learn python, i wrote a python module that supports connecting and authenticating to mysql over a socket, select, insert, update, and deleting of rows in the database, creating and dropping databases. it does what i need it to do and i'm willing to contribute this to the project... but i'd like to add some more documentation to it and use it in a useful script so that i can make sure i'm happy with the api. if there already exists such a beast, then there's no point in me working any further on it.

4. i ran into a weird problem with the following code:

Quote:
import xbmc

filename = "smb://banshee/videos/foobar.avi"
xbmc.player().play(filename)
the avi starts to play as expected but when i hit stop on the xbox remote, the screen goes black and the xbmc interface never comes back. i haven't waited to see what happens when the entire avi finishes. i am using the march 9, 2004 build... is this a known problem? if you replace the avi file with a mp3 file, it seems to work fine. any ideas?

5. someone mentioned in the forum about having buttons bound to python scripts... it would be fantastic if a user could add a button to the main xbmc menu (e.g. mythtv) that launches a python script. at the moment, the only way i could launch my scripts is to go into the settings ->scripts screen and pick the name of my script. i tried creating a shortcut to the python script so that i could pick the shortcut under programs but this did not work. i tried placing my python script in an apps folder but it didn't work either. is there any other way to launch a python script other than through the settings screen?

keep up the great work on the python interface! the possibilities are endless...
madtw is offline   Reply With Quote
Old 2004-03-23, 23:54   #2
darkie
Team-XBMC Developer
 
Join Date: Sep 2003
Posts: 530
darkie is on a distinguished road
Default

Quote:
1. does the xbmc version of python provide hooks to access smb shares natively? *i found a pure python implementation of the smb client side protocol and have been able to get that working nicely but i was just wondering if there already exists a way to do this? *i know that xbmc.player() can access files over smb shares if the "url" is constructed properly but i haven't found a way to do this using, for example, nt.listdir(dir).
no, this is not possible.
Quote:
2. xbmc obviously parses xml. *is this exposed anywhere in the python interpreter? *in order to bootstrap to the mysql database, i need a place to store the hostname, database name, user, and password. *i was thinking of adding this to my xboxmediacenter.xml file. *if there was a way for python scripts to get access to the parsed config file or to call the xml parser on a file, that would be handy.
python has some xml parser modules in it's library but i haven't add those yet to python for xbmc (just forgot to add it, but will do it soon).
if you read some documentation on www.python.org you will see that there is support for xml files.
Quote:
3. does anyone know of a pure python mysql client interface module? *in order to learn python, i wrote a python module that supports connecting and authenticating to mysql over a socket, select, insert, update, and deleting of rows in the database, creating and dropping databases. *it does what i need it to do and i'm willing to contribute this to the project... but i'd like to add some more documentation to it and use it in a useful script so that i can make sure i'm happy with the api. *if there already exists such a beast, then there's no point in me working any further on it.
there is a pure mysql python client but it is only available as a python dll module. and if there is only one big problem left for python it is loading dll modules and especially if they are not compiled for the xbox. so currently not possible.
and if you want to share what you already have, please. i think a lot of other user find this usefull.
Quote:
the avi starts to play as expected but when i hit stop on the xbox remote, the screen goes black and the xbmc interface never comes back. *i haven't waited to see what happens when the entire avi finishes. *i am using the march 9, 2004 build... is this a known problem? *if you replace the avi file with a mp3 file, it seems to work fine. *any ideas?
fixed in current cvs
Quote:
5. someone mentioned in the forum about having buttons bound to python scripts... it would be fantastic if a user could add a button to the main xbmc menu (e.g. mythtv) that launches a python script. *at the moment, the only way i could launch my scripts is to go into the settings ->scripts screen and pick the name of my script. *i tried creating a shortcut to the python script so that i could pick the shortcut under programs but this did not work. *i tried placing my python script in an apps folder but it didn't work either. *is there any other way to launch a python script other than through the settings screen?
binding scripts to buttons is possible. have a look at cvs/skinning.txt. somewhere at the end of the document there is this
Quote:
button control:

*<control>
...
...
<script>q:\scripts\update_tvguide.py</script>
*</control>
__________________
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


darkie is offline   Reply With Quote
Old 2004-03-24, 02:50   #3
stickman
Junior Member
 
Join Date: Mar 2004
Posts: 27
stickman is on a distinguished road
Default

i've been thinking about this for some time. recently i suggested adding mythtv frontend support as a feature, but maybe it will be possible to implement at least the main features through python.

i assume you already might know this, or maybe there's even better documentation, but i'll link it anyway.

as soon as you have some working code i'll beta test it for you and i'll try to help to improve it
stickman is offline   Reply With Quote
Old 2004-03-24, 11:16   #4
madtw
Senior Member
 
Join Date: Mar 2004
Posts: 174
madtw is on a distinguished road
Default

thanks darkie for the quick reply and the info.

stickman thanks for the info. at the moment, i'm focusing on getting access to the mythtv information in the database without using the mythtv protocol. the main driver for this is so that i can watch recorded shows without firing up the full blown linux mythtv frontend on the xbox. also, i'd like to be able to view tv listings on the xbox and since mythtv has it all in the database already, i might as well grab it from there instead of hitting zap2it again.

eventually, i'd like to get scheduling, etc. working... so at some point i'll have to delve into the protocol.

anyway, for those interested, here is a tar file containing the mysql python module that i wrote... it also includes the pysmb modules for accessing smb/cifs remote file systems.
madtw is offline   Reply With Quote
Old 2004-03-24, 14:01   #5
alx5962
Senior Member
 
Join Date: Jan 2004
Posts: 174
alx5962 is on a distinguished road
Default

as i said in another topic, i managed to read the listing.xml created by xmltv but there's a bug in thecurrent version of¨xbox python that prevents it to work. but darkie said he will fixes this soon.
alx5962 is offline   Reply With Quote
Old 2004-03-27, 00:54   #6
Hullebulle
Fan
 
Join Date: Sep 2003
Posts: 1,972
Hullebulle is on a distinguished road
Default

Quote:
Originally Posted by (alx5962 @ mar. 24 2004,13:01)
as i said in another topic, i managed to read the listing.xml created by xmltv but there's a bug in thecurrent version of¨xbox python that prevents it to work. but darkie said he will fixes this soon.
i think it is ficxed already.

cvs-note:
24-03-04 added: pyexpat module to python, should fix all those (pyhon) xml problems
__________________
read the xbmc online-manual, faq and search the forums before posting! do not e-mail the xbmc-team asking for support!
read/follow the forum rules! note! team-xbmc never have and never will host or distribute ms-xdk binaries/executables!
Hullebulle is offline   Reply With Quote
Old 2004-03-29, 07:24   #7
jswu
Junior Member
 
Join Date: Mar 2004
Posts: 20
jswu is on a distinguished road
Default

i think this is great idea. thank you for doing this.

i can help test the scripts for you but i only have the xbmc build from 3/9/2004.
jswu is offline   Reply With Quote
Old 2004-03-29, 08:19   #8
madtw
Senior Member
 
Join Date: Mar 2004
Posts: 174
madtw is on a distinguished road
Default

Quote:
i can help test the scripts for you but i only have the xbmc build from 3/9/2004.
i wasn't sure by your comment if you meant the xml stuff or if you meant the mythtv stuff. if you want to test the mythtv stuff, i started on the 3/9/2004 build and i think it is fine or at least as good as the 3/16/2004 build. i switched to the unofficial 3/16/2004 build hoping that it would include the stuff that darkie added but it didn't.

oh well... patience.
madtw is offline   Reply With Quote
Old 2004-03-29, 08:37   #9
jswu
Junior Member
 
Join Date: Mar 2004
Posts: 20
jswu is on a distinguished road
Default

Quote:
i wasn't sure by your comment if you meant the xml stuff or if you meant the mythtv stuff. *if you want to test the mythtv stuff, i started on the 3/9/2004 build
i meant the mythtv stuff. i downloaded the 0.2 xbmc-mythtv files from your site, and was able to get everything running. i needed to install the python.rar files. i also needed to include the username/password for the tv recording folder on my mythtv box in the mytv.xml smb setting.

excellent work! it was able to query the mysql db and get a list of recorded tv programs and access the tv program share when i selected a program. but a couple issues:
1. when you select a program, it starts playing (you can hear the audio) but it does not display the video. you have to press x or display to see the video playing.
2. when i press stop or reach the end of the video, the whole thing freezes and the screen goes black. i can't get back to xbmc or play the tv program anymore.
jswu is offline   Reply With Quote
Old 2004-03-29, 18:01   #10
madtw
Senior Member
 
Join Date: Mar 2004
Posts: 174
madtw is on a distinguished road
Default

Quote:
1. when you select a program, it starts playing (you can hear the audio) but it does not display the video. you have to press x or display to see the video playing.
yeah, i've noticed that too... there isn't much that i can do about it in the script as far as i can tell (maybe someone can correct me if i'm wrong). i think it is an xbmc issue in that it sets focus to the python script window instead of the player screen even though the python window was closed in the code. it might also be related to the window close issue i posted about earlier... where the window seems to get events even after a close. darkie any ideas on what i can do in the python code to fix this?

Quote:
2. when i press stop or reach the end of the video, the whole thing freezes and the screen goes black. i can't get back to xbmc or play the tv program anymore.
this is a known issue with python. darkie said that it has been fixed in cvs but we need to get a new build of the python library to fix the problem. hopefully someone will do that soon...
madtw is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MythTV front-end client built-into to XBMC falser XBMC Feature Suggestions 667 2009-10-20 02:05
Xbmc as a mythtv front end thayne XBMC General Discussion 2 2005-01-26 13:55
Xbmc as a mythtv front end thayne Plugin/Script (Python) Help and Support 2 2005-01-26 13:55
Mythtv ppcblaster XBMC for Xbox Specific Support 2 2004-12-29 00:06
www.mythtv.org phiberz XBMC Feature Suggestions 5 1970-01-01 02:00


All times are GMT +2. The time now is 11:53.


Protected by Akismet, We recommend WordPress blogs
Copyright © 2008, XBMC Project