Index: k/source/mediacenter_mediathek_2_3/usr/lib/enigma2/python/Plugins/Extensions/MultiMediathek/LICENSE
===================================================================
--- /ipk/source/mediacenter_mediathek_2_3/usr/lib/enigma2/python/Plugins/Extensions/MultiMediathek/LICENSE	(revision 6923)
+++ 	(revision )
@@ -1,8 +1,0 @@
-This plugin is licensed under the Creative Commons 
-Attribution-NonCommercial-ShareAlike 3.0 Unported 
-License. To view a copy of this license, visit
-http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative
-Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
-
-In addition, this plugin may only be distributed and executed on
-hardware which is licensed by Dream Multimedia GmbH.
Index: k/source/mediacenter_mediathek_2_3/usr/lib/enigma2/python/Plugins/Extensions/MultiMediathek/maintainer.info
===================================================================
--- /ipk/source/mediacenter_mediathek_2_3/usr/lib/enigma2/python/Plugins/Extensions/MultiMediathek/maintainer.info	(revision 6923)
+++ 	(revision )
@@ -1,2 +1,0 @@
-homey@dreambox-plugins.de
-MultiMediathek Plugin
Index: k/source/mediacenter_mediathek_2_3/usr/lib/enigma2/python/Plugins/Extensions/MultiMediathek/plugin.py
===================================================================
--- /ipk/source/mediacenter_mediathek_2_3/usr/lib/enigma2/python/Plugins/Extensions/MultiMediathek/plugin.py	(revision 6923)
+++ 	(revision )
@@ -1,1231 +1,0 @@
-#####################################################
-# Multi-Mediathek Plugin for Enigma2 Dreamboxes
-# Coded by Homey (c) 2011
-#
-# Version: 2.3
-# Support: www.i-have-a-dreambox.com
-#####################################################
-from Components.config import config, configfile, getConfigListEntry, ConfigSubsection, ConfigYesNo, ConfigText, ConfigEnableDisable, ConfigSelection, NoSave
-from Components.ConfigList import ConfigList, ConfigListScreen
-from Components.AVSwitch import AVSwitch
-from Components.ActionMap import ActionMap
-from Components.Button import Button
-from Components.PluginComponent import plugins
-from Components.Pixmap import Pixmap, MovingPixmap
-from Components.ServiceEventTracker import ServiceEventTracker
-from Components.Slider import Slider
-from Components.Sources.List import List
-from Components.Sources.StaticText import StaticText
-from Components.Task import Task, Job, job_manager as JobManager, Condition
-from Screens.Screen import Screen
-from Screens.MessageBox import MessageBox
-from Screens.ChoiceBox import ChoiceBox
-from Screens.InfoBar import MoviePlayer
-from Screens.InputBox import PinInput
-from Screens.Standby import TryQuitMainloop
-from Screens.TaskView import JobView
-from Screens.VirtualKeyBoard import VirtualKeyBoard
-from Tools import Notifications, ASCIItranslit
-from Tools.Directories import fileExists
-from Plugins.Plugin import PluginDescriptor
-
-from enigma import ePicLoad, eTimer, getDesktop, eConsoleAppContainer, eBackgroundFileEraser, eServiceReference, iServiceInformation, iPlayableService
-from os import stat as os_stat, listdir as os_listdir, path as os_path, system as os_system
-from time import time
-from twisted.web.client import getPage, downloadPage
-from urllib import urlencode
-from urllib2 import Request, urlopen
-from xml.dom.minidom import parse, parseString
-from xml.sax.saxutils import unescape
-
-import xml.etree.cElementTree
-
-try:
-	from Plugins.Extensions.VlcPlayer.VlcPlayer import VlcPlayer
-	from Plugins.Extensions.VlcPlayer.VlcServerConfig import vlcServerConfig
-	from Tools.BoundFunction import boundFunction
-	VLCSUPPORT = True
-except Exception, e:
-	VLCSUPPORT = False
-
-##############################
-#####  CONFIG SETTINGS   #####
-##############################
-
-config.plugins.multimediathek = ConfigSubsection()
-config.plugins.multimediathek.storagepath = ConfigText(default="/media/hdd", fixed_size=False)
-config.plugins.multimediathek.imagecache = ConfigEnableDisable(default=True)
-config.plugins.multimediathek.imagescaling = ConfigSelection(default="1", choices = [("0", _("simple")), ("1", _("better"))])
-config.plugins.multimediathek.showadultcontent = ConfigYesNo(default=False)
-config.plugins.multimediathek.showsecretcontent = ConfigYesNo(default=False)
-config.plugins.multimediathek.checkforupdate = ConfigYesNo(default=True)
-config.plugins.multimediathek.version = NoSave(ConfigText(default="230"))
-
-#################################
-###    Download Movie Task    ###
-#################################
-
-class downloadJob(Job):
-	def __init__(self, toolbox, cmdline, filename, filetitle):
-		Job.__init__(self, _("Saving Movie from Mediathek"))
-		self.toolbox = toolbox
-		self.retrycount = 0
-		downloadTask(self, cmdline, filename, filetitle)
-
-	def retry(self):
-		assert self.status == self.FAILED
-		self.retrycount += 1
-		self.restart()
-	
-class downloadTask(Task):
-	ERROR_CORRUPT_FILE, ERROR_RTMP_ReadPacket, ERROR_SEGFAULT, ERROR_SERVER, ERROR_UNKNOWN = range(5)
-	def __init__(self, job, cmdline, filename, filetitle):
-		Task.__init__(self, job, filetitle)
-		self.postconditions.append(downloadTaskPostcondition())
-		self.setCmdline(cmdline)
-		self.filename = filename
-		self.toolbox = job.toolbox
-		self.error = None
-		self.lasterrormsg = None
-		
-	def processOutput(self, data):
-		try:
-			if data.endswith('%)'):
-				startpos = data.rfind("sec (")+5
-				if startpos and startpos != -1:
-					self.progress = int(float(data[startpos:-4]))
-			elif data.find('%') != -1:
-				tmpvalue = data[:data.find("%")]
-				tmpvalue = tmpvalue[tmpvalue.rfind(" "):].strip()
-				tmpvalue = tmpvalue[tmpvalue.rfind("(")+1:].strip()
-				self.progress = int(float(tmpvalue))
-			else:
-				Task.processOutput(self, data)
-		except Exception, errormsg:
-			print "Error processOutput: " + str(errormsg)
-			Task.processOutput(self, data)
-
-	def processOutputLine(self, line):
-		line = line[:-1]
-		#print "[MultiMediathek DownloadTask STATUS MSG] %s" % line
-		if line.startswith("ERROR:"):
-			self.lasterrormsg = line
-			if line.find("RTMP_ReadPacket") != -1:
-				self.error = self.ERROR_RTMP_ReadPacket
-			elif line.find("corrupt file!") != -1:
-				self.error = self.ERROR_CORRUPT_FILE
-				os_system("rm -f %s" % self.filename)
-			else:
-				self.error = self.ERROR_UNKNOWN
-		elif line.startswith("wget:"):
-			self.lasterrormsg = line
-			if line.find("server returned error") != -1:
-				self.error = self.ERROR_SERVER
-		elif line.find("Segmentation fault") != -1:
-			self.error = self.ERROR_SEGFAULT
-			
-	def afterRun(self):
-		pass
-		#FIXME: Only show when we saved movie in background!
-		#if self.getProgress() == 0 or self.getProgress() == 100:
-		#	Notifications.AddNotification(MessageBox, _("Movie successfully transfered to your HDD!") +"\n"+self.filename, MessageBox.TYPE_INFO, timeout=10)
-
-class downloadTaskPostcondition(Condition):
-	RECOVERABLE = True
-	def check(self, task):
-		if task.returncode == 0 or task.error is None:
-			return True
-		else:
-			return False
-
-	def getErrorMessage(self, task):
-		return {
-			task.ERROR_CORRUPT_FILE: _("Video Download Failed!\n\nCorrupted Download File:\n%s" % task.lasterrormsg),
-			task.ERROR_RTMP_ReadPacket: _("Video Download Failed!\n\nCould not read RTMP-Packet:\n%s" % task.lasterrormsg),
-			task.ERROR_SEGFAULT: _("Video Download Failed!\n\nSegmentation fault:\n%s" % task.lasterrormsg),
-			task.ERROR_SERVER: _("Video Download Failed!\n\nServer returned error:\n%s" % task.lasterrormsg),
-			task.ERROR_UNKNOWN: _("Video Download Failed!\n\nUnknown Error:\n%s" % task.lasterrormsg)
-		}[task.error]
-
-###################################################
-
-class MediathekMoviePlayer(MoviePlayer):
-	def __init__(self, session, service, movieinfo=None):
-		MoviePlayer.__init__(self, session, service)
-		self.skinName = "MoviePlayer"
-		self.movieinfo = movieinfo
-
-		self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
-			{
-				iPlayableService.evUser+10: self.__evAudioDecodeError,
-				iPlayableService.evUser+11: self.__evVideoDecodeError,
-				iPlayableService.evUser+12: self.__evPluginError
-			})
-
-	def leavePlayer(self):
-		self.leavePlayerConfirmed(True)
-
-	def leavePlayerConfirmed(self, answer):
-		if answer:
-			self.close()
-
-	def doEofInternal(self, playing):
-		self.leavePlayerConfirmed(True)
-
-	def showMovies(self):
-		pass
-
-	def __evAudioDecodeError(self):
-		currPlay = self.session.nav.getCurrentService()
-		sTagAudioCodec = currPlay.info().getInfoString(iServiceInformation.sTagAudioCodec)
-		print "[__evAudioDecodeError] audio-codec %s can't be decoded by hardware" % (sTagAudioCodec)
-		self.session.open(MessageBox, _("This Dreambox can't decode %s streams!") % sTagAudioCodec, type=MessageBox.TYPE_INFO, timeout=20)
-
-	def __evVideoDecodeError(self):
-		currPlay = self.session.nav.getCurrentService()
-		sTagVideoCodec = currPlay.info().getInfoString(iServiceInformation.sTagVideoCodec)
-		print "[__evVideoDecodeError] video-codec %s can't be decoded by hardware" % (sTagVideoCodec)
-		self.session.open(MessageBox, _("This Dreambox can't decode %s streams!") % sTagVideoCodec, type=MessageBox.TYPE_INFO, timeout=20)
-
-	def __evPluginError(self):
-		currPlay = self.session.nav.getCurrentService()
-		message = currPlay.info().getInfoString(iServiceInformation.sUser+12)
-		print "[__evPluginError]" , message
-		if self.movieinfo is not None:
-			self.session.openWithCallback(self.VLCcallback, MessageBox, _("Your Dreambox can't decode this video stream!\n%s\nDo you want to stream it via VLC Server from your PC?") % message[17:], MessageBox.TYPE_YESNO)
-		else:
-			self.session.open(MessageBox, _("Your Dreambox can't decode this video stream!\n%s") % message, type=MessageBox.TYPE_INFO, timeout=20)
-
-	def VLCcallback(self, answer):
-		if answer is True:
-			self.close(self.movieinfo)
-		else:
-			self.close()
-
-#------------------------------------------------------------------------------------------
-
-class MultiMediathek(Screen):
-	def __init__(self, session, feedurl="http://www.dreambox-plugins.de/feeds/mediathek/main.xml", feedtitle="Startseite", feedtext="Mediathek"):
-
-		# Get Screen Resolution
-		size_w = getDesktop(0).size().width()
-		size_h = getDesktop(0).size().height()
-		self.FramebufferScale = AVSwitch().getFramebufferScale()
-
-		if size_w == 1280:
-			self.spaceTop = 200
-			self.spaceLeft = 50
-			self.spaceX = 35
-			self.spaceY = 40
-			self.picX = 200
-			self.picY = 180
-		else:
-			self.spaceTop = 160
-			self.spaceLeft = 15
-			self.spaceX = 30
-			self.spaceY = 35
-			self.picX = 160
-			self.picY = 144
-
-		# Workaround for UserAgent Settings when MediaPlayer not installed
-		try:
-			config.mediaplayer.useAlternateUserAgent.value = False
-			config.mediaplayer.alternateUserAgent.value = ""
-		except Exception, errormsg:
-			config.mediaplayer = ConfigSubsection()
-			config.mediaplayer.useAlternateUserAgent = ConfigYesNo(default=False)
-			config.mediaplayer.alternateUserAgent = ConfigText(default="")
-
-		# Set some default values
-		self["titletext"] = StaticText(feedtitle)
-		self["titlemessage"] = StaticText(feedtext)
-		self["pageinfo"] = StaticText("Downloading feeds from webserver ...")
-
-		self.feedurl = feedurl
-		self.feedtitle = feedtitle
-		self.feedtext = feedtext
-		self.textcolor = "#F7F7F7"
-		self.bgcolor = "#000000"
-		textsize = 20
-
-		# Create Thumblist
-		self.thumbsX = (size_w - self.spaceLeft) / (self.spaceX + self.picX) # thumbnails in X
-		self.thumbsY = (size_h - self.spaceTop) / (self.spaceY + self.picY) # thumbnails in Y
-		self.thumbsC = self.thumbsX * self.thumbsY # all thumbnails
-
-		self.positionlist = []
-		skincontent = ""
-
-		posX = -1
-		for x in range(self.thumbsC):
-			posY = x / self.thumbsX
-			posX += 1
-			if posX >= self.thumbsX:
-				posX = 0
-
-			absX = self.spaceLeft + self.spaceX + (posX*(self.spaceX + self.picX))
-			absY = self.spaceTop + self.spaceY + (posY*(self.spaceY + self.picY))
-			self.positionlist.append((absX, absY))
-			skincontent += "<widget source=\"label" + str(x) + "\" render=\"Label\" position=\"" + str(absX+2) + "," + str(absY+self.picY-textsize-10) + "\" size=\"" + str(self.picX - 10) + ","  + str((textsize*2)+10) + "\" halign=\"center\" font=\"Regular;" + str(textsize) + "\" zPosition=\"4\" transparent=\"1\" foregroundColor=\"" + self.textcolor + "\" />"
-			skincontent += "<widget name=\"thumb" + str(x) + "\" position=\"" + str(absX)+ "," + str(absY+5) + "\" size=\"" + str(self.picX -10) + "," + str(self.picY - (textsize*2)) + "\" zPosition=\"4\" transparent=\"1\" alphatest=\"on\" />"
-
-		# Screen, backgroundlabel and MovingPixmap
-		self.skin = "<screen position=\"0,0\" size=\"" + str(size_w) + "," + str(size_h) + "\" flags=\"wfNoBorder\" title=\"Mediathek\"> \
-			<ePixmap name=\"dp_logo\" position=\"50,30\" zPosition=\"2\" size=\"250,200\" pixmap=\"/usr/lib/enigma2/python/Plugins/Extensions/MultiMediathek/images/logo.png\" /> \
-			<eLabel position=\"75,200\" zPosition=\"1\" size=\"1140,2\" backgroundColor=\"#FF9900\" /> \
-			<widget source=\"titletext\" transparent=\"1\" render=\"Label\" zPosition=\"2\" position=\"320,105\" size=\"600,45\" font=\"Regular;40\" backgroundColor=\"" + self.bgcolor + "\" foregroundColor=\"" + self.textcolor + "\" /> \
-			<widget source=\"titlemessage\" transparent=\"1\" render=\"Label\" zPosition=\"2\" valign=\"center\" halign=\"left\" position=\"320,150\" size=\""+ str(size_w) + ",30\" font=\"Regular;25\" foregroundColor=\"" + self.textcolor + "\" /> \
-			<widget source=\"global.CurrentTime\" render=\"Label\" position=\"1135,100\" zPosition=\"2\" transparent=\"1\" size=\"80,30\" font=\"Regular;25\" halign=\"right\" foregroundColor=\"" + self.textcolor + "\"> \
-				<convert type=\"ClockToText\"></convert> \
-			</widget> \
-			<eLabel position=\"0,0\" zPosition=\"0\" size=\""+ str(size_w) + "," + str(size_h) + "\" backgroundColor=\"" + self.bgcolor + "\" /> \
-			<widget source=\"pageinfo\" position=\"0,667\" transparent=\"1\" render=\"Label\" zPosition=\"2\" valign=\"center\" halign=\"center\" size=\"" + str(size_w) + ",30\" font=\"Regular;14\" foregroundColor=\"" + self.textcolor + "\" /> \
-			<widget name=\"frame\" position=\"" + str(size_w) + "," + str(size_h) + "\" size=\"190,200\" pixmap=\"pic_frame.png\" zPosition=\"5\" alphatest=\"on\" />"  + skincontent + "</screen>"
-
-		Screen.__init__(self, session)
-
-		self.oldService = self.session.nav.getCurrentlyPlayingServiceReference()
-
-		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions", "MovieSelectionActions"],
-		{
-			"cancel": self.Exit,
-			"ok": self.key_ok,
-			"left": self.key_left,
-			"right": self.key_right,
-			"up": self.key_up,
-			"down": self.key_down,
-			"blue": self.selectBookmark,
-			"contextMenu": self.key_menu,
-			"showEventInfo": self.key_info
-		}, -1)
-
-		self.maxPage = 0
-		self.maxentry = 1
-		self.index = 0
-		self.itemlist = False
-
-		self["frame"] = MovingPixmap()
-		for x in range(self.thumbsC):
-			self["label"+str(x)] = StaticText()
-			self["thumb"+str(x)] = Pixmap()
-
-		self.picload = ePicLoad()
-		self.picload.PictureData.get().append(self.showPic)
-
-		self.ThumbTimer = eTimer()
-		self.ThumbTimer.callback.append(self.showPic)
-
-		# Init Thumb PicLoad
-		self.thumbload = ePicLoad()
-		self.thumbload.PictureData.get().append(self.showThumbPixmap)
-		self.thumbload.setPara((self.picX-10, self.picY-(textsize*2), self.FramebufferScale[0], self.FramebufferScale[1], config.plugins.multimediathek.imagecache.value, int(config.plugins.multimediathek.imagescaling.value), "#00000000"))
-
-		# Init eBackgroundFileEraser
-		self.BgFileEraser = eBackgroundFileEraser.getInstance()
-
-		# Check if plugin-update is available
-		if self.feedtitle == "Startseite" and config.plugins.multimediathek.checkforupdate.value:
-			self.onLayoutFinish.append(self.checkforupdate)
-
-		self.onFirstExecBegin.append(self.loadFrame)
-
-	def loadFrame(self):
-		if not self.createMediaFolders():
-			return
-
-		if self.feedtitle == "Bookmarks":
-			self.getBookmarks()
-		else:
-			self.getxmlfeed()
-
-	def createMediaFolders(self):
-		#if self.feedtitle == "Startseite" and not os_path.ismount(config.plugins.multimediathek.storagepath.value):
-		#	self["pageinfo"].setText(_("ERROR creating mediathek folders ..."))
-		#	return False
-
-		if self.feedtitle == "Startseite" and os_path.ismount(config.plugins.multimediathek.storagepath.value):
-			os_system("mkdir -p "+config.plugins.multimediathek.storagepath.value+"/mediathek")
-			os_system("mkdir -p "+config.plugins.multimediathek.storagepath.value+"/mediathek/images")
-			os_system("mkdir -p "+config.plugins.multimediathek.storagepath.value+"/mediathek/movies")
-			os_system("mkdir -p "+config.plugins.multimediathek.storagepath.value+"/mediathek/tmp")
-
-		return True
-
-	def checkforupdate(self):
-		try:
-			self["pageinfo"].setText(_("Checking for updates ..."))
-			getPage("http://www.dreambox-plugins.de/downloads/MultiMediathek/version.txt").addCallback(self.gotUpdateInfo).addErrback(self.getxmlfeedError)
-		except Exception, error:
-			print "[Mediathek]: Could not download HTTP Page\n" + str(error)
-
-	def gotUpdateInfo(self, html):
-		tmp_infolines = html.splitlines()
-		remoteversion = tmp_infolines[0]
-		self.updateurl = tmp_infolines[1]
-		if config.plugins.multimediathek.version.value < remoteversion:
-			self.session.openWithCallback(self.startPluginUpdate,MessageBox,_("An update is available for Mediathek Plugin!\nDo you want to download and install now?"), MessageBox.TYPE_YESNO)
-
-	def startPluginUpdate(self, answer):
-		if answer is True:
-			self.container=eConsoleAppContainer()
-			self.container.appClosed.append(self.finishedPluginUpdate)
-			self.container.execute("opkg install --force-overwrite " + str(self.updateurl))
-
-	def finishedPluginUpdate(self,retval):
-		self.session.openWithCallback(self.restartGUI, MessageBox,_("Mediathek-Plugin successfully updated!\nDo you want to restart Enigma2 GUI now?"), MessageBox.TYPE_YESNO)
-
-	def restartGUI(self, answer):
-		if answer is True:
-			self.session.open(TryQuitMainloop, 3)
-
-	def getxmlfeed(self):
-		feedurl = self.feedurl
-		if self.feedtitle == "Startseite" and (config.plugins.multimediathek.showadultcontent.value == True or config.plugins.multimediathek.showsecretcontent.value == True):
-			feedurl = feedurl + "?"
-			if config.plugins.multimediathek.showadultcontent.value:
-				feedurl = feedurl + "&showadult=1"
-			if config.plugins.multimediathek.showsecretcontent.value:
-				feedurl = feedurl + "&showsecret=1"
-
-		getPage(feedurl).addCallback(self.gotxmlfeed).addErrback(self.getxmlfeedError)
-
-	def getxmlfeedError(self, error=""):
-		self["pageinfo"].setText("Error downloading XML Feed!\n\n" + str(error))
-
-	def gotxmlfeed(self, page=""):
-		self["pageinfo"].setText("Parsing XML Feeds ...")
-		xml = parseString(page)
-
-		index = 0
-		framePos = 0
-		Page = 0
-
-		self.Thumbnaillist = []
-		self.itemlist = []
-		self.currPage = -1
-		self.maxPage = 0
-
-		for node in xml.getElementsByTagName("ITEM"):
-			id = int(node.getElementsByTagName("ID")[0].childNodes[0].data)
-			type = str(node.getElementsByTagName("TYPE")[0].childNodes[0].data)
-			name = unescape(str(node.getElementsByTagName("NAME")[0].childNodes[0].data))
-			imgurl = str(node.getElementsByTagName("IMGURL")[0].childNodes[0].data)
-			url = str(node.getElementsByTagName("URL")[0].childNodes[0].data)
-
-			# APPEND ITEM TO LIST
-			self.itemlist.append((index, framePos, Page, name, imgurl, url, type, "item"))
-			index += 1
-			framePos += 1
-
-			if framePos == 1:
-				self.maxPage += 1
-			elif framePos > (self.thumbsC-1):
-				framePos = 0
-				Page += 1
-
-		self.maxentry = len(self.itemlist)-1
-
-		self["pageinfo"].setText("")
-		self.paintFrame()
-		self["frame"].show()
-
-	def getBookmarks(self):
-		self["pageinfo"].setText("Parsing Bookmarks ...")
-
-		index = 0
-		framePos = 0
-		Page = 0
-
-		self.Thumbnaillist = []
-		self.itemlist = []
-		self.currPage = -1
-		self.maxPage = 0
-
-		bookmarkfile = "/etc/enigma2/multimediathek.bookmarks"
-		if fileExists(bookmarkfile, 'r'):
-			bookmarklist = []
-			bookmarkcount = 0
-			tmpfile = open(bookmarkfile, "r")
-			for line in tmpfile:
-				if ':::' in line:
-					bookmarkcount += 1
-					tmpline = line.split(":::")
-					id = bookmarkcount
-					type = str(tmpline[0])
-					name = str(tmpline[1])
-					url  = str(tmpline[2])
-					imgurl = str(tmpline[3])
-
-					# APPEND ITEM TO LIST
-					self.itemlist.append((index, framePos, Page, name, imgurl, url, type, "bookmark"))
-					index += 1
-					framePos += 1
-
-					if framePos == 1:
-						self.maxPage += 1
-					elif framePos > (self.thumbsC-1):
-						framePos = 0
-						Page += 1
-
-		self.maxentry = len(self.itemlist)-1
-
-		self["pageinfo"].setText("")
-		self.paintFrame()
-		self["frame"].show()
-
-	def getThumbnail(self):
-		self.thumbcount += 1
-		self.thumburl = self.Thumbnaillist[self.thumbcount][2]
-		self.thumbfile = config.plugins.multimediathek.storagepath.value+"/mediathek/images/"+str(self.Thumbnaillist[self.thumbcount][3])
-
-		if fileExists(self.thumbfile, 'r'):
-			self.gotThumbnail()
-		else:
-			downloadPage(self.thumburl, self.thumbfile).addCallback(self.gotThumbnail).addErrback(self.showThumbError)
-
-	def gotThumbnail(self, txt=""):
-		if self.thumbload.getThumbnail(self.thumbfile) == 1:
-			if self.thumbcount+1 < len(self.Thumbnaillist):
-				self.getThumbnail()
-
-	def showThumbPixmap(self, picInfo=None):
-		ptr = self.thumbload.getData()
-		if ptr != None:
-			self["thumb" + str(self.thumbcount)].instance.setPixmap(ptr.__deref__())
-			self["thumb" + str(self.thumbcount)].show()
-
-		if self.thumbcount+1 < len(self.Thumbnaillist):
-			self.getThumbnail()
-
-	def showThumbError(self, error):
-		if self.thumbcount+1 < self.thumbsC:
-			self.getThumbnail()
-
-	def paintFrame(self):
-		if self.maxentry < self.index or self.index < 0 or not self.itemlist:
-			return
-
-		pos = self.positionlist[self.itemlist[self.index][1]]
-		self["frame"].moveTo(pos[0], pos[1], 1)
-		self["frame"].startMoving()
-
-		if self.currPage != self.itemlist[self.index][2]:
-			self.currPage = self.itemlist[self.index][2]
-			self.newPage()
-
-	def newPage(self):
-		self.Thumbnaillist = []
-		if self.maxPage > 1:
-			self["pageinfo"].setText("Page "+str(self.currPage+1)+" of "+str(self.maxPage))
-		else:
-			self["pageinfo"].setText("")
-
-		#clear Labels and Thumbnail
-		for x in range(self.thumbsC):
-			self["label"+str(x)].setText("")
-			self["thumb"+str(x)].hide()
-
-		#paint Labels and fill Thumbnail-List
-		for x in self.itemlist:
-			if x[2] == self.currPage:
-				self["label"+str(x[1])].setText(x[3])
-				self["thumb"+str(x[1])].instance.setPixmapFromFile("/usr/lib/enigma2/python/Plugins/Extensions/MultiMediathek/images/item.png")
-				self["thumb"+str(x[1])].show()
-				self.Thumbnaillist.append([0, x[1], x[4], ASCIItranslit.legacyEncode(x[3]+"."+x[4].split('.')[-1]).lower()])
-
-		#Get Thumbnails
-		self.thumbcount = -1
-		self.getThumbnail()
-
-	def showPic(self, picInfo=""):
-		for x in range(len(self.Thumbnaillist)):
-			if self.Thumbnaillist[x][0] == 0:
-				if self.picload.getThumbnail(self.Thumbnaillist[x][2]) == 1:
-					self.ThumbTimer.start(500, True)
-				else:
-					self.Thumbnaillist[x][0] = 1
-				break
-			elif self.Thumbnaillist[x][0] == 1:
-				self.Thumbnaillist[x][0] = 2
-				ptr = self.picload.getData()
-				if ptr != None:
-					self["thumb" + str(self.Thumbnaillist[x][1])].instance.setPixmap(ptr.__deref__())
-					self["thumb" + str(self.Thumbnaillist[x][1])].show()
-
-	def selectBookmark(self):
-		self.session.open(MultiMediathek, self.itemlist[self.index][5], "Bookmarks", "Bookmarks from your favorite Movies")
-
-	def key_left(self):
-		self.index -= 1
-		if self.index < 0:
-			self.index = self.maxentry
-		self.paintFrame()
-
-	def key_right(self):
-		self.index += 1
-		if self.index > self.maxentry:
-			self.index = 0
-		self.paintFrame()
-
-	def key_up(self):
-		self.index -= self.thumbsX
-		if self.index < 0:
-			self.index = self.maxentry
-		self.paintFrame()
-
-	def key_down(self):
-		self.index += self.thumbsX
-		if self.index-self.thumbsX == self.maxentry:
-			self.index = 0
-		elif self.index > self.maxentry:
-			self.index = self.maxentry
-		self.paintFrame()
-
-	def key_info(self):
-		self.session.open(MessageBox,("Coming soon ..."), MessageBox.TYPE_INFO, timeout=10)
-
-	def key_menu(self):
-		if self.feedtitle == "Startseite":
-			self.session.openWithCallback(self.loadFrame, MultiMediathek_Settings)
-		elif self.itemlist:
-			self.session.openWithCallback(self.loadFrame, MultiMediathek_ItemOptions, self.itemlist[self.index])
-
-	def key_ok(self):
-		if not self.itemlist:
-			return
-
-		if self.itemlist[self.index][6] == "cat":
-			self.session.open(MultiMediathek, self.itemlist[self.index][5], self.itemlist[self.index][3], self.feedtext + " - " + self.itemlist[self.index][3])
-		elif self.itemlist[self.index][6] == "movie":
-			self.session.open(MovieInfoScreen, self.itemlist[self.index][5])
-		elif self.itemlist[self.index][6] == "search":
-			self.searchurl = self.itemlist[self.index][5]
-			self.session.openWithCallback(self.SendSearchQuery, VirtualKeyBoard, title = (_("Enter Search Term:")), text = "")
-
-	def SendSearchQuery(self, query):
-		if query is not None:
-			searchurl = self.itemlist[self.index][5] + "&searchquery=" + str(query)
-			self.session.open(MultiMediathek, searchurl, self.itemlist[self.index][3], self.feedtext + " - " + self.itemlist[self.index][3] + ": " + query)
-
-	def Exit(self):
-		if self.feedtitle == "Startseite":
-			# Restart old service
-			self.session.nav.playService(self.oldService)
-
-			# Clean TEMP Folder
-			if os_path.isdir(config.plugins.multimediathek.storagepath.value+"/mediathek/tmp"):
-				for filename in os_listdir(config.plugins.multimediathek.storagepath.value+"/mediathek/tmp"):
-					filelocation = "%s/mediathek/tmp/%s" % (config.plugins.multimediathek.storagepath.value,filename)
-					self.BgFileEraser.erase(filelocation)
-
-			# Clean Image Cache
-			if os_path.isdir(config.plugins.multimediathek.storagepath.value+"/mediathek/images"):
-				for filename in os_listdir(config.plugins.multimediathek.storagepath.value+"/mediathek/images"):
-					filelocation = "%s/mediathek/images/%s" % (config.plugins.multimediathek.storagepath.value,filename)
-					statinfo = os_stat(filelocation)
-					if statinfo.st_mtime < (time()-86400.0):
-						self.BgFileEraser.erase(filelocation)
-
-		self.close()
-
-#------------------------------------------------------------------------------------------
-
-class MovieInfoScreen(Screen):
-	def __init__(self, session, movieurl):
-		Screen.__init__(self, session)
-
-		size_w = getDesktop(0).size().width()
-		size_h = getDesktop(0).size().height()
-
-		if size_w == 1280:
-			self.skin = "<screen position=\"0,0\" size=\"" + str(size_w) + "," + str(size_h) + "\" flags=\"wfNoBorder\" title=\"Mediathek\" > \
-				<eLabel position=\"0,0\" zPosition=\"0\" size=\""+ str(size_w) + "," + str(size_h) + "\" backgroundColor=\"#000000\" /> \
-				<eLabel position=\"0,0\" zPosition=\"0\" size=\""+ str(size_w) + "," + str(size_h) + "\" backgroundColor=\"#000000\" /> \
-				<eLabel position=\"75,200\" zPosition=\"1\" size=\"1140,2\" backgroundColor=\"#FF9900\" /> \
-				<widget name=\"trailerimg\" position=\"128,238\" zPosition=\"2\" size=\"270,350\" alphatest=\"on\" /> \
-				<widget source=\"trailertitle\" transparent=\"1\" render=\"Label\" zPosition=\"2\" valign=\"center\" halign=\"left\" position=\"128,127\" size=\"1000,60\" font=\"Regular;30\" backgroundColor=\"#080B0A\" foregroundColor=\"#F7F7F7\" /> \
-				<widget source=\"trailertext\" transparent=\"1\" render=\"Label\" zPosition=\"2\" valign=\"top\" halign=\"left\" position=\"430,225\" size=\"500,400\" font=\"Regular;20\" backgroundColor=\"#080B0A\" foregroundColor=\"#F7F7F7\" /> \
-				<widget name=\"key_red\" position=\"350,630\" zPosition=\"3\" size=\"140,40\" font=\"Regular;18\" halign=\"center\" valign=\"center\" backgroundColor=\"#1f771f\" transparent=\"1\" /> \
-				<ePixmap pixmap=\"/usr/share/enigma2/skin_default/buttons/red.png\" zPosition=\"2\" position=\"350,630\" size=\"140,40\" alphatest=\"on\" /> \
-				<widget name=\"key_green\" position=\"500,630\" zPosition=\"3\" size=\"140,40\" font=\"Regular;18\" halign=\"center\" valign=\"center\" backgroundColor=\"#1f771f\" transparent=\"1\" /> \
-				<ePixmap pixmap=\"/usr/share/enigma2/skin_default/buttons/green.png\" zPosition=\"2\" position=\"500,630\" size=\"140,40\" alphatest=\"on\" /> \
-				<widget name=\"key_yellow\" position=\"650,630\" zPosition=\"3\" size=\"140,40\" font=\"Regular;18\" halign=\"center\" valign=\"center\" backgroundColor=\"#1f771f\" transparent=\"1\" /> \
-				<ePixmap pixmap=\"/usr/share/enigma2/skin_default/buttons/yellow.png\" zPosition=\"2\" position=\"650,630\" size=\"140,40\" alphatest=\"on\" /> \
-				<widget name=\"key_blue\" position=\"800,630\" zPosition=\"3\" size=\"140,40\" font=\"Regular;18\" halign=\"center\" valign=\"center\" backgroundColor=\"#1f771f\" transparent=\"1\" /> \
-				<ePixmap pixmap=\"/usr/share/enigma2/skin_default/buttons/blue.png\" zPosition=\"2\" position=\"800,630\" size=\"140,40\" alphatest=\"on\" /> \
-				</screen>"
-		else:
-			self.skin = "<screen position=\"0,0\" size=\"" + str(size_w) + "," + str(size_h) + "\" flags=\"wfNoBorder\" title=\"Mediathek\" > \
-				<eLabel position=\"0,0\" zPosition=\"0\" size=\""+ str(size_w) + "," + str(size_h) + "\" backgroundColor=\"#000000\" /> \
-				<eLabel position=\"0,0\" zPosition=\"0\" size=\""+ str(size_w) + "," + str(size_h) + "\" backgroundColor=\"#000000\" /> \
-				<eLabel position=\"25,110\" zPosition=\"1\" size=\"670,2\" backgroundColor=\"#FF9900\" /> \
-				<widget name=\"trailerimg\" position=\"40,120\" zPosition=\"2\" size=\"270,350\" alphatest=\"on\" /> \
-				<widget source=\"trailertitle\" transparent=\"1\" render=\"Label\" zPosition=\"2\" valign=\"center\" halign=\"left\" position=\"50,48\" size=\"600,60\" font=\"Regular;28\" backgroundColor=\"#080B0A\" foregroundColor=\"#F7F7F7\" /> \
-				<widget source=\"trailertext\" transparent=\"1\" render=\"Label\" zPosition=\"2\" valign=\"top\" halign=\"left\" position=\"320,200\" size=\"375,400\" font=\"Regular;20\" backgroundColor=\"#080B0A\" foregroundColor=\"#F7F7F7\" /> \
-				<widget name=\"key_red\" position=\"80,520\" zPosition=\"3\" size=\"140,40\" font=\"Regular;18\" halign=\"center\" valign=\"center\" backgroundColor=\"#1f771f\" transparent=\"1\" /> \
-				<ePixmap pixmap=\"/usr/share/enigma2/skin_default/buttons/red.png\" zPosition=\"2\" position=\"80,520\" size=\"140,40\" alphatest=\"on\" /> \
-				<widget name=\"key_green\" position=\"220,520\" zPosition=\"3\" size=\"140,40\" font=\"Regular;18\" halign=\"center\" valign=\"center\" backgroundColor=\"#1f771f\" transparent=\"1\" /> \
-				<ePixmap pixmap=\"/usr/share/enigma2/skin_default/buttons/green.png\" zPosition=\"2\" position=\"220,520\" size=\"140,40\" alphatest=\"on\" /> \
-				<widget name=\"key_yellow\" position=\"360,520\" zPosition=\"3\" size=\"140,40\" font=\"Regular;18\" halign=\"center\" valign=\"center\" backgroundColor=\"#1f771f\" transparent=\"1\" /> \
-				<ePixmap pixmap=\"/usr/share/enigma2/skin_default/buttons/yellow.png\" zPosition=\"2\" position=\"360,520\" size=\"140,40\" alphatest=\"on\" /> \
-				<widget name=\"key_blue\" position=\"500,520\" zPosition=\"3\" size=\"140,40\" font=\"Regular;18\" halign=\"center\" valign=\"center\" backgroundColor=\"#1f771f\" transparent=\"1\" /> \
-				<ePixmap pixmap=\"/usr/share/enigma2/skin_default/buttons/blue.png\" zPosition=\"2\" position=\"500,520\" size=\"140,40\" alphatest=\"on\" /> \
-				</screen>"
-
-		self["trailertitle"] = StaticText("")
-		self["trailertext"] = StaticText("")
-		self["trailerimg"] = Pixmap()
-
-		self["key_red"] = Button(_("Save on HDD"))
-		self["key_green"] = Button(_("Direct Play"))
-		self["key_yellow"] = Button(_("Cached Play"))
-		self["key_blue"] = Button(_("Bookmark"))
-
-		self.url = movieurl
-		self.action = None
-		self.movieinfo = None
-
-		self.useragent = "QuickTime/7.6.2 (qtver=7.6.2;os=Windows NT 5.1Service Pack 3)"
-		config.mediaplayer.useAlternateUserAgent.value = True
-		config.mediaplayer.alternateUserAgent.value = self.useragent
-		config.mediaplayer.useAlternateUserAgent.save()
-		config.mediaplayer.alternateUserAgent.save()
-		config.mediaplayer.save()
-
-		self.moviefolder = config.plugins.multimediathek.storagepath.value+"/mediathek/movies"
-		self.imagefolder = config.plugins.multimediathek.storagepath.value+"/mediathek/images"
-
-		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
-		{
-			"cancel": self.Exit,
-			"red": self.keyRed,
-			"green": self.keyGreen,
-			"yellow": self.keyYellow,
-			"blue": self.keyBlue
-		}, -1)
-
-		self.onFirstExecBegin.append(self.GetMovieInfo)
-
-	def keyRed(self):
-		self.action = "savemovie"
-		self.GetMovieList()
-
-	def keyGreen(self):
-		self.action = "directplayback"
-		self.GetMovieList()
-
-	def keyYellow(self):
-		self.action = "cachedplayback"
-		self.GetMovieList()
-
-	def keyBlue(self):
-		if self.movieinfo is not None:
-			os_system("echo 'movie:::%s:::%s:::%s\n' >> /etc/enigma2/multimediathek.bookmarks" % (self.movieinfo[0], self.url, self.movieinfo[3]))
-			self.session.open(MessageBox, _("Bookmark added!"), MessageBox.TYPE_INFO, timeout=5)
-
-	def GetMovieInfo(self):
-		try:
-			getPage(self.url).addCallback(self.GotMovieInfo).addErrback(self.error)
-		except Exception, error:
-			self.session.open(MessageBox,("GetMovieInfo() ERROR:\n%s") % (error), MessageBox.TYPE_ERROR)
-
-	def GotMovieInfo(self, html):
-		self.movieinfo = html.splitlines()
-
-		self["trailertitle"].setText(self.movieinfo[0])
-		self["trailertext"].setText(self.movieinfo[2])
-
-		downloadPage(self.movieinfo[3], self.imagefolder+"/poster.jpg").addCallback(self.downloadPosterCallback).addErrback(self.error)
-
- 	def downloadPosterCallback(self, txt=""):
-		sc = AVSwitch().getFramebufferScale()
-		self.picload = ePicLoad()
-		self.picload.PictureData.get().append(self.showPosterPixmap)
-		self.picload.setPara((270, 350, sc[0], sc[1], config.plugins.multimediathek.imagecache.value, int(config.plugins.multimediathek.imagescaling.value), "#00000000"))
-		self.picload.startDecode(self.imagefolder+"/poster.jpg")
-
-	def showPosterPixmap(self, picInfo=None):
-		ptr = self.picload.getData()
-		if ptr != None:
-			self["trailerimg"].instance.setPixmap(ptr.__deref__())
-			self["trailerimg"].show()
-
-	def GetMovieList(self):
-		try:
-			if '-->' in self.movieinfo[1]:
-				# Request to download external page
-				tmpurls = self.movieinfo[1].split("-->")
-				getpageurl = tmpurls[1]
-				self.postpageurl = tmpurls[0]
-				getPage(getpageurl).addCallback(self.ForwardExternalMovieList).addErrback(self.error)
-			else:
-				getPage(self.movieinfo[1]).addCallback(self.GotMovieList).addErrback(self.error)
-		except Exception, error:
-			print "[MultiMediathek] Could not download Movie-List\n%s" % (error)
-
-	def ForwardExternalMovieList(self, html):
-		# We send the received page directly to my webserver and parse it there ...
-		getPage(url=self.postpageurl, method='POST', headers={'Content-Type':'application/x-www-form-urlencoded'}, postdata=urlencode({'pagedata' : html})).addCallback(self.GotMovieList).addErrback(self.error)
-
-	def GotMovieList(self, html):
-		content = html.split("\n")
-		entrylist = []
-		filecount = 0
-
-		for line in content:
-			if '<-->' in line:
-				tmpline = line.split("<-->")
-				title = tmpline[0]
-				url = tmpline[1]
-				filename = tmpline[2]
-
-				if url and url != "":
-					filecount += 1
-					entrylist.append((title,url,filename,filecount))
-
-		if filecount == 0:
-			self.session.open(MessageBox, _("Sorry, no supported videos found here."), MessageBox.TYPE_ERROR, timeout=10)
-		elif filecount == 1:
-			tmpanswer = []
-			tmpanswer.append((title))
-			tmpanswer.append((url))
-			tmpanswer.append((filename))
-			tmpanswer.append((filecount))
-			self.movieSelectCallback(tmpanswer)
-		else:
-			self.session.openWithCallback(self.movieSelectCallback, ChoiceBox, title=_("Select a Movie:"), list=entrylist)
-
-	def movieSelectCallback(self, movieinfo):
-		self.selmovieinfo = movieinfo
-		if movieinfo is not None:
-			if self.action == "cachedplayback":
-				self.session.open(PlayMovie, movieinfo[0], self.movieinfo[0], movieinfo[1], movieinfo[2], self.useragent)
-			elif self.action == "directplayback":
-				if movieinfo[1][0:4].lower() == "rtmp":
-					self.session.openWithCallback(self.switchToCPBCallback, MessageBox, _("%s:// Streams can not get played directly (yet)!\n\nDo you want to use cached-playback?") % movieinfo[1][0:4], MessageBox.TYPE_YESNO)
-					return
-
-				sref = eServiceReference(0x1001, 0, movieinfo[1])
-				sref.setName(self.movieinfo[0])
-				self.session.openWithCallback(self.MoviePlayerCallback, MediathekMoviePlayer, sref, movieinfo)
-			elif self.action == "vlcplayback" and VLCSUPPORT:
-				try:
-					if vlcServerConfig.getDefaultServer() is None:
-						self.session.open(MessageBox, _("No Default Server configured in VLC Settings"), MessageBox.TYPE_ERROR)
-					else:
-						vlcServerConfig.getDefaultServer().play(self.session, media=movieinfo[1], name=self.movieinfo[0], currentList=None, player=boundFunction(VlcPlayer))
-				except Exception, error:
-					self.session.open(MessageBox, _("VLC Plugin Error") % error, MessageBox.TYPE_ERROR)
-
-			elif self.action == "savemovie":
-				self.saveMovie(movieinfo[0], movieinfo[1], movieinfo[2], movieinfo[3])
-
-	def switchToCPBCallback(self, answer):
-		if answer is True:
-			self.action = "cachedplayback"
-			self.movieSelectCallback(self.selmovieinfo)
-
-	def MoviePlayerCallback(self, response=None):
-		if response is not None:
-			tmpinfo = []
-			tmpinfo.append((response[0]))
-			tmpinfo.append((response[1]))
-			tmpinfo.append((response[2]))
-			tmpinfo.append((response[3]))
-			self.action = "vlcplayback"
-			self.movieSelectCallback(tmpinfo)
-
-	def saveMovie(self, title, url, filename, fileid):
-		if '(VLC)' in title and VLCSUPPORT:
-			try:
-				if vlcServerConfig.getDefaultServer() is None:
-					self.session.open(MessageBox, _("No Default Server configured in VLC Settings"), MessageBox.TYPE_ERROR)
-				else:
-					url = vlcServerConfig.getDefaultServer().playFile(url, 0x44, 0x45)
-			except Exception, error:
-				self.session.open(MessageBox,("VLC Plugin Error: %s") % error, MessageBox.TYPE_ERROR)
-
-		if self.movieinfo[0]:
-			if fileid > 1:
-				addfilenumber = "_"+str(fileid)
-			else:
-				addfilenumber = ""
-			filename = ASCIItranslit.legacyEncode(self.movieinfo[0]+addfilenumber+"."+filename.split('.')[-1]).lower()
-
-		if url[0:4] == "http" or url[0:3] == "ftp":
-			JobManager.AddJob(downloadJob(self, "wget --header='User-Agent: %s' -c '%s' -O '%s/%s'" % (self.useragent, url, self.moviefolder, filename), self.moviefolder+"/"+filename, self.movieinfo[0]))
-			self.LastJobView()
-		elif url[0:4] == "rtmp":
-			JobManager.AddJob(downloadJob(self, "rtmpdump -r '%s' -o '%s/%s' -e" % (url, self.moviefolder, filename), self.moviefolder+"/"+filename, self.movieinfo[0]))
-			self.LastJobView()
-		else:
-			self.session.open(MessageBox, _("Sorry, this Video can not get saved on HDD.\nOnly HTTP, FTP and RTMP streams can get saved on HDD!"), MessageBox.TYPE_ERROR)
-
-	def LastJobView(self):
-		currentjob = None
-		for job in JobManager.getPendingJobs():
-			currentjob = job
-
-		if currentjob is not None:
-			self.session.open(JobView, currentjob)
-
-	def error(self, error):
-		self.session.open(MessageBox, _("Unexpected Error:\n%s") % (error), MessageBox.TYPE_ERROR)
-
-	def Exit(self):
-		self.close()
-
-#------------------------------------------------------------------------------------------
-
-
-class PlayMovie(Screen):
-	skin = """
-		<screen position="center,center" size="400,240" title="Caching Video ..." >
-			<widget source="label_filename" transparent="1" render="Label" zPosition="2" position="10,10" size="380,20" font="Regular;19" />
-			<widget source="label_destination" transparent="1" render="Label" zPosition="2" position="10,35" size="380,20" font="Regular;19" />
-			<widget source="label_speed" transparent="1" render="Label" zPosition="2" position="10,60" size="380,20" font="Regular;19" />
-			<widget source="label_timeleft" transparent="1" render="Label" zPosition="2" position="10,85" size="380,20" font="Regular;19" />
-			<widget source="label_progress" transparent="1" render="Label" zPosition="2" position="10,110" size="380,20" font="Regular;19" />
-			<widget name="activityslider" position="10,150" size="380,30" zPosition="3" transparent="0" />
-			<widget name="key_green" position="50,200" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
-			<widget name="key_red" position="200,200" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
-			<ePixmap pixmap="/usr/share/enigma2/skin_default/buttons/green.png" position="50,200" size="140,40" alphatest="on" />
-			<ePixmap pixmap="/usr/share/enigma2/skin_default/buttons/red.png" position="200,200" size="140,40" alphatest="on" />
-		</screen>"""
-
-	def __init__(self, session, title, movietitle, url, filename, useragent):
-		self.skin = PlayMovie.skin
-		Screen.__init__(self, session)
-
-		self.url = url
-		self.title = title
-		self.filename = filename
-		self.movietitle = movietitle
-		self.destination = config.plugins.multimediathek.storagepath.value+"/mediathek/tmp/"
-		self.useragent = useragent
-
-		self.streamactive = False
-
-		self.container=eConsoleAppContainer()
-		self.container.appClosed.append(self.copyfinished)
-		self.container.stdoutAvail.append(self.progressUpdate)
-		self.container.stderrAvail.append(self.progressUpdate)
-		self.container.setCWD(self.destination)
-
-		self.oldService = self.session.nav.getCurrentlyPlayingServiceReference()
-
-		self.BgFileEraser = eBackgroundFileEraser.getInstance()
-
-		try:
-			req = Request(self.url)
-			req.add_header('User-agent',self.useragent)
-			usock = urlopen(req)
-			filesize =  usock.info().get('Content-Length')
-		except Exception, e:
-			filesize = 0
-
-		if filesize is None:
-			filesize = 0
-
-		self.filesize = float(filesize) # in bytes
-
-		self.dummyfilesize = False
-		self.lastcmddata = None
-		self.lastlocalsize = 0
-
-		self["key_green"] = Button(_("Play now"))
-		self["key_red"] = Button(_("Cancel"))
-
-		self["label_filename"] = StaticText("File: %s" % (self.filename))
-		self["label_destination"] = StaticText("Destination: %s" % (config.plugins.multimediathek.storagepath.value))
-		self["label_progress"] = StaticText("Progress: N/A")
-		self["label_speed"] = StaticText("Speed: N/A")
-		self["label_timeleft"] = StaticText("Time left: N/A")
-
-		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
-		{
-			"cancel": self.exit,
-			"ok": self.okbuttonClick,
-			"red": self.exit,
-			"green": self.playfile
-		}, -1)
-
-		self.StatusTimer = eTimer()
-		self.StatusTimer.callback.append(self.UpdateStatus)
-
-		self.activityslider = Slider(0, 100)
-		self["activityslider"] = self.activityslider
-
-		self.onFirstExecBegin.append(self.firstExecBegin)
-
-	def firstExecBegin(self):
-		self.progressperc = 0
-		self.copyfile()
-
-	def okbuttonClick(self):
-		self.StatusTimer.start(5000, True)
-		self.UpdateStatus()
-
-	def UpdateStatus(self):
-		if fileExists(self.destination + self.filename, 'r'):
-			self.localsize = os_path.getsize(self.destination + self.filename)
-		else:
-			self.localsize = 0
-
-		if self.filesize > 0 and not self.dummyfilesize:
-			self.progressperc = round((self.localsize / self.filesize) * 100, 2)
-
-		if int(self.progressperc) > 0:
-			self["activityslider"].setValue(int(self.progressperc))
-
-		if self.lastlocalsize != 0:
-			transferspeed = round(((self.localsize - self.lastlocalsize) / 1024.0) / 5, 0)
-			kbytesleft = round((self.filesize - self.localsize) / 1024.0,0)
-			if transferspeed > 0:
-				timeleft = round((kbytesleft / transferspeed) / 60,2)
-			else:
-				timeleft = 0
-		else:
-			transferspeed = 0
-			kbytesleft = 0
-			timeleft = 0
-
-		self.lastlocalsize = self.localsize
-
-		self["label_speed"].setText("Speed: " + str(transferspeed) + " KBit/s")
-		self["label_progress"].setText("Progress: " + str(round(((self.localsize / 1024.0) / 1024.0), 2)) + "MB of " + str(round(((self.filesize / 1024.0) / 1024.0), 2)) + "MB (" + str(self.progressperc) + "%)")
-		self["label_timeleft"].setText("Time left: " + str(timeleft) + " Minutes")
-		self.StatusTimer.start(5000, True)
-
-	def copyfile(self):
-		if '(VLC)' in self.title and VLCSUPPORT:
-			try:
-				if vlcServerConfig.getDefaultServer() is None:
-					self.session.openWithCallback(self.exit, MessageBox, _("No Default Server configured in VLC Settings"), MessageBox.TYPE_ERROR)
-				else:
-					self.filesize = 0
-					self.url = vlcServerConfig.getDefaultServer().playFile(self.url, 0x44, 0x45)
-			except Exception, error:
-				self.session.openWithCallback(self.exit, MessageBox, _("VLC Plugin Error: %s") % error, MessageBox.TYPE_ERROR)
-
-		if self.url[0:4] == "http" or self.url[0:3] == "ftp":
-			cmd = "wget --header='User-Agent: %s' -q '%s' -O '%s/%s' &" % (self.useragent, self.url, self.destination, self.filename)
-		elif self.url[0:4] == "rtmp":
-			cmd = "rtmpdump -r '%s' -o '%s/%s'" % (self.url, self.destination, self.filename)
-		else:
-			self.session.openWithCallback(self.exit, MessageBox, _("This stream can not get saved on HDD\nProtocol %s not supported :(") % self.url[0:5], MessageBox.TYPE_ERROR)
-			return
-
-		if fileExists(self.destination + self.filename, 'r'):
-			self.localsize = os_path.getsize(self.destination + self.filename)
-			if self.localsize > 0 and self.localsize >= self.filesize:
-				cmd = "echo File already downloaded! Skipping download ..."
-			elif self.localsize == 0:
-				self.BgFileEraser.erase(self.destination + self.filename)
-
-		self.StatusTimer.start(1000, True)
-		self.streamactive = True
-
-		print "[Mediathek] execute command: " + cmd
-		self.container.execute(cmd)
-
-	def progressUpdate(self, data):
-		self.lastcmddata = data
-		if data.endswith('%)'):
-			startpos = data.rfind("sec (")+5
-			if startpos and startpos != -1:
-				self.progressperc = int(float(data[startpos:-4]))
-
-				if self.lastlocalsize > 0 and self.progressperc > 0:
-					self.filesize = int(float(self.lastlocalsize/self.progressperc)*100)
-					self.dummyfilesize = True
-
-	def copyfinished(self,retval):
-		self.streamactive = False
-		self["label_progress"].setText("Progress: 100%")
-		self["activityslider"].setValue(100)
-		self.playfile()
-
-	def playfile(self):
-		if self.lastlocalsize > 0:
-			self.StatusTimer.stop()
-			sref = eServiceReference(0x1001, 0, self.destination + self.filename)
-			sref.setName(self.movietitle)
-			self.session.openWithCallback(self.stopplayback, MediathekMoviePlayer, sref)
-		else:
-			self.session.openWithCallback(self.exit, MessageBox, _("Error downloading file:\n%s") % self.lastcmddata, MessageBox.TYPE_ERROR)
-
-	def stopplayback(self, retval=None):
-		self.UpdateStatus()
-
-	def exit(self, retval=None):
-		self.container.kill()
-		self.BgFileEraser.erase(self.destination + self.filename)
-
-		self.StatusTimer.stop()
-		self.session.nav.playService(self.oldService)
-		self.close()
-
-#------------------------------------------------------------------------------------------
-
-class MultiMediathek_ItemOptions(Screen):
-	def __init__(self, session, movieinfo):
-		Screen.__init__(self, session)
-
-		self.skin = """
-			<screen position="center,center" size="400,200" title="Mediathek - Item Options">
-				<widget source="itemname" transparent="1" render="Label" zPosition="2" position="10,180" size="380,20" font="Regular;16" />
-				<widget source="menu" render="Listbox" zPosition="5" transparent="1" position="10,10" size="380,160" scrollbarMode="showOnDemand" >
-					<convert type="StringList" />
-				</widget>
-			</screen>"""
-
-		list = []
-		self.movieinfo = movieinfo
-		if self.movieinfo[7] == "bookmark":
-			list.append(("Delete this bookmark", "delbookmark", "menu_delbookmark", "50"))
-		elif self.movieinfo[6] == "movie":
-			list.append(("Bookmark this movie", "addbookmark", "menu_addbookmark", "50"))
-		elif self.movieinfo[6] == "cat":
-			list.append(("Bookmark this category", "addbookmark", "menu_addbookmark", "50"))
-		list.append(("View Bookmarks", "viewbookmarks", "menu_viewbookmarks", "50"))
-		list.append(("Mediathek Settings", "settingsmenu", "menu_settings", "50"))
-
-		self["menu"] = List(list)
-		self["itemname"] = StaticText(self.movieinfo[3])
-
-		self["actions"] = ActionMap(["OkCancelActions"],
-		{
-			"cancel": self.Exit,
-			"ok": self.okbuttonClick
-		}, -1)
-
-	def okbuttonClick(self):
-		selection = self["menu"].getCurrent()
-		if selection:
-			if selection[1] == "addbookmark":
-				os_system("echo '%s:::%s:::%s:::%s' >> /etc/enigma2/multimediathek.bookmarks" % (self.movieinfo[6], self.movieinfo[3], self.movieinfo[5], self.movieinfo[4]))
-				#self.session.openWithCallback(self.Exit, MessageBox, _("Bookmark added!"), MessageBox.TYPE_INFO, timeout=5)
-				self.Exit()
-			if selection[1] == "delbookmark":
-				bookmarkfile = "/etc/enigma2/multimediathek.bookmarks"
-				if fileExists(bookmarkfile, 'r'):
-					tmpdata = ""
-					tmpfile = open(bookmarkfile, "r")
-					for line in tmpfile:
-						if self.movieinfo[5] not in line:
-							tmpdata = tmpdata + line + "\n"
-
-					tmpfile.close()
-					os_system("echo '%s' > %s" % (tmpdata,bookmarkfile))
-
-				#self.session.openWithCallback(self.Exit, MessageBox, _("Bookmark deleted!"), MessageBox.TYPE_INFO, timeout=5)
-				self.Exit()
-			elif selection[1] == "viewbookmarks":
-				self.session.open(MultiMediathek, self.movieinfo[5], "Bookmarks", "Bookmarks from your favorite Movies")
-			elif selection[1] == "settingsmenu":
-				self.session.openWithCallback(self.Exit, MultiMediathek_Settings)
-			else:
-				self.Exit()
-		else:
-			self.Exit()
-
-	def Exit(self, retval=None):
-		self.close()
-
-#------------------------------------------------------------------------------------------
-
-class MultiMediathek_Settings(Screen, ConfigListScreen):
-	skin = """
-		<screen name="MultiMediathekSettings" position="center,center" size="560,330" title="Mediathek - Settings">
-			<widget name="config" position="10,10" size="540,250" scrollbarMode="showOnDemand" />
-			<ePixmap name="red"    position="0,280"   zPosition="4" size="140,40" pixmap="/usr/share/enigma2/skin_default/buttons/red.png" transparent="1" alphatest="on" />
-			<ePixmap name="green"  position="140,280" zPosition="4" size="140,40" pixmap="/usr/share/enigma2/skin_default/buttons/green.png" transparent="1" alphatest="on" />
-			<ePixmap name="yellow" position="280,280" zPosition="4" size="140,40" pixmap="/usr/share/enigma2/skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
-			<ePixmap name="blue"   position="420,280" zPosition="4" size="140,40" pixmap="/usr/share/enigma2/skin_default/buttons/blue.png" transparent="1" alphatest="on" />
-			<widget name="key_red" position="0,280" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
-			<widget name="key_green" position="140,280" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
-			<widget name="key_yellow" position="280,280" zPosition="5" size="140,40" valign="center" halign="center"  font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
-			<widget name="key_blue" position="420,280" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
-		</screen>"""
-
-	def __init__(self, session):
-		Screen.__init__(self, session)
-
-		self["key_red"] = Button(_("Cancel"))
-		self["key_green"] = Button(_("OK"))
-		self["key_yellow"] = Button("")
-		self["key_blue"] = Button("")
-
-		self["actions"] = ActionMap(["SetupActions", "ColorActions"],
-		{
-			"ok": self.keySave,
-			"green": self.keySave,
-			"red": self.keyCancel,
-			"cancel": self.keyCancel
-		}, -2)
-
-		self.setTitle("Mediathek v%s - Settings" % config.plugins.multimediathek.version.value)
-
-		self.oldadultcontentvalue = config.plugins.multimediathek.showadultcontent.value
-		self.oldstoragepathvalue = config.plugins.multimediathek.storagepath.value
-
-		self.cfglist = []
-		self.cfglist.append(getConfigListEntry(_("Thumbnail Caching:"), config.plugins.multimediathek.imagecache))
-		self.cfglist.append(getConfigListEntry(_("Thumbnail Scaling Mode:"), config.plugins.multimediathek.imagescaling))
-		self.cfglist.append(getConfigListEntry(_("Show Adult Content:"), config.plugins.multimediathek.showadultcontent))
-		#self.cfglist.append(getConfigListEntry(_("Show Secret Content:"), config.plugins.multimediathek.showsecretcontent))
-		self.cfglist.append(getConfigListEntry(_("Cache Folder:"), config.plugins.multimediathek.storagepath))
-		self.cfglist.append(getConfigListEntry(_("Check for updates:"), config.plugins.multimediathek.checkforupdate))
-		ConfigListScreen.__init__(self, self.cfglist, session)
-
-	def keySave(self):
-		config.plugins.multimediathek.save()
-
-		if config.ParentalControl.configured.value and config.plugins.multimediathek.showadultcontent.value and config.plugins.multimediathek.showadultcontent.value != self.oldadultcontentvalue:
-			pinList = self.getPinList()
-			self.session.openWithCallback(self.pinEntered, PinInput, pinList=pinList, triesEntry=config.ParentalControl.retries.setuppin, title = _("Please enter the correct pin code"), windowTitle = _("Enter pin code"))
-
-		if not os_path.isdir(config.plugins.multimediathek.storagepath.value):
-			self.session.open(MessageBox, "The directory %s does not exist!" % config.plugins.multimediathek.storagepath.value, MessageBox.TYPE_ERROR)
-			return
-
-		if config.plugins.multimediathek.storagepath.value != self.oldstoragepathvalue:
-			os_system("rm -rf "+self.oldstoragepathvalue+"/mediathek")
-			os_system("mkdir -p "+config.plugins.multimediathek.storagepath.value+"/mediathek")
-			os_system("mkdir -p "+config.plugins.multimediathek.storagepath.value+"/mediathek/images")
-			os_system("mkdir -p "+config.plugins.multimediathek.storagepath.value+"/mediathek/movies")
-			os_system("mkdir -p "+config.plugins.multimediathek.storagepath.value+"/mediathek/tmp")
-
-		configfile.save()
-		self.close()
-
-	def keyCancel(self):
-		for item in self.cfglist:
-			item[1].cancel()
-		self.close()
-
-	def getPinList(self):
-		pinList = []
-		pinList.append(config.ParentalControl.setuppin.value)
-		for x in config.ParentalControl.servicepin:
-			pinList.append(x.value)
-		return pinList
-
-	def pinEntered(self, result):
-		if result is None:
-			config.plugins.multimediathek.showadultcontent.value = False
-			config.plugins.multimediathek.save()
-		elif not result:
-			config.plugins.multimediathek.showadultcontent.value = False
-			config.plugins.multimediathek.save()
-
-#------------------------------------------------------------------------------------------
-
-def main(session, **kwargs):
-	session.open(MultiMediathek)
-
-def Plugins(**kwargs):
-	return [
-		PluginDescriptor(name = "Multi-Mediathek", description = "MultiMediathek for your Dreambox", where = PluginDescriptor.WHERE_PLUGINMENU, fnc = main),
-		PluginDescriptor(name = "Multi-Mediathek", description = "MultiMediathek for your Dreambox", where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main)]
