playbin2

max.s max.skarberg at gmail.com
Fri Feb 3 01:46:25 PST 2012


ok.. How do I change the delay property to playbin2 ?. The
"self.player.set_property" just take two arguments ("uri"
"file:///PATH.jpg") I cant add delay here.. 

here is some of the code,

/Max


        def strt(self):
                #
------------------------------------------------------------------------------------------
                # check the realise numeber on the server and on the bus
                serverRelease =
open('/home/lucid/server-release/server-release.txt', 'r')
                mediaRelease =
open('/home/lucid/media-release/media-release.txt', 'r')

                serverRelNR = serverRelease.readline()
                mediaRelNR = mediaRelease.readline()

                #
------------------------------------------------------------------------------------------
                # check if the realise numbers are the same if yes play the
videos in the media directory 
                if serverRelNR == mediaRelNR:
                       
#---------------------------------------------------------------------------------------
                        #if the source is supose to be a picture: use the
picture directory
                       
#---------------------------------------------------------------------------------------
                        if self.picture == 1:
                                self.picture = 0

                                self.player.set_property("uri",
"file:///home/lucid/media/article/" + self.pictureSpellista[self.fileNr])
                                #self.player.set_start_time(1)
                                self.player.set_state(gst.STATE_PLAYING)
                                #self.player.set_state(gst.STATE_PAUSED)
                                self.scroll = 0
                                stri =
open('/home/lucid/media/article/textf/' + self.pictureSpellista[self.fileNr]
+ '.txt', 'r' )
                                line = stri.readline()
                                line = line.strip()
                                print line

                                #
-------------------------------------------------------------------------------------
                                # put the screens horizontal space before
the text so it starts outside the screen and scroll from right to left
                                self.label.set_text("                                                 
" + line + "                                                  ")

                                #
-------------------------------------------------------------------------------------
                                # increase the integer filerNr so the next
video can be prepered
                                self.fileNr = self.fileNr + 1

                                #
-------------------------------------------------------------------------------------
                                # show the everything in the application
                                self.window.show_all()


                        else:
                                self.picture = 1

                                if self.updating == 1:
                                        #
--------------------------------------------------------------------------
                                        #       skapa spellista och sätt
self.updating till no
                                        dirpath = "/home/lucid/media"
                                        self.spellista = [s for s in
os.listdir(dirpath)
                                                if
os.path.isfile(os.path.join(dirpath, s))]
                                        self.spellista.sort(key=lambda s:
os.path.getmtime(os.path.join(dirpath, s)))

                                        self.updating = 0
                                        print self.spellista
                                        #
----------------------------------------------------------------------------

                                        #
--------------------------------------------------------------------------

                                        #       skapa pictureSpellista
                                        dirpath =
"/home/lucid/media/article"
                                        self.pictureSpellista = [s for s in
os.listdir(dirpath)
                                                if
os.path.isfile(os.path.join(dirpath, s))]
                                       
self.pictureSpellista.sort(key=lambda s:
os.path.getmtime(os.path.join(dirpath, s)))
                                        print self.pictureSpellista
                                        #
---------------------------------------------------------------------------
                                        self.fileNr = 0

                                self.player.set_property("uri",
"file:///home/lucid/media/" + self.spellista[self.fileNr])
                                self.player.set_state(gst.STATE_PLAYING)
                                self.scroll = 0
                                stri = open('/home/lucid/media/textf/' +
self.spellista[self.fileNr] + '.txt', 'r' )
                                line = stri.readline()
                                line = line.strip()
                                print line

                                #
-------------------------------------------------------------------------------------
                                # put the screens horizontal space before
the text so it starts outside the screen and scroll from right to left
                                self.label.set_text("                                                 
" + line + "                                                                                                                 
")

                                #
-------------------------------------------------------------------------------------
                                # increase the integer filerNr so the next
video can be prepered
                                self.fileNr = self.fileNr + 1

                                #
-------------------------------------------------------------------------------------
                                # show the everything in the application
                                self.window.show_all()

                else:
                        #
-------------------------------------------------------------------------------------
                        # if the bus do not update and the realise numbers
are different then update.
                        if self.updating == 0:

                                #
----------------------------------------------------------------------------                  
                                # run the rsyncscript in the background to
sychronize media from the server
                                os.system("/home/lucid/./updatemedia.sh")
                                # ------------------------
                                # set the update bool to 1
                                self.updating = 1

                        self.player.set_property("uri",
"file:///home/lucid/reklam/reklam.mov")
                        self.player.set_state(gst.STATE_PLAYING)
                        self.window.show_all()



        def on_message(self, bus, message):
                t = message.type
                if t == gst.MESSAGE_EOS:

                        #-------------------------------
                        #If its a picture displayed..
                        #-------------------------------
                        if self.picture == 0:
                                self.waitTime.start()

                        else:

                                self.player.set_state(gst.STATE_NULL)
                                self.label.set_text("")
                                #
-------------------------------------------------
                                # if all the videofiles has been played:
start over..
                                if self.fileNr >= len(self.spellista):
                                        self.fileNr = 0

                                if self.hidden == 1:
                                        self.window.hide_all()
                                        self.hidden = 0

                                        self.player.set_property("uri",
"file:///home/lucid/reklam/filmbild.3gp")
                                       
self.player.set_state(gst.STATE_PLAYING)
                                else:
                                        self.hidden = 1
                                        self.strt()


                elif t == gst.MESSAGE_ERROR:
                        self.player.set_state(gst.STATE_NULL)
                        self.label.set_text("")
                        err, debug = message.parse_error()
                        print "Error: %s" % err, debug
                        # if all the videofiles has been : start over..
                        if self.fileNr >= len(self.spellista):
                                self.fileNr = 0

                        self.strt()

  

--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/playbin2-tp4348783p4354116.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list