Exemplo n.º 1
0
def wybox_version():
    try:
        ver_file = open('/etc/wybox-release', 'r')
        version = ver_file.readline().strip()
        ver_file.close()
    except IOError:
        log.error('Unable to retrieve Wybox version.')
        version = None
    if not version:
        version = 'N/A'
    return version
Exemplo n.º 2
0
def wydev_revision():
    try:
        ver_file = open('/wymedia/usr/etc/wydev-mod-updaterelease', 'r')
        version = ver_file.readline().strip()
        ver_file.close()
    except IOError:
        log.error('Unable to retrieve Wydev version.')
        version = None
    if not version:
        version = 'N/A'
    return version
Exemplo n.º 3
0
def serial_number():
	try:
		ser_file = open('/proc/wybox/SN', 'r')
		serial = ser_file.readline().strip().lstrip('0')
		ser_file.close()
	except IOError:
		serial = None
		log.error('Unable to retrieve serial number.')
	if not serial:
		pass
	return serial
Exemplo n.º 4
0
def wybox_version():
	try:
		ver_file = open('/etc/wybox-release', 'r')
		version = ver_file.readline().strip()
		ver_file.close()
	except IOError:
		log.error('Unable to retrieve Wybox version.')
		version = None
	if not version:
		pass
	return version
Exemplo n.º 5
0
	def __init__(self, post_key):
		try:
			self.lircd = socket(AF_UNIX, SOCK_STREAM)
			self.lircd.connect('/dev/lircd')
		except:
			log.error("Can't load lirc plugin")
			del self.lircd
		else:
			notifier.descriptor_watch(self.lircd.fileno(), self.handle)
			self.kbmap_get = DIRECTFB_MAP.get
			self.post_key = post_key
Exemplo n.º 6
0
	def rotate(self):
		from glob import glob
		from os import unlink
		flist = glob(LOGFILE % 'record-*')
		flist.sort()
		for fname in flist[:-10]:
			try:
				unlink(fname)
				flist.remove(fname)
				continue
			except (IOError, OSError):
				log.error("*WARN* can't remove %s", fname)
				continue
Exemplo n.º 7
0
def init_startup():
	if no_DBUS:
		pygui_globs['wydbus'] = None
	else:
		from peewee.dbus import peewee_dbus
		pygui_globs['wydbus'] = peewee_dbus
	try:
		from pygui.item.mediaitem.core import RootItem
		RootItem()
	except:
		PRINT_EXCEPTION()
		log.error('Failed to load wymedia!')
	try:
		import pygui.input as input
		input.init()
	except:
		PRINT_EXCEPTION()
		log.error('Failed to load input!')
Exemplo n.º 8
0
	def run(self):
		self._running = True
		try:
			self.init()
		except Exception, e:
			log.error("Can't replay: %s", str(e))
Exemplo n.º 9
0
		self.rotate()
		self.fd = file(LOGFILE % 'record-%d' % int(sched.ts), 'w')
		self._last_ts = sched.ts

	def rotate(self):
		from glob import glob
		from os import unlink
		flist = glob(LOGFILE % 'record-*')
		flist.sort()
		for fname in flist[:-10]:
			try:
				unlink(fname)
				flist.remove(fname)
				continue
			except (IOError, OSError):
				log.error("*WARN* can't remove %s", fname)
				continue

	def add(self, event, args={}):
		ts = sched.ts - self._last_ts
		self._last_ts = sched.ts
		self.fd.write('%f:%s\n' % (ts, event))
		self.fd.flush()



class EventPlayer(Thread):
	def __init__(self, handler, logfile=None, loop=False):
		Thread.__init__(self)
		self.handler = handler
		self._flag_name = '/tmp/oom.flag'
Exemplo n.º 10
0
n 0(None)[from __future__ import absolute_import
from pygui.shared import pygui_globs
from peewee.debug import log, PRINT_EXCEPTION
from pygui.config import plugins, no_DBUS
def init_startup():
	if no_DBUS:
		pygui_globs['wydbus'] = None
	else:
		from peewee.dbus import peewee_dbus
		pygui_globs['wydbus'] = peewee_dbus
	try:
		from pygui.item.mediaitem.core import RootItem
		RootItem()
	except:
		PRINT_EXCEPTION()
		log.error('Failed to load wymedia!')
	try:
		import pygui.input as input
		input.init()
	except:
		PRINT_EXCEPTION()
		log.error('Failed to load input!')

]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7591e4c>}
from __future__ import absolute_import
from pygui.shared import pygui_globs
from peewee.debug import log, PRINT_EXCEPTION
Exemplo n.º 11
0
n 0(None)[return '.'.join(<genexpr>(version.split('.')))
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb761ee8c>}
nname: 0
n 0(None)[from __future__ import absolute_import
from peewee.debug import log
def wybox_version():
	try:
		ver_file = open('/etc/wybox-release', 'r')
		version = ver_file.readline().strip()
		ver_file.close()
	except IOError:
		log.error('Unable to retrieve Wybox version.')
		version = None
	if not version:
		pass
	return version

def serial_number():
	try:
		ser_file = open('/proc/wybox/SN', 'r')
		serial = ser_file.readline().strip().lstrip('0')
		ser_file.close()
	except IOError:
		serial = None
		log.error('Unable to retrieve serial number.')
	if not serial:
		pass
Exemplo n.º 12
0
self.nodes: {6: <unpyclib.structure.node instance at 0xb75c7f8c>}
nname: 0
n 0(None)[from __future__ import absolute_import
import peewee.notifier as notifier
from peewee.debug import log
from Queue import Full
from pygui.input import DIRECTFB_MAP
from socket import socket, AF_UNIX, SOCK_STREAM
class PluginInterface(object):
	__doc__ = '\n    Plugin for stdin control.\n    '
	def __init__(self, post_key):
		try:
			self.lircd = socket(AF_UNIX, SOCK_STREAM)
			self.lircd.connect('/dev/lircd')
		except:
			log.error("Can't load lirc plugin")
			del self.lircd
		else:
			notifier.descriptor_watch(self.lircd.fileno(), self.handle)
			self.kbmap_get = DIRECTFB_MAP.get
			self.post_key = post_key

	def handle(self):
		try:
			code, rep, keycode, garbage = self.lircd.recv(512).split(None, 3)
			rep = int(rep, 16)
			if 0 < rep:
				pass
			else:
				rep