Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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 []
Exemplo n.º 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 ""
Exemplo n.º 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)
Exemplo n.º 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 []
Exemplo n.º 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 ""
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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 []
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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 []
Exemplo n.º 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()
Exemplo n.º 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()
Exemplo n.º 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		
Exemplo n.º 25
0
	def playPhysicalCB(self, answer):
		if answer == True:
			self.FileBrowserClosed(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()))
		else:
			self.session.openWithCallback(self.FileBrowserClosed, FileBrowser)
Exemplo n.º 26
0
 def playPhysicalCB(self, answer):
     if answer:
         harddiskmanager.setDVDSpeed(harddiskmanager.getCD(), 1)
         self.FileBrowserClosed(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()))
Exemplo n.º 27
0
def play(session, **kwargs):
	from Screens import DVD
	session.open(DVD.DVDPlayer, dvd_device=harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()))
Exemplo n.º 28
0
 def playPhysicalCB(self, answer):
     if answer:
         harddiskmanager.setDVDSpeed(harddiskmanager.getCD(), 1)
         self.FileBrowserClosed(
             harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()))
Exemplo n.º 29
0
def play(session, **kwargs):
    from Screens import DVD
    session.open(DVD.DVDPlayer,
                 dvd_device=harddiskmanager.getAutofsMountpoint(
                     harddiskmanager.getCD()))