run python script before play
#1
there is a way to run a python script before playback ?

i tryed this

Code:
import xbmc

class MyPlayer(xbmc.Player):

    def __init__( self):
    xbmc.Player.__init__(self)

    def onPlayBackStarted(self):
    exe = "C:\\Users\\xxx\\AppData\\Roaming\\XBMC\\addons\\service.myaddon\\xbmc_ffaudio.exe"
    file = self.getPlayingFile()
    xbmc.executebuiltin('XBMC.System.ExecWait("%s" -f "%s" -p ffdaudio24p)' % (exe,file))    


player = MyPlayer()


while(not xbmc.abortRequested):
    xbmc.sleep(100)

but didn't work properly because my program (xbmc_ffaudio.exe) and playback run togheter

i wanna find a way to run exe, waiting for the complete execution and then run the playback

p.s.

the final purpose is change the delay in ffdshow audio setting when there is a video in 24p

my exe check the file and set a determinate profile.

(in ffdshow there is not a condition to set a profile with a determinate fps :|)
Reply
#2
Code:
import xbmc

class MyPlayer(xbmc.Player):

    def __init__( self):
    xbmc.Player.__init__(self)

    def onPlayBackStarted(self):
    exe = "C:\\Users\\xxx\\AppData\\Roaming\\XBMC\\addons\\service.myaddon\\xbmc_ffaudio.ex​e"
    file = self.getPlayingFile()
    self.stop() #to stop the playback
    xbmc.executebuiltin('XBMC.System.ExecWait("%s" -f "%s" -p ffdaudio24p)' % (exe,file))    
    self.Play() #to play the file again after ^^ has finished or it might have to be self.Play(file)

player = MyPlayer()


while(not xbmc.abortRequested):
    xbmc.sleep(100)

untested, but you get the idea
Reply
#3
hi

thx for the reply

i tryed some solution but there is too may problem in this way

the first biggest problem is that with self.stop() and then self.play()

i lose the resume function and other things like change tv refresh before play

so maybe override the onplayback function is not this big idea

i think i have to manage something in the skin to execute my program before playback
Reply
#4
ok i find i way to make this work ok

i edited my DialogVideoInfo.xml file of my skin

adding <onload>runscript(blablabla)</onload>

so in this way when i'm enter in movie information xbmc runscript with execution of my program
Reply

Logout Mark Read Team Forum Stats Members Help
run python script before play0