def seekstarttime(self, start): starttime = str2time(start) if self.hasmediafile and starttime <= self.duration: self.player.seek_simple(gst.FORMAT_TIME, gst.SEEK_FLAG_FLUSH, starttime) self.player.set_state(gst.STATE_PAUSED)
def on_buttonpreview_clicked (self): self.splitchoose = SplitNotChosen self.ui.lineeditstarttime.setEnabled (False) self.ui.lineeditendtime.setEnabled (False) starttime = str2time (self.ui.lineeditstarttime.text()) stoptime = str2time (self.ui.lineeditendtime.text()) if starttime < 0 or stoptime <= starttime: msg = CommonError (self.tr ("Start time or stop time invalid.")) msg.exec_() self.ui.buttoncancelbrowse.clicked.emit() return self.player.setloopsignal.emit (self.ui.lineeditstarttime.text(), self.ui.lineeditendtime.text()) self.ui.buttonpreview.hide() self.ui.buttoncancelbrowse.show()
def on_buttonsave_clicked (self): if not self.playerfile: return self.splitchoose = SplitNotChosen starttime = str2time (self.ui.lineeditstarttime.text()) stoptime = str2time (self.ui.lineeditendtime.text()) duration = stoptime - starttime if starttime < 0 or duration <= 0: msg = CommonError (self.tr ("Start time or stop time invalid.")) msg.exec_() return if self.ui.checkboxleadertitle.isChecked(): title = self.ui.lineeditleadertitle.text() if len (title) > 63: msg = CommonError (self.tr ("Movie title too long.")) msg.exec_() return else: title = None timestring = "%s -- %s" % (time2str (starttime), time2str (stoptime)) ss = SaveSplit (self.params['LastSplitPath']) ss.move (self.pos() + self.rect().center() - ss.rect().center()) if not ss.exec_() == QtGui.QDialog.Accepted: return outputfile = os.path.join (ss.splitpath, ss.splitfile) self.splitter = VideoSplitter (self.playerfile, outputfile, starttime, duration, title, ss.totranscode, self.player.params, self) self.splitter.addtranscode.connect (self.addtranscode) self.splitter.startnewsplit.connect (self.newsplitted) self.splitter.startworker (timestring) self.splitprog = SplitProg() self.splitprog.move (self.pos() + self.rect().center() - self.splitprog.rect().center()) self.splitter.updatemodel.connect (self.splitprog.setprogressbar) self.splitter.finished.connect (self.splitprog.accept) if not self.splitprog.exec_() == QtGui.QDialog.Accepted: self.splitter.finished.emit()
def setloop(self, start, end): starttime = str2time(start) endtime = str2time(end) if endtime == 0 or starttime >= self.duration: self.startpos = 0 self.stoppos = self.duration elif endtime > self.duration: self.startpos = starttime self.stoppos = self.duration else: self.startpos = starttime self.stoppos = endtime self.seek(self.startpos, self.stoppos) if endtime == 0: self.player.set_state(gst.STATE_PAUSED) self.dur_str = time2str(self.stoppos - self.startpos) self.loop = False else: self.player.set_state(gst.STATE_PLAYING) self.dur_str = time2str(self.stoppos - self.startpos) self.loop = True
def setloop (self, start, end): starttime = str2time (start) endtime = str2time (end) if endtime == 0 or starttime >= self.duration: self.startpos = 0 self.stoppos = self.duration elif endtime > self.duration: self.startpos = starttime self.stoppos = self.duration else: self.startpos = starttime self.stoppos = endtime self.seek (self.startpos, self.stoppos) if endtime == 0: self.player.set_state (gst.STATE_PAUSED) self.dur_str = time2str (self.stoppos - self.startpos) self.loop = False else: self.player.set_state (gst.STATE_PLAYING) self.dur_str = time2str (self.stoppos - self.startpos) self.loop = True
def seekstarttime (self, start): starttime = str2time (start) if self.hasmediafile and starttime <= self.duration: self.player.seek_simple (gst.FORMAT_TIME, gst.SEEK_FLAG_FLUSH, starttime) self.player.set_state (gst.STATE_PAUSED)