def go(self): eAVSwitch.getInstance().setAspectRatio(0) self.timer = eTimer() self.timer.callback.append(self.timerEvent) self.timer.start(200, False) printDEBUG('Playing: ' + str(self.rootID) + ':0:0:0:0:0:0:0:0:0:' + self.openmovie) root = eServiceReference(self.rootID, 0, self.openmovie) root.setName (self.movieTitle) self.session.nav.playService(root) myConfig.PlayerOn.value = True self.stateplay = 'Play' self['afpSubtitles'].hide() self.ToggleInfobar()
def go(self): eAVSwitch.getInstance().setAspectRatio(0) self.timer = eTimer() self.timer.callback.append(self.timerEvent) self.timer.start(200, False) printDEBUG('Playing: ' + str(self.rootID) + ':0:0:0:0:0:0:0:0:0:' + self.openmovie) root = eServiceReference(self.rootID, 0, self.openmovie) root.setName(self.movieTitle) self.session.nav.playService(root) myConfig.PlayerOn.value = True self.stateplay = 'Play' self['afpSubtitles'].hide() self.ToggleInfobar()
def aspectChange(self): printDBG("Aspect Ratio [%r]" % self.aspectratiomode) if self.aspectratiomode == "1": #letterbox eAVSwitch.getInstance().setAspectRatio(0) self.aspectratiomode = "2" return elif self.aspectratiomode == "2": #nonlinear self.aspectratiomode = "3" elif self.aspectratiomode == "3": #nonlinear eAVSwitch.getInstance().setAspectRatio(2) self.aspectratiomode = "4" elif self.aspectratiomode == "4": #panscan eAVSwitch.getInstance().setAspectRatio(3) self.aspectratiomode = "1"
def aspectChange(self): printDBG('Aspect Ratio [%r]' % self.aspectratiomode) if self.aspectratiomode == '0': # 4:3 Letterbox eAVSwitch.getInstance().setAspectRatio(2) self.aspectratiomode = '2' self.statusScreen.setStatus("16:9 Bestfit") return elif self.aspectratiomode == '2': # 16:9 Bestfit eAVSwitch.getInstance().setAspectRatio(1) self.aspectratiomode = '1' self.statusScreen.setStatus("4:3 PanScan") elif self.aspectratiomode == '1': # 4:3 PanScan eAVSwitch.getInstance().setAspectRatio(0) self.aspectratiomode = '0' self.statusScreen.setStatus("4:3 Letterbox")
def ExitPlayer(self): def DeleteFile(f2d): try: remove(f2d) printDEBUG('Deleting %s' % f2d) except: printDEBUG('Error deleting %s' % f2d) self.stateplay = 'Stop' try: self.timer.stop() except: pass self.session.nav.stopService() if self.URLlinkName == '' and not access(self.openmovie, W_OK): printDEBUG('No access to delete %s' % self.openmovie) elif self.URLlinkName != '' and not access(self.URLlinkName, W_OK): printDEBUG('No access to delete %s' % self.URLlinkName) if path.exists('/tmp/afpsubs.srt'): DeleteFile('/tmp/afpsubs.srt') elif myConfig.DeleteFileQuestion.value == True or PercentagePlayed >= int( myConfig.DeleteWhenPercentagePlayed.value) and int( myConfig.DeleteWhenPercentagePlayed.value) > 0: def ExitRet(ret): if ret: if self.URLlinkName == '': myDir = path.dirname(self.openmovie) myFile = \ getNameWithoutExtension(path.basename(self.openmovie)) # To delete all files e.g. txt,jpg,eit,etc if path.exists(self.openmovie): DeleteFile(self.openmovie) if path.exists(self.opensubtitle): DeleteFile(self.opensubtitle) if path.exists(myDir + '/' + myFile + '.jpg'): DeleteFile(myDir + '/' + myFile + '.jpg') if path.exists(myDir + '/' + myFile + '.eit'): DeleteFile(myDir + '/' + myFile + '.eit') if path.exists(myDir + '/' + myFile + '.txt'): DeleteFile(myDir + '/' + myFile + '.txt') if path.exists(myDir + '/' + myFile + '.srt'): DeleteFile(myDir + '/' + myFile + '.srt') if path.exists(myDir + '/' + myFile + '.nfo'): DeleteFile(myDir + '/' + myFile + '.nfo') if self.openmovie.endswith('.ts'): if path.exists(self.openmovie + '.ap'): DeleteFile(self.openmovie + '.ap') if path.exists(self.openmovie + '.meta'): DeleteFile(self.openmovie + '.meta') if path.exists(self.openmovie + '.sc'): DeleteFile(self.openmovie + '.sc') if path.exists(self.openmovie + ".cuts"): DeleteFile(self.openmovie + ".cuts") try: printDEBUG('Executing \'rm -f "%s/%s.*"\'' % (myDir, myFile)) ClearMemory( ) # some tuners (e.g. nbox) with small amount of RAM have problems with next command system('rm -f "%s/%s*"' % (myDir, myFile)) except: printDEBUG( 'Error executing system>delete files engine') else: printDEBUG('Deleting %s' % self.URLlinkName) if path.exists(self.URLlinkName): DeleteFile(self.URLlinkName) self.session.openWithCallback(ExitRet, MessageBox, _('Delete this movie?'), timeout=10, default=False) eAVSwitch.getInstance().setAspectRatio(2) self.close()
def ExitPlayer(self): def DeleteFile(f2d): try: remove(f2d) printDEBUG('Deleting %s' % f2d) except: printDEBUG('Error deleting %s' % f2d) self.stateplay = 'Stop' try: self.timer.stop() except: pass self.session.nav.stopService() if self.URLlinkName == '' and not access(self.openmovie, W_OK): printDEBUG('No access to delete %s' % self.openmovie) elif self.URLlinkName != '' and not access(self.URLlinkName, W_OK): printDEBUG('No access to delete %s' % self.URLlinkName) if path.exists('/tmp/afpsubs.srt'): DeleteFile('/tmp/afpsubs.srt') elif myConfig.DeleteFileQuestion.value == True or PercentagePlayed >= int(myConfig.DeleteWhenPercentagePlayed.value) and int(myConfig.DeleteWhenPercentagePlayed.value) > 0: def ExitRet(ret): if ret: if self.URLlinkName == '': myDir = path.dirname(self.openmovie) myFile = \ getNameWithoutExtension(path.basename(self.openmovie)) # To delete all files e.g. txt,jpg,eit,etc if path.exists(self.openmovie): DeleteFile(self.openmovie) if path.exists(self.opensubtitle): DeleteFile(self.opensubtitle) if path.exists(myDir + '/' + myFile + '.jpg'): DeleteFile(myDir + '/' + myFile + '.jpg') if path.exists(myDir + '/' + myFile + '.eit'): DeleteFile(myDir + '/' + myFile + '.eit') if path.exists(myDir + '/' + myFile + '.txt'): DeleteFile(myDir + '/' + myFile + '.txt') if path.exists(myDir + '/' + myFile + '.srt'): DeleteFile(myDir + '/' + myFile + '.srt') if path.exists(myDir + '/' + myFile + '.nfo'): DeleteFile(myDir + '/' + myFile + '.nfo') if self.openmovie.endswith('.ts'): if path.exists(self.openmovie + '.ap'): DeleteFile(self.openmovie + '.ap') if path.exists(self.openmovie + '.meta'): DeleteFile(self.openmovie + '.meta') if path.exists(self.openmovie + '.sc'): DeleteFile(self.openmovie + '.sc') if path.exists(self.openmovie + ".cuts"): DeleteFile(self.openmovie + ".cuts") try: printDEBUG('Executing \'rm -f "%s/%s.*"\'' % (myDir, myFile)) ClearMemory() # some tuners (e.g. nbox) with small amount of RAM have problems with next command system('rm -f "%s/%s*"' % (myDir, myFile)) except: printDEBUG('Error executing system>delete files engine' ) else: printDEBUG('Deleting %s' % self.URLlinkName) if path.exists(self.URLlinkName): DeleteFile(self.URLlinkName) self.session.openWithCallback(ExitRet, MessageBox, _('Delete this movie?'), timeout=10, default=False) eAVSwitch.getInstance().setAspectRatio(2) self.close()