aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Plugins/tuxboxplugins/plugin.py
blob: bf789465fd935c16878d9ac4be47cf98bc76c964 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from enigma import *
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Components.ActionMap import ActionMap
from Components.Label import Label

import os

def getPlugins():
	pluginlist = []

	try:
		dir = os.listdir("/usr/lib/tuxbox/plugins/")
	
		for x in dir:
			try:
				if x[-3:] == "cfg":
					params = getPluginParams(x)
					pluginlist.append((params["name"], params["desc"], "function", "main", x))
			except:
				pass
	except:
		print "no tuxbox plugins found"
	return pluginlist

def getPicturePaths():
	list = []
	try:
		dir = os.listdir("/usr/lib/tuxbox/plugins/")
		for x in dir: list.append("tuxbox.png")
	except:
		print "no tuxbox plugins found"
	return list

def getPluginParams(file):
	params = {}
	try:
		file = open("/usr/lib/tuxbox/plugins/" + file, "r")
		for x in file.readlines():
			split = x.split("=")
			params[split[0]] = split[1]
		file.close()
	except:
		print "not tuxbox plugins found"

	return params

def main(session, args):
	print "Running plugin " + args[:-4] + ".so with config file", args
	print getPluginParams(args)