def on_media_started(self, evt): ''' 设置图像调入后暂停, 隐藏窗口, 恢复窗口大小 ''' if self.pause: #读取节目时长 log(u'媒体播放事件开始',logs=mcon.logs) self.moviename = '' try: self.moviename=unicode(self.mpc.filename, 'utf-8') except Exception, ex: errlog(u'开始取播放文件名称出现错误', ex, sys.exc_info()) log(u'媒体播放事件开始'+self.moviename,logs=mcon.logs) self.mpc.Pause() self.mpc.Osd(0) log(u'开始取播放文件时长',logs=mcon.logs) self.movielen=0 try: self.movielen=self.mpc.GetTimeLength()*1000 #如果模拟测试节目非正常停止取消注释 #self.movielen+=1000000 except Exception, ex: errlog(u'开始取播放文件时长出现错误', ex, sys.exc_info())
log(u'影片长度:'+unicode(str(self.movielen)) ,logs=mcon.logs) self.mpc.Seek(0, 2) self.mpc.FrameStep() self.Hide() self.SetSize(wx.Size(mcon.winw,mcon.winh)) else: #第一个播放的节目 log(u'第一个播放的节目 ',logs=mcon.logs) try: self.movielen=self.mpc.GetTimeLength()*1000 self.movietime.Start(self.movielen-mcon.cutclip,True) log(u'影片长度:'+unicode(str(self.movielen)) ,logs=mcon.logs) except Exception, ex: errlog(u'开始取播放文件长度时出现错误', ex, sys.exc_info()) try: self.moviename=unicode(self.mpc.filename, 'utf-8') log(u'开始播放影片:'+self.moviename ,logs=mcon.logs) except Exception, ex: errlog(u'开始取播放文件名称出现错误', ex, sys.exc_info()) self.pause=True self.par.PreLoad() def OnTimerEvent(self,evt): log(u'影片计时器时间到,开始准备调用DoNext()',logs=mcon.logs) self.par.curprogramid += 1 log(u"curprogramid:"+unicode(self.par.curprogramid),logs=mcon.logs) log(u"oldprogramid:"+unicode(self.par.oldprogramid),logs=mcon.logs) self.par.DoNext()