Posts: 1,331
Joined: Jan 2008
Reputation:
3
rwparris2
Team-XBMC Python Developer
Posts: 1,331
use the player class in the xbmc module.
look at my lasttube plugin (link in sig), it has a class that watches for videos to play.
In a script (as opposed to a plugin), you probably won't need the same kind of while loop to keep it alive, but you'll have to play around to figure that out.
also this may not work if you followed the wiki link, since the "video" will not actually play. better thing to do would be to make a real .avi a few seconds long so that the player class can work.
off the top of my head, I think the best thing to do would be put all your short 1-2 second .avi files into one folder called /dvd/ or something like that, then use something like (pseudocode) if self.getTotalTime() == 2 : eject
no idea about ejecting the drive, it seems like there is a builtin or httpapi to do that, but I can't remember.
Posts: 16
Joined: Dec 2008
Reputation:
0
Thanks for the reply. I did create an .avi to use, it is a 10 sec clip that tells you to insert the DVD.
I also found the section of the script from your plugin, that deals with watching for movies to play. I have to admit though, my python skills are somewhat rudimentary and I have no idea how to interface them with xbmc. I know I can eject the drive, by using the linux command 'eject' so using subprocess, I can run that from a python script. What I cannot figure out is how to find the length of the movie, to see if I need to call the eject command.
Posts: 116
Joined: Dec 2008
Reputation:
1
If you put all your offline 'videos' in a folder called /dvd/ then could you just check if the source folder for the video is /dvd/ and if so run the eject command?
I don't know too much about python (trying to learn), but since all your offline videos will be in one folder it doesn't matter if you check the video length. There should be a way to check the source path via python. This won't work if you put your offline videos in with your online videos folder.
Posts: 74
Joined: Feb 2010
Reputation:
0
I currently have a script (that turns my HT lights off and back on) mapped to the play and pause/stop button on my remote. Lately I've been using the XBMC Commander app to play my movies but this uses the HTTP API to do so, not an actual remote command. Therefore is there somewhere in a system script/file I can place my "lights off" shell script, or commands, so that it's always executed when a movie is played or stopped? Is this only possible by having a python script run continuously in the background or something?
Thanks.
Posts: 39
Joined: May 2010
Reputation:
0
2011-01-06, 22:52
Just wondering if it's possible to have the RunScript function triggered when a video stops playing?
I'd like to have a python script run at the 95% mark (ideally) or when a movie stops playing altogether, is this possible?
Thanks!
Km.
Posts: 2,145
Joined: Jul 2008
Reputation:
12
Look at what the trakt.tv guys are doing since this is what they're doing.
Code:
GRANT ALL PRIVILEGES ON `xbmc_%`.* TO 'xbmc'@'%';
IF you have a mysql problem, find one of the 4 dozen threads already open.
Posts: 7
Joined: Mar 2017
Reputation:
0
Hello,
Sorry for resurrecting an old post, but my goal is similar. I have an nvidia shield, an harmony ultimate remote, a 4k bluray player and domoticz which can control harmony... In fact, this means i can eject my 4k player drive with a simple url "http..." thanks to domoticz.
I want kodi to eject my 4k drive when i play a short video in the folder "4K Bluray". How to modify torianironfist's script to launch my url, saying domoticz to eject my drive ?
And where do I place the "eject.py" script ?
Thanks for your help, hope i'm not confusing with my request !