Index: ipk/source/infos_imdb_1_0/usr/lib/enigma2/python/Plugins/Extensions/IMDb/plugin.py
===================================================================
--- ipk/source/infos_imdb_1_0/usr/lib/enigma2/python/Plugins/Extensions/IMDb/plugin.py	(revision 14689)
+++ ipk/source/infos_imdb_1_0/usr/lib/enigma2/python/Plugins/Extensions/IMDb/plugin.py	(revision 14689)
@@ -0,0 +1,662 @@
+# -*- coding: UTF-8 -*-
+from Plugins.Plugin import PluginDescriptor
+from twisted.web.client import downloadPage
+from enigma import ePicLoad, eServiceReference, getDesktop
+from Screens.Screen import Screen
+from Screens.EpgSelection import EPGSelection
+from Screens.ChannelSelection import SimpleChannelSelection
+from Components.ActionMap import ActionMap
+from Components.Pixmap import Pixmap
+from Components.Label import Label
+from Components.ScrollLabel import ScrollLabel
+from Components.Button import Button
+from Components.AVSwitch import AVSwitch
+from Components.MenuList import MenuList
+from Components.Language import language
+from Components.ProgressBar import ProgressBar
+from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
+from os import environ as os_environ, system as os_system
+from Screens.MessageBox import MessageBox
+import re
+import htmlentitydefs
+import urllib
+import gettext
+
+def localeInit():
+	lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"
+	os_environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!
+	gettext.bindtextdomain("IMDb", resolveFilename(SCOPE_PLUGINS, "Extensions/IMDb/locale"))
+
+def _(txt):
+	t = gettext.dgettext("IMDb", txt)
+	if t == txt:
+		print "[IMDb] fallback to default translation for", txt 
+		t = gettext.gettext(txt)
+	return t
+
+localeInit()
+language.addCallback(localeInit)
+
+class IMDBChannelSelection(SimpleChannelSelection):
+	def __init__(self, session):
+		SimpleChannelSelection.__init__(self, session, _("Channel Selection"))
+		self.skinName = "SimpleChannelSelection"
+
+		self["ChannelSelectEPGActions"] = ActionMap(["ChannelSelectEPGActions"],
+			{
+				"showEPGList": self.channelSelected
+			}
+		)
+
+	def channelSelected(self):
+		ref = self.getCurrentSelection()
+		if (ref.flags & 7) == 7:
+			self.enterPath(ref)
+		elif not (ref.flags & eServiceReference.isMarker):
+			self.session.openWithCallback(
+				self.epgClosed,
+				IMDBEPGSelection,
+				ref,
+				openPlugin = False
+			)
+
+	def epgClosed(self, ret = None):
+		if ret:
+			self.close(ret)
+
+class IMDBEPGSelection(EPGSelection):
+	def __init__(self, session, ref, openPlugin = True):
+		EPGSelection.__init__(self, session, ref)
+		self.skinName = "EPGSelection"
+		self["key_green"].setText(_("Lookup"))
+		self.openPlugin = openPlugin
+
+	def infoKeyPressed(self):
+		self.timerAdd()
+
+	def timerAdd(self):
+		cur = self["list"].getCurrent()
+		evt = cur[0]
+		sref = cur[1]
+		if not evt: 
+			return
+
+		if self.openPlugin:
+			self.session.open(
+				IMDB,
+				evt.getEventName()
+			)
+		else:
+			self.close(evt.getEventName())
+
+	def onSelectionChanged(self):
+		pass
+
+class IMDB(Screen):
+	if (getDesktop(0).size().width() == 1280):
+		skin = """
+			<screen name="IMDB" position="125,100" size="1030,520" title="Internet Movie Database Details Plugin" >
+				<eLabel backgroundColor="red" position="94,510" size="140,3" zPosition="0" />
+				<eLabel backgroundColor="green" position="328,510" size="140,3" zPosition="0" />
+				<eLabel backgroundColor="yellow" position="562,510" size="140,3" zPosition="0" />
+				<eLabel backgroundColor="blue" position="796,510" size="140,3" zPosition="0" />
+				<widget name="key_red" position="94,485" zPosition="1" size="140,25" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
+				<widget name="key_green" position="328,485" zPosition="1" size="140,25" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
+				<widget name="key_yellow" position="562,485" zPosition="1" size="140,25" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
+				<widget name="key_blue" position="796,485" zPosition="1" size="140,25" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
+				<widget name="titellabel" position="10,40" size="780,45" valign="center" font="Regular;22"/>
+				<widget name="detailslabel" position="105,90" size="895,140" font="Regular;18" />
+				<widget name="castlabel" position="10,235" size="990,240" font="Regular;18" />
+				<widget name="extralabel" position="10,40" size="990,450" font="Regular;18" />
+				<widget name="ratinglabel" position="790,62" size="210,20" halign="center" font="Regular;18" foregroundColor="#f0b400"/>
+				<widget name="statusbar" position="10,10" size="990,20" font="Regular;16" foregroundColor="#cccccc" />
+				<widget name="poster" position="4,90" size="96,140" alphatest="on" />
+				<widget name="menu" position="10,115" size="990,355" zPosition="3" scrollbarMode="showOnDemand" />
+				<widget name="starsbg" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/IMDb/starsbar_empty.png" position="790,40" zPosition="0" size="210,21" transparent="1" alphatest="on" />
+				<widget name="stars" position="790,40" size="210,21" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/IMDb/starsbar_filled.png" transparent="1" />
+			</screen>"""
+	elif (getDesktop(0).size().width() == 1024):
+		skin = """
+			<screen name="IMDB" position="97,78" size="830,420" title="Internet Movie Database Details Plugin" >
+				<eLabel backgroundColor="red" position="54,410" size="140,3" zPosition="0" />
+				<eLabel backgroundColor="green" position="248,410" size="140,3" zPosition="0" />
+				<eLabel backgroundColor="yellow" position="442,410" size="140,3" zPosition="0" />
+				<eLabel backgroundColor="blue" position="636,410" size="140,3" zPosition="0" />
+				<widget name="key_red" position="54,385" zPosition="1" size="140,25" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
+				<widget name="key_green" position="248,385" zPosition="1" size="140,25" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
+				<widget name="key_yellow" position="442,385" zPosition="1" size="140,25" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
+				<widget name="key_blue" position="636,385" zPosition="1" size="140,25" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
+				<widget name="titellabel" position="10,40" size="580,45" valign="center" font="Regular;22"/>
+				<widget name="detailslabel" position="105,90" size="695,140" font="Regular;18" />
+				<widget name="castlabel" position="10,235" size="790,140" font="Regular;18" />
+				<widget name="extralabel" position="10,40" size="790,350" font="Regular;18" />
+				<widget name="ratinglabel" position="590,62" size="210,20" halign="center" font="Regular;18" foregroundColor="#f0b400"/>
+				<widget name="statusbar" position="10,10" size="790,20" font="Regular;16" foregroundColor="#cccccc" />
+				<widget name="poster" position="4,90" size="96,140" alphatest="on" />
+				<widget name="menu" position="10,115" size="790,255" zPosition="3" scrollbarMode="showOnDemand" />
+				<widget name="starsbg" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/IMDb/starsbar_empty.png" position="590,40" zPosition="0" size="210,21" transparent="1" alphatest="on" />
+				<widget name="stars" position="590,40" size="210,21" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/IMDb/starsbar_filled.png" transparent="1" />
+			</screen>"""
+	else:
+		skin = """
+			<screen name="IMDB" position="45,78" size="630,420" title="Internet Movie Database Details Plugin" >
+				<eLabel backgroundColor="red" position="20,410" size="140,3" zPosition="0" />
+				<eLabel backgroundColor="green" position="170,410" size="140,3" zPosition="0" />
+				<eLabel backgroundColor="yellow" position="320,410" size="140,3" zPosition="0" />
+				<eLabel backgroundColor="blue" position="470,410" size="140,3" zPosition="0" />
+				<widget name="key_red" position="20,385" zPosition="1" size="140,25" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
+				<widget name="key_green" position="170,385" zPosition="1" size="140,25" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
+				<widget name="key_yellow" position="320,385" zPosition="1" size="140,25" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
+				<widget name="key_blue" position="470,385" zPosition="1" size="140,25" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
+				<widget name="titellabel" position="10,40" size="380,45" valign="center" font="Regular;22"/>
+				<widget name="detailslabel" position="105,90" size="495,140" font="Regular;18" />
+				<widget name="castlabel" position="10,235" size="590,140" font="Regular;18" />
+				<widget name="extralabel" position="10,40" size="590,350" font="Regular;18" />
+				<widget name="ratinglabel" position="390,62" size="210,20" halign="center" font="Regular;18" foregroundColor="#f0b400"/>
+				<widget name="statusbar" position="10,10" size="590,20" font="Regular;16" foregroundColor="#cccccc" />
+				<widget name="poster" position="4,90" size="96,140" alphatest="on" />
+				<widget name="menu" position="10,115" size="590,255" zPosition="3" scrollbarMode="showOnDemand" />
+				<widget name="starsbg" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/IMDb/starsbar_empty.png" position="390,40" zPosition="0" size="210,21" transparent="1" alphatest="on" />
+				<widget name="stars" position="390,40" size="210,21" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/IMDb/starsbar_filled.png" transparent="1" />
+			</screen>"""
+
+	def __init__(self, session, eventName, callbackNeeded=False):
+		Screen.__init__(self, session)
+
+		self.eventName = eventName
+		global searchname
+		searchname = eventName		
+		print "[Imdb] searchname", searchname
+		
+		self.callbackNeeded = callbackNeeded
+		self.callbackData = ""
+		self.callbackGenre = ""
+
+		self.dictionary_init()
+
+		self["poster"] = Pixmap()
+		self.picload = ePicLoad()
+		self.picload.PictureData.get().append(self.paintPosterPixmapCB)
+
+		self["stars"] = ProgressBar()
+		self["starsbg"] = Pixmap()
+		self["stars"].hide()
+		self["starsbg"].hide()
+		self.ratingstars = -1
+
+		self["titellabel"] = Label(_("The Internet Movie Database"))
+		self["detailslabel"] = ScrollLabel("")
+		self["castlabel"] = ScrollLabel("")
+		self["extralabel"] = ScrollLabel("")
+		self["statusbar"] = Label("")
+		self["ratinglabel"] = Label("")
+		self.resultlist = []
+		self["menu"] = MenuList(self.resultlist)
+		self["menu"].hide()
+
+		self["key_red"] = Button(_("Exit"))
+		self["key_green"] = Button("")
+		self["key_yellow"] = Button("")
+		self["key_blue"] = Button("")
+
+		# 0 = multiple query selection menu page
+		# 1 = movie info page
+		# 2 = extra infos page
+		self.Page = 0
+
+		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "MovieSelectionActions", "DirectionActions"],
+		{
+			"ok": self.showDetails,
+			"cancel": self.exit,
+			"down": self.pageDown,
+			"up": self.pageUp,
+			"red": self.exit,
+			"green": self.showMenu,
+			"yellow": self.showDetails,
+			"blue": self.showExtras,
+			"contextMenu": self.openChannelSelection,
+			"showEventInfo": self.showDetails
+		}, -1)
+
+		self.getIMDB()
+
+	def exit(self):
+		if self.callbackNeeded:
+			self.close([self.callbackData, self.callbackGenre])
+		else:
+			self.close()
+
+	def dictionary_init(self):
+		syslang = language.getLanguage()
+		if "de" not in syslang:
+			self.IMDBlanguage = ""  # set to empty ("") for english version
+		else:
+			self.IMDBlanguage = "german." # it's a subdomain, so add a '.' at the end
+
+		self.htmltags = re.compile('<.*?>')
+
+		self.generalinfomask = re.compile(
+		'<h1>(?P<title>.*?) <.*?</h1>.*?'
+		'(?:.*?<h5>(?P<g_director>Regisseur|Directors?):</h5>.*?<a href=\".*?\">(?P<director>.*?)</a>)*'
+		'(?:.*?<h5>(?P<g_creator>Sch\S*?pfer|Creators?):</h5>.*?<a href=\".*?\">(?P<creator>.*?)</a>)*'
+		'(?:.*?<h5>(?P<g_seasons>Seasons):</h5>(?:.*?)<a href=\".*?\">(?P<seasons>\d+?)</a>\s+?(?:<a class|\|\s+?<a href="episodes#season-unknown))*'
+		'(?:.*?<h5>(?P<g_writer>Drehbuch|Writer).*?</h5>.*?<a href=\".*?\">(?P<writer>.*?)</a>)*'
+		'(?:.*?<h5>(?P<g_premiere>Premiere|Release Date).*?</h5>\s+<div.*?>\s?(?P<premiere>.*?)\n\s.*?<)*'
+		'(?:.*?<h5>(?P<g_alternativ>Auch bekannt als|Also Known As):</h5><div.*?>\s*(?P<alternativ>.*?)<br>\s{0,8}<a.*?>(?:mehr|more))*'
+		'(?:.*?<h5>(?P<g_country>Land|Country):</h5>\s+<div.*?>(?P<country>.*?)</div>(?:.*?mehr|\s+?</div>))*'
+		, re.DOTALL)
+
+		self.extrainfomask = re.compile(
+		'(?:.*?<h5>(?P<g_tagline>Werbezeile|Tagline?):</h5>\n(?P<tagline>.+?)<)*'
+		'(?:.*?<h5>(?P<g_outline>Kurzbeschreibung|Plot Outline):</h5>(?P<outline>.+?)<)*'
+		'(?:.*?<h5>(?P<g_synopsis>Plot Synopsis):</h5>(?:.*?)(?:<a href=\".*?\">)*?(?P<synopsis>.+?)(?:</a>|</div>))*'
+		'(?:.*?<h5>(?P<g_keywords>Plot Keywords):</h5>(?P<keywords>.+?)(?:mehr|more</a>|</div>))*'
+		'(?:.*?<h5>(?P<g_awards>Filmpreise|Awards):</h5>(?P<awards>.+?)(?:mehr|more</a>|</div>))*'
+		'(?:.*?<h5>(?P<g_runtime>L\S*?nge|Runtime):</h5>(?P<runtime>.+?)</div>)*'
+		'(?:.*?<h5>(?P<g_language>Sprache|Language):</h5>(?P<language>.+?)</div>)*'
+		'(?:.*?<h5>(?P<g_color>Farbe|Color):</h5>(?P<color>.+?)</div>)*'
+		'(?:.*?<h5>(?P<g_aspect>Seitenverh\S*?ltnis|Aspect Ratio):</h5>(?P<aspect>.+?)(?:mehr|more</a>|</div>))*'
+		'(?:.*?<h5>(?P<g_sound>Tonverfahren|Sound Mix):</h5>(?P<sound>.+?)</div>)*'
+		'(?:.*?<h5>(?P<g_cert>Altersfreigabe|Certification):</h5>(?P<cert>.+?)</div>)*'
+		'(?:.*?<h5>(?P<g_locations>Drehorte|Filming Locations):</h5>(?P<locations>.+?)(?:mehr|more</a>|</div>))*'
+		'(?:.*?<h5>(?P<g_company>Firma|Company):</h5>(?P<company>.+?)(?:mehr|more</a>|</div>))*'
+		'(?:.*?<h5>(?P<g_trivia>Dies und das|Trivia):</h5>(?P<trivia>.+?)(?:mehr|more</a>|</div>))*'
+		'(?:.*?<h5>(?P<g_goofs>Pannen|Goofs):</h5>(?P<goofs>.+?)(?:mehr|more</a>|</div>))*'
+		'(?:.*?<h5>(?P<g_quotes>Dialogzitate|Quotes):</h5>(?P<quotes>.+?)(?:mehr|more</a>|</div>))*'
+		'(?:.*?<h5>(?P<g_connections>Bez\S*?ge zu anderen Titeln|Movie Connections):</h5>(?P<connections>.+?)(?:mehr|more</a>|</div>))*'
+		'(?:.*?<h3>(?P<g_comments>Nutzerkommentare|User Comments)</h3>.*?<a href="/user/ur\d{7,7}/comments">(?P<commenter>.+?)\n</div>.*?<p>(?P<comment>.+?)</p>)*'
+		, re.DOTALL)
+
+	def resetLabels(self):
+		self["detailslabel"].setText("")
+		self["ratinglabel"].setText("")
+		self["titellabel"].setText("")
+		self["castlabel"].setText("")
+		self["titellabel"].setText("")
+		self["extralabel"].setText("")
+		self.ratingstars = -1
+
+	def pageUp(self):
+		if self.Page == 0:
+			self["menu"].instance.moveSelection(self["menu"].instance.moveUp)
+		if self.Page == 1:
+			self["castlabel"].pageUp()
+			self["detailslabel"].pageUp()
+		if self.Page == 2:
+			self["extralabel"].pageUp()
+
+	def pageDown(self):
+		if self.Page == 0:
+			self["menu"].instance.moveSelection(self["menu"].instance.moveDown)
+		if self.Page == 1:
+			self["castlabel"].pageDown()
+			self["detailslabel"].pageDown()
+		if self.Page == 2:
+			self["extralabel"].pageDown()
+
+	def showMenu(self):
+		if ( self.Page is 1 or self.Page is 2 ) and self.resultlist:
+			self["menu"].show()
+			self["stars"].hide()
+			self["starsbg"].hide()
+			self["ratinglabel"].hide()
+			self["castlabel"].hide()
+			self["poster"].hide()
+			self["extralabel"].hide()
+			global searchname
+			self["titellabel"].setText(searchname)
+#			self["titellabel"].setText(_("Ambiguous results"))
+			self["detailslabel"].setText(_("Please select the matching entry"))
+			self["detailslabel"].show()
+			self["key_blue"].setText("")
+			self["key_green"].setText(_("Title Menu"))
+			self["key_yellow"].setText(_("Details"))
+			self.Page = 0
+
+	def showDetails(self):
+		self["ratinglabel"].show()
+		self["castlabel"].show()
+		self["detailslabel"].show()
+
+		if self.resultlist and self.Page == 0:
+			link = self["menu"].getCurrent()[1]
+			title = self["menu"].getCurrent()[0]
+			self["statusbar"].setText(_("Re-Query IMDb: %s...") % (title))
+			localfile = "/tmp/imdbquery2.html"
+			fetchurl = "http://" + self.IMDBlanguage + "imdb.com/title/" + link
+			print "[IMDB] downloading query " + fetchurl + " to " + localfile
+			downloadPage(fetchurl,localfile).addCallback(self.IMDBquery2).addErrback(self.fetchFailed)
+			self["menu"].hide()
+			self.resetLabels()
+			self.Page = 1
+
+		if self.Page == 2:
+			self["extralabel"].hide()
+			self["poster"].show()
+			if self.ratingstars > 0:
+				self["starsbg"].show()
+				self["stars"].show()
+				self["stars"].setValue(self.ratingstars)
+
+			self.Page = 1
+
+	def showExtras(self):
+		if self.Page == 1:
+			self["extralabel"].show()
+			self["detailslabel"].hide()
+			self["castlabel"].hide()
+			self["poster"].hide()
+			self["stars"].hide()
+			self["starsbg"].hide()
+			self["ratinglabel"].hide()
+			self.Page = 2
+
+	def openChannelSelection(self):
+		self.session.openWithCallback(
+			self.channelSelectionClosed,
+			IMDBChannelSelection
+		)
+
+	def channelSelectionClosed(self, ret = None):
+		if ret:
+			self.eventName = ret
+			self.Page = 0
+			self.resultlist = []
+			self["menu"].hide()
+			self["ratinglabel"].show()
+			self["castlabel"].show()
+			self["detailslabel"].show()
+			self["poster"].hide()
+			self["stars"].hide()
+			self["starsbg"].hide()
+			self.getIMDB()
+
+	def getIMDB(self):
+#		print "!!!!!!!!!!!!!!!!!!!!!!!wo"
+		self.resetLabels()
+		if self.eventName is "":
+#			print "!!!!!!!!!!!!!!!!!!!!!!!wo1"
+			s = self.session.nav.getCurrentService()
+			info = s.info()
+			event = info.getEvent(0) # 0 = now, 1 = next
+			if event:
+				self.eventName = event.getEventName()
+		if self.eventName is not "":
+#			print "!!!!!!!!!!!!!!!!!!!!!!!wo2"
+			self["statusbar"].setText(_("Query IMDb: %s...") % (self.eventName))
+			event_quoted = urllib.quote(self.eventName.decode('utf8').encode('latin-1','ignore'))
+			localfile = "/tmp/imdbquery.html"
+			fetchurl = "http://" + self.IMDBlanguage + "imdb.com/find?q=" + event_quoted + "&s=tt&site=aka"
+			print "[IMDB] Downloading Query " + fetchurl + " to " + localfile
+			downloadPage(fetchurl,localfile).addCallback(self.IMDBquery).addErrback(self.fetchFailed)
+		else:
+#			print "!!!!!!!!!!!!!!!!!!!!!!!wo3"	
+			global searchname
+			print "[Imdb-getIMDB] error get searchname back", searchname
+			self["statusbar"].setText(searchname)
+#			self["statusbar"].setText(_("Could't get Eventname"))
+
+	def fetchFailed(self,string):
+		print "[IMDB] fetch failed", string
+		self["statusbar"].setText(_("IMDb Download failed"))
+#		self.closed()
+
+	def html2utf8(self,in_html):
+		htmlentitynumbermask = re.compile('(&#(\d{1,5}?);)')
+		htmlentityhexmask = re.compile('(&#x([0-9A-Fa-f]{2,2}?);)')
+		htmlentitynamemask = re.compile('(&([^#]\D{1,5}?);)')
+		entitydict = {}
+		entityhexdict = {}
+		entities = htmlentitynamemask.finditer(in_html)
+
+		for x in entities:
+			entitydict[x.group(1)] = x.group(2)
+		for key, name in entitydict.items():
+			entitydict[key] = htmlentitydefs.name2codepoint[name]
+		entities = htmlentityhexmask.finditer(in_html)
+
+		for x in entities:
+			entityhexdict[x.group(1)] = x.group(2)
+
+		for key, name in entityhexdict.items():
+			entitydict[key] = "%d" % int(key[3:5], 16)
+			print "key:", key, "before:", name, "after:", entitydict[key]
+		
+		entities = htmlentitynumbermask.finditer(in_html)
+		for x in entities:
+			entitydict[x.group(1)] = x.group(2)
+		for key, codepoint in entitydict.items():
+			in_html = in_html.replace(key, (unichr(int(codepoint)).encode('latin-1')))
+		self.inhtml = in_html.decode('latin-1').encode('utf8')
+
+	def IMDBquery(self,string):
+		print "[IMDBquery]"
+		self["statusbar"].setText(_("IMDb Download completed"))
+
+		self.html2utf8(open("/tmp/imdbquery.html", "r").read())
+
+		self.generalinfos = self.generalinfomask.search(self.inhtml)
+#		print "!!!!!!!!!!!!!!!!!!!!!!!wo10"
+
+		if self.generalinfos:
+#			print "!!!!!!!!!!!!!!!!!!!!!!!wo20"
+			self.IMDBparse()
+		else:
+#			print "!!!!!!!!!!!!!!!!!!!!!!!wo30"		
+			if re.search("<title>(?:IMDb.{0,9}Search|IMDb Titelsuche)</title>", self.inhtml):
+#				print "!!!!!!!!!!!!!!!!!!!!!!!wo40"
+				searchresultmask = re.compile("<tr> <td.*?img src.*?>.*?<a href=\".*?/title/(tt\d{7,7})/\".*?>(.*?)</td>", re.DOTALL)
+				searchresults = searchresultmask.finditer(self.inhtml)
+				self.resultlist = [(self.htmltags.sub('',x.group(2)), x.group(1)) for x in searchresults]
+				self["menu"].l.setList(self.resultlist)
+				if len(self.resultlist) > 1:
+#					print "!!!!!!!!!!!!!!!!!!!!!!!wo50"
+#					global searchname
+#					self["detailslabel"].setText(searchname)
+
+					self.Page = 1
+					self.showMenu()
+				else:
+#					print "!!!!!!!!!!!!!!!!!!!!!!!wo60"
+				
+					global searchname
+					print "[Imdb-IMDBquery] error get searchname back", searchname
+					self["detailslabel"].setText(searchname)
+#					self["detailslabel"].setText(_("No IMDb match."))
+#					self["statusbar"].setText(_("No IMDb match."))
+					self["statusbar"].setText(_(searchname))
+#					self.closed()
+#					return
+
+			else:
+				splitpos = self.eventName.find('(')
+				if splitpos > 0 and self.eventName.endswith(')'):
+					self.eventName = self.eventName[splitpos+1:-1]
+					self["statusbar"].setText(_("Re-Query IMDb: %s...") % (self.eventName))
+					event_quoted = urllib.quote(self.eventName.decode('utf8').encode('latin-1','ignore'))
+					localfile = "/tmp/imdbquery.html"
+					fetchurl = "http://" + self.IMDBlanguage + "imdb.com/find?q=" + event_quoted + "&s=tt&site=aka"
+					print "[IMDB] Downloading Query " + fetchurl + " to " + localfile
+					downloadPage(fetchurl,localfile).addCallback(self.IMDBquery).addErrback(self.fetchFailed)
+				else:
+					self["detailslabel"].setText(_("IMDb query failed!"))
+
+	def IMDBquery2(self,string):
+		self["statusbar"].setText(_("IMDb Re-Download completed"))
+		self.html2utf8(open("/tmp/imdbquery2.html", "r").read())
+		self.generalinfos = self.generalinfomask.search(self.inhtml)
+		self.IMDBparse()
+
+	def IMDBparse(self):
+		print "[IMDBparse]"
+		self.Page = 1
+		Detailstext = _("No details found.")
+		if self.generalinfos:
+			self["key_yellow"].setText(_("Details"))
+			self["statusbar"].setText(_("IMDb Details parsed"))
+			Titeltext = self.generalinfos.group("title")
+			if len(Titeltext) > 57:
+				Titeltext = Titeltext[0:54] + "..."
+			self["titellabel"].setText(Titeltext)
+
+			Detailstext = ""
+
+			genreblockmask = re.compile('<h5>Genre:</h5>\n<p>\s+?(.*?)\s+?(?:mehr|more|</p|<a class|</div>)', re.DOTALL)
+			genreblock = genreblockmask.findall(self.inhtml)
+			if genreblock:
+				genres = self.htmltags.sub('', genreblock[0])
+				if genres:
+					Detailstext += "Genre: "
+					Detailstext += genres
+					self.callbackGenre = genres
+
+			for category in ("director", "creator", "writer", "premiere", "seasons"):
+				if self.generalinfos.group('g_'+category):
+					Detailstext += "\n" + self.generalinfos.group('g_'+category) + ": " + self.generalinfos.group(category)
+
+			if self.generalinfos.group("country"):
+				Detailstext += "\n" + self.generalinfos.group("g_country") + ": " + self.htmltags.sub('', self.generalinfos.group("country").replace('\n','').replace("<br>",'\n').replace("  ",' '))
+
+			if self.generalinfos.group("alternativ"):
+				Detailstext += "\n" + self.generalinfos.group("g_alternativ") + ": " + self.htmltags.sub('', self.generalinfos.group("alternativ").replace('\n','').replace("<br>",'\n').replace("  ",' '))
+
+			ratingmask = re.compile('<h5>(?P<g_rating>Nutzer-Bewertung|User Rating):</h5>.*?<b>(?P<rating>.*?)/10</b>', re.DOTALL)
+			rating = ratingmask.search(self.inhtml)
+			Ratingtext = _("no user rating yet")
+			if rating:
+				Ratingtext = rating.group("g_rating") + ": " + rating.group("rating") + " / 10"
+				self.ratingstars = int(10*round(float(rating.group("rating").replace(',','.')),1))
+				outrating = float(rating.group("rating").replace(',','.'))
+				self["stars"].show()
+				self["stars"].setValue(self.ratingstars)
+				self["starsbg"].show()
+			self["ratinglabel"].setText(Ratingtext)
+			castmask = re.compile('<td class="nm">.*?>(.*?)</a>.*?<td class="char">(?:<a.*?>)?(.*?)(?:</a>)?</td>', re.DOTALL)
+			castresult = castmask.finditer(self.inhtml)
+			if castresult:
+				Casttext = ""
+				count = 0
+				firstcast = ""
+				for x in castresult:
+					count += 1
+					if count == 1:
+						firstcast = self.htmltags.sub('', x.group(1))
+					else:						
+						if count == 2:
+							Casttext += "\n" + _("Second Cast: ") + "\n---------------\n" + self.htmltags.sub('', x.group(1))
+						else:							
+							Casttext += "\n" + self.htmltags.sub('', x.group(1))
+
+					if x.group(2):
+						if count == 1:
+							firstcast += _(" as ") + self.htmltags.sub('', x.group(2).replace('/ ...',''))
+						else:
+							Casttext += _(" as ") + self.htmltags.sub('', x.group(2).replace('/ ...',''))
+				if Casttext is not "":
+					Casttext = "\n" + _("Cast: ") + firstcast + "\n" + Casttext
+				else:
+					Casttext = _("No cast list found in the database.")
+				self["castlabel"].setText(Casttext)
+			postermask = re.compile('<div class="photo">.*?<img .*? src=\"(http.*?)\" .*?>', re.DOTALL)
+			posterurl = postermask.search(self.inhtml)
+			if posterurl and posterurl.group(1).find("jpg") > 0:
+				posterurl = posterurl.group(1)
+				self["statusbar"].setText(_("Downloading Movie Poster: %s...") % (posterurl))
+				localfile = "/tmp/poster.jpg"
+				print "[IMDB] downloading poster " + posterurl + " to " + localfile
+				downloadPage(posterurl,localfile).addCallback(self.IMDBPoster).addErrback(self.fetchFailed)
+			else:
+				self.IMDBPoster("kein Poster")
+			extrainfos = self.extrainfomask.search(self.inhtml)
+
+			if extrainfos:
+				Extratext = "\n" + _("Extra Info: ") + "\n------------\n"
+
+				for category in ("tagline","outline","synopsis","keywords","awards","runtime","language","color","aspect","sound","cert","locations","company","trivia","goofs","quotes","connections"):
+					if extrainfos.group('g_'+category):
+						Extratext += extrainfos.group('g_'+category) + ": " + self.htmltags.sub('',extrainfos.group(category).replace("\n",'').replace("<br>",'\n')) + "\n"
+				if extrainfos.group("g_comments"):
+					stripmask = re.compile('\s{2,}', re.DOTALL)
+					Extratext += extrainfos.group("g_comments") + " [" + stripmask.sub(' ', self.htmltags.sub('',extrainfos.group("commenter"))) + "]: " + self.htmltags.sub('',extrainfos.group("comment").replace("\n",' ')) + "\n"
+
+				self["extralabel"].setText(Extratext)
+				self["extralabel"].hide()
+				self["key_blue"].setText(_("Extra Info"))
+
+		self["detailslabel"].setText(Detailstext)
+		
+		if outrating is not None:
+			Detailstext += "\nRating: " + str(outrating) + " / 10"
+		for x in Casttext:
+			Detailstext += Casttext
+			break
+
+		for x in Extratext:
+			Detailstext += "\n" + Extratext
+			break		
+		
+		self.callbackData = Detailstext
+
+		
+	def IMDBPoster(self,string):
+		self["statusbar"].setText(_("IMDb Details parsed"))
+		if not string:
+			filename = "/tmp/poster.jpg"
+		else:
+			filename = resolveFilename(SCOPE_PLUGINS, "Extensions/IMDb/no_poster.png")
+		sc = AVSwitch().getFramebufferScale()
+		self.picload.setPara((self["poster"].instance.size().width(), self["poster"].instance.size().height(), sc[0], sc[1], False, 1, "#00000000"))
+		self.picload.startDecode(filename)
+
+	def paintPosterPixmapCB(self, picInfo=None):
+		ptr = self.picload.getData()
+		if ptr != None:
+			self["poster"].instance.setPixmap(ptr.__deref__())
+			self["poster"].show()
+
+	def createSummary(self):
+		return IMDbLCDScreen
+
+class IMDbLCDScreen(Screen):
+	skin = """
+	<screen position="0,0" size="132,64" title="IMDB Plugin">
+		<widget name="headline" position="4,0" size="128,22" font="Regular;20"/>
+		<widget source="session.Event_Now" render="Label" position="6,26" size="120,34" font="Regular;14" >
+			<convert type="EventName">Name</convert>
+		</widget>
+	</screen>"""
+
+	def __init__(self, session, parent):
+		Screen.__init__(self, session)
+		self["headline"] = Label(_("IMDb Plugin"))
+
+def eventinfo(session, servicelist, **kwargs):
+	ref = session.nav.getCurrentlyPlayingServiceReference()
+	session.open(IMDBEPGSelection, ref)
+
+def main(session, eventName="", **kwargs):
+	ret = os_system("checknet 4.2.2.1")
+	if ret == 0:
+		session.open(IMDB, eventName)
+	else:
+		session.open(MessageBox, _("Start of application without internet not allowed."), type = MessageBox.TYPE_INFO, timeout = 10)
+
+def Plugins(**kwargs):
+	try:
+		return [PluginDescriptor(name="IMDb Details",
+				description=_("Query details from the Internet Movie Database"),
+				icon="imdb.png",
+				where = PluginDescriptor.WHERE_PLUGINMENU,
+				fnc = main),
+				PluginDescriptor(name="IMDb Details",
+				description=_("Query details from the Internet Movie Database"),
+				where = PluginDescriptor.WHERE_EVENTINFO,
+				fnc = eventinfo)
+				]
+	except AttributeError:
+		wherelist = [PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_PLUGINMENU]
+		return PluginDescriptor(name="IMDb Details",
+				description=_("Query details from the Internet Movie Database"),
+				icon="imdb.png",
+				where = wherelist,
+				fnc=main)	
