onPlayBackStarted How to make it work ?
#1
hi !
i tried to use some of the player() class methods
the one i am intersting with is the onplaybackended()
i read in a paper about xbmc's classes (found in the cvs i think) i can read :

onplaybackended() -- onplaybackended method
will be called when xbmc stops playing a file

so, i made this in my script
def onplaybackended():
print 'this is the end !"

def playmusic()
xbmc.player().play(mystreamvideo)

so i thought that after playing my video, it will print 'this is the end' .. but nothing occured !! neither message nor error..

please help ! is this method working ?
Reply
#2
(solexalex @ sep. 20 2004,00:44 Wrote:so, i made this in my script
def onplaybackended():
   print 'this is the end !"

def playmusic()
   xbmc.player().play(mystreamvideo)
hi...

i don't have experience about that onplaybackended() function, but my guess is that you try to print to the console. at least that's what pythons print function does. you should use xbmcgui's textbox or label and use their settext() or setlabel() functions to print to the screen... i hope this helps you mate...
Reply
#3
thx for answer...but it doesn't help Smile
i want to use onplaybackended(), this seems to be part of xbmc and python's stuff (i am a beginner)
if you want to know more and can help me, download here :
http://cvs.sourceforge.net/viewcvs....rev=1.3
in the rar you'll find xbmc.htm in which i found the method onplaybackended() in the class player(.object)
i hope this could help you and all the others to help me Wink
Reply
#4
Quote:in the rar you'll find xbmc.htm in which i found the method onplaybackended() in the class player(.object)
note the last part you write, in the class player!.
so what you have todo is create a new class with player() as it's baseclass (have a look at the python docs if you don't know what a base class is) after that you overide the onplaybackended method with your custom code.
to give you an idea

Quote:class myplayer() : xbmc.player:
 onplaybackended(self):
   print('playback ended')

p = myplayer()
p.play('c:\file')

while(1):
 sleep(500) // sleep 500 msec

you need the while and sleep thing at the end of the code so the script will always run.



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
#5
thankyou
i will turn around your idea.

i'll try to understand everything but hard for me. french doc is rare... and i'm not a 'coder'

see ya
Reply
#6
this is interesting, will this capture the file that xbmc plays...

so could i make a script that constantly runs in the background recording every file that gets played..

ie,

when i navigate xbmc normally and play a movie, will this script be able to capture that and write it to a file?

thanks..
Reply
#7
no
because this is available only when you launched the video or audio or anything, using the player function of xbmc library.
when you will launch your video from xbmc itself, player library will not be used... so you can't use the onplaybackstarted function...

i may be wrong... but i think i'm not Wink
Reply
#8
i had a look at the lyricsscript by enderw, where lyrics are downloaded and displayed after a song change.
the prosedure there is extremely uneffective(i think).
* thread is started
loop
* check the player.getmusicinfotag
if new song do stuff
* sleep
goto loop



Reply
#9
@solexalex
i got the thing working now.
added some music in the playlist, and the events goes to the python script on every music change Smile

so i think it can be used to record every filename played
(did he think about recording the data played? maby i missunderstod it)



Reply
#10
yes ! you're right ! if the function can catch infos with songs or movies in your playlist, then you can make a script that works like you mentioned before, using the onplaybackstarted to do stuff you want (for example logging into a file played songs)
interesting test ! cheers
Reply

Logout Mark Read Team Forum Stats Members Help
onPlayBackStarted How to make it work ?0