Ejemplo n.º 1
0
    def run(self, callback, errback):
        # At the end a plugin has to call one of the functions: callback or errback
        # Callback should return with at least one of the parameter: Header, Body, Attachment
        # If empty or none is returned, nothing will be sent
        self.timers = []
        text = ""
        for timer in NavigationInstance.instance.RecordTimer.processed_timers:
            if timer.justplay:
                pass

            elif str(timer.service_ref)[0] == "-":
                pass

            elif TAG in timer.tags:
                pass

            elif timer.disabled:
                pass

            else:
                text += str(timer.name) + "\t" \
                   + strftime(_("%Y.%m.%d %H:%M"), localtime(timer.begin)) + " - " \
                   + strftime(_("%H:%M"), localtime(timer.end)) + "\t" \
                   + str(timer.service_ref and timer.service_ref.getServiceName() or "") \
                   + "\n"
                if self.getValue('include_description'):
                    text += str(timer.description) + "\n\n"
                self.timers.append(timer)
        if self.timers and text:
            callback(SUBJECT, BODY % text)
        else:
            callback()
Ejemplo n.º 2
0
	def push(self, callback, errback, pluginname, subject, body="", attachments=[]):
		from Plugins.Extensions.PushService.plugin import NAME, VERSION, SUPPORT, DONATE
		
		# Set SMTP parameters
		mailconf = {}
		mailconf["host"]     = self.getValue('smtpserver')
		mailconf["port"]     = self.getValue('smtpport')
		mailconf["username"] = self.getValue('username')
		mailconf["password"] = self.getValue('password')
		mailconf["ssl"]      = self.getValue('smtpssl')
		mailconf["tls"]      = self.getValue('smtptls')
		mailconf["timeout"]  = self.getValue('timeout')
		
		# Create message object
		from_addr = self.getValue('mailfrom')
		to_addrs = [self.getValue('mailto') or from_addr]
		
		# Prepare message
		if body == "": body = subject
		subject = MAIL_HEADER_TEMPLATE.format( **{'box': config.pushservice.boxname.value, 'name': NAME, 'plugin': pluginname, 'subject': subject} )
		body    = MAIL_BODY_TEMPLATE.format( **{'body': str(body), 'name': NAME, 'version': VERSION, 'plugin': pluginname, 'support': SUPPORT, 'donate': DONATE} )
		message = Message(from_addr, to_addrs, subject, body) #TODO change mime="text/plain", charset="utf-8")
		if attachments:
			for attachment in attachments:
				message.attach(attachment) #TODO change mime=None, charset=None, content=None):
		
		# Send message
		print _("PushService PushMail: Sending message: %s") % subject
		deferred, connector = sendmail(mailconf, message)
		
		# Add callbacks
		deferred.addCallback(callback)
		deferred.addErrback(errback)
		
		self.connectors.append(connector)
	def getUpdateInfosCB(self, callback, errback, retval = None):
		if retval is not None:
			if retval is True:
				if iSoftwareTools.available_updates is not 0:
					# _("There are at least ") + str(iSoftwareTools.available_updates) + _(" updates available.")
					log.debug( "Updates available." )
					return self.buildList(callback, errback)
				else:
					# _("There are no updates available.")
					log.debug( "There are no updates available." )
					return callback()
			elif retval is False:
				if iSoftwareTools.lastDownloadDate is None:
					if iSoftwareTools.NetworkConnectionAvailable:
						# _("Updatefeed not available.")
						log.debug( "Updatefeed not available." )
						return errback(_("Updatefeed not available."))
					else:
						# _("No network connection available.")
						log.debug( "No network connection available." )
						return errback(_("No network connection available."))
				else:
					log.debug( "IPKGUpdateNotification getUpdates" )
					# Call update
					iSoftwareTools.lastDownloadDate = time()
					iSoftwareTools.list_updating = True
					iSoftwareTools.getUpdates( boundFunction(self.getUpdateInfosCB, callback, errback) )
					return
		callback()
Ejemplo n.º 4
0
	def push(self, callback, errback, pluginname, subject, body="", attachments=[]):
		from Plugins.Extensions.PushService.plugin import NAME, VERSION, SUPPORT, DONATE
		
		# Set SMTP parameters
		mailconf = {}
		mailconf["host"]     = self.getValue('smtpserver')
		mailconf["port"]     = self.getValue('smtpport')
		mailconf["username"] = self.getValue('username')
		mailconf["password"] = self.getValue('password')
		mailconf["ssl"]      = self.getValue('smtpssl')
		mailconf["tls"]      = self.getValue('smtptls')
		mailconf["timeout"]  = self.getValue('timeout')
		
		# Create message object
		from_addr = self.getValue('mailfrom')
		to_addrs = [self.getValue('mailto') or from_addr]
		
		# Prepare message
		if body == "": body = subject
		subject = MAIL_HEADER_TEMPLATE.format( **{'box': config.pushservice.boxname.value, 'name': NAME, 'plugin': pluginname, 'subject': subject} )
		body    = MAIL_BODY_TEMPLATE.format( **{'body': str(body), 'name': NAME, 'version': VERSION, 'plugin': pluginname, 'support': SUPPORT, 'donate': DONATE} )
		message = Message(from_addr, to_addrs, subject, body) #TODO change mime="text/plain", charset="utf-8")
		if attachments:
			for attachment in attachments:
				message.attach(attachment) #TODO change mime=None, charset=None, content=None):
		
		# Send message
		print _("[PushService] PushMail: Sending message: %s") % subject
		deferred, connector = sendmail(mailconf, message)
		
		# Add callbacks
		deferred.addCallback(callback)
		deferred.addErrback(errback)
		
		self.connectors.append(connector)
 def getUpdateInfosCB(self, callback, errback, retval=None):
     if retval is not None:
         if retval is True:
             if iSoftwareTools.available_updates != 0:
                 # _("There are at least ") + str(iSoftwareTools.available_updates) + _(" updates available.")
                 print("Updates available.")
                 return self.buildList(callback, errback)
             else:
                 # _("There are no updates available.")
                 print("There are no updates available.")
                 return callback()
         elif retval is False:
             if iSoftwareTools.lastDownloadDate is None:
                 if iSoftwareTools.NetworkConnectionAvailable:
                     # _("Updatefeed not available.")
                     print("Updatefeed not available.")
                     return errback(_("Updatefeed not available."))
                 else:
                     # _("No network connection available.")
                     print("No network connection available.")
                     return errback(_("No network connection available."))
             else:
                 print("IPKGUpdateNotification getUpdates")
                 # Call update
                 iSoftwareTools.lastDownloadDate = time()
                 iSoftwareTools.list_updating = True
                 iSoftwareTools.getUpdates(
                     boundFunction(self.getUpdateInfosCB, callback,
                                   errback))
                 return
     callback()
	def run(self, callback, errback):
		# At the end a plugin has to call one of the functions: callback or errback
		# Callback should return with at least one of the parameter: Header, Body, Attachment
		# If empty or none is returned, nothing will be sent
		self.timers = []
		text = ""
		for timer in NavigationInstance.instance.RecordTimer.processed_timers:
			if timer.justplay:
				pass
			
			elif str(timer.service_ref)[0]=="-":
				pass
			
			elif TAG in timer.tags:
				pass
			
			elif timer.disabled:
				pass
			
			else:
				text += str(timer.name) + "\t" \
							+ strftime(_("%Y.%m.%d %H:%M"), localtime(timer.begin)) + " - " \
							+ strftime(_("%H:%M"), localtime(timer.end)) + "\t" \
							+ str(timer.service_ref and timer.service_ref.getServiceName() or "") \
							+ "\n"
                                if self.getValue('include_description'):
					text += str(timer.description) + "\n\n"
				self.timers.append( timer )
		if self.timers and text:
			callback( SUBJECT, BODY % text )
		else:
			callback()
	def __init__(self):
		# Is called on instance creation
		ControllerBase.__init__(self)
		self.timers = []
		
		# Default configuration
		self.setOption( 'remove_timer', NoSave(ConfigYesNo( default = False )), _("Remove deactivated timer(s)") )
		self.setOption( 'list_similar', NoSave(ConfigYesNo( default = False )), _("List similar timer(s)") )
Ejemplo n.º 8
0
	def __init__(self):
		# Is called on instance creation
		ControllerBase.__init__(self)
		self.timers = []
		
		# Default configuration
		self.setOption( 'remove_timer',        NoSave(ConfigYesNo( default = False )), _("Remove finished timer(s)") )
		self.setOption( 'include_description', NoSave(ConfigYesNo( default = False )), _("Include timer description") )
Ejemplo n.º 9
0
    def __init__(self):
        # Is called on instance creation
        ControllerBase.__init__(self)
        self.timers = []

        # Default configuration
        self.setOption('remove_timer', NoSave(ConfigYesNo(default=False)),
                       _("Remove deactivated timer(s)"))
        self.setOption('list_similar', NoSave(ConfigYesNo(default=False)),
                       _("List similar timer(s)"))
Ejemplo n.º 10
0
    def __init__(self):
        # Is called on instance creation
        ServiceBase.__init__(self)
        self.connectors = []

        # Default configuration
        self.setOption(
            'smtpserver',
            NoSave(ConfigText(default="smtp.server.com", fixed_size=False)),
            _("SMTP Server"))
        self.setOption('smtpport', NoSave(ConfigNumber(default=587)),
                       _("SMTP Port"))
        self.setOption('smtpssl', NoSave(ConfigYesNo(default=True)),
                       _("SMTP SSL"))
        self.setOption('smtptls', NoSave(ConfigYesNo(default=True)),
                       _("SMTP TLS"))
        self.setOption('timeout', NoSave(ConfigNumber(default=30)),
                       _("Timeout"))

        self.setOption('username',
                       NoSave(ConfigText(default="user", fixed_size=False)),
                       _("User name"))
        self.setOption('password', NoSave(ConfigPassword(default="password")),
                       _("Password"))

        self.setOption(
            'mailfrom',
            NoSave(ConfigText(default="*****@*****.**", fixed_size=False)),
            _("Mail from"))
        self.setOption('mailto', NoSave(ConfigText(fixed_size=False)),
                       _("Mail to or leave empty (From will be used)"))
Ejemplo n.º 11
0
    def __init__(self):
        # Is called on instance creation
        ControllerBase.__init__(self)
        self.timers = []

        # Default configuration
        self.setOption('remove_timer', NoSave(ConfigYesNo(default=False)),
                       _("Remove finished timer(s)"))
        self.setOption('include_description',
                       NoSave(ConfigYesNo(default=False)),
                       _("Include timer description"))
Ejemplo n.º 12
0
    def run(self, callback, errback):
        # At the end a plugin has to call one of the functions: callback or errback
        # Callback should return with at least one of the parameter: Header, Body, Attachment
        # If empty or none is returned, nothing will be sent
        path = self.getValue('path')
        limit = self.getValue('limit')

        if not self.getValue('wakehdd'):
            #Adapted from: from Components.Harddisk import findMountPoint
            def mountpoint(path):
                path = os.path.realpath(path)
                if os.path.ismount(path) or len(path) == 0:
                    return path
                return mountpoint(os.path.dirname(path))

            def getDevicebyMountpoint(hdm, mountpoint):
                for x in hdm.partitions[:]:
                    if x.mountpoint == mountpoint:
                        return x.device
                return None

            def getHDD(hdm, part):
                for hdd in hdm.hdd:
                    if hdd.device == part[:3]:
                        return hdd
                return None

            # User specified to avoid HDD wakeup if it is sleeping
            from Components.Harddisk import harddiskmanager
            dev = getDevicebyMountpoint(harddiskmanager, mountpoint(path))
            if dev is not None:
                hdd = getHDD(harddiskmanager, dev)
                if hdd is not None:
                    if hdd.isSleeping():
                        # Don't wake up HDD
                        print _("[FreeSpace] HDD is idle: ") + str(path)
                        callback()

        # Check free space on path
        if os.path.exists(path):
            stat = os.statvfs(path)
            free = (stat.f_bavail if stat.f_bavail != 0 else
                    stat.f_bfree) * stat.f_bsize / 1024 / 1024  # MB
            if limit > (free / 1024):  #GB
                if free >= 10 * 1024:  #MB
                    free = "%d GB" % (free / 1024)
                else:
                    free = "%d MB" % (free)
                # Not enough free space
                callback(SUBJECT, BODY % (path, limit, free))
            else:
                # There is enough free space
                callback()
Ejemplo n.º 13
0
    def __init__(self):
        # Is called on instance creation
        ServiceBase.__init__(self)
        # self.sockets = []

        # Default configuration
        self.setOption("growlhost", NoSave(ConfigText(default="host", fixed_size=False)), _("Growl Host name"))
        self.setOption("growlport", NoSave(ConfigNumber(default=23053)), _("Growl Port"))
        self.setOption("timeout", NoSave(ConfigNumber(default=3)), _("Timeout"))
        self.setOption("password", NoSave(ConfigPassword()), _("Password"))
        self.setOption("sticky", NoSave(ConfigYesNo(default=True)), _("Send as sticky"))
        self.setOption("priority", NoSave(ConfigNumber(default=1)), _("Send with priority"))
Ejemplo n.º 14
0
	def __init__(self):
		# Is called on instance creation
		ControllerBase.__init__(self)
		self.logfiles = []

		# Default configuration
		self.setOption( 'path',            NoSave(ConfigText(  default = "/media/hdd/", fixed_size = False )), _("Path to check") )
		self.setOption( 'file_pattern',    NoSave(ConfigText(  default = "*.log", fixed_size = False )), _("Filename pattern (No RegExp)") )
		self.setOption( 'content_pattern', NoSave(ConfigText(  default = ".*", fixed_size = False )), _("Content pattern (RegExp)") )
		self.setOption( 'scan_subs',       NoSave(ConfigYesNo( default = False )), _("Scan subfolders") )
		self.setOption( 'rename_logs',     NoSave(ConfigYesNo( default = False )), _("Rename log(s)") )
		self.setOption( 'delete_logs',     NoSave(ConfigYesNo( default = False )), _("Delete log(s)") )
Ejemplo n.º 15
0
    def run(self, callback, errback):
        # At the end a plugin has to call one of the functions: callback or errback
        # Callback should return with at least one of the parameter: Header, Body, Attachment
        # If empty or none is returned, nothing will be sent

        self.timers = []
        text = ""
        list_similar = self.getValue('list_similar')

        def timerToString(timer):
            return str(timer.name) + "\t" \
              + strftime(_("%Y.%m.%d %H:%M"), localtime(timer.begin)) + " - " \
              + strftime(_("%H:%M"), localtime(timer.end)) + "\t" \
              + str(timer.service_ref and timer.service_ref.getServiceName() or "") \
              + "\t" + str(timer.tags)

        import NavigationInstance
        for timer in NavigationInstance.instance.RecordTimer.timer_list + NavigationInstance.instance.RecordTimer.processed_timers:
            if timer.justplay:
                pass

            elif str(timer.service_ref)[0] == "-":
                pass

            elif TAG in timer.tags:
                pass

            elif not timer.disabled:
                pass

            else:
                text += timerToString(timer) + "\r\n"

                if list_similar:
                    if not timer.eit:
                        text += "\r\n\r\n" + _("Timer has no EIT") + "\r\n\r\n"
                        continue

                    text += "\r\n\r\n" + _("Similar:") + "\r\n"

                    for t in NavigationInstance.instance.RecordTimer.timer_list + NavigationInstance.instance.RecordTimer.processed_timers:
                        if not t.disabled and not t.justplay and t.name == timer.name and t.eit != timer.eit:
                            text += "\t" + timerToString(t) + "\r\n"

                    text += "\r\n"

                self.timers.append(timer)

        if self.timers and text:
            callback(SUBJECT, BODY % text)
        else:
            callback()
Ejemplo n.º 16
0
    def __init__(self):
        # Is called on instance creation
        ControllerBase.__init__(self)

        # Default configuration
        self.setOption('wakehdd', NoSave(ConfigYesNo(default=False)),
                       _("Allow HDD wake up"))
        self.setOption(
            'path',
            NoSave(ConfigText(default="/media/hdd/movie", fixed_size=False)),
            _("Where to check free space"))
        self.setOption('limit', NoSave(ConfigNumber(default=100)),
                       _("Free space limit in GB"))
Ejemplo n.º 17
0
    def __init__(self):
        # Is called on instance creation
        ControllerBase.__init__(self)
        self.movielist = []

        # Default configuration
        self.setOption(
            'path',
            NoSave(ConfigText(default="/media/hdd/movie/", fixed_size=False)),
            _("Where to check"))
        self.setOption('ext',
                       NoSave(ConfigText(default=".ts", fixed_size=False)),
                       _("file extension"))
Ejemplo n.º 18
0
	def run(self, callback, errback):
		# At the end a plugin has to call one of the functions: callback or errback
		# Callback should return with at least one of the parameter: Header, Body, Attachment
		# If empty or none is returned, nothing will be sent
		path = self.getValue('path')
		limit = self.getValue('limit')
		
		if not self.getValue('wakehdd'):
			#Adapted from: from Components.Harddisk import findMountPoint
			def mountpoint(path):
				path = os.path.realpath(path)
				if os.path.ismount(path) or len(path)==0: return path
				return mountpoint(os.path.dirname(path))
						
			def getDevicebyMountpoint(hdm, mountpoint):
				for x in hdm.partitions[:]:
					if x.mountpoint == mountpoint:
						return x.device
				return None
			
			def getHDD(hdm, part):
				for hdd in hdm.hdd:
					if hdd.device == part[:3]:
						return hdd
				return None
			
			# User specified to avoid HDD wakeup if it is sleeping
			from Components.Harddisk import harddiskmanager
			dev = getDevicebyMountpoint( harddiskmanager, mountpoint(path) )
			if dev is not None:
				hdd = getHDD( harddiskmanager, dev )
				if hdd is not None:
					if hdd.isSleeping():
						# Don't wake up HDD
						print _("[FreeSpace] HDD is idle: ") + str(path)
						callback()
		
		# Check free space on path
		if os.path.exists( path ):
			stat = os.statvfs( path )
			free = ( stat.f_bavail if stat.f_bavail!=0 else stat.f_bfree ) * stat.f_bsize / 1024 / 1024 # MB
			if limit > (free/1024): #GB
				if free >= 10*1024:	#MB
					free = "%d GB" %(free/1024)
				else:
					free = "%d MB" %(free)
				# Not enough free space
				callback( SUBJECT, BODY % (path, limit, free) )
			else:
				# There is enough free space
				callback()
Ejemplo n.º 19
0
	def __init__(self):
		# Is called on instance creation
		ControllerBase.__init__(self)
		self.crashlogs = []

		# Default configuration
		self.setOption( 'delete_logs', NoSave(ConfigYesNo( default = False )), _("Delete crashlog(s)") )
    def __init__(self):
        # Is called on instance creation
        ControllerBase.__init__(self)

        # Default configuration
        self.setOption('selfcheck', NoSave(ConfigYesNo(default=False)),
                       _("Start update check if not done yet"))
Ejemplo n.º 21
0
	def __init__(self):
		# Is called on instance creation
		ControllerBase.__init__(self)
		self.crashlogs = []

		# Default configuration
		self.setOption( 'delete_logs', NoSave(ConfigYesNo( default = False )), _("Delete crashlog(s)") )
	def __init__(self):
		# Is called on instance creation
		ControllerBase.__init__(self)
		self.timers = []
		
		# Default configuration
		self.setOption( 'add_tag', NoSave(ConfigYesNo( default = False )), _("Start update check if not done yet") )
Ejemplo n.º 23
0
    def run(self, callback, errback):
        # At the end a plugin has to call one of the functions: callback or errback
        # Callback should return with at least one of the parameter: Header, Body, Attachment
        # If empty or none is returned, nothing will be sent
        path = self.getValue('path')
        limit = self.getValue('limit')

        if not self.getValue('wakehdd'):

            # User specified to avoid HDD wakeup if it is sleeping
            from Components.Harddisk import harddiskmanager
            dev = getDevicebyMountpoint(harddiskmanager, mountpoint(path))
            if dev is not None:
                hdd = getHDD(harddiskmanager, dev)
                if hdd is not None:
                    if hdd.isSleeping():
                        # Don't wake up HDD
                        print _("[FreeSpace] HDD is idle: ") + str(path)
                        callback()

        # Check free space on path
        if os.path.exists(path):
            stat = os.statvfs(path)
            free = (stat.f_bavail if stat.f_bavail != 0 else
                    stat.f_bfree) * stat.f_bsize / 1024 / 1024  # MB
            if limit > (free / 1024):  #GB
                if free >= 10 * 1024:  #MB
                    free = "%d GB" % (free / 1024)
                else:
                    free = "%d MB" % (free)
                # Not enough free space
                text = ""
                if self.getValue('listtimer'):
                    text = "\r\n\r\n"
                    text += _("Next timer:")
                    text += "\r\n"
                    import NavigationInstance
                    now = time()
                    next_day = now + 86400  # Add one day
                    for t in NavigationInstance.instance.RecordTimer.timer_list + NavigationInstance.instance.RecordTimer.processed_timers:
                        if not t.disabled and not t.justplay and now < t.begin and t.end < next_day:
                            text += "\t" + timerToString(t) + "\r\n"

                callback(SUBJECT, BODY % (path, limit, free) + text)
            else:
                # There is enough free space
                callback()
Ejemplo n.º 24
0
	def run(self, callback, errback):
		# At the end a plugin has to call one of the functions: callback or errback
		# Callback should return with at least one of the parameter: Header, Body, Attachment
		# If empty or none is returned, nothing will be sent
		path = self.getValue('path')
		limit = self.getValue('limit')
		
		if not self.getValue('wakehdd'):

			# User specified to avoid HDD wakeup if it is sleeping
			from Components.Harddisk import harddiskmanager
			dev = getDevicebyMountpoint( harddiskmanager, mountpoint(path) )
			if dev is not None:
				hdd = getHDD( harddiskmanager, dev )
				if hdd is not None:
					if hdd.isSleeping():
						# Don't wake up HDD
						log.debug( _("[FreeSpace] HDD is idle: ") + str(path) )
						callback()
		
		# Check free space on path
		if os.path.exists( path ):
			stat = os.statvfs( path )
			free = ( stat.f_bavail if stat.f_bavail!=0 else stat.f_bfree ) * stat.f_bsize / 1024 / 1024 # MB
			if limit > (free/1024): #GB
				if free >= 10*1024:	#MB
					free = "%d GB" %(free/1024)
				else:
					free = "%d MB" %(free)
				# Not enough free space
				text = ""
				if self.getValue('listtimer'):
					text = "\r\n\r\n" 
					text += _("Next timer:") 
					text += "\r\n"
					import NavigationInstance
					now = time()
					next_day = now + 86400 # Add one day
					for t in NavigationInstance.instance.RecordTimer.timer_list + NavigationInstance.instance.RecordTimer.processed_timers:
						if not t.disabled and not t.justplay and now < t.begin and t.end < next_day:
							text += "\t" + timerToString(t)  + "\r\n"
					
				callback( SUBJECT, BODY % (path, limit, free) + text )
			else:
				# There is enough free space
				callback()
Ejemplo n.º 25
0
    def __init__(self):
        # Is called on instance creation
        ControllerBase.__init__(self)
        self.movielist = []

        # Default configuration
        self.setOption("path", NoSave(ConfigText(default="/media/hdd/movie/", fixed_size=False)), _("Where to check"))
        self.setOption("ext", NoSave(ConfigText(default=".ts", fixed_size=False)), _("file extension"))
Ejemplo n.º 26
0
	def push(self, callback, errback, pluginname, subject, body="", attachments=[]):
		from Plugins.Extensions.PushService.plugin import NAME
		# Fire and forget
		AddPopup(
			POPUP_TEMPLATE.format( **{'name': NAME, 'plugin': pluginname, 'subject': subject, 'body': body} ),
			MessageBox.TYPE_INFO,
			self.getValue('timeout'),
			'PS_PopUp_ID_' + subject
		)
		# There is no known error state
		callback(_("The PopUp will be shown after all dialogs are closed."))
Ejemplo n.º 27
0
	def run(self, callback, errback):
		# At the end a plugin has to call one of the functions: callback or errback
		# Callback should return with at least one of the parameter: Header, Body, Attachment
		# If empty or none is returned, nothing will be sent
		
		self.timers = []
		text = ""
		list_similar = self.getValue('list_similar')
		
		def timerToString(timer):
			return str(timer.name) + "\t" \
					+ strftime(_("%Y.%m.%d %H:%M"), localtime(timer.begin)) + " - " \
					+ strftime(_("%H:%M"), localtime(timer.end)) + "\t" \
					+ str(timer.service_ref and timer.service_ref.getServiceName() or "") \
					+ "\t" + str(timer.tags)
		
		import NavigationInstance
		for timer in NavigationInstance.instance.RecordTimer.timer_list + NavigationInstance.instance.RecordTimer.processed_timers:
			if timer.disabled and TAG not in timer.tags:
				text += timerToString(timer) + "\r\n"
				
				if list_similar:
					if not timer.eit:
						text += "\r\n\r\n" + _("Timer has no EIT") + "\r\n\r\n"
						continue
					
					text += "\r\n\r\n" + _("Similar:") + "\r\n"
					
					for t in NavigationInstance.instance.RecordTimer.timer_list + NavigationInstance.instance.RecordTimer.processed_timers:
						if not t.disabled and not t.justplay and t.name == timer.name and t.eit != timer.eit:
							text += "\t" + timerToString(t)  + "\r\n"
					
					text += "\r\n"
				
				self.timers.append( timer )
			
		if self.timers and text:
			callback( SUBJECT, BODY % text )
		else:
			callback()
Ejemplo n.º 28
0
	def __init__(self):
		# Is called on instance creation
		ServiceBase.__init__(self)
		#self.sockets = []

		# Default configuration
		self.setOption('growlhost', NoSave(ConfigText(default="host", fixed_size=False)), _("Growl Host name"))
		self.setOption('growlport', NoSave(ConfigNumber(default=23053)), _("Growl Port"))
		self.setOption('timeout', NoSave(ConfigNumber(default=3)), _("Timeout"))
		self.setOption('password', NoSave(ConfigPassword()), _("Password"))
		self.setOption('sticky', NoSave(ConfigYesNo(default=True)), _("Send as sticky"))
		self.setOption('priority', NoSave(ConfigNumber(default=1)), _("Send with priority"))
Ejemplo n.º 29
0
	def run(self, callback, errback):
		# At the end a plugin has to call one of the functions: callback or errback
		# Callback should return with at least one of the parameter: Header, Body, Attachment
		# If empty or none is returned, nothing will be sent
		timers = 0
		tomorrow_begin = mktime( ( date.today() + timedelta(days=1) ).timetuple() )
		tomorrow_end   = tomorrow_begin + 24*60*60
		
		for timer in NavigationInstance.instance.RecordTimer.timer_list:
			if not timer.disabled:
				timer_begin = timer.begin
				if tomorrow_begin <= timer_begin <= tomorrow_end:
					timers += 1
				
		if timers == 0:
			callback( SUBJECT, BODY % strftime(_("%Y.%m.%d"), localtime(tomorrow_begin)))
		else:
			callback()
	def __init__(self):
		# Is called on instance creation
		ControllerBase.__init__(self)
		
		# Default configuration
		self.setOption( 'selfcheck', NoSave(ConfigYesNo( default = False )), _("Start update check if not done yet") )
		
		self.data = ""
		self.container = eConsoleAppContainer()
		try:
			self.container_dataAvail_conn = self.container.dataAvail.connect(self.dataAvail)
		except:
			self.container_dataAvail_conn = None
			self.container.dataAvail.append(self.dataAvail)
		try:
			self.container_appClosed_conn = self.container.appClosed.connect(self.opkgupgradableFinished)
		except:
			self.container_appClosed_conn = None
			self.container.appClosed.append(self.opkgupgradableFinished)
	def __init__(self):
		# Is called on instance creation
		ControllerBase.__init__(self)
		
		# Default configuration
		self.setOption( 'selfcheck', NoSave(ConfigYesNo( default = False )), _("Start update check if not done yet") )
		
		self.data = ""
		self.container = eConsoleAppContainer()
		try:
			self.container_dataAvail_conn = self.container.dataAvail.connect(self.dataAvail)
		except:
			self.container_dataAvail_conn = None
			self.container.dataAvail.append(self.dataAvail)
		try:
			self.container_appClosed_conn = self.container.appClosed.connect(self.opkgupgradableFinished)
		except:
			self.container_appClosed_conn = None
			self.container.appClosed.append(self.opkgupgradableFinished)
	def run(self, callback, errback):
		# At the end a plugin has to call one of the functions: callback or errback
		# Callback should return with at least one of the parameter: Header, Body, Attachment
		# If empty or none is returned, nothing will be sent
		timers = 0
		tomorrow_begin = mktime( ( date.today() + timedelta(days=1) ).timetuple() )
		tomorrow_end   = tomorrow_begin + 24*60*60
		
		for timer in NavigationInstance.instance.RecordTimer.timer_list:
			if not timer.disabled and str(timer.service_ref)[0]!="-":
				timer_begin = timer.begin
				if tomorrow_begin <= timer_begin <= tomorrow_end:
					timers += 1
					break
				
		if timers == 0:
			callback( SUBJECT, BODY % strftime(_("%Y.%m.%d"), localtime(tomorrow_begin)))
		else:
			callback()
Ejemplo n.º 33
0
 def push(self,
          callback,
          errback,
          pluginname,
          subject,
          body="",
          attachments=[]):
     from Plugins.Extensions.PushService.plugin import NAME
     # Fire and forget
     AddPopup(
         POPUP_TEMPLATE.format(
             **{
                 'name': NAME,
                 'plugin': pluginname,
                 'subject': subject,
                 'body': body
             }), MessageBox.TYPE_INFO, self.getValue('timeout'),
         'PS_PopUp_ID_' + subject)
     # There is no known error state
     callback(_("The PopUp will be shown after all dialogs are closed."))
Ejemplo n.º 34
0
	def run(self, callback, errback):
		# At the end a plugin has to call one of the functions: callback or errback
		# Callback should return with at least one of the parameter: Header, Body, Attachment
		# If empty or none is returned, nothing will be sent
		self.timers = []
		text = ""
		now = time()
		for timer in NavigationInstance.instance.RecordTimer.timer_list + NavigationInstance.instance.RecordTimer.processed_timers:
			if timer.justplay:
				log.debug( _("ActiveTimers: Skip justplay") + str(timer.name) )
				pass
			
			elif str(timer.service_ref)[0]=="-":
				log.debug( _("ActiveTimers: Skip serviceref") + str(timer.name) )
				pass
			
			elif self.getValue('add_tag') and TAG in timer.tags:
				log.debug( _("ActiveTimers: Skip tag") + str(timer.name) )
				pass
			
			elif timer.disabled:
				log.debug( _("ActiveTimers: Skip disabled") + str(timer.name) )
				pass
			
			elif timer.begin < now:
				log.debug( _("ActiveTimers: Skip begin < now") + str(timer.name) )
				pass
			
			else:
				text += str(timer.name) + "    " \
							+ strftime(_("%Y.%m.%d %H:%M"), localtime(timer.begin)) + " - " \
							+ strftime(_("%H:%M"), localtime(timer.end)) + "    " \
							+ str(timer.service_ref and timer.service_ref.getServiceName() or "") \
							+ "\n"
				self.timers.append( timer )
		if self.timers and text:
			callback( SUBJECT, BODY % text )
		else:
			callback()
Ejemplo n.º 35
0
#######################################################################

# Config
from Components.config import ConfigYesNo, ConfigText, NoSave

# Plugin internal
from Plugins.Extensions.PushService.__init__ import _
from Plugins.Extensions.PushService.ControllerBase import ControllerBase

# Plugin specific
import os
import re
import fnmatch

# Constants
SUBJECT = _("Found Log(s)")
BODY    = _("Log(s) are attached")


class SendLog(ControllerBase):
	
	ForceSingleInstance = True
	
	def __init__(self):
		# Is called on instance creation
		ControllerBase.__init__(self)
		self.logfiles = []

		# Default configuration
		self.setOption( 'path',            NoSave(ConfigText(  default = "/media/hdd/", fixed_size = False )), _("Path to check") )
		self.setOption( 'file_pattern',    NoSave(ConfigText(  default = "*.log", fixed_size = False )), _("Filename pattern (No RegExp)") )
Ejemplo n.º 36
0
#######################################################################

# Config
from Components.config import ConfigYesNo, NoSave

# Plugin internal
from Plugins.Extensions.PushService.__init__ import _
from Plugins.Extensions.PushService.ControllerBase import ControllerBase

# Plugin specific
import os

# Constants
CRASHLOG_DIR = '/media/hdd'

SUBJECT = _("Found CrashLog(s)")
BODY = _("Crashlog(s) are attached")


class CrashLog(ControllerBase):

    ForceSingleInstance = True

    def __init__(self):
        # Is called on instance creation
        ControllerBase.__init__(self)
        self.crashlogs = []

        # Default configuration
        self.setOption('delete_logs', NoSave(ConfigYesNo(default=False)),
                       _("Delete crashlog(s)"))
#######################################################################

# Config
from Components.config import ConfigYesNo, NoSave

# Plugin internal
from Plugins.Extensions.PushService.__init__ import _
from Plugins.Extensions.PushService.ControllerBase import ControllerBase

# Plugin specific
import NavigationInstance
from time import localtime, strftime, mktime
from datetime import date, timedelta

# Constants
SUBJECT = _("Missing timer")
BODY    = _("There are no timer for tomorrow - %s")


class MissingTimers(ControllerBase):
	
	ForceSingleInstance = True
	
	def __init__(self):
		# Is called on instance creation
		ControllerBase.__init__(self)

	def run(self, callback, errback):
		# At the end a plugin has to call one of the functions: callback or errback
		# Callback should return with at least one of the parameter: Header, Body, Attachment
		# If empty or none is returned, nothing will be sent
Ejemplo n.º 38
0
	def __init__(self):
		# Is called on instance creation
		ServiceBase.__init__(self)
		self.connectors = []
		
		# Default configuration
		self.setOption( 'smtpserver', NoSave(ConfigText(default="smtp.server.com", fixed_size = False)),    _("SMTP Server") )
		self.setOption( 'smtpport',   NoSave(ConfigNumber(default = 587)),                                  _("SMTP Port") )
		self.setOption( 'smtpssl',    NoSave(ConfigYesNo(default = True)),                                  _("SMTP SSL") )
		self.setOption( 'smtptls',    NoSave(ConfigYesNo(default = True)),                                  _("SMTP TLS") )
		self.setOption( 'timeout',    NoSave(ConfigNumber(default = 30)),                                   _("Timeout") )
		
		self.setOption( 'username',   NoSave(ConfigText(default="user", fixed_size = False)),               _("User name") )
		self.setOption( 'password',   NoSave(ConfigPassword(default="password")),                           _("Password") )
		
		self.setOption( 'mailfrom',   NoSave(ConfigText(default = "*****@*****.**", fixed_size = False)), _("Mail from") )
		self.setOption( 'mailto',     NoSave(ConfigText(fixed_size = False)),                               _("Mail to or leave empty") )
Ejemplo n.º 39
0
#######################################################################

# Config
from Components.config import ConfigYesNo, NoSave

# Plugin internal
from Plugins.Extensions.PushService.__init__ import _
from Plugins.Extensions.PushService.ControllerBase import ControllerBase

# Plugin specific
import NavigationInstance
from time import localtime, strftime


# Constants
SUBJECT = _("Record Summary")
BODY    = _("Finished record list:\n%s")
TAG     = _("FinishedTimerPushed")


class RecordSummary(ControllerBase):
	
	ForceSingleInstance = True
	
	def __init__(self):
		# Is called on instance creation
		ControllerBase.__init__(self)
		self.timers = []
		
		# Default configuration
		self.setOption( 'remove_timer', NoSave(ConfigYesNo( default = False )), _("Remove finished timer(s)") )
Ejemplo n.º 40
0
#
#######################################################################

# Config
from Components.config import ConfigYesNo, NoSave

# Plugin internal
from Plugins.Extensions.PushService.__init__ import _
from Plugins.Extensions.PushService.ControllerBase import ControllerBase

# Plugin specific
import NavigationInstance
from time import localtime, strftime

# Constants
SUBJECT = _("Record Summary")
BODY = _("Finished record list:\n%s")
TAG = _("FinishedTimerPushed")


class RecordSummary(ControllerBase):

    ForceSingleInstance = True

    def __init__(self):
        # Is called on instance creation
        ControllerBase.__init__(self)
        self.timers = []

        # Default configuration
        self.setOption('remove_timer', NoSave(ConfigYesNo(default=False)),
# Config
from Components.config import ConfigYesNo, ConfigText, ConfigNumber, NoSave

# Plugin internal
from Plugins.Extensions.PushService.__init__ import _
from Plugins.Extensions.PushService.ControllerBase import ControllerBase

# Plugin specific
import os
from time import time
from Tools.BoundFunction import boundFunction
from Plugins.SystemPlugins.SoftwareManager.SoftwareTools import iSoftwareTools

# Constants
SUBJECT = _("IPKG Update Notification")
BODY = _("There are updates available:\n%s")


class IPKGUpdateNotification(ControllerBase):

    ForceSingleInstance = True

    def __init__(self):
        # Is called on instance creation
        ControllerBase.__init__(self)

        # Default configuration
        self.setOption('selfcheck', NoSave(ConfigYesNo(default=False)),
                       _("Start update check if not done yet"))
Ejemplo n.º 42
0
	def __init__(self):
		# Is called on instance creation
		ServiceBase.__init__(self)
		# Default configuration
		self.setOption( 'timeout', NoSave(ConfigNumber(default = 30)), _("Timeout") )
Ejemplo n.º 43
0
def timerToString(timer):
	return str(timer.name) + "\t" \
			+ strftime(_("%Y.%m.%d %H:%M"), localtime(timer.begin)) + " - " \
			+ strftime(_("%H:%M"), localtime(timer.end)) + "\t" \
			+ str(timer.service_ref and timer.service_ref.getServiceName() or "") \
			+ "\t" + str(timer.tags)
#######################################################################

# Config
from Components.config import *

# Plugin internal
from Plugins.Extensions.PushService.__init__ import _
from Plugins.Extensions.PushService.ControllerBase import ControllerBase

# Plugin specific
from time import time
import os
import fnmatch

# Constants
SUBJECT = _("Broken records")
BODY    = _("There are broken records - %s")


class BrokenRecords(ControllerBase):
	
	ForceSingleInstance = True
	
	def __init__(self):
		# Is called on instance creation
		ControllerBase.__init__(self)

	def run(self, callback, errback):
		# At the end a plugin has to call one of the functions: callback or errback
		# Callback should return with at least one of the parameter: Header, Body, Attachment
		# If empty or none is returned, nothing will be sent
Ejemplo n.º 45
0
#
#######################################################################

# Config
from Components.config import config, NoSave, ConfigText, ConfigNumber, ConfigYesNo, ConfigPassword

# Plugin internal
from Plugins.Extensions.PushService.__init__ import _
from Plugins.Extensions.PushService.ServiceBase import ServiceBase

# Plugin specific
from mail.mail import Message, sendmail


# Constants
MAIL_HEADER_TEMPLATE = _("{box:s} {name:s}: {plugin:s}: {subject:s}")
MAIL_BODY_TEMPLATE = 	_("{body:s}\n\n") \
								+ _("Provided by Dreambox Plugin {name:s} {version:s} - {plugin:s}\n") \
								+ _("C 2012 by betonme @ IHAD\n") \
								+ _("Support {support:s}\n") \
								+ _("Donate {donate:s}")


class SMTP(ServiceBase):
	
	ForceSingleInstance = False
	
	def __init__(self):
		# Is called on instance creation
		ServiceBase.__init__(self)
		self.connectors = []
Ejemplo n.º 46
0
# Config
from Components.config import ConfigYesNo, ConfigText, ConfigNumber, NoSave

# Plugin internal
from Plugins.Extensions.PushService.__init__ import _
from Plugins.Extensions.PushService.ControllerBase import ControllerBase
from Plugins.Extensions.PushService.Logger import log

# Plugin specific
import os
from time import localtime, strftime, time


# Constants
SUBJECT = _("Free space warning")
BODY    = _("Free disk space limit has been reached:\n") \
				+ _("Path:  %s\n") \
				+ _("Limit: %d GB\n") \
				+ _("Left:  %s")

#Adapted from: from Components.Harddisk import findMountPoint
def mountpoint(path):
	path = os.path.realpath(path)
	if os.path.ismount(path) or len(path)==0: return path
	return mountpoint(os.path.dirname(path))
			
def getDevicebyMountpoint(hdm, mountpoint):
	for x in hdm.partitions[:]:
		if x.mountpoint == mountpoint:
			return x.device
Ejemplo n.º 47
0
#
#######################################################################

# Config
from Components.config import config, NoSave, ConfigText, ConfigNumber, ConfigYesNo, ConfigPassword

# Plugin internal
from Plugins.Extensions.PushService.__init__ import _
from Plugins.Extensions.PushService.ServiceBase import ServiceBase

# Plugin specific
import sys
import gntp.notifier

# Constants
APP_NAME = _("{box:s} {name:s}")
NOTIFICATION_TYPE = _("{name:s}")
GROWL_SUBJECT_TEMPLATE = _("{box:s}: {subject:s}")
GROWL_BODY_TEMPLATE = _("{body:s}\n\n") \
											+ _("Donate {donate:s}")


class GNTP(ServiceBase):

	ForceSingleInstance = False

	def __init__(self):
		# Is called on instance creation
		ServiceBase.__init__(self)
		#self.sockets = []
Ejemplo n.º 48
0
	def __init__(self):
		# Is called on instance creation
		ControllerBase.__init__(self)
		
		# Default configuration
		self.setOption( 'wakehdd',  NoSave(ConfigYesNo(  default = False )),                                  _("Allow HDD wake up") )
		self.setOption( 'path',     NoSave(ConfigText(   default = "/media/hdd/movie", fixed_size = False )), _("Where to check free space") )
		self.setOption( 'limit',    NoSave(ConfigNumber( default = 100 )),                                    _("Free space limit in GB") )
		self.setOption( 'listtimer',NoSave(ConfigYesNo(  default = False )),                                  _("List upcoming timer") )
from Components.config import ConfigYesNo, ConfigText, ConfigNumber, NoSave

# Plugin internal
from Plugins.Extensions.PushService.__init__ import _
from Plugins.Extensions.PushService.ControllerBase import ControllerBase
from Plugins.Extensions.PushService.Logger import log

# Plugin specific
import os
from time import time
from Tools.BoundFunction import boundFunction
from enigma import eConsoleAppContainer


# Constants
SUBJECT = _("OPKG Update Notification")
BODY    = _("There are updates available:\n%s")


class OPKGUpdateNotification(ControllerBase):
	
	ForceSingleInstance = True
	
	def __init__(self):
		# Is called on instance creation
		ControllerBase.__init__(self)
		
		# Default configuration
		self.setOption( 'selfcheck', NoSave(ConfigYesNo( default = False )), _("Start update check if not done yet") )
		
		self.data = ""
#
#######################################################################

# Config
from Components.config import ConfigYesNo, NoSave

# Plugin internal
from Plugins.Extensions.PushService.__init__ import _
from Plugins.Extensions.PushService.ControllerBase import ControllerBase

# Plugin specific
import NavigationInstance
from time import localtime, strftime

# Constants
SUBJECT = _("Found deactivated timer(s)")
BODY = _("Deactivated timer list:\n%s")
TAG = _("DeactivatedTimerPushed")


class DeactivatedTimers(ControllerBase):

    ForceSingleInstance = True

    def __init__(self):
        # Is called on instance creation
        ControllerBase.__init__(self)
        self.timers = []

        # Default configuration
        self.setOption('remove_timer', NoSave(ConfigYesNo(default=False)),
Ejemplo n.º 51
0
#
#######################################################################

# Config
from Components.config import ConfigYesNo, NoSave

# Plugin internal
from Plugins.Extensions.PushService.__init__ import _
from Plugins.Extensions.PushService.ControllerBase import ControllerBase

# Plugin specific
from time import localtime, strftime


# Constants
SUBJECT = _("Found deactivated timer(s)")
BODY    = _("Deactivated timer list:\n%s")
TAG     = _("DeactivatedTimerPushed")


class DeactivatedTimers(ControllerBase):
	
	ForceSingleInstance = True
	
	def __init__(self):
		# Is called on instance creation
		ControllerBase.__init__(self)
		self.timers = []
		
		# Default configuration
		self.setOption( 'remove_timer', NoSave(ConfigYesNo( default = False )), _("Remove deactivated timer(s)") )
Ejemplo n.º 52
0
#
#######################################################################

# Config
from Components.config import config, NoSave, ConfigText, ConfigNumber, ConfigYesNo, ConfigPassword

# Plugin internal
from Plugins.Extensions.PushService.__init__ import _
from Plugins.Extensions.PushService.ServiceBase import ServiceBase

# Plugin specific
from mail.mail import Message, sendmail


# Constants
MAIL_HEADER_TEMPLATE = _("{box:s} {name:s}: {plugin:s}: {subject:s}")
MAIL_BODY_TEMPLATE = 	_("{body:s}\n\n") \
								+ _("Provided by Dreambox Plugin {name:s} {version:s} - {plugin:s}\n") \
								+ _("C 2012 by betonme @ IHAD\n") \
								+ _("Support {support:s}\n") \
								+ _("Donate {donate:s}")


class SMTP(ServiceBase):
	
	ForceSingleInstance = False
	
	def __init__(self):
		# Is called on instance creation
		ServiceBase.__init__(self)
		self.connectors = []
Ejemplo n.º 53
0
#######################################################################

# Config
from Components.config import ConfigYesNo, ConfigText, ConfigNumber, NoSave

# Plugin internal
from Plugins.Extensions.PushService.__init__ import _
from Plugins.Extensions.PushService.ControllerBase import ControllerBase

# Plugin specific
import os


# Constants

SUBJECT = _("List of Files")


class ListDir(ControllerBase):

    ForceSingleInstance = True

    def __init__(self):
        # Is called on instance creation
        ControllerBase.__init__(self)
        self.movielist = []

        # Default configuration
        self.setOption("path", NoSave(ConfigText(default="/media/hdd/movie/", fixed_size=False)), _("Where to check"))
        self.setOption("ext", NoSave(ConfigText(default=".ts", fixed_size=False)), _("file extension"))
Ejemplo n.º 54
0
#    GNU General Public License for more details.
#
#######################################################################

# Config
from Components.config import ConfigYesNo, ConfigText, ConfigNumber, NoSave

# Plugin internal
from Plugins.Extensions.PushService.__init__ import _
from Plugins.Extensions.PushService.ControllerBase import ControllerBase

# Plugin specific
import os

# Constants
SUBJECT = _("Free space warning")
BODY = _("Free disk space limit has been reached:\n") \
    + _("Path:  %s\n") \
    + _("Limit: %d GB\n") \
    + _("Left:  %s")


class FreeSpace(ControllerBase):

    ForceSingleInstance = False

    def __init__(self):
        # Is called on instance creation
        ControllerBase.__init__(self)

        # Default configuration
Ejemplo n.º 55
0
#######################################################################

# Config
from Components.config import NoSave, ConfigNumber

# Plugin internal
from Plugins.Extensions.PushService.__init__ import _
from Plugins.Extensions.PushService.ServiceBase import ServiceBase

# Plugin specific
from Tools.Notifications import AddPopup
from Screens.MessageBox import MessageBox


# Constants
POPUP_TEMPLATE = _("{name:s} {plugin:s}\n{subject:s}\n{body:s}")


class PopUp(ServiceBase):
	
	ForceSingleInstance = True
	
	def __init__(self):
		# Is called on instance creation
		ServiceBase.__init__(self)
		# Default configuration
		self.setOption( 'timeout', NoSave(ConfigNumber(default = 30)), _("Timeout") )

	def push(self, callback, errback, pluginname, subject, body="", attachments=[]):
		from Plugins.Extensions.PushService.plugin import NAME
		# Fire and forget
Ejemplo n.º 56
0
#######################################################################

# Config
from Components.config import ConfigYesNo, NoSave

# Plugin internal
from Plugins.Extensions.PushService.__init__ import _
from Plugins.Extensions.PushService.ControllerBase import ControllerBase

# Plugin specific
import NavigationInstance
from time import localtime, strftime


# Constants
SUBJECT = _("Found active timer(s)")
BODY = _("Active timer list:\n%s")
TAG = _("ActiveTimerPushed")


class ActiveTimers(ControllerBase):

	ForceSingleInstance = True

	def __init__(self):
		# Is called on instance creation
		ControllerBase.__init__(self)
		self.timers = []

	def run(self, callback, errback):
		# At the end a plugin has to call one of the functions: callback or errback
# Config
from Components.config import ConfigYesNo, NoSave

# Plugin internal
from Plugins.Extensions.PushService.__init__ import _
from Plugins.Extensions.PushService.ControllerBase import ControllerBase
from Plugins.Extensions.PushService.Logger import log

# Plugin specific
import NavigationInstance
from time import time, localtime, strftime


# Constants
SUBJECT = _("Found active timer(s)")
BODY    = _("Active timer list:\n%s")
TAG     = _("ActiveTimerPushed")


class ActiveTimers(ControllerBase):
	
	ForceSingleInstance = True
	
	def __init__(self):
		# Is called on instance creation
		ControllerBase.__init__(self)
		self.timers = []
		
		# Default configuration
		self.setOption( 'add_tag', NoSave(ConfigYesNo( default = False )), _("Start update check if not done yet") )