remove unnecessary import
[enigma2-plugins.git] / imdb / src / plugin.py
1 # -*- coding: utf8 -*-
2 from Plugins.Plugin import PluginDescriptor
3 from twisted.web.client import downloadPage
4 from enigma import ePicLoad
5 from Screens.Screen import Screen
6 from Components.ActionMap import ActionMap
7 from Components.Pixmap import Pixmap
8 from Components.Label import Label
9 from Components.ScrollLabel import ScrollLabel
10 from Components.Button import Button
11 from Components.AVSwitch import AVSwitch
12 from Components.MenuList import MenuList
13 from Components.Language import language
14 from Components.ProgressBar import ProgressBar
15 from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
16 import re
17 import htmlentitydefs
18 import urllib
19
20 class IMDB(Screen):
21         skin = """
22                 <screen name="IMDB" position="90,95" size="560,420" title="Internet Movie Database Details Plugin" >
23                         <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
24                         <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
25                         <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
26                         <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
27                         <widget name="key_red" position="0,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#9f1313" transparent="1" />
28                         <widget name="key_green" position="140,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
29                         <widget name="key_yellow" position="280,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#a08500" transparent="1" />
30                         <widget name="key_blue" position="420,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#18188b" transparent="1" />
31                         <widget name="titellabel" position="10,40" size="330,45" valign="center" font="Regular;22"/>
32                         <widget name="detailslabel" position="105,90" size="445,140" font="Regular;18" />
33                         <widget name="castlabel" position="10,235" size="540,155" font="Regular;18" />
34                         <widget name="extralabel" position="10,40" size="540,350" font="Regular;18" />
35                         <widget name="ratinglabel" position="340,62" size="210,20" halign="center" font="Regular;18" foregroundColor="#f0b400"/>
36                         <widget name="statusbar" position="10,404" size="540,16" font="Regular;16" foregroundColor="#cccccc" />
37                         <widget name="poster" position="4,90" size="96,140" alphatest="on" />
38                         <widget name="menu" position="10,115" size="540,275" zPosition="3" scrollbarMode="showOnDemand" />
39                         <widget name="starsbg" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/IMDb/starsbar_empty.png" position="340,40" zPosition="0" size="210,21" transparent="1" alphatest="on" />
40                         <widget name="stars" position="340,40" size="210,21" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/IMDb/starsbar_filled.png" transparent="1" />
41                 </screen>"""
42
43         def __init__(self, session, eventName, args = None):
44                 self.skin = IMDB.skin
45                 Screen.__init__(self, session)
46
47                 self.eventName = eventName
48
49                 self.dictionary_init()
50
51                 self["poster"] = Pixmap()
52                 self.picload = ePicLoad()
53                 self.picload.PictureData.get().append(self.paintPosterPixmapCB)
54
55                 self["stars"] = ProgressBar()
56                 self["starsbg"] = Pixmap()
57                 self["stars"].hide()
58                 self["starsbg"].hide()
59                 self.ratingstars = -1
60
61                 self["titellabel"] = Label("The Internet Movie Database")
62                 self["detailslabel"] = ScrollLabel("")
63                 self["castlabel"] = ScrollLabel("")
64                 self["extralabel"] = ScrollLabel("")
65                 self["statusbar"] = Label("")
66                 self["ratinglabel"] = Label("")
67                 self.resultlist = []
68                 self["menu"] = MenuList(self.resultlist)
69                 self["menu"].hide()
70
71                 self["key_red"] = Button(self._("Exit"))
72                 self["key_green"] = Button("")
73                 self["key_yellow"] = Button("")
74                 self["key_blue"] = Button("")
75
76                 # 0 = multiple query selection menu page
77                 # 1 = movie info page
78                 # 2 = extra infos page
79                 self.Page = 0
80
81                 self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "MovieSelectionActions", "DirectionActions"],
82                 {
83                         "ok": self.showDetails,
84                         "cancel": self.close,
85                         "down": self.pageDown,
86                         "up": self.pageUp,
87                         "red": self.close,
88                         "green": self.showMenu,
89                         "yellow": self.showDetails,
90                         "blue": self.showExtras,
91                         "showEventInfo": self.showDetails
92                 }, -1)
93
94                 self.getIMDB()
95
96         def dictionary_init(self):
97                 syslang = language.getLanguage()
98                 if syslang.find("de") is -1:
99                         self.IMDBlanguage = ""  # set to empty ("") for english version
100                 else:
101                         self.IMDBlanguage = "german." # it's a subdomain, so add a '.' at the end
102
103                 self.dict = {}
104                 self.dict["of"]="von"
105                 self.dict[" as "]=" als "
106                 self.dict["Ambiguous results"]="Kein eindeutiger Treffer"
107                 self.dict["Please select the matching entry"]="Bitte passenden Eintrag auswählen"
108                 self.dict["No IMDb match."]="Keine passenden Einträge gefunden."
109                 self.dict["IMDb query failed!"]="IMDb-Query fehlgeschlagen!"
110                 self.dict["No details found."]="Keine Details gefunden."
111                 self.dict["no user rating yet"]="noch keine Nutzerwertung"
112                 self.dict["Cast: "]="Darsteller: "
113                 self.dict["No cast list found in the database."]="Keine Darstellerliste in der Datenbank gefunden."
114                 self.dict["Exit"]="Beenden"
115                 self.dict["Extra Info"]="Zusatzinfos"
116                 self.dict["Title Menu"]="Titelauswahl"
117
118                 self.htmltags = re.compile('<.*?>')
119
120                 self.generalinfomask = re.compile(
121                 '<h1>(?P<title>.*?) <.*?</h1>.*?'
122                 '(?:.*?<h5>(?P<g_director>Regisseur|Directors?):</h5>.*?>(?P<director>.*?)</a>)*'
123                 '(?:.*?<h5>(?P<g_creator>Sch\S*?pfer|Creators?):</h5>.*?>(?P<creator>.*?)</a>)*'
124                 '(?:.*?<h5>(?P<g_seasons>Seasons):</h5>(?:.*?)<a href=\".*?\">(?P<seasons>\d+?)</a>\s+?(?:<a class|\|\s+?<a href="episodes#season-unknown))*'
125                 '(?:.*?<h5>(?P<g_writer>Drehbuch|Writer).*?</h5>.*?>(?P<writer>.*?)</a>)*'
126                 '(?:.*?<h5>(?P<g_premiere>Premiere|Release Date).*?</h5>\s.*?\n?(?P<premiere>.*?)\n\s.*?<)*'
127                 '(?:.*?<h5>(?P<g_alternativ>Alternativ|Also Known As):</h5>(?P<alternativ>.*?)<br>\s{0,8}<a.*?>(?:mehr|more))*'
128                 '(?:.*?<h5>(?P<g_country>Produktionsland|Country):</h5>.*?<a.*?>(?P<country>.*?)</a>(?:.*?mehr|\n</div>))*'
129                 , re.DOTALL)
130
131                 self.extrainfomask = re.compile(
132                 '(?:.*?<h5>(?P<g_tagline>Werbezeile|Tagline?):</h5>\n(?P<tagline>.+?)<)*'
133                 '(?:.*?<h5>(?P<g_outline>Kurzbeschreibung|Plot Outline):</h5>(?P<outline>.+?)<)*'
134                 '(?:.*?<h5>(?P<g_synopsis>Plot Synopsis):</h5>(?:.*?)(?:<a href=\".*?\">)*?(?P<synopsis>.+?)(?:</a>|</div>))*'
135                 '(?:.*?<h5>(?P<g_keywords>Plot Keywords):</h5>(?P<keywords>.+?)(?:mehr|more</a>|</div>))*'
136                 '(?:.*?<h5>(?P<g_awards>Filmpreise|Awards):</h5>(?P<awards>.+?)(?:mehr|more</a>|</div>))*'
137                 '(?:.*?<h5>(?P<g_runtime>L\S*?nge|Runtime):</h5>(?P<runtime>.+?)<)*'
138                 '(?:.*?<h5>(?P<g_language>Sprache|Language):</h5>(?P<language>.+?)</div>)*'
139                 '(?:.*?<h5>(?P<g_color>Farbe|Color):</h5>(?P<color>.+?)</div>)*'
140                 '(?:.*?<h5>(?P<g_aspect>Seitenverh\S*?ltnis|Aspect Ratio):</h5>(?P<aspect>.+?)(?:mehr|more</a>|</div>))*'
141                 '(?:.*?<h5>(?P<g_sound>Tonverfahren|Sound Mix):</h5>(?P<sound>.+?)</div>)*'
142                 '(?:.*?<h5>(?P<g_cert>Altersfreigabe|Certification):</h5>(?P<cert>.+?)</div>)*'
143                 '(?:.*?<h5>(?P<g_locations>Drehorte|Filming Locations):</h5>(?P<locations>.+?)(?:mehr|more</a>|</div>))*'
144                 '(?:.*?<h5>(?P<g_company>Firma|Company):</h5>(?P<company>.+?)(?:mehr|more</a>|</div>))*'
145                 '(?:.*?<h5>(?P<g_trivia>Dies und das|Trivia):</h5>(?P<trivia>.+?)(?:mehr|more</a>|</div>))*'
146                 '(?:.*?<h5>(?P<g_goofs>Pannen|Goofs):</h5>(?P<goofs>.+?)(?:mehr|more</a>|</div>))*'
147                 '(?:.*?<h5>(?P<g_quotes>Dialogzitate|Quotes):</h5>(?P<quotes>.+?)(?:mehr|more</a>|</div>))*'
148                 '(?:.*?<h5>(?P<g_connections>Bez\S*?ge zu anderen Titeln|Movie Connections):</h5>(?P<connections>.+?)(?:mehr|more</a>|</div>))*'
149                 '(?:.*?<h3>(?P<g_comments>Nutzerkommentare|User Comments)</h3>.*?<a href="/user/ur\d{7,7}/comments">(?P<commenter>.+?)\n</div>.*?<p>(?P<comment>.+?)</p>)*'
150                 , re.DOTALL)
151
152         def _(self, in_string):
153                 out_string = in_string
154                 if ((self.IMDBlanguage).find("german")) != -1:
155                         out_string = self.dict.get(in_string, in_string)
156                 return out_string
157
158         def resetLabels(self):
159                 self["detailslabel"].setText("")
160                 self["ratinglabel"].setText("")
161                 self["titellabel"].setText("")
162                 self["castlabel"].setText("")
163                 self["titellabel"].setText("")
164                 self["extralabel"].setText("")
165                 self.ratingstars = -1
166
167         def pageUp(self):
168                 if self.Page == 0:
169                         self["menu"].instance.moveSelection(self["menu"].instance.moveUp)
170                 if self.Page == 1:
171                         self["castlabel"].pageUp()
172                         self["detailslabel"].pageUp()
173                 if self.Page == 2:
174                         self["extralabel"].pageUp()
175
176         def pageDown(self):
177                 if self.Page == 0:
178                         self["menu"].instance.moveSelection(self["menu"].instance.moveDown)
179                 if self.Page == 1:
180                         self["castlabel"].pageDown()
181                         self["detailslabel"].pageDown()
182                 if self.Page == 2:
183                         self["extralabel"].pageDown()
184
185         def showMenu(self):
186                 if ( self.Page is 1 or self.Page is 2 ) and self.resultlist:
187                         self["menu"].show()
188                         self["stars"].hide()
189                         self["starsbg"].hide()
190                         self["ratinglabel"].hide()
191                         self["castlabel"].hide()
192                         self["poster"].hide()
193                         self["extralabel"].hide()
194                         self["titellabel"].setText(self._("Ambiguous results"))
195                         self["detailslabel"].setText(self._("Please select the matching entry"))
196                         self["detailslabel"].show()
197                         self["key_blue"].setText("")
198                         self["key_green"].setText(self._("Title Menu"))
199                         self["key_yellow"].setText(self._("Details"))
200                         self.Page = 0
201
202         def showDetails(self):
203                 self["ratinglabel"].show()
204                 self["castlabel"].show()
205                 self["detailslabel"].show()
206
207                 if self.resultlist and self.Page == 0:
208                         link = self["menu"].getCurrent()[1]
209                         title = self["menu"].getCurrent()[0]
210                         self["statusbar"].setText("Re-Query IMDb: "+title+"...")
211                         localfile = "/tmp/imdbquery2.html"
212                         fetchurl = "http://" + self.IMDBlanguage + "imdb.com/title/" + link
213                         print "[IMDB] downloading query " + fetchurl + " to " + localfile
214                         downloadPage(fetchurl,localfile).addCallback(self.IMDBquery2).addErrback(self.fetchFailed)
215                         self["menu"].hide()
216                         self.resetLabels()
217                         self.Page = 1
218
219                 if self.Page == 2:
220                         self["extralabel"].hide()
221                         self["poster"].show()
222                         if self.ratingstars > 0:
223                                 self["starsbg"].show()
224                                 self["stars"].show()
225                                 self["stars"].setValue(self.ratingstars)
226
227                         self.Page = 1
228
229         def showExtras(self):
230                 if self.Page == 1:
231                         self["extralabel"].show()
232                         self["detailslabel"].hide()
233                         self["castlabel"].hide()
234                         self["poster"].hide()
235                         self["stars"].hide()
236                         self["starsbg"].hide()
237                         self["ratinglabel"].hide()
238                         self.Page = 2
239
240         def getIMDB(self):
241                 self.resetLabels()
242                 if self.eventName is "":
243                         s = self.session.nav.getCurrentService()
244                         info = s.info()
245                         event = info.getEvent(0) # 0 = now, 1 = next
246                         if event:
247                                 self.eventName = event.getEventName()
248                 if self.eventName is not "":
249                         self["statusbar"].setText("Query IMDb: " + self.eventName + "...")
250                         event_quoted = urllib.quote(self.eventName.decode('utf8').encode('latin-1','ignore'))
251                         localfile = "/tmp/imdbquery.html"
252                         fetchurl = "http://" + self.IMDBlanguage + "imdb.com/find?q=" + event_quoted + "&s=tt&site=aka"
253                         print "[IMDB] Downloading Query " + fetchurl + " to " + localfile
254                         downloadPage(fetchurl,localfile).addCallback(self.IMDBquery).addErrback(self.fetchFailed)
255                 else:
256                         self["statusbar"].setText("Could't get Eventname -_-")
257
258         def fetchFailed(self,string):
259                 print "[IMDB] fetch failed " + string
260                 self["statusbar"].setText("IMDb Download failed -_-")
261
262         def html2utf8(self,in_html):
263                 htmlentitynumbermask = re.compile('(&#(\d{1,5}?);)')
264                 htmlentitynamemask = re.compile('(&(\D{1,5}?);)')
265
266                 entities = htmlentitynamemask.finditer(in_html)
267                 entitydict = {}
268
269                 for x in entities:
270                         entitydict[x.group(1)] = x.group(2)
271
272                 for key, name in entitydict.items():
273                         entitydict[key] = htmlentitydefs.name2codepoint[name]
274
275                 entities = htmlentitynumbermask.finditer(in_html)
276
277                 for x in entities:
278                         entitydict[x.group(1)] = x.group(2)
279
280                 for key, codepoint in entitydict.items():
281                         in_html = in_html.replace(key, (unichr(int(codepoint)).encode('latin-1')))
282
283                 self.inhtml = in_html.decode('latin-1').encode('utf8')
284
285         def IMDBquery(self,string):
286                 print "[IMDBquery]"
287                 self["statusbar"].setText("IMDb Download completed")
288
289                 self.html2utf8(open("/tmp/imdbquery.html", "r").read())
290
291                 self.generalinfos = self.generalinfomask.search(self.inhtml)
292
293                 if self.generalinfos:
294                         self.IMDBparse()
295                 else:
296                         if re.search("<title>(?:IMDb.{0,9}Search|IMDb Titelsuche)</title>", self.inhtml):
297                                 searchresultmask = re.compile("href=\".*?/title/(tt\d{7,7})/\">(.*?)</td>", re.DOTALL)
298                                 searchresults = searchresultmask.finditer(self.inhtml)
299                                 self.resultlist = []
300                                 if searchresults:
301                                         for x in searchresults:
302                                                 self.resultlist.append((self.htmltags.sub('',x.group(2)), x.group(1)))
303                                         self["menu"].l.setList(self.resultlist)
304                                 if len(self.resultlist) > 1:
305                                         self.Page = 1
306                                         self.showMenu()
307                                 else:
308                                         self["detailslabel"].setText(self._("No IMDb match."))
309                                         self["statusbar"].setText("No IMDb match")
310                         else:
311                                 splitpos = self.eventName.find('(')
312                                 if splitpos > 0 and self.eventName.endswith(')'):
313                                         self.eventName = self.eventName[splitpos+1:-1]
314                                         self["statusbar"].setText("Re-Query IMDb: " + self.eventName + "...")
315                                         event_quoted = urllib.quote(self.eventName.decode('utf8').encode('latin-1','ignore'))
316                                         localfile = "/tmp/imdbquery.html"
317                                         fetchurl = "http://" + self.IMDBlanguage + "imdb.com/find?q=" + event_quoted + "&s=tt&site=aka"
318                                         print "[IMDB] Downloading Query " + fetchurl + " to " + localfile
319                                         downloadPage(fetchurl,localfile).addCallback(self.IMDBquery).addErrback(self.fetchFailed)
320                                 else:
321                                         self["detailslabel"].setText(self._("IMDb query failed!"))
322
323         def IMDBquery2(self,string):
324                 self["statusbar"].setText("IMDb Re-Download completed")
325                 self.html2utf8(open("/tmp/imdbquery2.html", "r").read())
326                 self.generalinfos = self.generalinfomask.search(self.inhtml)
327                 self.IMDBparse()
328
329         def IMDBparse(self):
330                 print "[IMDBparse]"
331                 self.Page = 1
332                 Detailstext = self._("No details found.")
333                 if self.generalinfos:
334                         self["key_yellow"].setText(self._("Details"))
335                         self["statusbar"].setText("IMDb Details parsed ^^")
336                         Titeltext = self.generalinfos.group("title")
337                         if len(Titeltext) > 57:
338                                 Titeltext = Titeltext[0:54] + "..."
339                         self["titellabel"].setText(Titeltext)
340
341                         Detailstext = ""
342
343                         genreblockmask = re.compile('<h5>Genre:</h5>(.*?)(?:mehr|more|</div>)', re.DOTALL)
344                         genreblock = genreblockmask.findall(self.inhtml)
345                         genremask = re.compile('\">(.*?)</a')
346                         if genreblock:
347                                 genres = genremask.finditer(genreblock[0])
348                                 if genres:
349                                         Detailstext += "Genre: "
350                                         for x in genres:
351                                                 Detailstext += x.group(1) + " "
352                         detailscategories = ["director", "creator", "writer", "premiere", "seasons", "country"]
353
354                         for category in detailscategories:
355                                 if self.generalinfos.group('g_'+category):
356                                         Detailstext += "\n" + self.generalinfos.group('g_'+category) + ": " + self.generalinfos.group(category)
357
358                         if self.generalinfos.group("alternativ"):
359                                 Detailstext += "\n" + self.generalinfos.group("g_alternativ") + ": " + self.htmltags.sub('',(self.generalinfos.group("alternativ").replace('\n','').replace("<br>",'\n').replace("  ",' ')))
360
361                         ratingmask = re.compile('(?P<g_rating>Nutzer-Bewertung|User Rating):</b>.{0,2}<b>(?P<rating>.*?)/10</b>', re.DOTALL)
362                         rating = ratingmask.search(self.inhtml)
363                         Ratingtext = self._("no user rating yet")
364                         if rating:
365                                 Ratingtext = rating.group("g_rating") + ": " + rating.group("rating") + " / 10"
366                                 self.ratingstars = int(10*round(float(rating.group("rating")),1))
367                                 self["stars"].show()
368                                 self["stars"].setValue(self.ratingstars)
369                                 self["starsbg"].show()
370                         self["ratinglabel"].setText(Ratingtext)
371                         castmask = re.compile('<td class="nm">.*?>(.*?)</a>.*?<td class="char">(?:<a.*?>)?(.*?)(?:</a>)?</td>', re.DOTALL)
372                         castresult = castmask.finditer(self.inhtml)
373                         if castresult:
374                                 Casttext = ""
375                                 for x in castresult:
376                                         Casttext += "\n" + self.htmltags.sub('', x.group(1))
377                                         if x.group(2):
378                                                 Casttext += self._(" als ") + self.htmltags.sub('', x.group(2).replace('/ ...',''))
379                                 if Casttext is not "":
380                                         Casttext = self._("Cast: ") + Casttext
381                                 else:
382                                         Casttext = self._("No cast list found in the database.")
383                                 self["castlabel"].setText(Casttext)
384                         postermask = re.compile('<div class="photo">.*?<img .*? src=\"(http.*?)\" .*?>', re.DOTALL)
385                         posterurl = postermask.search(self.inhtml)
386                         if posterurl and posterurl.group(1).find("jpg") > 0:
387                                 posterurl = posterurl.group(1)
388                                 self["statusbar"].setText("Downloading Movie Poster: "+posterurl+"...")
389                                 localfile = "/tmp/poster.jpg"
390                                 print "[IMDB] downloading poster " + posterurl + " to " + localfile
391                                 downloadPage(posterurl,localfile).addCallback(self.IMDBPoster).addErrback(self.fetchFailed)
392                         else:
393                                 self.IMDBPoster("kein Poster")
394                         extrainfos = self.extrainfomask.search(self.inhtml)
395
396                         if extrainfos:
397                                 Extratext = "Extra Info\n"
398                                 extracategories = ["tagline","outline","synopsis","keywords","awards","runtime","language","color","aspect","sound","cert","locations","company","trivia","goofs","quotes","connections"]
399
400                                 for category in extracategories:
401                                         if extrainfos.group('g_'+category):
402                                                 Extratext += extrainfos.group('g_'+category) + ": " + self.htmltags.sub('',extrainfos.group(category).replace("\n",'').replace("<br>",'\n')) + "\n"
403                                 if extrainfos.group("g_comments"):
404                                         Extratext += extrainfos.group("g_comments") + " [" + self.htmltags.sub('',extrainfos.group("commenter")) + "]: " + self.htmltags.sub('',extrainfos.group("comment").replace("\n",' ')) + "\n"
405
406                                 self["extralabel"].setText(Extratext)
407                                 self["extralabel"].hide()
408                                 self["key_blue"].setText(self._("Extra Info"))
409
410                 self["detailslabel"].setText(Detailstext)
411
412         def IMDBPoster(self,string):
413                 self["statusbar"].setText("IMDb Details parsed ^^")
414                 if not string:
415                         filename = "/tmp/poster.jpg"
416                 else:
417                         filename = resolveFilename(SCOPE_PLUGINS, "Extensions/IMDb/no_poster.png")
418                 sc = AVSwitch().getFramebufferScale()
419                 self.picload.setPara((self["poster"].instance.size().width(), self["poster"].instance.size().height(), sc[0], sc[1], False, 1, "#00000000"))
420                 self.picload.startDecode(filename)
421
422         def paintPosterPixmapCB(self, picInfo=None):
423                 ptr = self.picload.getData()
424                 if ptr != None:
425                         self["poster"].instance.setPixmap(ptr.__deref__())
426                         self["poster"].show()
427
428         def createSummary(self):
429                 return IMDbLCDScreen
430
431 class IMDbLCDScreen(Screen):
432         skin = """
433         <screen position="0,0" size="132,64" title="IMDB Plugin">
434                 <widget name="headline" position="4,0" size="128,22" font="Regular;20"/>
435                 <widget source="session.Event_Now" render="Label" position="6,26" size="120,34" font="Regular;14" >
436                         <convert type="EventName">Name</convert>
437                 </widget>
438         </screen>"""
439
440         def __init__(self, session, parent):
441                 Screen.__init__(self, session)
442                 self["headline"] = Label("IMDB Plugin")
443
444 def main(session, eventName="", **kwargs):
445         session.open(IMDB, eventName)
446
447 def Plugins(**kwargs):
448         try:
449                 wherelist = [PluginDescriptor.WHERE_EVENTINFO, PluginDescriptor.WHERE_PLUGINMENU]
450                 return PluginDescriptor(name="IMDb Details",
451                                 description=_("Query details from the Internet Movie Database"),
452                                 icon="imdb.png",
453                                 where = wherelist,
454                                 fnc=main)
455         except AttributeError:
456                 wherelist = [PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_PLUGINMENU]
457                 return PluginDescriptor(name="IMDb Details",
458                                 description=_("Query details from the Internet Movie Database"),
459                                 icon="imdb.png",
460                                 where = wherelist,
461                                 fnc=main)