def __newPath(self, path): name = None if path: #TODO very slow if path.endswith(".iso"): if not self.iso: self.iso = IsoSupport(path) name = self.iso and self.iso.getIsoName() if name and len(name): path = "/home/root/dvd-" + name elif os.path.isdir(path): path += "/dvd" path += ".cuts" if self.cut_file != path: self.cut_file = path self.cut_mtime = 0
class CutList(): # InfoBarCueSheetSupport types CUT_TYPE_IN = 0 CUT_TYPE_OUT = 1 CUT_TYPE_MARK = 2 CUT_TYPE_LAST = 3 # Additional custom EMC specific types # Has to be remove before starting a player CUT_TYPE_SAVEDLAST = 4 CUT_TYPE_LENGTH = 5 # Toggle Types CUT_TOGGLE_START = 0 CUT_TOGGLE_RESUME = 1 CUT_TOGGLE_FINISHED = 2 CUT_TOGGLE_START_FOR_PLAY = 3 CUT_TOGGLE_FOR_PLAY = 4 # Additional cut_list information # cut_list[x][0] = pts = long long # cut_list[x][1] = what = long # Constants ENABLE_RESUME_SUPPORT = True MOVIE_FINISHED = 0xFFFFFFFFFFFFFFFF INSORT_SCOPE = 45000 # 0.5 seconds * 90 * 1000 def __init__(self, path=None): # Is already initialized in InfoBar and EMCMediaCenter #InfoBarCueSheetSupport.__init__(self) #InfoBarSeek.__init__(self) #self.service = None self.cut_file = None self.cut_mtime = 0 self.cut_list = [] self.iso = None self.__newPath(path) self.__readCutFile() self.__verifyCutList() def __newPath(self, path): name = None if path: #TODO very slow if path.endswith(".iso"): if not self.iso: self.iso = IsoSupport(path) name = self.iso and self.iso.getIsoName() if name and len(name): path = "/home/root/dvd-" + name elif os.path.isdir(path): path += "/dvd" path += ".cuts" if self.cut_file != path: self.cut_file = path self.cut_mtime = 0 def __ptsToSeconds(self, pts): # Cut files are using the presentation time stamp time format # pts has a resolution of 90kHz return pts / 90 / 1000 def __secondsToPts(self, seconds): return seconds * 90 * 1000 def __getCuesheet(self): service = self.session.nav.getCurrentService() if service is None: return None return service.cueSheet() ############################################################################## ## Overwrite Functions # InfoBarCueSheetSupport def downloadCuesheet(self): try: service = hasattr(self, "service") and self.service # Is there native cuesheet support cue = self.__getCuesheet() #InfoBarCueSheetSupport._InfoBarCueSheetSupport__getCuesheet(self) if cue: # Native cuesheet support self.cut_list = cue.getCutList() else: # No native cuesheet support if service: path = service.getPath() self.__newPath(path) self.__readCutFile() #print "CUTSTEST0 ", self.cut_list if config.EMC.cutlist_at_download.value: if service and hasCutlistDownloader: try: bestCutlist(service, self.cutlistDownloaded) except Exception, e: emcDebugOut("[EMC] Plugin CutlistDownloader exception:" + str(e)) #MAYBE: If the cutlist is empty we can check the EPG NowNext Events except Exception, e: emcDebugOut("[CUTS] downloadCutList exception:" + str(e))