Running python-scrips from "My Videos"
#1
hi, i would like to be able to run my python scripts (especially those which stream in media) from the my videos section of xbmc. i put in a bookmark link to a special folder containing various scripts (such as cnn and ooba) and added .py to the list of supported file extensions that videos can access. however, when i select a script xbmc freezes, how would i enable this feature? is this something i can reconfigure? the main basis is that i don't like having my media in different places, i often go from switching between streaming media and locally stored media and would not like to have to go searching all over the media centre to find it. any help would be greatly appriceated as this has been bugging me for quite some time. thanks!
Reply
#2
this is normally impossible but i do have a guess you could hack up something with an httpapi command going to the webserver (embed the command in the url) to run the script and then put the url into a .strm file. when the xbox tries to open the url for streaming it tricks the webserver into launching the script.

im not sure it will work though... i doubt the player would be happy.

glad you are using the cnn script Smile
Reply
#3
hi
i found the asteron idea interesting ! so i tryed to write the http command that launch a script :
Quote:http://192.168.0.3/xbmccmds/xbmchttp?command=execbuiltin&parameter=xbmc.runscript(q:\scripts\cnn\cnn.py)
this http command work from my pc (it launchs the script on xbox)
then i tried to write this url into a .strm file but it hangs xbmc when i try to launch the strm file.

maybe is there a way to call xbmc http server from itself by replacing the xbox ip by a substitue ip adress meaning the xbox itself (like for windows 127.0.0.1 but it does not work)

hey ! another idea (simpliest in fact !!Wink
try to write the builtin command as your bookmark in your video section :
Quote:xbmc.runscript(q:\scripts\meteo\france-meteo07.py)
but i did not tryed this trick (my girlfriend starts to hit myself with the remote control... Sad )
try it, and tell us !

nb: most of scripts use the os.getcwd() function to get the current path (for relative file paths). i don't really know how these scripts will run if they are not launched from the folder where they stand... so, once again, you should try it
Reply
#4
i asked for this as a feature request for v2.0 of the skinning engine. please ask jm for this. i really want this too!
I'm not an expert but I play one at work.
Reply
#5
did somebody tried my trick ?
Quote:xbmc.runscript(q:\scripts\meteo\france-meteo07.py)
Reply
#6
(solexalex @ jan. 22 2006,17:08 Wrote:nb: most of scripts use the os.getcwd() function to get the current path (for relative file paths). i don't really know how these scripts will run if they are not launched from the folder where they stand... so, once again, you should try it
all the scripts that get launched from dialogsubmenu.xml are launched with the builtin command. should be fine.
Reply
#7
to answer the original question:

Quote: hi, i would like to be able to run my python scripts (especially those which stream in media) from the my videos section of xbmc. i put in a bookmark link to a special folder containing various scripts (such as cnn and ooba) and added .py to the list of supported file extensions that videos can access. however, when i select a script xbmc freezes, how would i enable this feature? is this something i can reconfigure? the main basis is that i don't like having my media in different places, i often go from switching between streaming media and locally stored media and would not like to have to go searching all over the media centre to find it. any help would be greatly appriceated as this has been bugging me for quite some time. thanks!

you can add a button to all windows in the skin, or just map a remote button in keymap.xml to do this:

xbmc.activatewindow(scripts)
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.
Reply
#8
i'll add that to a feature suggestion. it's easy to just map a button to scripts and push it, what i am more looking for is the ability to say view the xm radio py from within my music section and the say cnn.py from within the my videos section. the thought of adding python scripts is great, but most of these scripts just add functionality to an already existing feature set. why go to different places in the program to access the same features. pictures videos and music, streaming or not, should still in my opinion be accessed from the same area. it seems to me that if you took the same code that executes the py script and just pasted that into the code that plays the video it just might work.
Reply
#9
interesting idea about the windows like local ip address (127.0.0.1). i think this would be useful for several things. ie i would like ot have a rss crawl appear on my main screen weather or not i am connected to the internet. a local rss file with random information even if it is not grabbed from the internet would still be fun.... or is this already possible?
Reply
#10
the ability to run a .py script from within the 'my videos', 'my music' and other sections would be very useful. i find it rather a pain that when i am watching local media on my xbmc i go to the my videos section and click my media, however when i want to watch streaming media i then have to go back to the scripts menu and select from there. it would be much easier to just have a bookmark, like a channels section, that is in the same area but allows py scriupts to run. so i can go from watching a music video locally on my hard drive to watching one off launch.com with ease.
Reply
#11
you can already add buttons which launch scripts from anywhere in the gui.
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.
Reply
#12
first off, you can add a button to launch any script, anywhere in the gui.

second, you may be able to run a local rss if the the internal webserver is enabled. i've never tried, but i suspect it's possible.
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.
Reply
#13
as was mentioned earlier, you can do this with a button, but you cannot do it within the list. the only place it would make sense in the list anyway would be in the root bookmarks listing, and so you mayaswell just make a button that does it.

use:

<execute>runscript(name_of_script)</execute>

to run a script from a button.
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.


Image
Reply
#14
i understand i can make a button to do this, however what i was looking for was say just add a bookmark of a folder containing py scripts, open that folder (just like a folder of say music videos) and it has the icons for the different scripts, and you can click on the py from there.
Reply
#15
while ofcourse this is possible, it defeats the purpose of having separated items.

it would involve adding .py as a video extension and any video-specific launching code would need to be altered to suit. any non-video related .py files would show up as well.

feel free to do it yourself and submit a patch.
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.


Image
Reply

Logout Mark Read Team Forum Stats Members Help
Running python-scrips from "My Videos"0