コード例 #1
0
    def calculateFilename(self):
        service_name = self.service_ref.getServiceName()
        begin_date = strftime("%Y%m%d %H%M", localtime(self.begin))

        print "begin_date: ", begin_date
        print "service_name: ", service_name
        print "name:", self.name
        print "description: ", self.description

        filename = begin_date + " - " + service_name
        if self.name:
            if config.recording.filename_composition.getValue() == "short":
                filename = strftime("%Y%m%d", localtime(
                    self.begin)) + " - " + self.name
            elif config.recording.filename_composition.getValue() == "long":
                filename += " - " + self.name + " - " + self.description
            else:
                filename += " - " + self.name  # standard

        if config.recording.ascii_filenames.getValue():
            filename = ASCIItranslit.legacyEncode(filename)

        if not self.dirname:
            dirname = findSafeRecordPath(defaultMoviePath())
        else:
            dirname = findSafeRecordPath(self.dirname)
            if dirname is None:
                dirname = findSafeRecordPath(defaultMoviePath())
                self.dirnameHadToFallback = True
        if not dirname:
            return None
        self.Filename = Directories.getRecordingFilename(filename, dirname)
        self.log(0, "Filename calculated as: '%s'" % self.Filename)
        return self.Filename
コード例 #2
0
ファイル: RecordTimer.py プロジェクト: torac/enigma2
	def calculateFilename(self):
		service_name = self.service_ref.getServiceName()
		begin_date = strftime("%Y%m%d %H%M", localtime(self.begin))

#		print "begin_date: ", begin_date
#		print "service_name: ", service_name
#		print "name:", self.name
#		print "description: ", self.description
#
		filename = begin_date + " - " + service_name
		if self.name:
			if config.recording.filename_composition.getValue() == "short":
				filename = strftime("%Y%m%d", localtime(self.begin)) + " - " + self.name
			elif config.recording.filename_composition.getValue() == "long":
				filename += " - " + self.name + " - " + self.description
			else:
				filename += " - " + self.name # standard

		if config.recording.ascii_filenames.getValue():
			filename = ASCIItranslit.legacyEncode(filename)


		if not self.dirname:
			dirname = findSafeRecordPath(defaultMoviePath())
		else:
			dirname = findSafeRecordPath(self.dirname)
			if dirname is None:
				dirname = findSafeRecordPath(defaultMoviePath())
				self.dirnameHadToFallback = True
		if not dirname:
			return None
		self.Filename = Directories.getRecordingFilename(filename, dirname)
		self.log(0, "Filename calculated as: '%s'" % self.Filename)
		return self.Filename
コード例 #3
0
ファイル: RecordTimer.py プロジェクト: Huevos/enigma2
	def freespace(self):
		self.MountPath = None
		if not self.dirname:
			dirname = findSafeRecordPath(defaultMoviePath())
		else:
			dirname = findSafeRecordPath(self.dirname)
			if dirname is None:
				dirname = findSafeRecordPath(defaultMoviePath())
				self.dirnameHadToFallback = True
		if not dirname:
			return False

		self.MountPath = dirname
		mountwriteable = os.access(dirname, os.W_OK)
		if not mountwriteable:
			self.log(0, ("Mount '%s' is not writeable." % dirname))
			return False

		s = os.statvfs(dirname)
		if (s.f_bavail * s.f_bsize) / 1000000 < 1024:
			self.log(0, "Not enough free space to record")
			return False
		else:
			self.log(0, "Found enough free space to record")
			return True
コード例 #4
0
	def calculateFilename(self, name=None):
		service_name = self.service_ref.getServiceName()
		begin_date = strftime("%Y%m%d %H%M", localtime(self.begin))
		name = name or self.name
		filename = begin_date + " - " + service_name
		if name:
			if config.recording.filename_composition.value == "event":
				filename = name + ' - ' + begin_date + "_" + service_name
			elif config.recording.filename_composition.value == "short":
				filename = strftime("%Y%m%d", localtime(self.begin)) + " - " + name
			elif config.recording.filename_composition.value == "long":
				filename += " - " + name + " - " + self.description
			else:
				filename += " - " + name # standard

		if config.recording.ascii_filenames.value:
			filename = ASCIItranslit.legacyEncode(filename)
		if not self.dirname:
			dirname = (defaultMoviePath())
		else:
			dirname = (self.dirname)
			if dirname is None:
				dirname = (defaultMoviePath())
				self.dirnameHadToFallback = True
		if not dirname:
			return None
		self.Filename = Directories.getRecordingFilename(filename, dirname)
		self.log(0, "Filename calculated as: '%s'" % self.Filename)
		return self.Filename
コード例 #5
0
	def freespace(self):
		self.MountPath = None
		if not self.dirname:
			dirname = findSafeRecordPath(defaultMoviePath())
		else:
			dirname = findSafeRecordPath(self.dirname)
			if dirname is None:
				dirname = findSafeRecordPath(defaultMoviePath())
				self.dirnameHadToFallback = True
		if not dirname:
			return False

		self.MountPath = dirname
		mountwriteable = os.access(dirname, os.W_OK)
		if not mountwriteable:
			self.log(0, ("Mount '%s' is not writeable." % dirname))
			return False

		s = os.statvfs(dirname)
		if (s.f_bavail * s.f_bsize) / 1000000 < 1024:
			self.log(0, "Not enough free space to record")
			return False
		else:
			self.log(0, "Found enough free space to record")
			return True
コード例 #6
0
    def cleanupMovies(self):
        if config.plugins.AutomaticCleanup.deleteOrphanedMovieFiles.value:  # check only if feature is enabled
            print pluginPrintname, "Cleaning up orphaned movies"
            moviePath = []
            excludePath = []

            from Components.UsageConfig import defaultMoviePath
            if defaultMoviePath().endswith('/'):
                moviePath.append(defaultMoviePath())
            else:
                moviePath.append(defaultMoviePath() + "/")
            if config.usage.instantrec_path.value.endswith('/'):
                excludePath.append(config.usage.instantrec_path.value)
            else:
                excludePath.append(config.usage.instantrec_path.value + "/")
            if config.usage.timeshift_path.value.endswith('/'):
                excludePath.append(config.usage.timeshift_path.value)
            else:
                excludePath.append(config.usage.timeshift_path.value + "/")

            try:
                # try to import EMC module to check for its existence
                from Plugins.Extensions.EnhancedMovieCenter.EnhancedMovieCenter import EnhancedMovieCenterMenu
                if config.EMC.movie_homepath.value:
                    path = config.EMC.movie_homepath.value
                    if not path.endswith("/"): path += "/"
                    if path not in moviePath:
                        moviePath.append(path)
                try:  # with v3 name
                    if len(config.EMC.movie_trashcan_path.value
                           ) > 1:  # Trashpath specified?
                        if DEBUG:
                            print pluginPrintname, "EMC v3 trashcan path is", config.EMC.movie_trashcan_path.value
                        if config.EMC.movie_trashcan_path.value.endswith('/'):
                            excludePath.append(
                                config.EMC.movie_trashcan_path.value)
                        else:
                            excludePath.append(
                                config.EMC.movie_trashcan_path.value + "/")
                except KeyError, ke:
                    print pluginPrintname, "EMC v3 trashcan path not specified", ke
                    try:  # else with v2 name
                        if len(config.EMC.movie_trashpath.value
                               ) > 1:  # Trashpath specified?
                            if DEBUG:
                                print pluginPrintname, "EMC v2 trashcan path is", config.EMC.movie_trashpath.value
                            if config.EMC.movie_trashpath.value.endswith('/'):
                                excludePath.append(
                                    config.EMC.movie_trashpath.value)
                            else:
                                excludePath.append(
                                    config.EMC.movie_trashpath.value + "/")
                    except KeyError, ke:
                        print pluginPrintname, "EMC v2 trashcan path not specified", ke
コード例 #7
0
	def cleanupMovies(self):
		if config.plugins.AutomaticCleanup.deleteOrphanedMovieFiles.value: # check only if feature is enabled
			print(pluginPrintname, "Cleaning up orphaned movies")
			moviePath = []
			excludePath = []
			
			from Components.UsageConfig import defaultMoviePath
			if defaultMoviePath().endswith('/'): moviePath.append(defaultMoviePath())
			else: moviePath.append(defaultMoviePath() + "/")
			if config.usage.instantrec_path.value.endswith('/'): excludePath.append(config.usage.instantrec_path.value)
			else: excludePath.append(config.usage.instantrec_path.value + "/")			
			if config.usage.timeshift_path.value.endswith('/'): excludePath.append(config.usage.timeshift_path.value)
			else: excludePath.append(config.usage.timeshift_path.value + "/")

			try:
				# try to import EMC module to check for its existence
				from Plugins.Extensions.EnhancedMovieCenter.EnhancedMovieCenter import EnhancedMovieCenterMenu
				if config.EMC.movie_homepath.value:
					path = config.EMC.movie_homepath.value
					if not path.endswith("/"): path += "/"
					if path not in moviePath:
						moviePath.append(path)
				try: # with v3 name
					if len(config.EMC.movie_trashcan_path.value) > 1:	# Trashpath specified?
						if DEBUG: print(pluginPrintname, "EMC v3 trashcan path is", config.EMC.movie_trashcan_path.value)
						if config.EMC.movie_trashcan_path.value.endswith('/'): excludePath.append(config.EMC.movie_trashcan_path.value)
						else: excludePath.append(config.EMC.movie_trashcan_path.value + "/")
				except KeyError as ke:
					print(pluginPrintname, "EMC v3 trashcan path not specified", ke)
					try: # else with v2 name
						if len(config.EMC.movie_trashpath.value) > 1:	# Trashpath specified?
							if DEBUG: print(pluginPrintname, "EMC v2 trashcan path is", config.EMC.movie_trashpath.value)
							if config.EMC.movie_trashpath.value.endswith('/'): excludePath.append(config.EMC.movie_trashpath.value)
							else: excludePath.append(config.EMC.movie_trashpath.value + "/")
					except KeyError as ke:
						print(pluginPrintname, "EMC v2 trashcan path not specified", ke)
			except ImportError as ie:
				print(pluginPrintname, "EMC not installed:", ie)

			if len(moviePath) == 0:
				print(pluginPrintname, "No movies found!")
			else:
				for f in range(len(excludePath)):
					if excludePath[f].startswith("/hdd"): excludePath[f] = "/media" + excludePath[f]
				print(pluginPrintname, "Movie path:", moviePath)
				print(pluginPrintname, "Excluded movie path:", excludePath)
				for checkPath in moviePath:	
					self.filterMovies(str(checkPath), excludePath)
		else:
			print(pluginPrintname, "Orphaned movies cleanup disabled")
コード例 #8
0
 def reloadList(self, sel=None, home=False):
     if not fileExists(config.movielist.last_videodir.value):
         path = defaultMoviePath()
         config.movielist.last_videodir.value = path
         config.movielist.last_videodir.save()
         self.current_ref = eServiceReferenceTrash(path)
         self["freeDiskSpace"].path = path
     if sel is None:
         sel = self.getCurrent()
     self["list"].reload(self.current_ref)
     if config.AdvancedMovieSelection.wastelist_buildtype.value == 'listAllMoviesMedia':
         title = _("Wastebasket: %s") % ("/media")
     else:
         title = _("Wastebasket: %s") % (config.movielist.last_videodir.value)
     self["location"].setText(title)
     if not (sel and self["list"].moveTo(sel)):
         if home:
             self["list"].moveToIndex(0)
     self["freeDiskSpace"].update()
     count = Trashcan.getTrashCount()
     cap = Trashcan.getTrashSize()
     if cap <= 999:
         wastebasket_info = (_("Trash count: %d") % (count)) + ' / ' + (_("Trash size: %d MB") % cap)
     else:
         format_string = _("Trash size:") + " %%.%sf GB" % (config.AdvancedMovieSelection.filesize_digits.value)
         wastebasket_info = _("Trash count:") + (" %d / " % (count)) + (format_string) % (cap / 1000.0)
     if count == 0:
         self["wastetxt"].setText(_("Wastebasket is empty!"))
     else:
         self["wastetxt"].setText(wastebasket_info)
コード例 #9
0
ファイル: plugin.py プロジェクト: Toysoft/plugins-enigma2_2.1
	def cleanupMovies(self):
		if config.plugins.AutomaticCleanup.deleteOrphanedMovieFiles.value: # check only if feature is enabled
			print pluginPrintname, "Cleaning up orphaned movies"
			moviePath = []
			excludePath = []
			
			from Components.UsageConfig import defaultMoviePath
			moviePath.append(defaultMoviePath())
			if config.usage.instantrec_path.value.endswith('/'): excludePath.append(config.usage.instantrec_path.value)
			else: excludePath.append(config.usage.instantrec_path.value + "/")			
			if config.usage.timeshift_path.value.endswith('/'): excludePath.append(config.usage.timeshift_path.value)
			else: excludePath.append(config.usage.timeshift_path.value + "/")

			try:
				# try to import EMC module to check for its existence
				from Plugins.Extensions.EnhancedMovieCenter.EnhancedMovieCenter import EnhancedMovieCenterMenu 
				moviePath.append(config.EMC.movie_homepath.value)
				if len(config.EMC.movie_trashpath.value) > 1:	# Trashpath specified?
					if config.EMC.movie_trashpath.value.endswith('/'): excludePath.append(config.EMC.movie_trashpath.value)
					else: excludePath.append(config.EMC.movie_trashpath.value + "/")
			except ImportError, ie:
				print pluginPrintname, "EMC not installed:", ie

			if len(moviePath) == 0:
				print pluginPrintname, "No movies found!"
			else:
				for f in range(len(excludePath)):
					if excludePath[f].startswith("/hdd"): excludePath[f] = "/media" + excludePath[f]
				print pluginPrintname, "Excluded movie path:", excludePath
				for checkPath in moviePath:	
					self.filterMovies(str(checkPath), excludePath)				
コード例 #10
0
ファイル: MovieList.py プロジェクト: xf22001/enigma2_plugins
 def realDirUp(self, root):
     parent = None
     info = self.serviceHandler.info(root)
     pwd = info and info.getName(root)
     print "[SF-Plugin] MovieList.realDirUp: pwd = >%s<" % (str(pwd))
     if pwd and not os.path.samefile(pwd, defaultMoviePath()):
         parentdir = pwd[: pwd.rfind("/", 0, -1)] + "/"
         parent = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + parentdir)
         info = self.serviceHandler.info(parent)
         if info is not None:
             txt = info.getName(parent)  # Titel
             service = ServiceReference(
                 info.getInfoString(parent, iServiceInformation.sServiceref)
             ).getServiceName()  # Sender
             description = info.getInfoString(parent, iServiceInformation.sDescription)  # Beschreibung
             # 				begin = info.getInfo(root, iServiceInformation.sTimeCreate)
             begin = self.MAXTIME
             parent.flags = eServiceReference.flagDirectory | eServiceReference.sort1
             tinfo = [
                 self.REAL_DIR | self.REAL_UP,
                 self.fupMap,
                 "  0",
                 txt,
                 service,
                 1,
             ]  # "  0" sorts before VIRT_UP
             return (parent, info, begin, tinfo)
コード例 #11
0
	def calculateFilename(self):
		service_name = self.service_ref.getServiceName()
		begin_date = strftime("%Y%m%d %H%M", localtime(self.begin))
		begin_shortdate = strftime("%Y%m%d", localtime(self.begin))
		
		print "begin_date: ", begin_date
		print "service_name: ", service_name
		print "name:", self.name
		print "description: ", self.description
		
		filename = begin_date + " - " + service_name
		if self.name:
			if config.usage.setup_level.index >= 2: # expert+
				if config.recording.filename_composition.value == "short":
					filename = begin_shortdate + " - " + self.name
				elif config.recording.filename_composition.value == "long":
					filename += " - " + self.name + " - " + self.description
				else:
					filename += " - " + self.name # standard
			else:
				filename += " - " + self.name

		if config.recording.ascii_filenames.value:
			filename = ASCIItranslit.legacyEncode(filename)

		if not self.dirname or not Directories.fileExists(self.dirname, 'w'):
			if self.dirname:
				self.dirnameHadToFallback = True
			dirname = defaultMoviePath()
		else:
			dirname = self.dirname
		self.Filename = Directories.getRecordingFilename(filename, dirname)
		self.log(0, "Filename calculated as: '%s'" % self.Filename)
コード例 #12
0
 def __init__(self, session, csel, service):
     self.csel = csel
     serviceHandler = eServiceCenter.getInstance()
     info = serviceHandler.info(service)
     self.sourcepath = service.getPath().rsplit("/", 1)[0]
     if len(self.csel.list.multiSelection) == 0:
         self.name = info.getName(service)
         self.service_list = [service]
     else:
         self.service_list = self.csel.list.multiSelection
         self.name = _("Selected movies")
     cbkeys = []
     listpath = []
     for element in range(len(listpath)):
         if element <= 10:
             cbkeys.append(str(element))
         else:
             cbkeys.append("")
     listpath.append((_("To adjusted move/copy location"), "CALLFUNC", self.selectedLocation))
     cbkeys.append("blue")
     listpath.append((_("Directory Selection"), "CALLFUNC", self.selectDir))
     cbkeys.append("yellow")
     listpath.append((_("Show active move/copy processes"), "CALLFUNC", self.showActive))
     cbkeys.append("green")
     listpath.append((_("Abort"), "CALLFUNC", self.close))
     cbkeys.append("red")
     if (
         len(os.listdir(config.movielist.last_videodir.value)) == 0
         and defaultMoviePath() <> config.movielist.last_videodir.value
     ):
         listpath.append((_("Remove ' %s '") % config.movielist.last_videodir.value, "CALLFUNC", self.remove))
         cbkeys.append("red")
     ChoiceBox.__init__(self, session, list=listpath, keys=cbkeys)
     self.onShown.append(self.setWindowTitle)
コード例 #13
0
ファイル: RecordTimer.py プロジェクト: sek1973/openpliPC
    def calculateFilename(self):
        service_name = self.service_ref.getServiceName()
        begin_date = strftime("%Y%m%d %H%M", localtime(self.begin))
        begin_shortdate = strftime("%Y%m%d", localtime(self.begin))

        print "begin_date: ", begin_date
        print "service_name: ", service_name
        print "name:", self.name
        print "description: ", self.description

        filename = begin_date + " - " + service_name
        if self.name:
            if config.usage.setup_level.index >= 2:  # expert+
                if config.recording.filename_composition.value == "short":
                    filename = begin_shortdate + " - " + self.name
                elif config.recording.filename_composition.value == "long":
                    filename += " - " + self.name + " - " + self.description
                else:
                    filename += " - " + self.name  # standard
            else:
                filename += " - " + self.name

        if config.recording.ascii_filenames.value:
            filename = ASCIItranslit.legacyEncode(filename)

        if not self.dirname or not Directories.fileExists(self.dirname, 'w'):
            if self.dirname:
                self.dirnameHadToFallback = True
            dirname = defaultMoviePath()
        else:
            dirname = self.dirname
        self.Filename = Directories.getRecordingFilename(filename, dirname)
        self.log(0, "Filename calculated as: '%s'" % self.Filename)
コード例 #14
0
	def cleanupMovies(self):
		if config.plugins.AutomaticCleanup.deleteOrphanedMovieFiles.value: # check only if feature is enabled
			print pluginPrintname, "Cleaning up orphaned movies"
			moviePath = []
			excludePath = []
			
			from Components.UsageConfig import defaultMoviePath
			moviePath.append(defaultMoviePath())
			if config.usage.instantrec_path.value.endswith('/'): excludePath.append(config.usage.instantrec_path.value)
			else: excludePath.append(config.usage.instantrec_path.value + "/")			
			if config.usage.timeshift_path.value.endswith('/'): excludePath.append(config.usage.timeshift_path.value)
			else: excludePath.append(config.usage.timeshift_path.value + "/")

			try:
				# try to import EMC module to check for its existence
				from Plugins.Extensions.EnhancedMovieCenter.EnhancedMovieCenter import EnhancedMovieCenterMenu 
				moviePath.append(config.EMC.movie_homepath.value)
				try: # with v3 name
					if len(config.EMC.movie_trashcan_path.value) > 1:	# Trashpath specified?
						if DEBUG: print pluginPrintname, "EMC v3 trashcan path is", config.EMC.movie_trashcan_path.value
						if config.EMC.movie_trashcan_path.value.endswith('/'): excludePath.append(config.EMC.movie_trashcan_path.value)
						else: excludePath.append(config.EMC.movie_trashcan_path.value + "/")
				except KeyError, ke:
					print pluginPrintname, "EMC v3 trashcan path not specified", ke
					try: # else with v2 name
						if len(config.EMC.movie_trashpath.value) > 1:	# Trashpath specified?
							if DEBUG: print pluginPrintname, "EMC v2 trashcan path is", config.EMC.movie_trashpath.value
							if config.EMC.movie_trashpath.value.endswith('/'): excludePath.append(config.EMC.movie_trashpath.value)
							else: excludePath.append(config.EMC.movie_trashpath.value + "/")
					except KeyError, ke:
						print pluginPrintname, "EMC v2 trashcan path not specified", ke
コード例 #15
0
 def reloadList(self, sel=None, home=False):
     if not fileExists(config.movielist.last_videodir.value):
         path = defaultMoviePath()
         config.movielist.last_videodir.value = path
         config.movielist.last_videodir.save()
         self.current_ref = eServiceReferenceTrash(path)
         self["freeDiskSpace"].path = path
     if sel is None:
         sel = self.getCurrent()
     self["list"].reload(self.current_ref)
     if config.AdvancedMovieSelection.wastelist_buildtype.value == 'listAllMoviesMedia':
         title = _("Wastebasket: %s") % ("/media")
     else:
         title = _("Wastebasket: %s") % (
             config.movielist.last_videodir.value)
     self["location"].setText(title)
     if not (sel and self["list"].moveTo(sel)):
         if home:
             self["list"].moveToIndex(0)
     self["freeDiskSpace"].update()
     count = Trashcan.getTrashCount()
     cap = Trashcan.getTrashSize()
     if cap <= 999:
         wastebasket_info = (_("Trash count: %d") %
                             (count)) + ' / ' + (_("Trash size: %d MB") %
                                                 cap)
     else:
         format_string = _("Trash size:") + " %%.%sf GB" % (
             config.AdvancedMovieSelection.filesize_digits.value)
         wastebasket_info = _("Trash count:") + (
             " %d / " % (count)) + (format_string) % (cap / 1000.0)
     if count == 0:
         self["wastetxt"].setText(_("Wastebasket is empty!"))
     else:
         self["wastetxt"].setText(wastebasket_info)
コード例 #16
0
    def displayHddUsed(self):

        if debug:
            print "TopfieldVFD: determine HDD usage"

        # determine the HDD usage
        used = 0
        try:
            f = statvfs(defaultMoviePath())
            # there are 8 HDD segments in the VFD
            used = (f.f_blocks - f.f_bavail) * 8 / f.f_blocks
        except:
            used = 0

        if self.hddUsed != used:
            try:
                fd = open("/dev/fpc")
                if self.hddUsed > used:
                    fcntl.ioctl(fd.fileno(), ioIconCmd, ioHddClear)
                fcntl.ioctl(fd.fileno(), ioIconCmd, ioHddUsage[used])
                if used == 8:
                    fcntl.ioctl(fd.fileno(), ioIconCmd, ioHddFull)
                fd.close()
            except IOError, e:
                self.hddUsed = used  # dummy operation
            self.hddUsed = used
コード例 #17
0
 def realDirUp(self, root):
     parent = None
     info = self.serviceHandler.info(root)
     pwd = info and info.getName(root)
     print("[SF-Plugin] MovieList.realDirUp: pwd = >%s<" % (str(pwd)))
     if pwd and os.path.exists(pwd) and not os.path.samefile(
             pwd, defaultMoviePath()):
         parentdir = pwd[:pwd.rfind("/", 0, -1)] + "/"
         parent = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + parentdir)
         info = self.serviceHandler.info(parent)
         if info is not None:
             txt = info.getName(parent)  # Titel
             service = ServiceReference(
                 info.getInfoString(parent, iServiceInformation.sServiceref)
             ).getServiceName()  # Sender
             description = info.getInfoString(
                 parent, iServiceInformation.sDescription)  # Beschreibung
             #				begin = info.getInfo(root, iServiceInformation.sTimeCreate)
             begin = self.MAXTIME
             parent.flags = eServiceReference.flagDirectory | eServiceReference.sort1
             tinfo = [
                 self.REAL_DIR | self.REAL_UP, self.fupMap, "  0", txt,
                 service, 1
             ]  # "  0" sorts before VIRT_UP
             return ((parent, info, begin, tinfo))
コード例 #18
0
	def calculateFilename(self, record_service=None):
		service_name = self.service_ref.getServiceName()
		begin_date = strftime("%Y%m%d %H%M", localtime(self.begin))
		begin_shortdate = strftime("%Y%m%d", localtime(self.begin))
		
		print("begin_date: ", begin_date)
		print("service_name: ", service_name)
		print("name:", self.name)
		print("description: ", self.description)
		
		filename = begin_date + " - " + service_name
		if self.name:
			if config.usage.setup_level.index >= 2: # expert+
				if config.recording.filename_composition.value == "short":
					filename = begin_shortdate + " - " + self.name
				elif config.recording.filename_composition.value == "long":
					filename += " - " + self.name + " - " + self.description
				else:
					filename += " - " + self.name # standard
			else:
				filename += " - " + self.name

		if config.recording.ascii_filenames.value:
			filename = ASCIItranslit.legacyEncode(filename)

		if not self.dirname or not Directories.fileExists(self.dirname, 'w'):
			if self.dirname:
				self.dirnameHadToFallback = True
			dirname = defaultMoviePath()
			self.log(0, "Directory '%s' doesn't seem to exist or isn't writable. Falling back to default movie path '%s'." % (self.dirname, dirname))
		else:
			dirname = self.dirname
		self.Filename = Directories.getRecordingFilename(filename, dirname) + (".ts" if record_service is None else record_service.getFileExtension())

		self.log(0, "Filename calculated as: '%s'" % self.Filename)
コード例 #19
0
    def displayHddUsed(self):

        if debug:
            print "TopfieldVFD: determine HDD usage"

        # determine the HDD usage
        used = 0
        try:
            f = statvfs(defaultMoviePath())
            # there are 8 HDD segments in the VFD
            used = (f.f_blocks - f.f_bavail) * 8 / f.f_blocks
        except OSError:
            used = 0

        if self.hddUsed != used:
            try:
                fd = open("/dev/fpc")
                if self.hddUsed > used:
                    fcntl.ioctl(fd.fileno(), ioIconCmd, ioHddClear)
                fcntl.ioctl(fd.fileno(), ioIconCmd, ioHddUsage[used])
                if used == 8:
                    fcntl.ioctl(fd.fileno(), ioIconCmd, ioHddFull)
                fd.close()
            except IOError, e:
                self.hddUsed = used  # dummy operation
            self.hddUsed = used
コード例 #20
0
    def getCurrentMoviePath(self):
        if not fileExists(config.movielist.last_videodir.value):
            config.movielist.last_videodir.value = defaultMoviePath()
            config.movielist.last_videodir.save()

        curMovieRef = eServiceReference("2:0:1:0:0:0:0:0:0:0:" +
                                        config.movielist.last_videodir.value)
        return curMovieRef
コード例 #21
0
    def autoDeleteAllMovies(self):
        from Client import isAnyRecording
        remote_recordings = isAnyRecording()

        retryvalue = "%s minutes" % int(
            config.AdvancedMovieSelection.next_empty_check.value)

        if self.recTimer.isActive():
            self.recTimer.stop()

        if remote_recordings:
            print "[AdvancedMovieSelection] Start automated deleting all movies but remote recordings activ, retry at", retryvalue
            self.recTimer.start(
                config.AdvancedMovieSelection.next_empty_check.value * 60000)
            return

        if not Screens.Standby.inStandby:
            print "[AdvancedMovieSelection] Start automated deleting all movies but box not in standby, retry in", retryvalue
            self.recTimer.start(
                config.AdvancedMovieSelection.next_empty_check.value * 60000)
        else:
            recordings = self.session.nav.getRecordings()
            next_rec_time = -1
            if not recordings:
                next_rec_time = self.session.nav.RecordTimer.getNextRecordingTime(
                )
            if config.movielist.last_videodir.value == "/hdd/movie/" and recordings or (
                    next_rec_time > 0 and (next_rec_time - time()) < 360):
                print "[AdvancedMovieSelection] Start automated deleting all movies but recordings activ, retry at", retryvalue
                self.recTimer.start(
                    config.AdvancedMovieSelection.next_empty_check.value *
                    60000)
            else:
                if self.recTimer.isActive():
                    self.recTimer.stop()
                self.list = []

                path = config.movielist.last_videodir.value
                if not fileExists(path):
                    path = defaultMoviePath()
                    config.movielist.last_videodir.value = path
                    config.movielist.last_videodir.save()

                if config.AdvancedMovieSelection.wastelist_buildtype.value == 'listMovies':
                    trash = Trashcan.listMovies(path)
                elif config.AdvancedMovieSelection.wastelist_buildtype.value == 'listAllMovies':
                    trash = Trashcan.listAllMovies(path)
                else:
                    trash = Trashcan.listAllMovies("/media")

                print "[AdvancedMovieSelection] Start automated deleting all movies in trash list"
                Trashcan.deleteAsynch(trash)
                config.AdvancedMovieSelection.last_auto_empty_wastebasket.value = int(
                    time())
                config.AdvancedMovieSelection.last_auto_empty_wastebasket.save(
                )
                self.configChange()
コード例 #22
0
ファイル: RecordTimer.py プロジェクト: torac/enigma2
	def freespace(self):
		try:
			if not self.dirname:
				dirname = findSafeRecordPath(defaultMoviePath())
			else:
				dirname = findSafeRecordPath(self.dirname)
				if dirname is None:
					dirname = findSafeRecordPath(defaultMoviePath())
					self.dirnameHadToFallback = True
			s = os.statvfs(dirname)
			if (s.f_bavail * s.f_bsize) / 1000000 < 1024:
				self.log(0, "Not enough free space to record")
				return False
			else:
				self.log(0, "Found enough free space to record")
				return True
		except:
			self.log(0, "failed to find mount to check for free space.")
			return False
コード例 #23
0
 def freespace(self):
     try:
         if not self.dirname:
             dirname = findSafeRecordPath(defaultMoviePath())
         else:
             dirname = findSafeRecordPath(self.dirname)
             if dirname is None:
                 dirname = findSafeRecordPath(defaultMoviePath())
                 self.dirnameHadToFallback = True
         s = os.statvfs(dirname)
         if (s.f_bavail * s.f_bsize) / 1000000 < 1024:
             self.log(0, "Not enough free space to record")
             return False
         else:
             self.log(0, "Found enough free space to record")
             return True
     except:
         self.log(0, "failed to find mount to check for free space.")
         return False
コード例 #24
0
    def isUsbRecordingPath(self):
        dirname = None

        if self.dirname:
            dirname = findSafeRecordPath(self.dirname)

        if dirname is None:
            dirname = findSafeRecordPath(defaultMoviePath())

        from Components import Harddisk
        return Harddisk.isUsbStorage(dirname)
コード例 #25
0
    def getDefaultMoviePath(self):
        path = defaultMoviePath()
        config.movielist.last_videodir.value = path
        config.movielist.last_videodir.save()
        tmp = config.movielist.videodirs.value[:]
        if path not in tmp:
            tmp.append(path)
            tmp.sort()
            config.movielist.videodirs.value = tmp
            config.movielist.videodirs.save()

        return path
コード例 #26
0
    def autoDeleteAllMovies(self):
        from Source.Remote.Client import isAnyRecording

        remote_recordings = isAnyRecording()

        retryvalue = "%s minutes" % int(config.AdvancedMovieSelection.next_empty_check.value)

        if self.recTimer.isActive():
            self.recTimer.stop()

        if remote_recordings:
            print "[AdvancedMovieSelection] Start automated deleting all movies but remote recordings activ, retry at", retryvalue
            self.recTimer.start(config.AdvancedMovieSelection.next_empty_check.value * 60000)
            return

        if not Screens.Standby.inStandby:
            print "[AdvancedMovieSelection] Start automated deleting all movies but box not in standby, retry in", retryvalue
            self.recTimer.start(config.AdvancedMovieSelection.next_empty_check.value * 60000)
        else:
            recordings = self.session.nav.getRecordings()
            next_rec_time = -1
            if not recordings:
                next_rec_time = self.session.nav.RecordTimer.getNextRecordingTime()
            if (
                config.movielist.last_videodir.value == "/hdd/movie/"
                and recordings
                or (next_rec_time > 0 and (next_rec_time - time()) < 360)
            ):
                print "[AdvancedMovieSelection] Start automated deleting all movies but recordings activ, retry at", retryvalue
                self.recTimer.start(config.AdvancedMovieSelection.next_empty_check.value * 60000)
            else:
                if self.recTimer.isActive():
                    self.recTimer.stop()
                self.list = []

                path = config.movielist.last_videodir.value
                if not fileExists(path):
                    path = defaultMoviePath()
                    config.movielist.last_videodir.value = path
                    config.movielist.last_videodir.save()

                if config.AdvancedMovieSelection.wastelist_buildtype.value == "listMovies":
                    trash = Trashcan.listMovies(path)
                elif config.AdvancedMovieSelection.wastelist_buildtype.value == "listAllMovies":
                    trash = Trashcan.listAllMovies(path)
                else:
                    trash = Trashcan.listAllMovies("/media")

                print "[AdvancedMovieSelection] Start automated deleting all movies in trash list"
                Trashcan.deleteAsynch(trash)
                config.AdvancedMovieSelection.last_auto_empty_wastebasket.value = int(time())
                config.AdvancedMovieSelection.last_auto_empty_wastebasket.save()
                self.configChange()
コード例 #27
0
	def changed(self, what):
		if not self.suspended:
			try:
                                videodir_value = defaultMoviePath()
				if path.exists(videodir_value):
					stat = statvfs(videodir_value)
					free = (stat.f_bavail if stat.f_bavail!=0 else stat.f_bfree) * stat.f_bsize / 1048576
					if free >= 10240:
						fdspace = "%d GB " %(free/1024)
						self.text = fdspace + _(videodir_value)
					else:
						fdspace = "%d MB " %(free)
						self.text = fdspace + _(videodir_value)
				else:
					self.text = '---'
			except:
				self.text = 'ERR'
コード例 #28
0
ファイル: mvmHDDfree.py プロジェクト: carlo0815/openNFR-skin
	def changed(self, what):
		if not self.suspended:
			try:
                                videodir_value = defaultMoviePath()
				if path.exists(videodir_value):
					stat = statvfs(videodir_value)
					free = (stat.f_bavail if stat.f_bavail!=0 else stat.f_bfree) * stat.f_bsize / 1048576
					if free >= 10240:
						fdspace = "%d GB " %(free/1024)
						self.text = fdspace + _(videodir_value)
					else:
						fdspace = "%d MB " %(free)
						self.text = fdspace + _(videodir_value)
				else:
					self.text = '---'
			except:
				self.text = 'ERR'
コード例 #29
0
 def reloadList(self, sel=None, home=False):
     if not fileExists(config.movielist.last_videodir.value):
         path = defaultMoviePath()
         config.movielist.last_videodir.value = path
         config.movielist.last_videodir.save()
         self.current_ref = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + path)
         self["freeDiskSpace"].path = path
     if sel is None:
         sel = self.getCurrent()
     self["list"].reload(self.current_ref, self.selected_tags)
     title = _("Recorded files...")
     if config.usage.setup_level.index >= 2:  # expert+
         title += "  " + config.movielist.last_videodir.value
     if self.selected_tags is not None:
         title += " - " + ','.join(self.selected_tags)
     self.setTitle(title)
     if not (sel and self["list"].moveTo(sel)):
         if home:
             self["list"].moveToIndex(0)
     self.updateTags()
     self["freeDiskSpace"].update()
コード例 #30
0
ファイル: MovieSelection.py プロジェクト: popazerty/12
	def reloadList(self, sel = None, home = False):
		if not fileExists(config.movielist.last_videodir.value):
			path = defaultMoviePath()
			config.movielist.last_videodir.value = path
			config.movielist.last_videodir.save()
			self.current_ref = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + path)
			self["freeDiskSpace"].path = path
		if sel is None:
			sel = self.getCurrent()
		self["list"].reload(self.current_ref, self.selected_tags)
		title = _("Recorded files...")
		if config.usage.setup_level.index >= 2: # expert+
			title += "  " + config.movielist.last_videodir.value
		if self.selected_tags is not None:
			title += " - " + ','.join(self.selected_tags)
		self.setTitle(title)
 		if not (sel and self["list"].moveTo(sel)):
			if home:
				self["list"].moveToIndex(0)
		self.updateTags()
		self["freeDiskSpace"].update()
コード例 #31
0
ファイル: plugin.py プロジェクト: Cofybreak/enigma2-plugins
    def cleanupMovies(self):
        if config.plugins.AutomaticCleanup.deleteOrphanedMovieFiles.value:  # check only if feature is enabled
            print pluginPrintname, "Cleaning up orphaned movies"
            moviePath = []
            excludePath = []

            from Components.UsageConfig import defaultMoviePath

            moviePath.append(defaultMoviePath())
            if config.usage.instantrec_path.value.endswith("/"):
                excludePath.append(config.usage.instantrec_path.value)
            else:
                excludePath.append(config.usage.instantrec_path.value + "/")
            if config.usage.timeshift_path.value.endswith("/"):
                excludePath.append(config.usage.timeshift_path.value)
            else:
                excludePath.append(config.usage.timeshift_path.value + "/")

            try:
                # try to import EMC module to check for its existence
                from Plugins.Extensions.EnhancedMovieCenter.EnhancedMovieCenter import EnhancedMovieCenterMenu

                moviePath.append(config.EMC.movie_homepath.value)
                if len(config.EMC.movie_trashpath.value) > 1:  # Trashpath specified?
                    if config.EMC.movie_trashpath.value.endswith("/"):
                        excludePath.append(config.EMC.movie_trashpath.value)
                    else:
                        excludePath.append(config.EMC.movie_trashpath.value + "/")
            except ImportError, ie:
                print pluginPrintname, "EMC not installed:", ie

            if len(moviePath) == 0:
                print pluginPrintname, "No movies found!"
            else:
                for f in range(len(excludePath)):
                    if excludePath[f].startswith("/hdd"):
                        excludePath[f] = "/media" + excludePath[f]
                print pluginPrintname, "Excluded movie path:", excludePath
                for checkPath in moviePath:
                    self.filterMovies(str(checkPath), excludePath)
コード例 #32
0
 def __init__(self, session, csel, service):
     self.csel = csel
     serviceHandler = eServiceCenter.getInstance()
     info = serviceHandler.info(service)
     self.sourcepath = service.getPath().rsplit('/', 1)[0]
     if len(self.csel.list.multiSelection) == 0:
         self.name = info.getName(service)
         self.service_list = [service]
     else:
         self.service_list = self.csel.list.multiSelection
         self.name = _("Selected movies")
     cbkeys = []
     listpath = []
     for element in range(len(listpath)):
         if element <= 10:
             cbkeys.append(str(element))
         else:
             cbkeys.append("")
     listpath.append((_("To adjusted move/copy location"), "CALLFUNC",
                      self.selectedLocation))
     cbkeys.append("blue")
     listpath.append((_("Directory Selection"), "CALLFUNC", self.selectDir))
     cbkeys.append("yellow")
     listpath.append((_("Show active move/copy processes"), "CALLFUNC",
                      self.showActive))
     cbkeys.append("green")
     listpath.append((_("Abort"), "CALLFUNC", self.close))
     cbkeys.append("red")
     if len(
             os.listdir(config.movielist.last_videodir.value)
     ) == 0 and defaultMoviePath() <> config.movielist.last_videodir.value:
         listpath.append(
             (_("Remove ' %s '") % config.movielist.last_videodir.value,
              "CALLFUNC", self.remove))
         cbkeys.append("red")
     ChoiceBox.__init__(self, session, list=listpath, keys=cbkeys)
     self.onShown.append(self.setWindowTitle)
コード例 #33
0
ファイル: RecordTimer.py プロジェクト: kingvuplus/dvbapp
    def calculateFilename(self):
        service_name = self.service_ref.getServiceName()
        begin_date = strftime("%Y%m%d %H%M", localtime(self.begin))

        print "begin_date: ", begin_date
        print "service_name: ", service_name
        print "name:", self.name
        print "description: ", self.description

        filename = begin_date + " - " + service_name
        if self.name:
            filename += " - " + self.name

        if config.recording.ascii_filenames.value:
            filename = ASCIItranslit.legacyEncode(filename)

        if not self.dirname or not Directories.fileExists(self.dirname, 'w'):
            if self.dirname:
                self.dirnameHadToFallback = True
            dirname = defaultMoviePath()
        else:
            dirname = self.dirname
        self.Filename = Directories.getRecordingFilename(filename, dirname)
        self.log(0, "Filename calculated as: '%s'" % self.Filename)
コード例 #34
0
ファイル: RecordTimer.py プロジェクト: kakunbsc/enigma2.1
	def calculateFilename(self):
		service_name = self.service_ref.getServiceName()
		begin_date = strftime("%Y%m%d %H%M", localtime(self.begin))
		
		print "begin_date: ", begin_date
		print "service_name: ", service_name
		print "name:", self.name
		print "description: ", self.description
		
		filename = begin_date + " - " + service_name
		if self.name:
			filename += " - " + self.name

		if config.recording.ascii_filenames.value:
			filename = ASCIItranslit.legacyEncode(filename)

		if not self.dirname or not Directories.fileExists(self.dirname, 'w'):
			if self.dirname:
				self.dirnameHadToFallback = True
			dirname = defaultMoviePath()
		else:
			dirname = self.dirname
		self.Filename = Directories.getRecordingFilename(filename, dirname)
		self.log(0, "Filename calculated as: '%s'" % self.Filename)
コード例 #35
0
    def createConfig(self):
        TimerEntryBase.createConfig(self)
        justplay = self.timer.justplay
        always_zap = self.timer.always_zap
        pipzap = self.timer.pipzap
        rename_repeat = self.timer.rename_repeat
        conflict_detection = self.timer.conflict_detection

        afterevent = {
            AFTEREVENT.NONE: "nothing",
            AFTEREVENT.DEEPSTANDBY: "deepstandby",
            AFTEREVENT.STANDBY: "standby",
            AFTEREVENT.AUTO: "auto"
        }[self.timer.afterEvent]

        if self.timer.record_ecm and self.timer.descramble:
            recordingtype = "descrambled+ecm"
        elif self.timer.record_ecm:
            recordingtype = "scrambled+ecm"
        elif self.timer.descramble:
            recordingtype = "normal"

        self.timerentry_justplay = ConfigSelection(
            choices=[("zap", _("zap")), ("record", _("record")),
                     ("zap+record", _("zap and record"))],
            default={
                0: "record",
                1: "zap",
                2: "zap+record"
            }[justplay + 2 * always_zap])
        if SystemInfo["DeepstandbySupport"]:
            shutdownString = _("go to deep standby")
        else:
            shutdownString = _("shut down")
        self.timerentry_afterevent = ConfigSelection(choices=[
            ("nothing", _("do nothing")), ("standby", _("go to standby")),
            ("deepstandby", shutdownString), ("auto", _("auto"))
        ],
                                                     default=afterevent)
        self.timerentry_recordingtype = ConfigSelection(choices=[
            ("normal", _("normal")),
            ("descrambled+ecm", _("descramble and record ecm")),
            ("scrambled+ecm", _("don't descramble, record ecm"))
        ],
                                                        default=recordingtype)
        self.timerentry_name = ConfigText(default=self.timer.name.replace(
            '\x86', '').replace('\x87', ''),
                                          visible_width=50,
                                          fixed_size=False)
        self.timerentry_description = ConfigText(
            default=self.timer.description, visible_width=50, fixed_size=False)
        self.timerentry_tags = self.timer.tags[:]
        # if no tags found, make name of event default tag set.
        if not self.timerentry_tags:
            tagname = self.timer.name.strip()
            if tagname:
                tagname = tagname[0].upper() + tagname[1:].replace(" ", "_")
                self.timerentry_tags.append(tagname)

        self.timerentry_tagsset = ConfigSelection(choices=[
            not self.timerentry_tags and "None"
            or " ".join(self.timerentry_tags)
        ])

        self.timerentry_renamerepeat = ConfigYesNo(default=rename_repeat)

        self.timerentry_pipzap = ConfigYesNo(default=pipzap)
        self.timerentry_conflictdetection = ConfigYesNo(
            default=conflict_detection)

        self.timerentry_showendtime = ConfigSelection(default=False,
                                                      choices=[
                                                          (True, _("yes")),
                                                          (False, _("no"))
                                                      ])

        default = self.timer.dirname or defaultMoviePath()
        tmp = config.movielist.videodirs.value
        if default not in tmp:
            tmp.append(default)
        self.timerentry_dirname = ConfigSelection(default=default, choices=tmp)

        # FIXME some service-chooser needed here
        servicename = "N/A"
        try:  # no current service available?
            servicename = str(self.timer.service_ref.getServiceName())
        except:
            pass
        self.timerentry_service_ref = self.timer.service_ref
        self.timerentry_service = ConfigSelection([servicename])
コード例 #36
0
    def keySave(self, result=None):
        if not self.timerentry_service_ref.isRecordable():
            self.session.openWithCallback(
                self.selectChannelSelector, MessageBox,
                _("You didn't select a channel to record from."),
                MessageBox.TYPE_ERROR)
            return
        self.timer.name = self.timerentry_name.value
        self.timer.description = self.timerentry_description.value
        self.timer.justplay = self.timerentry_justplay.value == "zap"
        self.timer.always_zap = self.timerentry_justplay.value == "zap+record"
        self.timer.pipzap = self.timerentry_pipzap.value
        self.timer.rename_repeat = self.timerentry_renamerepeat.value
        self.timer.conflict_detection = self.timerentry_conflictdetection.value
        if self.timerentry_justplay.value == "zap":
            if not self.timerentry_showendtime.value:
                self.timerentry_endtime.value = self.timerentry_starttime.value
        self.timer.afterEvent = {
            "nothing": AFTEREVENT.NONE,
            "deepstandby": AFTEREVENT.DEEPSTANDBY,
            "standby": AFTEREVENT.STANDBY,
            "auto": AFTEREVENT.AUTO
        }[self.timerentry_afterevent.value]
        # There is no point doing anything after a Zap-only timer!
        # For a start, you can't actually configure anything in the menu, but
        # leaving it as AUTO means that the code may try to shutdown at Zap time
        # if the Zap timer woke the box up.
        #
        if self.timer.justplay:
            self.timer.afterEvent = AFTEREVENT.NONE
        self.timer.descramble = {
            "normal": True,
            "descrambled+ecm": True,
            "scrambled+ecm": False,
        }[self.timerentry_recordingtype.value]
        self.timer.record_ecm = {
            "normal": False,
            "descrambled+ecm": True,
            "scrambled+ecm": True,
        }[self.timerentry_recordingtype.value]
        self.timer.service_ref = self.timerentry_service_ref
        self.timer.tags = self.timerentry_tags

        if self.timer.dirname or self.timerentry_dirname.value != defaultMoviePath(
        ):
            self.timer.dirname = self.timerentry_dirname.value
            config.movielist.last_timer_videodir.value = self.timer.dirname
            config.movielist.last_timer_videodir.save()

        if self.timerentry_type.value == "once":
            self.timer.begin, self.timer.end = self.getBeginEnd()

        TimerEntryBase.keySave(self)

        if self.timer.eit is not None:
            event = eEPGCache.getInstance().lookupEventId(
                self.timer.service_ref.ref, self.timer.eit)
            if event:
                n = event.getNumOfLinkageServices()
                if n > 1:
                    tlist = []
                    ref = self.session.nav.getCurrentlyPlayingServiceOrGroup()
                    parent = self.timer.service_ref.ref
                    selection = 0
                    for x in range(n):
                        i = event.getLinkageService(parent, x)
                        if i.toString() == ref.toString():
                            selection = x
                        tlist.append((i.getName(), i))
                    self.session.openWithCallback(
                        self.subserviceSelected,
                        ChoiceBox,
                        title=_("Please select a subservice to record..."),
                        list=tlist,
                        selection=selection)
                    return
                elif n > 0:
                    parent = self.timer.service_ref.ref
                    self.timer.service_ref = ServiceReference(
                        event.getLinkageService(parent, 0))

        self.saveTimer()
        self.close((True, self.timer))
コード例 #37
0
    def keyGo(self, result=None):
        #check record path
        print "self.timerentry_dirname.value:", self.timerentry_dirname.value
        if self.timerentry_justplay.value == "record":
            if not checkRecordPath(self.timerentry_dirname.value):
                self["config"].setCurrentIndex(8)
                self.session.open(
                    MessageBox,
                    _("Record Path: ") + self.timerentry_dirname.value + "\n" +
                    _("Please check is inserted an external storage device and  select the right record Directory?\nUSB storage device: /media/usb\n"
                      ), MessageBox.TYPE_ERROR)
                return

        if not self.timerentry_service_ref.isRecordable():
            #remove input helpbar
            self["config"].setCurrentIndex(7)
            self.session.openWithCallback(
                self.selectChannelSelector, MessageBox,
                _("You didn't select a channel to record from."),
                MessageBox.TYPE_ERROR)
            return
        self.timer.name = self.timerentry_name.value
        self.timer.description = self.timerentry_description.value
        self.timer.justplay = self.timerentry_justplay.value == "zap"
        if self.timerentry_justplay.value == "zap":
            if not self.timerentry_showendtime.value:
                self.timerentry_endtime.value = self.timerentry_starttime.value
        self.timer.resetRepeated()
        self.timer.afterEvent = {
            "nothing": AFTEREVENT.NONE,
            "deepstandby": AFTEREVENT.DEEPSTANDBY,
            "standby": AFTEREVENT.STANDBY,
            "auto": AFTEREVENT.AUTO
        }[self.timerentry_afterevent.value]
        self.timer.service_ref = self.timerentry_service_ref
        self.timer.tags = self.timerentry_tags

        if self.timer.dirname or self.timerentry_dirname.value != defaultMoviePath(
        ):
            self.timer.dirname = self.timerentry_dirname.value
            config.movielist.last_timer_videodir.value = self.timer.dirname
            config.movielist.last_timer_videodir.save()

        if self.timerentry_type.value == "once":
            self.timer.begin, self.timer.end = self.getBeginEnd()
        if self.timerentry_type.value == "repeated":
            if self.timerentry_repeated.value == "daily":
                for x in (0, 1, 2, 3, 4, 5, 6):
                    self.timer.setRepeated(x)

            if self.timerentry_repeated.value == "weekly":
                self.timer.setRepeated(self.timerentry_weekday.index)

            if self.timerentry_repeated.value == "weekdays":
                for x in (0, 1, 2, 3, 4):
                    self.timer.setRepeated(x)

            if self.timerentry_repeated.value == "user":
                for x in (0, 1, 2, 3, 4, 5, 6):
                    if self.timerentry_day[x].value:
                        self.timer.setRepeated(x)

            self.timer.repeatedbegindate = self.getTimestamp(
                self.timerentry_repeatedbegindate.value,
                self.timerentry_starttime.value)
            if self.timer.repeated:
                self.timer.begin = self.getTimestamp(
                    self.timerentry_repeatedbegindate.value,
                    self.timerentry_starttime.value)
                self.timer.end = self.getTimestamp(
                    self.timerentry_repeatedbegindate.value,
                    self.timerentry_endtime.value)
            else:
                self.timer.begin = self.getTimestamp(
                    time.time(), self.timerentry_starttime.value)
                self.timer.end = self.getTimestamp(
                    time.time(), self.timerentry_endtime.value)

            # when a timer end is set before the start, add 1 day
            if self.timer.end < self.timer.begin:
                self.timer.end += 86400

        if self.timer.eit is not None:
            event = eEPGCache.getInstance().lookupEventId(
                self.timer.service_ref.ref, self.timer.eit)
            if event:
                n = event.getNumOfLinkageServices()
                if n > 1:
                    tlist = []
                    ref = self.session.nav.getCurrentlyPlayingServiceReference(
                    )
                    parent = self.timer.service_ref.ref
                    selection = 0
                    for x in range(n):
                        i = event.getLinkageService(parent, x)
                        if i.toString() == ref.toString():
                            selection = x
                        tlist.append((i.getName(), i))
                    self.session.openWithCallback(
                        self.subserviceSelected,
                        ChoiceBox,
                        title=_("Please select a subservice to record..."),
                        list=tlist,
                        selection=selection)
                    return
                elif n > 0:
                    parent = self.timer.service_ref.ref
                    self.timer.service_ref = ServiceReference(
                        event.getLinkageService(parent, 0))
        self.saveTimer()
        self.close((True, self.timer))
コード例 #38
0
    def createConfig(self):
        justplay = self.timer.justplay
        always_zap = self.timer.always_zap
        rename_repeat = self.timer.rename_repeat

        afterevent = {
            AFTEREVENT.NONE: "nothing",
            AFTEREVENT.DEEPSTANDBY: "deepstandby",
            AFTEREVENT.STANDBY: "standby",
            AFTEREVENT.AUTO: "auto"
        }[self.timer.afterEvent]

        if self.timer.record_ecm and self.timer.descramble:
            recordingtype = "descrambled+ecm"
        elif self.timer.record_ecm:
            recordingtype = "scrambled+ecm"
        elif self.timer.descramble:
            recordingtype = "normal"

        weekday_table = ("mon", "tue", "wed", "thu", "fri", "sat", "sun")

        # calculate default values
        day = []
        weekday = 0
        for x in (0, 1, 2, 3, 4, 5, 6):
            day.append(0)
        if self.timer.repeated:  # repeated
            type = "repeated"
            if self.timer.repeated == 31:  # Mon-Fri
                repeated = "weekdays"
            elif self.timer.repeated == 127:  # daily
                repeated = "daily"
            else:
                flags = self.timer.repeated
                repeated = "user"
                count = 0
                for x in (0, 1, 2, 3, 4, 5, 6):
                    if flags == 1:  # weekly
                        # 						print "Set to weekday " + str(x)
                        weekday = x
                    if flags & 1 == 1:  # set user defined flags
                        day[x] = 1
                        count += 1
                    else:
                        day[x] = 0
                    flags >>= 1
                if count == 1:
                    repeated = "weekly"
        else:  # once
            type = "once"
            repeated = None
            weekday = int(strftime("%u", localtime(self.timer.begin))) - 1
            day[weekday] = 1

        self.timerentry_justplay = ConfigSelection(
            choices=[("zap", _("zap")), ("record", _("record")),
                     ("zap+record", _("zap and record"))],
            default={
                0: "record",
                1: "zap",
                2: "zap+record"
            }[justplay + 2 * always_zap])
        self.timertyp = self.timerentry_justplay.value

        if SystemInfo["DeepstandbySupport"]:
            shutdownString = _("go to deep standby")
        else:
            shutdownString = _("shut down")
        self.timerentry_afterevent = ConfigSelection(choices=[
            ("nothing", _("do nothing")), ("standby", _("go to standby")),
            ("deepstandby", shutdownString), ("auto", _("auto"))
        ],
                                                     default=afterevent)
        self.timerentry_recordingtype = ConfigSelection(choices=[
            ("normal", _("normal")),
            ("descrambled+ecm", _("descramble and record ecm")),
            ("scrambled+ecm", _("don't descramble, record ecm"))
        ],
                                                        default=recordingtype)
        self.timerentry_type = ConfigSelection(choices=[("once", _("once")),
                                                        ("repeated",
                                                         _("repeated"))],
                                               default=type)
        self.timerentry_name = ConfigText(default=self.timer.name.replace(
            '\xc2\x86', '').replace('\xc2\x87', '').encode("utf-8"),
                                          visible_width=50,
                                          fixed_size=False)
        self.timerentry_description_replaced = self.timer.description.replace(
            '\xc2\x8a', ' ').encode("utf-8")
        self.timerentry_description = ConfigText(
            default=self.timerentry_description_replaced,
            visible_width=50,
            fixed_size=False)
        self.timerentry_tags = self.timer.tags[:]
        # if no tags found, make name of event default tag set.
        if not self.timerentry_tags:
            tagname = self.timer.name.strip()
            if tagname:
                tagname = tagname[0].upper() + tagname[1:].replace(" ", "_")
                self.timerentry_tags.append(tagname)

        self.timerentry_tagsset = ConfigSelection(choices=[
            not self.timerentry_tags and "None"
            or " ".join(self.timerentry_tags)
        ])

        self.timerentry_repeated = ConfigSelection(
            default=repeated,
            choices=[("weekly", _("weekly")), ("daily", _("daily")),
                     ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])
        self.timerentry_renamerepeat = ConfigYesNo(default=rename_repeat)

        self.timerentry_date = ConfigDateTime(default=self.timer.begin,
                                              formatstring=_("%d %B %Y"),
                                              increment=86400)
        self.timerentry_starttime = ConfigClock(default=self.timer.begin)
        self.timerentry_endtime = ConfigClock(default=self.timer.end)
        #self.timerentry_showendtime = ConfigSelection(default = False, choices = [(True, _("yes")), (False, _("no"))])
        self.timerentry_showendtime = ConfigSelection(
            default=(self.timer.end > self.timer.begin + 3
                     and self.timer.justplay),
            choices=[(True, _("yes")), (False, _("no"))])

        default = self.timer.dirname or defaultMoviePath()
        tmp = config.movielist.videodirs.value
        if default not in tmp:
            tmp.append(default)
        self.timerentry_dirname = ConfigSelection(default=default, choices=tmp)

        self.timerentry_repeatedbegindate = ConfigDateTime(
            default=self.timer.repeatedbegindate,
            formatstring=_("%d.%B %Y"),
            increment=86400)

        self.timerentry_weekday = ConfigSelection(
            default=weekday_table[weekday],
            choices=[("mon", _("Monday")), ("tue", _("Tuesday")),
                     ("wed", _("Wednesday")), ("thu", _("Thursday")),
                     ("fri", _("Friday")), ("sat", _("Saturday")),
                     ("sun", _("Sunday"))])

        self.timerentry_day = ConfigSubList()
        for x in (0, 1, 2, 3, 4, 5, 6):
            self.timerentry_day.append(ConfigYesNo(default=day[x]))

        # FIXME some service-chooser needed here
        servicename = "N/A"
        try:  # no current service available?
            servicename = str(self.timer.service_ref.getServiceName())
        except:
            pass
        self.timerentry_service_ref = self.timer.service_ref
        self.timerentry_service = ConfigSelection([servicename])
コード例 #39
0
    def keyGo(self, result=None):
        if not self.timerentry_service_ref.isRecordable():
            self.session.openWithCallback(
                self.selectChannelSelector, MessageBox,
                _("You didn't select a channel to record from."),
                MessageBox.TYPE_ERROR)
        else:
            self.timer.external = self.timerentry_fallback.value
            self.timer.name = self.timerentry_name.value
            self.timer.description = self.timerentry_description.value
            self.timer.justplay = self.timerentry_justplay.value == "zap"
            self.timer.always_zap = self.timerentry_justplay.value == "zap+record"
            self.timer.zap_wakeup = self.timerentry_zapwakeup.value
            self.timer.pipzap = self.timerentry_pipzap.value
            self.timer.rename_repeat = self.timerentry_renamerepeat.value
            self.timer.conflict_detection = self.timerentry_conflictdetection.value
            if self.timerentry_justplay.value == "zap":
                if not self.timerentry_showendtime.value:
                    self.timerentry_endtime.value = self.timerentry_starttime.value
                    self.timerentry_afterevent.value = "nothing"
            self.timer.resetRepeated()
            self.timer.afterEvent = {
                "nothing": AFTEREVENT.NONE,
                "deepstandby": AFTEREVENT.DEEPSTANDBY,
                "standby": AFTEREVENT.STANDBY,
                "auto": AFTEREVENT.AUTO
            }[self.timerentry_afterevent.value]
            # There is no point doing anything after a Zap-only timer!
            # For a start, you can't actually configure anything in the menu, but
            # leaving it as AUTO means that the code may try to shutdown at Zap time
            # if the Zap timer woke the box up.
            #
            if self.timer.justplay:
                self.timer.afterEvent = AFTEREVENT.NONE
            self.timer.descramble = {
                "normal": True,
                "descrambled+ecm": True,
                "scrambled+ecm": False,
            }[self.timerentry_recordingtype.value]
            self.timer.record_ecm = {
                "normal": False,
                "descrambled+ecm": True,
                "scrambled+ecm": True,
            }[self.timerentry_recordingtype.value]
            self.timer.service_ref = self.timerentry_service_ref
            self.timer.tags = self.timerentry_tags

            # reset state when edit timer type
            if not self.timer.external and self.timer.justplay != "zap" and self.timer.isRunning(
            ):
                if self.timer in self.session.nav.RecordTimer.timer_list and (
                        not self.timer.record_service or not isinstance(
                            self.timer.record_service, iRecordableServicePtr)):
                    self.timer.resetState()

            if self.timerentry_fallback.value:
                self.timer.dirname = self.timerentry_fallbackdirname.value
            else:
                if self.timer.dirname or self.timerentry_dirname.value != defaultMoviePath(
                ):
                    self.timer.dirname = self.timerentry_dirname.value
                    config.movielist.last_timer_videodir.value = self.timer.dirname
                    config.movielist.last_timer_videodir.save()

            if self.timerentry_type.value == "once":
                self.timer.begin, self.timer.end = self.getBeginEnd()
            if self.timerentry_type.value == "repeated":
                if self.timerentry_repeated.value == "daily":
                    for x in (0, 1, 2, 3, 4, 5, 6):
                        self.timer.setRepeated(x)

                if self.timerentry_repeated.value == "weekly":
                    self.timer.setRepeated(self.timerentry_weekday.index)

                if self.timerentry_repeated.value == "weekdays":
                    for x in (0, 1, 2, 3, 4):
                        self.timer.setRepeated(x)

                if self.timerentry_repeated.value == "user":
                    for x in (0, 1, 2, 3, 4, 5, 6):
                        if self.timerentry_day[x].value:
                            self.timer.setRepeated(x)

                self.timer.repeatedbegindate = self.getTimestamp(
                    self.timerentry_repeatedbegindate.value,
                    self.timerentry_starttime.value)
                if self.timer.repeated:
                    self.timer.begin = self.getTimestamp(
                        self.timerentry_repeatedbegindate.value,
                        self.timerentry_starttime.value)
                    self.timer.end = self.getTimestamp(
                        self.timerentry_repeatedbegindate.value,
                        self.timerentry_endtime.value)
                else:
                    self.timer.begin = self.getTimestamp(
                        time(), self.timerentry_starttime.value)
                    self.timer.end = self.getTimestamp(
                        time(), self.timerentry_endtime.value)

                # when a timer end is set before the start, add 1 day
                if self.timer.end < self.timer.begin:
                    self.timer.end += 86400

            if self.timer.eit is not None:
                event = eEPGCache.getInstance().lookupEventId(
                    self.timer.service_ref.ref, self.timer.eit)
                if event:
                    n = event.getNumOfLinkageServices()
                    if n > 1:
                        tlist = []
                        ref = self.session.nav.getCurrentlyPlayingServiceOrGroup(
                        )
                        parent = self.timer.service_ref.ref
                        selection = 0
                        for x in range(n):
                            i = event.getLinkageService(parent, x)
                            if i.toString() == ref.toString():
                                selection = x
                            tlist.append((i.getName(), i))
                        self.session.openWithCallback(
                            self.subserviceSelected,
                            ChoiceBox,
                            title=_("Please select a subservice to record..."),
                            list=tlist,
                            selection=selection)
                        return
                    elif n > 0:
                        parent = self.timer.service_ref.ref
                        self.timer.service_ref = ServiceReference(
                            event.getLinkageService(parent, 0))
            self.saveTimer()
            self.close((True, self.timer))
コード例 #40
0
ファイル: TimerEntry.py プロジェクト: Taykun345/enigma2
	def keyGo(self, result = None):
		if not self.timerentry_service_ref.isRecordable():
			self.session.openWithCallback(self.selectChannelSelector, MessageBox, _("You didn't select a channel to record from."), MessageBox.TYPE_ERROR)
			return
		self.timer.name = self.timerentry_name.value
		self.timer.description = self.timerentry_description.value
		self.timer.justplay = self.timerentry_justplay.value == "zap"
		self.timer.always_zap = self.timerentry_justplay.value == "zap+record"
		self.timer.zap_wakeup = self.timerentry_zapwakeup.value
		self.timer.rename_repeat = self.timerentry_renamerepeat.value
		if self.timerentry_justplay.value == "zap":
			if not self.timerentry_showendtime.value:
				self.timerentry_endtime.value = self.timerentry_starttime.value
				self.timerentry_afterevent.value = "nothing"
		self.timer.resetRepeated()
		self.timer.afterEvent = {
			"nothing": AFTEREVENT.NONE,
			"deepstandby": AFTEREVENT.DEEPSTANDBY,
			"standby": AFTEREVENT.STANDBY,
			"auto": AFTEREVENT.AUTO
			}[self.timerentry_afterevent.value]
		self.timer.descramble = {
			"normal": True,
			"descrambled+ecm": True,
			"scrambled+ecm": False,
			}[self.timerentry_recordingtype.value]
		self.timer.record_ecm = {
			"normal": False,
			"descrambled+ecm": True,
			"scrambled+ecm": True,
			}[self.timerentry_recordingtype.value]
		self.timer.service_ref = self.timerentry_service_ref
		self.timer.tags = self.timerentry_tags

		if self.timer.dirname or self.timerentry_dirname.value != defaultMoviePath():
			self.timer.dirname = self.timerentry_dirname.value
			config.movielist.last_timer_videodir.value = self.timer.dirname
			config.movielist.last_timer_videodir.save()

		if self.timerentry_type.value == "once":
			self.timer.begin, self.timer.end = self.getBeginEnd()
		if self.timerentry_type.value == "repeated":
			if self.timerentry_repeated.value == "daily":
				for x in (0, 1, 2, 3, 4, 5, 6):
					self.timer.setRepeated(x)

			if self.timerentry_repeated.value == "weekly":
				self.timer.setRepeated(self.timerentry_weekday.index)

			if self.timerentry_repeated.value == "weekdays":
				for x in (0, 1, 2, 3, 4):
					self.timer.setRepeated(x)

			if self.timerentry_repeated.value == "user":
				for x in (0, 1, 2, 3, 4, 5, 6):
					if self.timerentry_day[x].value:
						self.timer.setRepeated(x)

			self.timer.repeatedbegindate = self.getTimestamp(self.timerentry_repeatedbegindate.value, self.timerentry_starttime.value)
			if self.timer.repeated:
				self.timer.begin = self.getTimestamp(self.timerentry_repeatedbegindate.value, self.timerentry_starttime.value)
				self.timer.end = self.getTimestamp(self.timerentry_repeatedbegindate.value, self.timerentry_endtime.value)
			else:
				self.timer.begin = self.getTimestamp(time.time(), self.timerentry_starttime.value)
				self.timer.end = self.getTimestamp(time.time(), self.timerentry_endtime.value)

			# when a timer end is set before the start, add 1 day
			if self.timer.end < self.timer.begin:
				self.timer.end += 86400

		if self.timer.eit is not None:
			event = eEPGCache.getInstance().lookupEventId(self.timer.service_ref.ref, self.timer.eit)
			if event:
				n = event.getNumOfLinkageServices()
				if n > 1:
					tlist = []
					ref = self.session.nav.getCurrentlyPlayingServiceOrGroup()
					parent = self.timer.service_ref.ref
					selection = 0
					for x in range(n):
						i = event.getLinkageService(parent, x)
						if i.toString() == ref.toString():
							selection = x
						tlist.append((i.getName(), i))
					self.session.openWithCallback(self.subserviceSelected, ChoiceBox, title=_("Please select a subservice to record..."), list = tlist, selection = selection)
					return
				elif n > 0:
					parent = self.timer.service_ref.ref
					self.timer.service_ref = ServiceReference(event.getLinkageService(parent, 0))
		self.saveTimer()
		self.close((True, self.timer))
コード例 #41
0
ファイル: TimerEntry.py プロジェクト: OpenDMM/enigma2
	def getConfigListValues(self):
		if not self.timerentry_service_ref.isRecordable():
			self.session.openWithCallback(self.selectChannelSelector, MessageBox, _("You didn't select a channel to record from."), MessageBox.TYPE_ERROR)
			return
		if self.timerentry_justplay.value == 'record':
			if not harddiskmanager.inside_mountpoint(self.timerentry_dirname.value):
				if harddiskmanager.HDDCount() and not harddiskmanager.HDDEnabledCount():
					self.session.open(MessageBox, _("Unconfigured storage devices found!") + "\n" \
						+ _("Please make sure to set up your storage devices with the improved storage management in menu -> setup -> system -> storage devices."), MessageBox.TYPE_ERROR)
					return
				elif harddiskmanager.HDDEnabledCount() and defaultStorageDevice() == "<undefined>":
					self.session.open(MessageBox, _("No default storage device found!") + "\n" \
						+ _("Please make sure to set up your default storage device in menu -> setup -> system -> recording paths."), MessageBox.TYPE_ERROR)
					return
				elif harddiskmanager.HDDEnabledCount() and defaultStorageDevice() != "<undefined>":
					part = harddiskmanager.getDefaultStorageDevicebyUUID(defaultStorageDevice())
					if part is None:
						self.session.open(MessageBox, _("Default storage device is not available!") + "\n" \
							+ _("Please verify if your default storage device is attached or set up your default storage device in menu -> setup -> system -> recording paths."), MessageBox.TYPE_ERROR)
						return
				else:
					self.session.open(MessageBox, _("Recording destination for this timer does not exists."), MessageBox.TYPE_ERROR)
					return

		self.timer.name = self.timerentry_name.value
		self.timer.description = self.timerentry_description.value
		self.timer.justplay = self.timerentry_justplay.value == "zap"
		if self.timerentry_justplay.value == "zap":
			if not self.timerentry_showendtime.value:
				self.timerentry_endtime.value = self.timerentry_starttime.value

		self.timer.resetRepeated()
		self.timer.afterEvent = {
			"nothing": AFTEREVENT.NONE,
			"deepstandby": AFTEREVENT.DEEPSTANDBY,
			"standby": AFTEREVENT.STANDBY,
			"auto": AFTEREVENT.AUTO
			}[self.timerentry_afterevent.value]
		self.timer.service_ref = self.timerentry_service_ref
		self.timer.tags = self.timerentry_tags

		if self.timer.dirname or self.timerentry_dirname.value != defaultMoviePath():
			self.timer.dirname = self.timerentry_dirname.value
			config.movielist.last_timer_videodir.value = self.timer.dirname
			config.movielist.last_timer_videodir.save()

		if self.timerentry_type.value == "once":
			self.timer.begin, self.timer.end = self.getBeginEnd()
		if self.timerentry_type.value == "repeated":
			if self.timerentry_repeated.value == "daily":
				for x in (0, 1, 2, 3, 4, 5, 6):
					self.timer.setRepeated(x)

			if self.timerentry_repeated.value == "weekly":
				self.timer.setRepeated(self.timerentry_weekday.index)

			if self.timerentry_repeated.value == "weekdays":
				for x in (0, 1, 2, 3, 4):
					self.timer.setRepeated(x)

			if self.timerentry_repeated.value == "user":
				for x in (0, 1, 2, 3, 4, 5, 6):
					if self.timerentry_day[x].value:
						self.timer.setRepeated(x)

			self.timer.repeatedbegindate = self.getTimestamp(self.timerentry_repeatedbegindate.value, self.timerentry_starttime.value)
			if self.timer.repeated:
				self.timer.begin = self.getTimestamp(self.timerentry_repeatedbegindate.value, self.timerentry_starttime.value)
				self.timer.end = self.getTimestamp(self.timerentry_repeatedbegindate.value, self.timerentry_endtime.value)
			else:
				self.timer.begin = self.getTimestamp(time.time(), self.timerentry_starttime.value)
				self.timer.end = self.getTimestamp(time.time(), self.timerentry_endtime.value)

			# when a timer end is set before the start, add 1 day
			if self.timer.end < self.timer.begin:
				self.timer.end += 86400
コード例 #42
0
ファイル: TimerEntry.py プロジェクト: ahmedmoselhi/dvbapp2
    def createConfig(self):
        justplay = self.timer.justplay
        always_zap = self.timer.always_zap
        rename_repeat = self.timer.rename_repeat
        afterevent = {AFTEREVENT.NONE: 'nothing',
         AFTEREVENT.DEEPSTANDBY: 'deepstandby',
         AFTEREVENT.STANDBY: 'standby',
         AFTEREVENT.AUTO: 'auto'}[self.timer.afterEvent]
        if self.timer.record_ecm and self.timer.descramble:
            recordingtype = 'descrambled+ecm'
        elif self.timer.record_ecm:
            recordingtype = 'scrambled+ecm'
        elif self.timer.descramble:
            recordingtype = 'normal'
        weekday_table = ('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun')
        day = []
        weekday = 0
        for x in (0, 1, 2, 3, 4, 5, 6):
            day.append(0)

        if self.timer.repeated:
            type = 'repeated'
            if self.timer.repeated == 31:
                repeated = 'weekdays'
            elif self.timer.repeated == 127:
                repeated = 'daily'
            else:
                flags = self.timer.repeated
                repeated = 'user'
                count = 0
                for x in (0, 1, 2, 3, 4, 5, 6):
                    if flags == 1:
                        weekday = x
                    if flags & 1 == 1:
                        day[x] = 1
                        count += 1
                    else:
                        day[x] = 0
                    flags >>= 1

                if count == 1:
                    repeated = 'weekly'
        else:
            type = 'once'
            repeated = None
            weekday = int(strftime('%u', localtime(self.timer.begin))) - 1
            day[weekday] = 1
        self.timerentry_justplay = ConfigSelection(choices=[('zap', _('zap')), ('record', _('record')), ('zap+record', _('zap and record'))], default={0: 'record',
         1: 'zap',
         2: 'zap+record'}[justplay + 2 * always_zap])
        self.timertyp = self.timerentry_justplay.value
        if SystemInfo['DeepstandbySupport']:
            shutdownString = _('go to deep standby')
        else:
            shutdownString = _('shut down')
        self.timerentry_afterevent = ConfigSelection(choices=[('nothing', _('do nothing')),
         ('standby', _('go to standby')),
         ('deepstandby', shutdownString),
         ('auto', _('auto'))], default=afterevent)
        self.timerentry_recordingtype = ConfigSelection(choices=[('normal', _('normal')), ('descrambled+ecm', _('descramble and record ecm')), ('scrambled+ecm', _("don't descramble, record ecm"))], default=recordingtype)
        self.timerentry_type = ConfigSelection(choices=[('once', _('once')), ('repeated', _('repeated'))], default=type)
        self.timerentry_name = ConfigText(default=self.timer.name.replace('\xc2\x86', '').replace('\xc2\x87', '').encode('utf-8'), visible_width=50, fixed_size=False)
        self.timerentry_description_replaced = self.timer.description.replace('\xc2\x8a', ' ').encode('utf-8')
        self.timerentry_description = ConfigText(default=self.timerentry_description_replaced, visible_width=50, fixed_size=False)
        self.timerentry_tags = self.timer.tags[:]
        if not self.timerentry_tags:
            tagname = self.timer.name.strip()
            if tagname:
                tagname = tagname[0].upper() + tagname[1:].replace(' ', '_')
                self.timerentry_tags.append(tagname)
        self.timerentry_tagsset = ConfigSelection(choices=[not self.timerentry_tags and 'None' or ' '.join(self.timerentry_tags)])
        self.timerentry_repeated = ConfigSelection(default=repeated, choices=[('weekly', _('weekly')),
         ('daily', _('daily')),
         ('weekdays', _('Mon-Fri')),
         ('user', _('user defined'))])
        self.timerentry_renamerepeat = ConfigYesNo(default=rename_repeat)
        self.timerentry_date = ConfigDateTime(default=self.timer.begin, formatstring=_('%d %B %Y'), increment=86400)
        self.timerentry_starttime = ConfigClock(default=self.timer.begin)
        self.timerentry_endtime = ConfigClock(default=self.timer.end)
        self.timerentry_showendtime = ConfigSelection(default=self.timer.end > self.timer.begin + 3 and self.timer.justplay, choices=[(True, _('yes')), (False, _('no'))])
        default = self.timer.dirname or defaultMoviePath()
        tmp = config.movielist.videodirs.value
        if default not in tmp:
            tmp.append(default)
        self.timerentry_dirname = ConfigSelection(default=default, choices=tmp)
        self.timerentry_repeatedbegindate = ConfigDateTime(default=self.timer.repeatedbegindate, formatstring=_('%d.%B %Y'), increment=86400)
        self.timerentry_weekday = ConfigSelection(default=weekday_table[weekday], choices=[('mon', _('Monday')),
         ('tue', _('Tuesday')),
         ('wed', _('Wednesday')),
         ('thu', _('Thursday')),
         ('fri', _('Friday')),
         ('sat', _('Saturday')),
         ('sun', _('Sunday'))])
        self.timerentry_day = ConfigSubList()
        for x in (0, 1, 2, 3, 4, 5, 6):
            self.timerentry_day.append(ConfigYesNo(default=day[x]))

        servicename = 'N/A'
        try:
            servicename = str(self.timer.service_ref.getServiceName())
        except:
            pass

        self.timerentry_service_ref = self.timer.service_ref
        self.timerentry_service = ConfigSelection([servicename])
コード例 #43
0
ファイル: TimerEntry.py プロジェクト: kingvuplus/boom
    def keyGo(self, result = None):
        if not self.timerentry_service_ref.isRecordable():
            self.session.openWithCallback(self.selectChannelSelector, MessageBox, _("You didn't select a channel to record from."), MessageBox.TYPE_ERROR)
            return
        else:
            self.timer.name = self.timerentry_name.value
            self.timer.description = self.timerentry_description.value
            self.timer.justplay = self.timerentry_justplay.value == 'zap'
            self.timer.always_zap = self.timerentry_justplay.value == 'zap+record'
            self.timer.rename_repeat = self.timerentry_renamerepeat.value
            if self.timerentry_justplay.value == 'zap':
                if not self.timerentry_showendtime.value:
                    self.timerentry_endtime.value = self.timerentry_starttime.value
                    self.timerentry_afterevent.value = 'nothing'
            if self.timerentry_endtime.value == self.timerentry_starttime.value and self.timerentry_afterevent.value != 'nothing':
                self.timerentry_afterevent.value = 'nothing'
                self.session.open(MessageBox, _('Difference between timer begin and end must be equal or greater than %d minutes.\nEnd Action was disabled !') % 1, MessageBox.TYPE_INFO, timeout=30)
            self.timer.resetRepeated()
            self.timer.afterEvent = {'nothing': AFTEREVENT.NONE,
             'deepstandby': AFTEREVENT.DEEPSTANDBY,
             'standby': AFTEREVENT.STANDBY,
             'auto': AFTEREVENT.AUTO}[self.timerentry_afterevent.value]
            self.timer.descramble = {'normal': True,
             'descrambled+ecm': True,
             'scrambled+ecm': False}[self.timerentry_recordingtype.value]
            self.timer.record_ecm = {'normal': False,
             'descrambled+ecm': True,
             'scrambled+ecm': True}[self.timerentry_recordingtype.value]
            self.timer.service_ref = self.timerentry_service_ref
            self.timer.tags = self.timerentry_tags
            if self.timer.dirname or self.timerentry_dirname.value != defaultMoviePath():
                self.timer.dirname = self.timerentry_dirname.value
                config.movielist.last_timer_videodir.value = self.timer.dirname
                config.movielist.last_timer_videodir.save()
            if self.timerentry_type.value == 'once':
                self.timer.begin, self.timer.end = self.getBeginEnd()
            if self.timerentry_type.value == 'repeated':
                if self.timerentry_repeated.value == 'daily':
                    for x in (0, 1, 2, 3, 4, 5, 6):
                        self.timer.setRepeated(x)

                if self.timerentry_repeated.value == 'weekly':
                    self.timer.setRepeated(self.timerentry_weekday.index)
                if self.timerentry_repeated.value == 'weekdays':
                    for x in (0, 1, 2, 3, 4):
                        self.timer.setRepeated(x)

                if self.timerentry_repeated.value == 'user':
                    for x in (0, 1, 2, 3, 4, 5, 6):
                        if self.timerentry_day[x].value:
                            self.timer.setRepeated(x)

                self.timer.repeatedbegindate = self.getTimestamp(self.timerentry_repeatedbegindate.value, self.timerentry_starttime.value)
                if self.timer.repeated:
                    self.timer.begin = self.getTimestamp(self.timerentry_repeatedbegindate.value, self.timerentry_starttime.value)
                    self.timer.end = self.getTimestamp(self.timerentry_repeatedbegindate.value, self.timerentry_endtime.value)
                else:
                    self.timer.begin = self.getTimestamp(time.time(), self.timerentry_starttime.value)
                    self.timer.end = self.getTimestamp(time.time(), self.timerentry_endtime.value)
                if self.timer.end < self.timer.begin:
                    self.timer.end += 86400
            if self.timer.eit is not None:
                event = eEPGCache.getInstance().lookupEventId(self.timer.service_ref.ref, self.timer.eit)
                if event:
                    n = event.getNumOfLinkageServices()
                    if n > 1:
                        tlist = []
                        ref = self.session.nav.getCurrentlyPlayingServiceOrGroup()
                        parent = self.timer.service_ref.ref
                        selection = 0
                        for x in range(n):
                            i = event.getLinkageService(parent, x)
                            if i.toString() == ref.toString():
                                selection = x
                            tlist.append((i.getName(), i))

                        self.session.openWithCallback(self.subserviceSelected, ChoiceBox, title=_('Please select a subservice to record...'), list=tlist, selection=selection)
                        return
                    if n > 0:
                        parent = self.timer.service_ref.ref
                        self.timer.service_ref = ServiceReference(event.getLinkageService(parent, 0))
            self.saveTimer()
            self.close((True, self.timer))
            return
コード例 #44
0
	def __init__(self, session, selectedmovie=None):
#		print "[SF-Plugin] SF:MovieSelection.init, PWD=%s; selmv=%s" % (config.movielist.last_videodir.value, str(selectedmovie))
		Screen.__init__(self, session)
		HelpableScreen.__init__(self)

		self.tags = []
		if selectedmovie:
			self.selected_tags = config.movielist.last_selected_tags.value
		else:
			self.selected_tags = None
		self.selected_tags_ele = None
		self.toggletype = 0

		self.movemode = False
		self.bouquet_mark_edit = False

		self.delayTimer = eTimer()
		self.delayTimer.callback.append(self.updateHDDData)

		self["waitingtext"] = Label(_("Please wait... Loading list..."))

		# create optional description border and hide immediately
		self["DescriptionBorder"] = Pixmap()
		self["DescriptionBorder"].hide()

		if not fileExists(config.movielist.last_videodir.value):
			config.movielist.last_videodir.value = defaultMoviePath()
			config.movielist.last_videodir.save()
#			print "[SF-Plugin] MovieSelection.MovieSelection: save" + config.movielist.last_videodir.value
		self.current_ref = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + config.movielist.last_videodir.value)

		self["list"] = MovieList(None,
			config.movielist.sflisttype.value,
			config.movielist.sfmoviesort.value,
			config.movielist.sftimes.value,
			config.movielist.sftitle_episode_separator.value,
			self)

		self.list = self["list"]
		self.selectedmovie = selectedmovie

		# Need list for init
		SelectionEventInfo.__init__(self)

		self["key_red"] = Button(_("All"))
		self["key_green"] = Button("")
		self["key_yellow"] = Button("")
		self["key_blue"] = Button("")

		self["freeDiskSpace"] = self.diskinfo = DiskInfo(config.movielist.last_videodir.value, DiskInfo.FREE, update=False)

		if config.usage.setup_level.index >= 2: # expert+
			self["InfobarActions"] = HelpableActionMap(self, "InfobarActions",
				{
					"showMovies": (self.doPathSelect, _("select the movie path")),
				})

		self["MovieSelectionActions"] = HelpableActionMap(self, "MovieSelectionActions",
			{
				"contextMenu": (self.doContext, _("menu")),
				"showEventInfo": (self.showEventInformation, _("show event details")),
			})

		self["ColorActions"] = HelpableActionMap(self, "ColorActions",
			{
				"red": (self.showAll, _("show all")),
				"green": (self.showTagsFirst, _("show first selected tag")),
				"yellow": (self.showTagsSecond, _("show second selected tag")),
				"blue": (self.showTagsSelect, _("show tag menu")),
			})

		self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions",
			{
				"cancel": (self.abort, _("exit movielist")),
				"ok": (self.movieSelected, _("select movie")),
			})

		self["NumberActions"] = HelpableActionMap(self, "SetupActions",
			{
				"0": (self.toggleSort, _x("Toggle date / alphabetic sort mode")),
				"deleteBackward": (self.moveToIndexStrt, _x("Jump to listbegin")),
				"deleteForward": (self.moveToIndexEnd, _x("Jump to listend")),
				"5": (self.toggleMinimal, _x("Toggle style minimal / compact")),
				"8": (self.toggleTags, _x("Toggle description / tags display")),
			})

		self.onShown.append(self.go)
		self.onLayoutFinish.append(self.saveListsize)
		self.inited = False
コード例 #45
0
    def createConfig(self):
        justplay = self.timer.justplay

        afterevent = {
            AFTEREVENT.NONE: "nothing",
            AFTEREVENT.DEEPSTANDBY: "deepstandby",
            AFTEREVENT.STANDBY: "standby",
            AFTEREVENT.AUTO: "auto"
        }[self.timer.afterEvent]

        weekday_table = ("mon", "tue", "wed", "thu", "fri", "sat", "sun")

        # calculate default values
        day = []
        weekday = 0
        for x in (0, 1, 2, 3, 4, 5, 6):
            day.append(0)
        if self.timer.repeated:  # repeated
            type = "repeated"
            if (self.timer.repeated == 31):  # Mon-Fri
                repeated = "weekdays"
            elif (self.timer.repeated == 127):  # daily
                repeated = "daily"
            else:
                flags = self.timer.repeated
                repeated = "user"
                count = 0
                for x in (0, 1, 2, 3, 4, 5, 6):
                    if flags == 1:  # weekly
                        print "Set to weekday " + str(x)
                        weekday = x
                    if flags & 1 == 1:  # set user defined flags
                        day[x] = 1
                        count += 1
                    else:
                        day[x] = 0
                    flags = flags >> 1
                if count == 1:
                    repeated = "weekly"
        else:  # once
            type = "once"
            repeated = None
            weekday = (int(strftime("%w", localtime(self.timer.begin))) -
                       1) % 7
            day[weekday] = 1

        self.timerentry_justplay = ConfigSelection(choices=[("zap", _("zap")),
                                                            ("record",
                                                             _("record"))],
                                                   default={
                                                       0: "record",
                                                       1: "zap"
                                                   }[justplay])
        if SystemInfo["DeepstandbySupport"]:
            shutdownString = _("go to deep standby")
        else:
            shutdownString = _("shut down")
        self.timerentry_afterevent = ConfigSelection(choices=[
            ("nothing", _("do nothing")), ("standby", _("go to standby")),
            ("deepstandby", shutdownString), ("auto", _("auto"))
        ],
                                                     default=afterevent)
        self.timerentry_type = ConfigSelection(choices=[("once", _("once")),
                                                        ("repeated",
                                                         _("repeated"))],
                                               default=type)
        self.timerentry_name = ConfigText(default=self.timer.name,
                                          visible_width=50,
                                          fixed_size=False)
        self.timerentry_description = ConfigText(
            default=self.timer.description, visible_width=50, fixed_size=False)
        self.timerentry_tags = self.timer.tags[:]
        self.timerentry_tagsset = ConfigSelection(choices=[
            not self.timerentry_tags and "None"
            or " ".join(self.timerentry_tags)
        ])

        self.timerentry_repeated = ConfigSelection(
            default=repeated,
            choices=[("daily", _("daily")), ("weekly", _("weekly")),
                     ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])

        self.timerentry_date = ConfigDateTime(default=self.timer.begin,
                                              formatstring=_("%d.%B %Y"),
                                              increment=86400)
        self.timerentry_starttime = ConfigClock(default=self.timer.begin)
        self.timerentry_endtime = ConfigClock(default=self.timer.end)
        self.timerentry_showendtime = ConfigSelection(
            default=((self.timer.end - self.timer.begin) > 4),
            choices=[(True, _("yes")), (False, _("no"))])

        default = self.timer.dirname or defaultMoviePath()
        tmp = config.movielist.videodirs.value
        if default not in tmp:
            tmp.append(default)
        self.timerentry_dirname = ConfigSelection(default=default, choices=tmp)

        self.timerentry_repeatedbegindate = ConfigDateTime(
            default=self.timer.repeatedbegindate,
            formatstring=_("%d.%B %Y"),
            increment=86400)

        self.timerentry_weekday = ConfigSelection(
            default=weekday_table[weekday],
            choices=[("mon", _("Monday")), ("tue", _("Tuesday")),
                     ("wed", _("Wednesday")), ("thu", _("Thursday")),
                     ("fri", _("Friday")), ("sat", _("Saturday")),
                     ("sun", _("Sunday"))])

        self.timerentry_day = ConfigSubList()
        for x in (0, 1, 2, 3, 4, 5, 6):
            self.timerentry_day.append(ConfigYesNo(default=day[x]))

        # FIXME some service-chooser needed here
        servicename = "N/A"
        try:  # no current service available?
            servicename = str(self.timer.service_ref.getServiceName())
        except:
            pass
        self.timerentry_service_ref = self.timer.service_ref
        self.timerentry_service = ConfigSelection([servicename])
コード例 #46
0
ファイル: TimerEntry.py プロジェクト: OpenDMM/enigma2
	def createConfig(self):
			justplay = self.timer.justplay

			afterevent = {
				AFTEREVENT.NONE: "nothing",
				AFTEREVENT.DEEPSTANDBY: "deepstandby",
				AFTEREVENT.STANDBY: "standby",
				AFTEREVENT.AUTO: "auto"
				}[self.timer.afterEvent]

			weekday_table = ("mon", "tue", "wed", "thu", "fri", "sat", "sun")

			# calculate default values
			day = []
			weekday = 0
			for x in (0, 1, 2, 3, 4, 5, 6):
				day.append(0)
			if self.timer.repeated: # repeated
				type = "repeated"
				if (self.timer.repeated == 31): # Mon-Fri
					repeated = "weekdays"
				elif (self.timer.repeated == 127): # daily
					repeated = "daily"
				else:
					flags = self.timer.repeated
					repeated = "user"
					count = 0
					for x in (0, 1, 2, 3, 4, 5, 6):
						if flags == 1: # weekly
							print "Set to weekday " + str(x)
							weekday = x
						if flags & 1 == 1: # set user defined flags
							day[x] = 1
							count += 1
						else:
							day[x] = 0
						flags = flags >> 1
					if count == 1:
						repeated = "weekly"
			else: # once
				type = "once"
				repeated = None
				weekday = (int(strftime("%w", localtime(self.timer.begin))) - 1) % 7
				day[weekday] = 1

			if not config.misc.recording_allowed.value:
				self.timerentry_justplay = ConfigSelection(choices = [("zap", _("zap"))], default = "zap")
			else:
				tmp_dir = self.timer.dirname or defaultMoviePath()
				if not harddiskmanager.inside_mountpoint(tmp_dir):
					justplay = 1
				justplay_default = {0: "record", 1: "zap"}[justplay]
				self.timerentry_justplay = ConfigSelection(choices = [("zap", _("zap")), ("record", _("record"))], default = justplay_default)

			if SystemInfo["DeepstandbySupport"]:
				shutdownString = _("go to standby")
			else:
				shutdownString = _("shut down")
			self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to idle mode")), ("deepstandby", shutdownString), ("auto", _("auto"))], default = afterevent)
			self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
			self.timerentry_name = ConfigText(default = self.timer.name, visible_width = 50, fixed_size = False)
			self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False)
			self.timerentry_tags = self.timer.tags[:]
			self.timerentry_tagsset = ConfigSelection(choices = [not self.timerentry_tags and "None" or " ".join(self.timerentry_tags)])

			self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("daily", _("daily")), ("weekly", _("weekly")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])
			
			self.timerentry_date = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400)
			self.timerentry_starttime = ConfigClock(default = self.timer.begin)
			self.timerentry_endtime = ConfigClock(default = self.timer.end)
			self.timerentry_showendtime = ConfigSelection(default = ((self.timer.end - self.timer.begin) > 4), choices = [(True, _("yes")), (False, _("no"))])

			default = self.timer.dirname or defaultMoviePath()
			tmp = config.movielist.videodirs.value
			if default not in tmp:
				tmp.append(default)
			self.timerentry_dirname = ConfigSelection(default = default, choices = tmp)

			self.timerentry_repeatedbegindate = ConfigDateTime(default = self.timer.repeatedbegindate, formatstring = _("%d.%B %Y"), increment = 86400)

			self.timerentry_weekday = ConfigSelection(default = weekday_table[weekday], choices = [("mon",_("Monday")), ("tue", _("Tuesday")), ("wed",_("Wednesday")), ("thu", _("Thursday")), ("fri", _("Friday")), ("sat", _("Saturday")), ("sun", _("Sunday"))])

			self.timerentry_day = ConfigSubList()
			for x in (0, 1, 2, 3, 4, 5, 6):
				self.timerentry_day.append(ConfigYesNo(default = day[x]))

			try: # no current service available?
				servicename = str(self.timer.service_ref.getServiceName())
			except:
				pass
			servicename = servicename or "N/A"
			self.timerentry_service_ref = self.timer.service_ref
			self.timerentry_service = ConfigSelection([servicename])

			self.timerentry_plugins = {}
			if config.usage.setup_level.index >= 2:
				from Plugins.Plugin import PluginDescriptor
				from Components.PluginComponent import plugins
				missing = self.timer.plugins.keys()
				for p in plugins.getPlugins(PluginDescriptor.WHERE_TIMEREDIT):
					if p.__call__.has_key("setupFnc"):
						setupFnc = p.__call__["setupFnc"]
						if setupFnc is not None:
							if p.__call__.has_key("configListEntry"):
								entry = p.__call__["configListEntry"]()
								pdata = None
								if p.name in self.timer.plugins:
									pval = self.timer.plugins[p.name][0]
									pdata = self.timer.plugins[p.name][1]
									try:
										if isinstance(entry[1].value, bool):
											entry[1].value = (pval == "True")
										elif isinstance(entry[1].value, str):
											entry[1].value = str(pval)
										elif isinstance(entry[1].value, int):
											entry[1].value = int(pval)
									except ValueError:
										print "could not get config_val", pval, type(pval), "for WHERE_TIMEREDIT plugin:", p.name
										break

								self.timerentry_plugins[entry] = [p.name, setupFnc, pdata] # [plugin name, function call for plugin setup, plugin private data]
								if p.name in missing:
									missing.remove(p.name)
				if len(missing):
					print "could not setup WHERE_TIMEREDIT plugin(s):", missing
コード例 #47
0
	def keyGo(self, result = None):
	#check record path
		print "self.timerentry_dirname.value:",self.timerentry_dirname.value
		if self.timerentry_justplay.value == "record":
			if not checkRecordPath(self.timerentry_dirname.value):
				self["config"].setCurrentIndex(8)
				self.session.open(MessageBox, _("Record Path: ") + self.timerentry_dirname.value + "\n" + _("Please check is inserted an external storage device and  select the right record Directory?\nUSB storage device: /media/usb\n"), MessageBox.TYPE_ERROR)
				return
				
		if not self.timerentry_service_ref.isRecordable():
			#remove input helpbar
			self["config"].setCurrentIndex(7)
			self.session.openWithCallback(self.selectChannelSelector, MessageBox, _("You didn't select a channel to record from."), MessageBox.TYPE_ERROR)
			return
		self.timer.name = self.timerentry_name.value
		self.timer.description = self.timerentry_description.value
		self.timer.justplay = self.timerentry_justplay.value == "zap"
		if self.timerentry_justplay.value == "zap":
			if not self.timerentry_showendtime.value:
				self.timerentry_endtime.value = self.timerentry_starttime.value
		self.timer.resetRepeated()
		self.timer.afterEvent = {
			"nothing": AFTEREVENT.NONE,
			"deepstandby": AFTEREVENT.DEEPSTANDBY,
			"standby": AFTEREVENT.STANDBY,
			"auto": AFTEREVENT.AUTO
			}[self.timerentry_afterevent.value]
		self.timer.service_ref = self.timerentry_service_ref
		self.timer.tags = self.timerentry_tags

		if self.timer.dirname or self.timerentry_dirname.value != defaultMoviePath():
			self.timer.dirname = self.timerentry_dirname.value
			config.movielist.last_timer_videodir.value = self.timer.dirname
			config.movielist.last_timer_videodir.save()

		if self.timerentry_type.value == "once":
			self.timer.begin, self.timer.end = self.getBeginEnd()
		if self.timerentry_type.value == "repeated":
			if self.timerentry_repeated.value == "daily":
				for x in (0, 1, 2, 3, 4, 5, 6):
					self.timer.setRepeated(x)

			if self.timerentry_repeated.value == "weekly":
				self.timer.setRepeated(self.timerentry_weekday.index)

			if self.timerentry_repeated.value == "weekdays":
				for x in (0, 1, 2, 3, 4):
					self.timer.setRepeated(x)

			if self.timerentry_repeated.value == "user":
				for x in (0, 1, 2, 3, 4, 5, 6):
					if self.timerentry_day[x].value:
						self.timer.setRepeated(x)

			self.timer.repeatedbegindate = self.getTimestamp(self.timerentry_repeatedbegindate.value, self.timerentry_starttime.value)
			if self.timer.repeated:
				self.timer.begin = self.getTimestamp(self.timerentry_repeatedbegindate.value, self.timerentry_starttime.value)
				self.timer.end = self.getTimestamp(self.timerentry_repeatedbegindate.value, self.timerentry_endtime.value)
			else:
				self.timer.begin = self.getTimestamp(time.time(), self.timerentry_starttime.value)
				self.timer.end = self.getTimestamp(time.time(), self.timerentry_endtime.value)

			# when a timer end is set before the start, add 1 day
			if self.timer.end < self.timer.begin:
				self.timer.end += 86400

		if self.timer.eit is not None:
			event = eEPGCache.getInstance().lookupEventId(self.timer.service_ref.ref, self.timer.eit)
			if event:
				n = event.getNumOfLinkageServices()
				if n > 1:
					tlist = []
					ref = self.session.nav.getCurrentlyPlayingServiceReference()
					parent = self.timer.service_ref.ref
					selection = 0
					for x in range(n):
						i = event.getLinkageService(parent, x)
						if i.toString() == ref.toString():
							selection = x
						tlist.append((i.getName(), i))
					self.session.openWithCallback(self.subserviceSelected, ChoiceBox, title=_("Please select a subservice to record..."), list = tlist, selection = selection)
					return
				elif n > 0:
					parent = self.timer.service_ref.ref
					self.timer.service_ref = ServiceReference(event.getLinkageService(parent, 0))
		self.saveTimer()
		self.close((True, self.timer))
コード例 #48
0
ファイル: TimerEntry.py プロジェクト: Sign-in-and/enigma2
    def keyGo(self, result=None):
        if not self.timerentry_service_ref.isRecordable():
            self.session.openWithCallback(
                self.selectChannelSelector, MessageBox,
                _("You didn't select a channel to record from."),
                MessageBox.TYPE_ERROR)
        elif self.timerentry_remote.value:
            service_ref = self.timerentry_service_ref
            if self.timer.eit is not None:
                event = eEPGCache.getInstance().lookupEventId(
                    service_ref.ref, self.timer.eit)
                if event:
                    n = event.getNumOfLinkageServices()
                    if n > 1:
                        tlist = []
                        ref = self.session.nav.getCurrentlyPlayingServiceReference(
                        )
                        parent = service_ref.ref
                        selection = 0
                        for x in range(n):
                            i = event.getLinkageService(parent, x)
                            if i.toString() == ref.toString():
                                selection = x
                            tlist.append((i.getName(), i))
                        self.session.openWithCallback(
                            self.RemoteSubserviceSelected,
                            ChoiceBox,
                            title=_("Please select a subservice to record..."),
                            list=tlist,
                            selection=selection)
                        return
                    elif n > 0:
                        parent = service_ref.ref
                        service_ref = ServiceReference(
                            event.getLinkageService(parent, 0))
            #resolve alternative
            alternative_ref = GetWithAlternative(str(service_ref))
            service_ref = ':'.join(alternative_ref.split(':')[:11])

            # XXX: this will - without any hassle - ignore the value of repeated
            begin, end = self.getBeginEnd()

            # when a timer end is set before the start, add 1 day
            if end < begin:
                end += 86400

            rt_name = urllib.quote(
                self.timerentry_name.value.decode('utf8').encode(
                    'utf8', 'ignore'))
            rt_description = urllib.quote(
                self.timerentry_description.value.decode('utf8').encode(
                    'utf8', 'ignore'))
            rt_disabled = 0  # XXX: do we really want to hardcode this? why do we offer this option then?
            rt_repeated = 0  # XXX: same here
            rt_dirname = "/hdd/movie"

            if self.timerentry_justplay.value == "zap":
                rt_justplay = 1
            else:
                rt_justplay = 0

            rt_eit = 0
            if self.timer.eit is not None:
                rt_eit = self.timer.eit

            rt_afterEvent = {
                "deepstandby": AFTEREVENT.DEEPSTANDBY,
                "standby": AFTEREVENT.STANDBY,
                "nothing": AFTEREVENT.NONE,
                "auto": AFTEREVENT.AUTO
            }.get(self.timerentry_afterevent.value, AFTEREVENT.AUTO)

            url = "%s/web/timeradd?sRef=%s&begin=%s&end=%s&name=%s&description=%s&disabled=%s&justplay=%s&afterevent=%s&repeated=%s&dirname=%s&eit=%s" % (
                config.usage.remote_fallback.value.rsplit(":", 1)[0],
                service_ref, begin, end, rt_name, rt_description, rt_disabled,
                rt_justplay, rt_afterEvent, rt_repeated, rt_dirname, rt_eit)
            print "[RemoteTimer] debug remote", url
            from Screens.TimerEdit import getUrl
            getUrl(url).addCallback(self.remoteTimerOK).addErrback(
                self.remoteTimerNOK)

        else:

            self.timer.name = self.timerentry_name.value
            self.timer.description = self.timerentry_description.value
            self.timer.justplay = self.timerentry_justplay.value == "zap"
            self.timer.always_zap = self.timerentry_justplay.value == "zap+record"
            self.timer.zap_wakeup = self.timerentry_zapwakeup.value
            self.timer.pipzap = self.timerentry_pipzap.value
            self.timer.rename_repeat = self.timerentry_renamerepeat.value
            self.timer.conflict_detection = self.timerentry_conflictdetection.value
            if self.timerentry_justplay.value == "zap":
                if not self.timerentry_showendtime.value:
                    self.timerentry_endtime.value = self.timerentry_starttime.value
                    self.timerentry_afterevent.value = "nothing"
            self.timer.resetRepeated()
            self.timer.afterEvent = {
                "nothing": AFTEREVENT.NONE,
                "deepstandby": AFTEREVENT.DEEPSTANDBY,
                "standby": AFTEREVENT.STANDBY,
                "auto": AFTEREVENT.AUTO
            }[self.timerentry_afterevent.value]
            self.timer.descramble = {
                "normal": True,
                "descrambled+ecm": True,
                "scrambled+ecm": False,
            }[self.timerentry_recordingtype.value]
            self.timer.record_ecm = {
                "normal": False,
                "descrambled+ecm": True,
                "scrambled+ecm": True,
            }[self.timerentry_recordingtype.value]
            self.timer.service_ref = self.timerentry_service_ref
            self.timer.tags = self.timerentry_tags

            if self.timer.dirname or self.timerentry_dirname.value != defaultMoviePath(
            ):
                self.timer.dirname = self.timerentry_dirname.value
                config.movielist.last_timer_videodir.value = self.timer.dirname
                config.movielist.last_timer_videodir.save()

            if self.timerentry_type.value == "once":
                self.timer.begin, self.timer.end = self.getBeginEnd()
            if self.timerentry_type.value == "repeated":
                if self.timerentry_repeated.value == "daily":
                    for x in (0, 1, 2, 3, 4, 5, 6):
                        self.timer.setRepeated(x)

                if self.timerentry_repeated.value == "weekly":
                    self.timer.setRepeated(self.timerentry_weekday.index)

                if self.timerentry_repeated.value == "weekdays":
                    for x in (0, 1, 2, 3, 4):
                        self.timer.setRepeated(x)

                if self.timerentry_repeated.value == "user":
                    for x in (0, 1, 2, 3, 4, 5, 6):
                        if self.timerentry_day[x].value:
                            self.timer.setRepeated(x)

                self.timer.repeatedbegindate = self.getTimestamp(
                    self.timerentry_repeatedbegindate.value,
                    self.timerentry_starttime.value)
                if self.timer.repeated:
                    self.timer.begin = self.getTimestamp(
                        self.timerentry_repeatedbegindate.value,
                        self.timerentry_starttime.value)
                    self.timer.end = self.getTimestamp(
                        self.timerentry_repeatedbegindate.value,
                        self.timerentry_endtime.value)
                else:
                    self.timer.begin = self.getTimestamp(
                        time(), self.timerentry_starttime.value)
                    self.timer.end = self.getTimestamp(
                        time(), self.timerentry_endtime.value)

                # when a timer end is set before the start, add 1 day
                if self.timer.end < self.timer.begin:
                    self.timer.end += 86400

            if self.timer.eit is not None:
                event = eEPGCache.getInstance().lookupEventId(
                    self.timer.service_ref.ref, self.timer.eit)
                if event:
                    n = event.getNumOfLinkageServices()
                    if n > 1:
                        tlist = []
                        ref = self.session.nav.getCurrentlyPlayingServiceOrGroup(
                        )
                        parent = self.timer.service_ref.ref
                        selection = 0
                        for x in range(n):
                            i = event.getLinkageService(parent, x)
                            if i.toString() == ref.toString():
                                selection = x
                            tlist.append((i.getName(), i))
                        self.session.openWithCallback(
                            self.subserviceSelected,
                            ChoiceBox,
                            title=_("Please select a subservice to record..."),
                            list=tlist,
                            selection=selection)
                        return
                    elif n > 0:
                        parent = self.timer.service_ref.ref
                        self.timer.service_ref = ServiceReference(
                            event.getLinkageService(parent, 0))
            self.saveTimer()
            self.close((True, self.timer))
コード例 #49
0
ファイル: TimerEntry.py プロジェクト: Taykun345/enigma2
	def createConfig(self):
			justplay = self.timer.justplay
			always_zap = self.timer.always_zap
			zap_wakeup = self.timer.zap_wakeup
			rename_repeat = self.timer.rename_repeat

			afterevent = {
				AFTEREVENT.NONE: "nothing",
				AFTEREVENT.DEEPSTANDBY: "deepstandby",
				AFTEREVENT.STANDBY: "standby",
				AFTEREVENT.AUTO: "auto"
				}[self.timer.afterEvent]

			if self.timer.record_ecm and self.timer.descramble:
				recordingtype = "descrambled+ecm"
			elif self.timer.record_ecm:
				recordingtype = "scrambled+ecm"
			elif self.timer.descramble:
				recordingtype = "normal"

			weekday_table = ("mon", "tue", "wed", "thu", "fri", "sat", "sun")

			# calculate default values
			day = []
			weekday = 0
			for x in (0, 1, 2, 3, 4, 5, 6):
				day.append(0)
			if self.timer.repeated: # repeated
				type = "repeated"
				if (self.timer.repeated == 31): # Mon-Fri
					repeated = "weekdays"
				elif (self.timer.repeated == 127): # daily
					repeated = "daily"
				else:
					flags = self.timer.repeated
					repeated = "user"
					count = 0
					for x in (0, 1, 2, 3, 4, 5, 6):
						if flags == 1: # weekly
							print "Set to weekday " + str(x)
							weekday = x
						if flags & 1 == 1: # set user defined flags
							day[x] = 1
							count += 1
						else:
							day[x] = 0
						flags = flags >> 1
					if count == 1:
						repeated = "weekly"
			else: # once
				type = "once"
				repeated = None
				weekday = int(strftime("%u", localtime(self.timer.begin))) - 1
				day[weekday] = 1

			self.timerentry_justplay = ConfigSelection(choices = [
				("zap", _("zap")), ("record", _("record")), ("zap+record", _("zap and record"))],
				default = {0: "record", 1: "zap", 2: "zap+record"}[justplay + 2*always_zap])
			if SystemInfo["DeepstandbySupport"]:
				shutdownString = _("go to deep standby")
				choicelist = [("always", _("always")), ("from_standby", _("only from standby")), ("from_deep_standby", _("only from deep standby")), ("never", _("never"))]
			else:
				shutdownString = _("shut down")
				choicelist = [("always", _("always")), ("never", _("never"))]
			self.timerentry_zapwakeup = ConfigSelection(choices = choicelist, default = zap_wakeup)
			self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", shutdownString), ("auto", _("auto"))], default = afterevent)
			self.timerentry_recordingtype = ConfigSelection(choices = [("normal", _("normal")), ("descrambled+ecm", _("descramble and record ecm")), ("scrambled+ecm", _("don't descramble, record ecm"))], default = recordingtype)
			self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
			self.timerentry_name = ConfigText(default = self.timer.name, visible_width = 50, fixed_size = False)
			self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False)
			self.timerentry_tags = self.timer.tags[:]
			self.timerentry_tagsset = ConfigSelection(choices = [not self.timerentry_tags and "None" or " ".join(self.timerentry_tags)])

			self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("weekly", _("weekly")), ("daily", _("daily")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])
			self.timerentry_renamerepeat = ConfigYesNo(default = rename_repeat)

			self.timerentry_date = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400)
			self.timerentry_starttime = ConfigClock(default = self.timer.begin)
			self.timerentry_endtime = ConfigClock(default = self.timer.end)
			self.timerentry_showendtime = ConfigSelection(default = ((self.timer.end - self.timer.begin) > 4), choices = [(True, _("yes")), (False, _("no"))])

			default = self.timer.dirname or defaultMoviePath()
			tmp = config.movielist.videodirs.value
			if default not in tmp:
				tmp.append(default)
			self.timerentry_dirname = ConfigSelection(default = default, choices = tmp)

			self.timerentry_repeatedbegindate = ConfigDateTime(default = self.timer.repeatedbegindate, formatstring = _("%d.%B %Y"), increment = 86400)

			self.timerentry_weekday = ConfigSelection(default = weekday_table[weekday], choices = [("mon",_("Monday")), ("tue", _("Tuesday")), ("wed",_("Wednesday")), ("thu", _("Thursday")), ("fri", _("Friday")), ("sat", _("Saturday")), ("sun", _("Sunday"))])

			self.timerentry_day = ConfigSubList()
			for x in (0, 1, 2, 3, 4, 5, 6):
				self.timerentry_day.append(ConfigYesNo(default = day[x]))

			# FIXME some service-chooser needed here
			servicename = "N/A"
			try: # no current service available?
				servicename = str(self.timer.service_ref.getServiceName())
			except:
				pass
			self.timerentry_service_ref = self.timer.service_ref
			self.timerentry_service = ConfigSelection([servicename])
コード例 #50
0
ファイル: MovieSelection.py プロジェクト: 4doe/e2plugins
	def __init__(self, session, selectedmovie = None):
#		print "[SF-Plugin] SF:MovieSelection.init, PWD=%s; selmv=%s" % (config.movielist.last_videodir.value, str(selectedmovie))
		Screen.__init__(self, session)
		HelpableScreen.__init__(self)

		self.tags = [ ]
		if selectedmovie:
			self.selected_tags = config.movielist.last_selected_tags.value
		else:
			self.selected_tags = None
		self.selected_tags_ele = None
		self.toggletype = 0

		self.movemode = False
		self.bouquet_mark_edit = False

		self.delayTimer = eTimer()
		self.delayTimer.callback.append(self.updateHDDData)

		self["waitingtext"] = Label(_("Please wait... Loading list..."))

		# create optional description border and hide immediately
		self["DescriptionBorder"] = Pixmap()
		self["DescriptionBorder"].hide()

		if not fileExists(config.movielist.last_videodir.value):
			config.movielist.last_videodir.value = defaultMoviePath()
			config.movielist.last_videodir.save()
#			print "[SF-Plugin] MovieSelection.MovieSelection: save" + config.movielist.last_videodir.value
		self.current_ref = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + config.movielist.last_videodir.value)

		self["list"] = MovieList(None,
			config.movielist.sflisttype.value,
			config.movielist.sfmoviesort.value,
			config.movielist.sftimes.value,
			config.movielist.sftitle_episode_separator.value,
			self)

		self.list = self["list"]
		self.selectedmovie = selectedmovie

		# Need list for init
		SelectionEventInfo.__init__(self)

		self["key_red"] = Button(_("All"))
		self["key_green"] = Button("")
		self["key_yellow"] = Button("")
		self["key_blue"] = Button("")

		self["freeDiskSpace"] = self.diskinfo = DiskInfo(config.movielist.last_videodir.value, DiskInfo.FREE, update=False)

		if config.usage.setup_level.index >= 2: # expert+
			self["InfobarActions"] = HelpableActionMap(self, "InfobarActions", 
				{
					"showMovies": (self.doPathSelect, _("select the movie path")),
				})


		self["MovieSelectionActions"] = HelpableActionMap(self, "MovieSelectionActions",
			{
				"contextMenu": (self.doContext, _("menu")),
				"showEventInfo": (self.showEventInformation, _("show event details")),
			})

		self["ColorActions"] = HelpableActionMap(self, "ColorActions",
			{
				"red": (self.showAll, _("show all")),
				"green": (self.showTagsFirst, _("show first selected tag")),
				"yellow": (self.showTagsSecond, _("show second selected tag")),
				"blue": (self.showTagsSelect, _("show tag menu")),
			})

		self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions",
			{
				"cancel": (self.abort, _("exit movielist")),
				"ok": (self.movieSelected, _("select movie")),
			})

		self["NumberActions"] = HelpableActionMap(self, "SetupActions",
			{
				"0": (self.toggleSort, _x("Toggle date / alphabetic sort mode")),
				"deleteBackward": (self.moveToIndexStrt, _x("Jump to listbegin")),
				"deleteForward": (self.moveToIndexEnd, _x("Jump to listend")),
				"5": (self.toggleMinimal, _x("Toggle style minimal / compact")),
				"8": (self.toggleTags, _x("Toggle description / tags display")),
			})


		self.onShown.append(self.go)
		self.onLayoutFinish.append(self.saveListsize)
		self.inited = False
コード例 #51
0
    def createConfig(self, currlocation=None, locations=[]):
        justplay = self.timer.justplay
        always_zap = self.timer.always_zap
        zap_wakeup = self.timer.zap_wakeup
        pipzap = self.timer.pipzap
        rename_repeat = self.timer.rename_repeat
        conflict_detection = self.timer.conflict_detection

        afterevent = {
            AFTEREVENT.NONE: "nothing",
            AFTEREVENT.DEEPSTANDBY: "deepstandby",
            AFTEREVENT.STANDBY: "standby",
            AFTEREVENT.AUTO: "auto"
        }[self.timer.afterEvent]

        if self.timer.record_ecm and self.timer.descramble:
            recordingtype = "descrambled+ecm"
        elif self.timer.record_ecm:
            recordingtype = "scrambled+ecm"
        elif self.timer.descramble:
            recordingtype = "normal"

        weekday_table = ("mon", "tue", "wed", "thu", "fri", "sat", "sun")

        day = list(
            [int(x) for x in reversed('{0:07b}'.format(self.timer.repeated))])
        weekday = 0
        if self.timer.repeated:  # repeated
            type = "repeated"
            if (self.timer.repeated == 31):  # Mon-Fri
                repeated = "weekdays"
            elif (self.timer.repeated == 127):  # daily
                repeated = "daily"
            else:
                repeated = "user"
                if day.count(1) == 1:
                    repeated = "weekly"
                    weekday = day.index(1)
        else:  # once
            type = "once"
            repeated = None
            weekday = int(strftime("%u", localtime(self.timer.begin))) - 1
            day[weekday] = 1
        self.timerentry_fallback = ConfigYesNo(
            default=self.timer.external_prev or
            config.usage.remote_fallback_external_timer.value and config.usage.
            remote_fallback.value and not nimmanager.somethingConnected())
        self.timerentry_justplay = ConfigSelection(
            choices=[("zap", _("zap")), ("record", _("record")),
                     ("zap+record", _("zap and record"))],
            default={
                0: "record",
                1: "zap",
                2: "zap+record"
            }[justplay + 2 * always_zap])
        if SystemInfo["DeepstandbySupport"]:
            shutdownString = _("go to deep standby")
            choicelist = [("always", _("always")),
                          ("from_standby", _("only from standby")),
                          ("from_deep_standby", _("only from deep standby")),
                          ("never", _("never"))]
        else:
            shutdownString = _("shut down")
            choicelist = [("always", _("always")), ("never", _("never"))]
        self.timerentry_zapwakeup = ConfigSelection(choices=choicelist,
                                                    default=zap_wakeup)
        self.timerentry_afterevent = ConfigSelection(choices=[
            ("nothing", _("do nothing")), ("standby", _("go to standby")),
            ("deepstandby", shutdownString), ("auto", _("auto"))
        ],
                                                     default=afterevent)
        self.timerentry_recordingtype = ConfigSelection(choices=[
            ("normal", _("normal")),
            ("descrambled+ecm", _("descramble and record ecm")),
            ("scrambled+ecm", _("don't descramble, record ecm"))
        ],
                                                        default=recordingtype)
        self.timerentry_type = ConfigSelection(choices=[("once", _("once")),
                                                        ("repeated",
                                                         _("repeated"))],
                                               default=type)
        self.timerentry_name = ConfigText(default=self.timer.name,
                                          visible_width=50,
                                          fixed_size=False)
        self.timerentry_description = ConfigText(
            default=self.timer.description, visible_width=50, fixed_size=False)
        self.timerentry_tags = self.timer.tags[:]
        self.timerentry_tagsset = ConfigSelection(choices=[
            not self.timerentry_tags and _("None")
            or " ".join(self.timerentry_tags)
        ])

        self.timerentry_repeated = ConfigSelection(
            default=repeated,
            choices=[("weekly", _("weekly")), ("daily", _("daily")),
                     ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])
        self.timerentry_renamerepeat = ConfigYesNo(default=rename_repeat)
        self.timerentry_pipzap = ConfigYesNo(default=pipzap)
        self.timerentry_conflictdetection = ConfigYesNo(
            default=conflict_detection)

        self.timerentry_date = ConfigDateTime(
            default=self.timer.begin,
            formatstring=config.usage.date.full.value,
            increment=86400)
        self.timerentry_starttime = ConfigClock(default=self.timer.begin)
        self.timerentry_endtime = ConfigClock(default=self.timer.end)
        self.timerentry_showendtime = ConfigSelection(
            default=((self.timer.end - self.timer.begin) > 4),
            choices=[(True, _("yes")), (False, _("no"))])

        default = not self.timer.external_prev and self.timer.dirname or defaultMoviePath(
        )
        tmp = config.movielist.videodirs.value
        if default not in tmp:
            tmp.append(default)
        self.timerentry_dirname = ConfigSelection(default=default, choices=tmp)

        default = self.timer.external_prev and self.timer.dirname or currlocation
        if default not in locations:
            locations.append(default)
        self.timerentry_fallbackdirname = ConfigSelection(default=default,
                                                          choices=locations)

        self.timerentry_repeatedbegindate = ConfigDateTime(
            default=self.timer.repeatedbegindate,
            formatstring=config.usage.date.full.value,
            increment=86400)

        self.timerentry_weekday = ConfigSelection(
            default=weekday_table[weekday],
            choices=[("mon", _("Monday")), ("tue", _("Tuesday")),
                     ("wed", _("Wednesday")), ("thu", _("Thursday")),
                     ("fri", _("Friday")), ("sat", _("Saturday")),
                     ("sun", _("Sunday"))])

        self.timerentry_day = ConfigSubList()
        for x in (0, 1, 2, 3, 4, 5, 6):
            self.timerentry_day.append(ConfigYesNo(default=day[x]))

        # FIXME some service-chooser needed here
        servicename = "N/A"
        try:  # no current service available?
            servicename = str(self.timer.service_ref.getServiceName())
        except:
            pass
        self.timerentry_service_ref = self.timer.service_ref
        self.timerentry_service = ConfigSelection([servicename])
        self.createSetup("config")
コード例 #52
0
ファイル: MovieSelection.py プロジェクト: popazerty/12
	def __init__(self, session, selectedmovie = None):
		Screen.__init__(self, session)
		HelpableScreen.__init__(self)

		self.tags = [ ]
		if selectedmovie:
			self.selected_tags = config.movielist.last_selected_tags.value
		else:
			self.selected_tags = None
		self.selected_tags_ele = None

		self.movemode = False
		self.bouquet_mark_edit = False

		self.delayTimer = eTimer()
		self.delayTimer_conn = self.delayTimer.timeout.connect(self.updateHDDData)

		self["waitingtext"] = Label(_("Please wait... Loading list..."))

		# create optional description border and hide immediately
		self["DescriptionBorder"] = Pixmap()
		self["DescriptionBorder"].hide()

		if not fileExists(config.movielist.last_videodir.value):
			config.movielist.last_videodir.value = defaultMoviePath()
			config.movielist.last_videodir.save()
		self.current_ref = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + config.movielist.last_videodir.value)

		self["list"] = MovieList(None,
			config.movielist.listtype.value,
			config.movielist.moviesort.value,
			config.movielist.description.value)

		self.list = self["list"]
		self.selectedmovie = selectedmovie

		# Need list for init
		SelectionEventInfo.__init__(self)

		self["key_red"] = Button(_("All"))
		self["key_green"] = Button("")
		self["key_yellow"] = Button("")
		self["key_blue"] = Button("")

		self["freeDiskSpace"] = self.diskinfo = DiskInfo(config.movielist.last_videodir.value, DiskInfo.FREE, update=False)

		if config.usage.setup_level.index >= 2: # expert+
			self["InfobarActions"] = HelpableActionMap(self, "InfobarActions", 
				{
					"showMovies": (self.doPathSelect, _("select the movie path")),
				})


		self["MovieSelectionActions"] = HelpableActionMap(self, "MovieSelectionActions",
			{
				"contextMenu": (self.doContext, _("menu")),
				"showEventInfo": (self.showEventInformation, _("show event details")),
			})

		self["ColorActions"] = HelpableActionMap(self, "ColorActions",
			{
				"red": (self.showAll, _("show all")),
				"green": (self.showTagsFirst, _("show first selected tag")),
				"yellow": (self.showTagsSecond, _("show second selected tag")),
				"blue": (self.showTagsSelect, _("show tag menu")),
			})

		self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions",
			{
				"cancel": (self.abort, _("exit movielist")),
				"ok": (self.movieSelected, _("select movie")),
			})

		self.onShown.append(self.go)
		self.onLayoutFinish.append(self.saveListsize)
		self.inited = False
コード例 #53
0
    def keyGo(self, result=None):
        if not self.timerentry_service_ref.isRecordable():
            self.session.openWithCallback(
                self.selectChannelSelector, MessageBox,
                _("You didn't select a channel to record from."),
                MessageBox.TYPE_ERROR)
            return
        self.timer.name = self.timerentry_name.value
        self.timer.description = self.timerentry_description.value if self.timerentry_description_replaced != self.timerentry_description.value else self.timer.description
        self.timer.justplay = self.timerentry_justplay.value == "zap"
        self.timer.always_zap = self.timerentry_justplay.value == "zap+record"
        self.timer.rename_repeat = self.timerentry_renamerepeat.value
        if self.timerentry_justplay.value == "zap":
            if not self.timerentry_showendtime.value:
                self.timerentry_endtime.value = self.timerentry_starttime.value
                self.timerentry_afterevent.value = "nothing"

        if self.timerentry_endtime.value == self.timerentry_starttime.value and self.timerentry_afterevent.value != "nothing":
            self.timerentry_afterevent.value = "nothing"
            self.session.open(
                MessageBox,
                _("Difference between timer begin and end must be equal or greater than %d minutes.\nEnd Action was disabled !"
                  ) % 1,
                MessageBox.TYPE_INFO,
                timeout=30)

        self.timer.resetRepeated()
        self.timer.afterEvent = {
            "nothing": AFTEREVENT.NONE,
            "deepstandby": AFTEREVENT.DEEPSTANDBY,
            "standby": AFTEREVENT.STANDBY,
            "auto": AFTEREVENT.AUTO
        }[self.timerentry_afterevent.value]
        self.timer.descramble = {
            "normal": True,
            "descrambled+ecm": True,
            "scrambled+ecm": False,
        }[self.timerentry_recordingtype.value]
        self.timer.record_ecm = {
            "normal": False,
            "descrambled+ecm": True,
            "scrambled+ecm": True,
        }[self.timerentry_recordingtype.value]
        self.timer.service_ref = self.timerentry_service_ref
        self.timer.tags = self.timerentry_tags

        if self.timer.dirname or self.timerentry_dirname.value != defaultMoviePath(
        ):
            self.timer.dirname = self.timerentry_dirname.value
            config.movielist.last_timer_videodir.value = self.timer.dirname
            config.movielist.last_timer_videodir.save()

        if self.timerentry_type.value == "once":
            self.timer.begin, self.timer.end = self.getBeginEnd()
        if self.timerentry_type.value == "repeated":
            if self.timerentry_repeated.value == "daily":
                for x in (0, 1, 2, 3, 4, 5, 6):
                    self.timer.setRepeated(x)

            if self.timerentry_repeated.value == "weekly":
                self.timer.setRepeated(self.timerentry_weekday.index)

            if self.timerentry_repeated.value == "weekdays":
                for x in (0, 1, 2, 3, 4):
                    self.timer.setRepeated(x)

            if self.timerentry_repeated.value == "user":
                for x in (0, 1, 2, 3, 4, 5, 6):
                    if self.timerentry_day[x].value:
                        self.timer.setRepeated(x)

            self.timer.repeatedbegindate = self.getTimestamp(
                self.timerentry_repeatedbegindate.value,
                self.timerentry_starttime.value)
            if self.timer.repeated:
                self.timer.begin = self.getTimestamp(
                    self.timerentry_repeatedbegindate.value,
                    self.timerentry_starttime.value)
                self.timer.end = self.getTimestamp(
                    self.timerentry_repeatedbegindate.value,
                    self.timerentry_endtime.value)
            else:
                self.timer.begin = self.getTimestamp(
                    time(), self.timerentry_starttime.value)
                self.timer.end = self.getTimestamp(
                    time(), self.timerentry_endtime.value)

            # when a timer end is set before the start, add 1 day
            if self.timer.end < self.timer.begin:
                self.timer.end += 86400

        if self.timer.eit is not None:
            event = eEPGCache.getInstance().lookupEventId(
                self.timer.service_ref.ref, self.timer.eit)
            if event:
                n = event.getNumOfLinkageServices()
                if n > 1:
                    tlist = []
                    ref = self.session.nav.getCurrentlyPlayingServiceOrGroup()
                    parent = self.timer.service_ref.ref
                    selection = 0
                    for x in range(n):
                        i = event.getLinkageService(parent, x)
                        if i.toString() == ref.toString():
                            selection = x
                        tlist.append((i.getName(), i))
                    self.session.openWithCallback(
                        self.subserviceSelected,
                        ChoiceBox,
                        title=_("Please select a subservice to record..."),
                        list=tlist,
                        selection=selection)
                    return
                elif n > 0:
                    parent = self.timer.service_ref.ref
                    self.timer.service_ref = ServiceReference(
                        event.getLinkageService(parent, 0))
        self.saveTimer()
        self.close((True, self.timer))
コード例 #54
0
ファイル: TimerEntry.py プロジェクト: Antonio-Team/enigma2
	def createConfig(self, currlocation=None, locations=[]):
		justplay = self.timer.justplay
		always_zap = self.timer.always_zap
		zap_wakeup = self.timer.zap_wakeup
		pipzap = self.timer.pipzap
		rename_repeat = self.timer.rename_repeat
		conflict_detection = self.timer.conflict_detection

		afterevent = {
			AFTEREVENT.NONE: "nothing",
			AFTEREVENT.DEEPSTANDBY: "deepstandby",
			AFTEREVENT.STANDBY: "standby",
			AFTEREVENT.AUTO: "auto"
			}[self.timer.afterEvent]

		if self.timer.record_ecm and self.timer.descramble:
			recordingtype = "descrambled+ecm"
		elif self.timer.record_ecm:
			recordingtype = "scrambled+ecm"
		elif self.timer.descramble:
			recordingtype = "normal"

		weekday_table = ("mon", "tue", "wed", "thu", "fri", "sat", "sun")

		day = list([int(x) for x in reversed('{0:07b}'.format(self.timer.repeated))])
		weekday = 0
		if self.timer.repeated: # repeated
			type = "repeated"
			if (self.timer.repeated == 31): # Mon-Fri
				repeated = "weekdays"
			elif (self.timer.repeated == 127): # daily
				repeated = "daily"
			else:
				repeated = "user"
				if day.count(1) == 1:
					repeated = "weekly"
					weekday = day.index(1)
		else: # once
			type = "once"
			repeated = None
			weekday = int(strftime("%u", localtime(self.timer.begin))) - 1
			day[weekday] = 1
		self.timerentry_fallback = ConfigYesNo(default=self.timer.external_prev or config.usage.remote_fallback_external_timer.value and config.usage.remote_fallback.value and not nimmanager.somethingConnected())
		self.timerentry_justplay = ConfigSelection(choices = [
			("zap", _("zap")), ("record", _("record")), ("zap+record", _("zap and record"))],
			default = {0: "record", 1: "zap", 2: "zap+record"}[justplay + 2*always_zap])
		if SystemInfo["DeepstandbySupport"]:
			shutdownString = _("go to deep standby")
			choicelist = [("always", _("always")), ("from_standby", _("only from standby")), ("from_deep_standby", _("only from deep standby")), ("never", _("never"))]
		else:
			shutdownString = _("shut down")
			choicelist = [("always", _("always")), ("never", _("never"))]
		self.timerentry_zapwakeup = ConfigSelection(choices = choicelist, default = zap_wakeup)
		self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", shutdownString), ("auto", _("auto"))], default = afterevent)
		self.timerentry_recordingtype = ConfigSelection(choices = [("normal", _("normal")), ("descrambled+ecm", _("descramble and record ecm")), ("scrambled+ecm", _("don't descramble, record ecm"))], default = recordingtype)
		self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
		self.timerentry_name = ConfigText(default = self.timer.name, visible_width = 50, fixed_size = False)
		self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False)
		self.timerentry_tags = self.timer.tags[:]
		self.timerentry_tagsset = ConfigSelection(choices = [not self.timerentry_tags and "None" or " ".join(self.timerentry_tags)])

		self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("weekly", _("weekly")), ("daily", _("daily")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])
		self.timerentry_renamerepeat = ConfigYesNo(default = rename_repeat)
		self.timerentry_pipzap = ConfigYesNo(default = pipzap)
		self.timerentry_conflictdetection = ConfigYesNo(default = conflict_detection)

		self.timerentry_date = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400)
		self.timerentry_starttime = ConfigClock(default = self.timer.begin)
		self.timerentry_endtime = ConfigClock(default = self.timer.end)
		self.timerentry_showendtime = ConfigSelection(default = ((self.timer.end - self.timer.begin) > 4), choices = [(True, _("yes")), (False, _("no"))])

		default = not self.timer.external_prev and self.timer.dirname or defaultMoviePath()
		tmp = config.movielist.videodirs.value
		if default not in tmp:
			tmp.append(default)
		self.timerentry_dirname = ConfigSelection(default = default, choices = tmp)

		default = self.timer.external_prev and self.timer.dirname or currlocation
		if default not in locations:
			locations.append(default)
		self.timerentry_fallbackdirname = ConfigSelection(default=default, choices=locations)

		self.timerentry_repeatedbegindate = ConfigDateTime(default = self.timer.repeatedbegindate, formatstring = _("%d.%B %Y"), increment = 86400)

		self.timerentry_weekday = ConfigSelection(default = weekday_table[weekday], choices = [("mon",_("Monday")), ("tue", _("Tuesday")), ("wed",_("Wednesday")), ("thu", _("Thursday")), ("fri", _("Friday")), ("sat", _("Saturday")), ("sun", _("Sunday"))])

		self.timerentry_day = ConfigSubList()
		for x in (0, 1, 2, 3, 4, 5, 6):
			self.timerentry_day.append(ConfigYesNo(default = day[x]))

		# FIXME some service-chooser needed here
		servicename = "N/A"
		try: # no current service available?
			servicename = str(self.timer.service_ref.getServiceName())
		except:
			pass
		self.timerentry_service_ref = self.timer.service_ref
		self.timerentry_service = ConfigSelection([servicename])
		self.createSetup("config")
コード例 #55
0
 def remove(self, arg):
     os.rmdir(config.movielist.last_videodir.value)
     self.gotFilename(defaultMoviePath())
コード例 #56
0
ファイル: TimerEntry.py プロジェクト: kingvuplus/boom
    def createConfig(self):
        justplay = self.timer.justplay
        always_zap = self.timer.always_zap
        rename_repeat = self.timer.rename_repeat
        afterevent = {AFTEREVENT.NONE: 'nothing',
         AFTEREVENT.DEEPSTANDBY: 'deepstandby',
         AFTEREVENT.STANDBY: 'standby',
         AFTEREVENT.AUTO: 'auto'}[self.timer.afterEvent]
        if self.timer.record_ecm and self.timer.descramble:
            recordingtype = 'descrambled+ecm'
        elif self.timer.record_ecm:
            recordingtype = 'scrambled+ecm'
        elif self.timer.descramble:
            recordingtype = 'normal'
        weekday_table = ('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun')
        day = []
        weekday = 0
        for x in (0, 1, 2, 3, 4, 5, 6):
            day.append(0)

        if self.timer.repeated:
            type = 'repeated'
            if self.timer.repeated == 31:
                repeated = 'weekdays'
            elif self.timer.repeated == 127:
                repeated = 'daily'
            else:
                flags = self.timer.repeated
                repeated = 'user'
                count = 0
                for x in (0, 1, 2, 3, 4, 5, 6):
                    if flags == 1:
                        weekday = x
                    if flags & 1 == 1:
                        day[x] = 1
                        count += 1
                    else:
                        day[x] = 0
                    flags >>= 1

                if count == 1:
                    repeated = 'weekly'
        else:
            type = 'once'
            repeated = None
            weekday = int(strftime('%u', localtime(self.timer.begin))) - 1
            day[weekday] = 1
        self.timerentry_justplay = ConfigSelection(choices=[('zap', _('zap')), ('record', _('record')), ('zap+record', _('zap and record'))], default={0: 'record',
         1: 'zap',
         2: 'zap+record'}[justplay + 2 * always_zap])
        if SystemInfo['DeepstandbySupport']:
            shutdownString = _('go to deep standby')
        else:
            shutdownString = _('shut down')
        self.timerentry_afterevent = ConfigSelection(choices=[('nothing', _('do nothing')),
         ('standby', _('go to standby')),
         ('deepstandby', shutdownString),
         ('auto', _('auto'))], default=afterevent)
        self.timerentry_recordingtype = ConfigSelection(choices=[('normal', _('normal')), ('descrambled+ecm', _('descramble and record ecm')), ('scrambled+ecm', _("don't descramble, record ecm"))], default=recordingtype)
        self.timerentry_type = ConfigSelection(choices=[('once', _('once')), ('repeated', _('repeated'))], default=type)
        self.timerentry_name = ConfigText(default=self.timer.name.replace('\xc2\x86', '').replace('\xc2\x87', '').encode('utf-8'), visible_width=50, fixed_size=False)
        self.timerentry_description = ConfigText(default=self.timer.description, visible_width=50, fixed_size=False)
        self.timerentry_tags = self.timer.tags[:]
        if not self.timerentry_tags:
            tagname = self.timer.name.strip()
            if tagname:
                tagname = tagname[0].upper() + tagname[1:].replace(' ', '_')
                self.timerentry_tags.append(tagname)
        self.timerentry_tagsset = ConfigSelection(choices=[not self.timerentry_tags and 'None' or ' '.join(self.timerentry_tags)])
        self.timerentry_repeated = ConfigSelection(default=repeated, choices=[('weekly', _('weekly')),
         ('daily', _('daily')),
         ('weekdays', _('Mon-Fri')),
         ('user', _('user defined'))])
        self.timerentry_renamerepeat = ConfigYesNo(default=rename_repeat)
        self.timerentry_date = ConfigDateTime(default=self.timer.begin, formatstring=_('%d %B %Y'), increment=86400)
        self.timerentry_starttime = ConfigClock(default=self.timer.begin)
        self.timerentry_endtime = ConfigClock(default=self.timer.end)
        self.timerentry_showendtime = ConfigSelection(default=self.timer.end > self.timer.begin + 3 and self.timer.justplay, choices=[(True, _('yes')), (False, _('no'))])
        default = self.timer.dirname or defaultMoviePath()
        tmp = config.movielist.videodirs.value
        if default not in tmp:
            tmp.append(default)
        self.timerentry_dirname = ConfigSelection(default=default, choices=tmp)
        self.timerentry_repeatedbegindate = ConfigDateTime(default=self.timer.repeatedbegindate, formatstring=_('%d.%B %Y'), increment=86400)
        self.timerentry_weekday = ConfigSelection(default=weekday_table[weekday], choices=[('mon', _('Monday')),
         ('tue', _('Tuesday')),
         ('wed', _('Wednesday')),
         ('thu', _('Thursday')),
         ('fri', _('Friday')),
         ('sat', _('Saturday')),
         ('sun', _('Sunday'))])
        self.timerentry_day = ConfigSubList()
        for x in (0, 1, 2, 3, 4, 5, 6):
            self.timerentry_day.append(ConfigYesNo(default=day[x]))

        servicename = 'N/A'
        try:
            servicename = str(self.timer.service_ref.getServiceName())
        except:
            pass

        self.timerentry_service_ref = self.timer.service_ref
        self.timerentry_service = ConfigSelection([servicename])
        return