Example #1
0
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
Example #2
0
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
Example #3
0
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
Example #4
0
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 []
Example #5
0
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 ""
Example #6
0
 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)
Example #7
0
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 []
Example #8
0
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 ""
Example #9
0
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)
Example #10
0
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)
Example #11
0
	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)
Example #12
0
	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)
Example #13
0
	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)
Example #14
0
 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)
Example #15
0
	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)
Example #16
0
 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
Example #17
0
	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
Example #18
0
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 []
Example #19
0
	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
Example #20
0
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
Example #21
0
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 []
Example #22
0
	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()
Example #23
0
	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()
Example #24
0
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		
Example #25
0
	def playPhysicalCB(self, answer):
		if answer == True:
			self.FileBrowserClosed(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()))
		else:
			self.session.openWithCallback(self.FileBrowserClosed, FileBrowser)
Example #26
0
 def playPhysicalCB(self, answer):
     if answer:
         harddiskmanager.setDVDSpeed(harddiskmanager.getCD(), 1)
         self.FileBrowserClosed(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()))
Example #27
0
def play(session, **kwargs):
	from Screens import DVD
	session.open(DVD.DVDPlayer, dvd_device=harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()))
Example #28
0
 def playPhysicalCB(self, answer):
     if answer:
         harddiskmanager.setDVDSpeed(harddiskmanager.getCD(), 1)
         self.FileBrowserClosed(
             harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()))
Example #29
0
def play(session, **kwargs):
    from Screens import DVD
    session.open(DVD.DVDPlayer,
                 dvd_device=harddiskmanager.getAutofsMountpoint(
                     harddiskmanager.getCD()))