def checkConfigBackup(): parts = [(p.description, p.mountpoint) for p in harddiskmanager.getMountedPartitions() if p.mountpoint != "/"] parts.extend([ (hd.model(), harddiskmanager.getAutofsMountpoint(hd.device + str(hd.numPartitions()))) for hd in harddiskmanager.hdd if harddiskmanager.getAutofsMountpoint( hd.device + str(hd.numPartitions())) not in parts ]) if len(parts): for x in parts: if x[1].endswith('/'): fullbackupfile = x[1] + 'backup/' + backupfile if fileExists(fullbackupfile): config.plugins.configurationbackup.backuplocation.value = str( x[1]) config.plugins.configurationbackup.backuplocation.save() config.plugins.configurationbackup.save() return x else: fullbackupfile = x[1] + '/backup/' + backupfile if fileExists(fullbackupfile): config.plugins.configurationbackup.backuplocation.value = str( x[1]) config.plugins.configurationbackup.backuplocation.save() config.plugins.configurationbackup.save() return x return None return None
def play(session, **kwargs): from Screens import DVD if (os.path.exists(os.path.join(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()), "VIDEO_TS")) or os.path.exists(os.path.join(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()), "video_ts"))): session.open(DVD.DVDPlayer, dvd_device=harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())) else: return
def play(session, **kwargs): from Screens import DVD if (os.path.exists(os.path.join(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()), "VIDEO_TS")) or os.path.exists(os.path.join(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()), "video_ts"))): session.open(DVD.DVDPlayer, dvd_device=harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())) else: return
def menu(menuid, **kwargs): if menuid == "mainmenu": global detected_DVD if detected_DVD is None or detected_DVD: cd = harddiskmanager.getCD() if cd and (os.path.exists(os.path.join(harddiskmanager.getAutofsMountpoint(cd), "VIDEO_TS")) or os.path.exists(os.path.join(harddiskmanager.getAutofsMountpoint(cd), "video_ts"))): print "[DVDplayer] Mountpoint is present and is", harddiskmanager.getAutofsMountpoint(cd) detected_DVD = True else: detected_DVD = False if onPartitionChange not in harddiskmanager.on_partition_list_change: harddiskmanager.on_partition_list_change.append(onPartitionChange) if detected_DVD: return [(_("DVD player"), play, "dvd_player", 46)] return []
def isCDdevice(): cd = harddiskmanager.getCD() if cd: file_path = harddiskmanager.getAutofsMountpoint(cd) if (os.path.exists(os.path.join(file_path, "VIDEO_TS")) or os.path.exists(os.path.join(file_path, "video_ts"))) and isCdromMount(file_path): return file_path return ""
def playPhysicalCB(self, answer): if answer == True: harddiskmanager.setDVDSpeed(harddiskmanager.getCD(), 1) self.FileBrowserClosed( harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())) else: self.session.openWithCallback(self.FileBrowserClosed, FileBrowser)
def menu(menuid, **kwargs): if menuid == "mainmenu": global detected_DVD if detected_DVD is None or detected_DVD: cd = harddiskmanager.getCD() if cd and (os.path.exists(os.path.join(harddiskmanager.getAutofsMountpoint(cd), "VIDEO_TS")) or os.path.exists(os.path.join(harddiskmanager.getAutofsMountpoint(cd), "video_ts"))): print "[DVDplayer] Mountpoint is present and is", harddiskmanager.getAutofsMountpoint(cd) detected_DVD = True else: detected_DVD = False if onPartitionChange not in harddiskmanager.on_partition_list_change: harddiskmanager.on_partition_list_change.append(onPartitionChange) if detected_DVD: return [(_("DVD player"), play, "dvd_player", 46)] return []
def isCDdevice(): cd = harddiskmanager.getCD() if cd: file_path = harddiskmanager.getAutofsMountpoint(cd) if (os.path.exists(os.path.join(file_path, "VIDEO_TS")) or os.path.exists(os.path.join(file_path, "video_ts"))) and isCdromMount(file_path): return file_path return ""
def filescan_open(list, session, **kwargs): from Screens import DVD if len(list) == 1 and list[0].mimetype == "video/x-dvd": cd = harddiskmanager.getCD() if cd and (os.path.exists(os.path.join(harddiskmanager.getAutofsMountpoint(cd), "VIDEO_TS")) or os.path.exists(os.path.join(harddiskmanager.getAutofsMountpoint(cd), "video_ts"))): print "[DVDplayer] found device /dev/%s", " mount path ", harddiskmanager.getAutofsMountpoint(cd) session.open(DVD.DVDPlayer, dvd_device="/dev/%s" %(harddiskmanager.getAutofsMountpoint(cd))) return else: dvd_filelist = [] for x in list: if x.mimetype == "video/x-dvd-iso": dvd_filelist.append(x.path) if x.mimetype == "video/x-dvd": dvd_filelist.append(x.path.rsplit('/',1)[0]) session.open(DVD.DVDPlayer, dvd_filelist=dvd_filelist)
def filescan_open(list, session, **kwargs): from Screens import DVD if len(list) == 1 and list[0].mimetype == "video/x-dvd": cd = harddiskmanager.getCD() if cd and (os.path.exists(os.path.join(harddiskmanager.getAutofsMountpoint(cd), "VIDEO_TS")) or os.path.exists(os.path.join(harddiskmanager.getAutofsMountpoint(cd), "video_ts"))): print "[DVDplayer] found device /dev/%s", " mount path ", harddiskmanager.getAutofsMountpoint(cd) session.open(DVD.DVDPlayer, dvd_device="/dev/%s" %(harddiskmanager.getAutofsMountpoint(cd))) return else: dvd_filelist = [] for x in list: if x.mimetype == "video/x-dvd-iso": dvd_filelist.append(x.path) if x.mimetype == "video/x-dvd": dvd_filelist.append(x.path.rsplit('/',1)[0]) session.open(DVD.DVDPlayer, dvd_filelist=dvd_filelist)
def askLeavePlayer(self): choices = [(_("Exit"), "exit"), (_("Continue playing"), "play")] if True or not self.physicalDVD: choices.insert(1,(_("Return to file browser"), "browser")) if self.physicalDVD: cur = self.session.nav.getCurrentlyPlayingServiceReference() if cur and not cur.toString().endswith(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())): choices.insert(0,(_("Play DVD"), "playPhysical" )) self.session.openWithCallback(self.exitCB, ChoiceBox, title=_("Leave DVD Player?"), list = choices)
def askLeavePlayer(self): choices = [(_("Exit"), "exit"), (_("Continue playing"), "play")] if True or not self.physicalDVD: choices.insert(1,(_("Return to file browser"), "browser")) if self.physicalDVD: cur = self.session.nav.getCurrentlyPlayingServiceReference() if cur and not cur.toString().endswith(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())): choices.insert(0,(_("Play DVD"), "playPhysical" )) self.session.openWithCallback(self.exitCB, ChoiceBox, title=_("Leave DVD Player?"), list = choices)
def askLeavePlayer(self): if self.autoplay: self.exitCB((None,"exit")) return choices = [(_("Exit"), "exit"), (_("Continue playing"), "play")] if self.physicalDVD: cur = self.session.nav.getCurrentlyPlayingServiceOrGroup() if cur and not cur.toString().endswith(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())): choices.insert(0,(_("Play DVD"), "playPhysical")) self.session.openWithCallback(self.exitCB, ChoiceBox, title=_("Leave DVD player?"), list=choices)
def askLeavePlayer(self): if self.autoplay: self.exitCB((None, 'exit')) return None choices = [(_('Exit'), 'exit'), (_('Continue playing'), 'play')] if self.physicalDVD: cur = self.session.nav.getCurrentlyPlayingServiceOrGroup() if cur and not cur.toString().endswith(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())): choices.insert(0, (_('Play DVD'), 'playPhysical')) self.session.openWithCallback(self.exitCB, ChoiceBox, title=_('Leave DVD player?'), list=choices)
def askLeavePlayer(self): if self.autoplay: self.exitCB((None, "exit")) return choices = [(_("Exit"), "exit"), (_("Continue playing"), "play")] if self.physicalDVD: cur = self.session.nav.getCurrentlyPlayingServiceOrGroup() cd = harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()) if cur and cur.toString()[-len(cd):] != cd: choices.insert(0,(_("Play DVD"), "playPhysical")) self.session.openWithCallback(self.exitCB, ChoiceBox, title=_("Leave DVD player?"), list = choices)
def askLeavePlayer(self): if self.autoplay: self.exitCB((None, 'exit')) return None else: choices = [(_('Exit'), 'exit'), (_('Continue playing'), 'play')] if self.physicalDVD: cur = self.session.nav.getCurrentlyPlayingServiceOrGroup() if cur and not cur.toString().endswith(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())): choices.insert(0, (_('Play DVD'), 'playPhysical')) self.session.openWithCallback(self.exitCB, ChoiceBox, title=_('Leave DVD player?'), list=choices) return None
def scanHotplug(self): devicepath = harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()) if pathExists(devicepath): from Components.Scanner import scanDevice res = scanDevice(devicepath) list = [ (r.description, r, res[r], self.session) for r in res ] if list: (desc, scanner, files, session) = list[0] for file in files: if file.mimetype == "video/x-dvd": print "[DVD] physical dvd found:", devicepath self.physicalDVD = True return self.physicalDVD = False
def menu(menuid, **kwargs): if menuid == "mainmenu": global detected_DVD if detected_DVD is None: cd = harddiskmanager.getCD() if cd and os.path.exists(os.path.join(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()), "VIDEO_TS")): detected_DVD = True else: detected_DVD = False if onPartitionChange not in harddiskmanager.on_partition_list_change: harddiskmanager.on_partition_list_change.append(onPartitionChange) if detected_DVD: return [(_("DVD Player"), play, "dvd_player", 46)] return []
def scanHotplug(self): devicepath = harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()) if pathExists(devicepath): from Components.Scanner import scanDevice res = scanDevice(devicepath) list = [ (r.description, r, res[r], self.session) for r in res ] if list: (desc, scanner, files, session) = list[0] for file in files: if file.mimetype == "video/x-dvd": print "[DVD] physical dvd found:", devicepath self.physicalDVD = True return self.physicalDVD = False
def checkConfigBackup(): parts = [ (p.description, p.mountpoint) for p in harddiskmanager.getMountedPartitions() if p.mountpoint != "/"] parts.extend([ ( hd.model(), harddiskmanager.getAutofsMountpoint(hd.device + str(hd.numPartitions())) ) for hd in harddiskmanager.hdd if harddiskmanager.getAutofsMountpoint(hd.device + str(hd.numPartitions())) not in parts ]) for x in parts: path = x[1] path = path[:-1] if path.endswith('/') else path fullbackupfile = "%s/backup/%s" %(path,backupfile) if fileExists(fullbackupfile): Log.i("Found backup at '%s'" %(fullbackupfile,)) config.plugins.configurationbackup.backuplocation.value = str(x[1]) config.plugins.configurationbackup.backuplocation.save() config.plugins.configurationbackup.save() return x return None
def menu(menuid, **kwargs): if menuid == "mainmenu": global detected_DVD if config.usage.show_dvdplayer.value: return [(_("DVD Player"), main, "dvd_player", 46)] elif detected_DVD is None: cd = harddiskmanager.getCD() if cd and os.path.exists(os.path.join(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()), "VIDEO_TS")): detected_DVD = True else: detected_DVD = False if onPartitionChange not in harddiskmanager.on_partition_list_change: harddiskmanager.on_partition_list_change.append(onPartitionChange) if detected_DVD: return [(_("DVD Player"), play, "dvd_player", 46)] return []
def hotplugCB(self, dev, media_state): if dev == harddiskmanager.getCD(): if media_state == "1": from Components.Scanner import scanDevice devpath = harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()) self.cdAudioTrackFiles = [] res = scanDevice(devpath) list = [(r.description, r, res[r], self.session) for r in res] if list: (desc, scanner, files, session) = list[0] for file in files: if file.mimetype == "audio/x-cda": self.cdAudioTrackFiles.append(file.path) else: self.cdAudioTrackFiles = [] if self.isAudioCD: self.clear_playlist()
def hotplugCB(self, dev, media_state): if dev == harddiskmanager.getCD(): if media_state == "1": from Components.Scanner import scanDevice devpath = harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()) self.cdAudioTrackFiles = [] res = scanDevice(devpath) list = [ (r.description, r, res[r], self.session) for r in res ] if list: (desc, scanner, files, session) = list[0] for file in files: if file.mimetype == "audio/x-cda": self.cdAudioTrackFiles.append(file.path) else: self.cdAudioTrackFiles = [] if self.isAudioCD: self.clear_playlist()
def checkConfigBackup(): parts = [ (p.description, p.mountpoint) for p in harddiskmanager.getMountedPartitions() if p.mountpoint != "/"] parts.extend([ ( hd.model(), harddiskmanager.getAutofsMountpoint(hd.device + str(hd.numPartitions())) ) for hd in harddiskmanager.hdd if harddiskmanager.getAutofsMountpoint(hd.device + str(hd.numPartitions())) not in parts ]) if len(parts): for x in parts: if x[1].endswith('/'): fullbackupfile = x[1] + 'backup/' + backupfile if fileExists(fullbackupfile): config.plugins.configurationbackup.backuplocation.value = str(x[1]) config.plugins.configurationbackup.backuplocation.save() config.plugins.configurationbackup.save() return x else: fullbackupfile = x[1] + '/backup/' + backupfile if fileExists(fullbackupfile): config.plugins.configurationbackup.backuplocation.value = str(x[1]) config.plugins.configurationbackup.backuplocation.save() config.plugins.configurationbackup.save() return x return None return None
def playPhysicalCB(self, answer): if answer == True: self.FileBrowserClosed(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())) else: self.session.openWithCallback(self.FileBrowserClosed, FileBrowser)
def playPhysicalCB(self, answer): if answer: harddiskmanager.setDVDSpeed(harddiskmanager.getCD(), 1) self.FileBrowserClosed(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()))
def play(session, **kwargs): from Screens import DVD session.open(DVD.DVDPlayer, dvd_device=harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()))
def playPhysicalCB(self, answer): if answer: harddiskmanager.setDVDSpeed(harddiskmanager.getCD(), 1) self.FileBrowserClosed( harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()))
def play(session, **kwargs): from Screens import DVD session.open(DVD.DVDPlayer, dvd_device=harddiskmanager.getAutofsMountpoint( harddiskmanager.getCD()))