def run(self, callback): self.callback = callback if self.agent is not None: self.download = downloadWithProgress(self.url,self.local,agent=self.agent) else: self.download = downloadWithProgress(self.url,self.local) self.download.addProgress(self.http_progress) self.download.start().addCallback(self.http_finished).addErrback(self.http_failed)
def IMDBquery(self, string): self["statusbar"].setText(_("IMDb Download completed")) self.html2utf8(open("/tmp/imdbquery.html", "r").read()) self.generalinfos = self.generalinfomask.search(self.inhtml) if self.generalinfos: self.IMDBparse() else: if re.search("<title>Find - IMDb</title>", self.inhtml): pos = self.inhtml.find("<table class=\"findList\">") pos2 = self.inhtml.find("</table>", pos) findlist = self.inhtml[pos:pos2] searchresultmask = re.compile( '<tr class=\"findResult (?:odd|even)\">.*?<td class=\"result_text\"> <a href=\"/title/(tt\d{7,7})/.*?\"\s?>(.*?)</a>.*?</td>', re.DOTALL) searchresults = searchresultmask.finditer(findlist) self.resultlist = [(self.htmltags.sub('', x.group(2)), x.group(1)) for x in searchresults] Len = len(self.resultlist) self["menu"].l.setList(self.resultlist) if Len == 1: self["statusbar"].setText( _("Re-Query IMDb: %s...") % (self.resultlist[0][0], )) self.eventName = self.resultlist[0][1] localfile = "/tmp/imdbquery.html" fetchurl = "http://imdb.com/find?q=" + quoteEventName( self.eventName) + "&s=tt&site=aka" download = downloadWithProgress(fetchurl, localfile) download.start().addCallback(self.IMDBquery).addErrback( self.http_failed) elif Len > 1: self.Page = 1 self.showMenu() else: self["detailslabel"].setText(_("No IMDb match.")) self["statusbar"].setText( _("No IMDb match.") + ' ' + self.eventName) 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 = quoteEventName(self.eventName) localfile = "/tmp/imdbquery.html" fetchurl = "http://imdb.com/find?q=" + quoteEventName( self.eventName) + "&s=tt&site=aka" download = downloadWithProgress(fetchurl, localfile) download.start().addCallback(self.IMDBquery).addErrback( self.http_failed) else: self["detailslabel"].setText(_("IMDb query failed!"))
def run(self, callback): self.callback = callback if self.agent is not None: self.download = downloadWithProgress(self.url, self.local, agent=self.agent) else: self.download = downloadWithProgress(self.url, self.local) self.download.addProgress(self.http_progress) self.download.start().addCallback(self.http_finished).addErrback( self.http_failed)
def IMDBquery(self,string): self["statusbar"].setText(_("IMDb Download completed")) self.inhtml = open("/tmp/imdbquery.html", "r").read() self.inhtml = self.cleanhtml(self.inhtml) self.generalinfos = self.generalinfomask.search(self.inhtml) if self.generalinfos: self.IMDBparse() else: if not re.search('class="findHeader">No results found for', self.inhtml): pos = self.inhtml.find("<table class=\"findList\">") pos2 = self.inhtml.find("</table>",pos) findlist = self.inhtml[pos:pos2] searchresultmask = re.compile('<tr class=\"findResult (?:odd|even)\">.*?<td class=\"result_text\"> <a href=\"/title/(tt\d{7,7})/.*?\"\s?>(.*?)</a>.*?</td>', re.S) searchresults = searchresultmask.finditer(findlist) self.resultlist = [(self.htmltags.sub('',x.group(2)), x.group(1)) for x in searchresults] Len = len(self.resultlist) self["menu"].l.setList(self.resultlist) if Len == 1: self["key_green"].setText("") self["statusbar"].setText(_("Re-Query IMDb: %s...") % (self.resultlist[0][0],)) self.eventName = self.resultlist[0][1] localfile = "/tmp/imdbquery.html" fetchurl = "http://www.imdb.com/find?ref_=nv_sr_fn&q=" + quoteEventName(self.eventName) + "&s=all" download = downloadWithProgress(fetchurl,localfile,headers=imdb_headers) download.start().addCallback(self.IMDBquery).addErrback(self.http_failed) elif Len > 1: self.Page = 1 self.showMenu() else: self["statusbar"].setText(_("No IMDb match.") + ' ' + self.eventName) else: splitpos = self.eventName.find('(') if splitpos > 0: self.eventName = self.eventName[:splitpos-1] self["statusbar"].setText(_("Re-Query IMDb: %s...") % (self.eventName)) localfile = "/tmp/imdbquery.html" fetchurl = "http://www.imdb.com/find?ref_=nv_sr_fn&q=" + quoteEventName(self.eventName) + "&s=all" download = downloadWithProgress(fetchurl,localfile,headers=imdb_headers) download.start().addCallback(self.IMDBquery).addErrback(self.http_failed) else: splitpos = self.eventName.find('-') if splitpos > 0: self.eventName = self.eventName[:splitpos-1].strip() self["statusbar"].setText(_("Re-Query IMDb: %s...") % (self.eventName)) localfile = "/tmp/imdbquery.html" fetchurl = "http://www.imdb.com/find?ref_=nv_sr_fn&q=" + quoteEventName(self.eventName) + "&s=all" download = downloadWithProgress(fetchurl,localfile,headers=imdb_headers) download.start().addCallback(self.IMDBquery).addErrback(self.http_failed) else: self["statusbar"].setText(_("IMDb query failed!"))
def getIMDB(self): self.resetLabels() if not self.eventName: s = self.session.nav.getCurrentService() info = s and s.info() event = info and info.getEvent(0) # 0 = now, 1 = next if event: self.eventName = event.getEventName() else: self.eventName = self.session.nav.getCurrentlyPlayingServiceReference().toString() self.eventName = self.eventName.split("/") self.eventName = self.eventName[-1] self.eventName = self.eventName.replace(".", " ") self.eventName = self.eventName.split("-") self.eventName = self.eventName[0] if self.eventName.endswith(" "): self.eventName = self.eventName[:-1] if self.eventName: self["statusbar"].setText(_("Query IMDb: %s") % (self.eventName)) localfile = "/tmp/imdbquery.html" fetchurl = "http://imdb.com/find?q=" + quoteEventName(self.eventName) + "&s=tt&site=aka" print("[IMDB] getIMDB() Downloading Query " + fetchurl + " to " + localfile) download = downloadWithProgress(fetchurl, localfile) download.start().addCallback(self.IMDBquery).addErrback(self.http_failed) else: self["statusbar"].setText(_("Could't get Eventname"))
def run(self, callback): self.callback = callback self.download = downloadWithProgress(self.url, self.path) self.download.addProgress(self.download_progress) self.download.start().addCallback(self.download_finished).addErrback( self.download_failed) print "[ImageDownloadTask] downloading", self.url, "to", self.path
def run(self, callback): self.callback = callback self.download = downloadWithProgress(self.url, self.path) self.download.addProgress(self.download_progress) self.download.start().addCallback(self.download_finished).addErrback( self.download_failed) print('[SH4MultiBoot-Download] Downloading', self.url, 'to', self.path)
def run(self, callback): from Tools.Downloader import downloadWithProgress self.callback = callback self.download = downloadWithProgress(self.url,self.path) self.download.addProgress(self.download_progress) self.download.start().addCallback(self.download_finished).addErrback(self.download_failed) print "[DownloadTask] downloading", self.url, "to", self.path
def startDownloading(self, url, file): self.progress = 0 self.downloading = True self.error = "" self.download = downloadWithProgress(url, file) self.download.addProgress(self.httpProgress) self.download.start().addCallback(self.httpFinished).addErrback(self.httpFailed)
def fileDownload(self): from Tools.Downloader import downloadWithProgress self.download = downloadWithProgress(self.url, self.dstfilename) self.download.addProgress(self.progress) self.download.start().addCallback(self.finished).addErrback(self.failed) self.downloading(True) self['fname'].text = _('Downloading file: %s ...') % self.filename
def run(self, callback): self.callback = callback getsize(self.url) self.download = downloadWithProgress(self.url, self.local) self.download.addProgress(self.http_progress) print "self.url, self.local",self.url, self.local self.download.start().addCallback(self.http_finished).addErrback(self.http_failed)
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://imdb.com/title/" + link print("[IMDB] showDetails() downloading query " + fetchurl + " to " + localfile) download = downloadWithProgress(fetchurl,localfile) download.start().addCallback(self.IMDBquery2).addErrback(self.http_failed) 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 startDownload(self): from Tools.Downloader import downloadWithProgress info = ' Downloading :\n %s ' % self.url self['info2'].setText(info) self.downloader = downloadWithProgress(self.url, self.target) self.downloader.addProgress(self.progress) self.downloader.start().addCallback(self.responseCompleted).addErrback(self.responseFailed)
def getIMDB(self): self.resetLabels() if not self.eventName: s = self.session.nav.getCurrentService() info = s and s.info() event = info and info.getEvent(0) # 0 = now, 1 = next if event: self.eventName = event.getEventName() else: self.eventName = self.session.nav.getCurrentlyPlayingServiceReference().toString() self.eventName = self.eventName.split('/') self.eventName = self.eventName[-1] self.eventName = self.eventName.replace('.',' ') self.eventName = self.eventName.split('-') self.eventName = self.eventName[0] if self.eventName.endswith(' '): self.eventName = self.eventName[:-1] if self.eventName: self["statusbar"].setText(_("Query IMDb: %s") % (self.eventName)) localfile = "/tmp/imdbquery.html" fetchurl = "http://imdb.com/find?q=" + quoteEventName(self.eventName) + "&s=tt&site=aka" print("[IMDB] getIMDB() Downloading Query " + fetchurl + " to " + localfile) download = downloadWithProgress(fetchurl,localfile) download.start().addCallback(self.IMDBquery).addErrback(self.http_failed) else: self["statusbar"].setText(_("Could't get Eventname"))
def startDownload(self): from Tools.Downloader import downloadWithProgress print "[PPanel File] Downloading %s to %s" % (self.url, self.target) self.downloader = downloadWithProgress(self.url, self.target) self.downloader.addProgress(self.progress) self.downloader.start().addCallback(self.responseCompleted).addErrback( self.responseFailed)
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://imdb.com/title/" + link print("[IMDB] showDetails() downloading query " + fetchurl + " to " + localfile) download = downloadWithProgress(fetchurl,localfile) download.start().addCallback(self.IMDBquery2).addErrback(self.http_failed) self.fetchurl = fetchurl 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 getIMDB(self, search=False): self.resetLabels() if not self.eventName: s = self.session.nav.getCurrentService() info = s and s.info() event = info and info.getEvent(0) if event: self.eventName = event.getEventName() elif self.session.nav.getCurrentlyPlayingServiceReference(): self.eventName = self.session.nav.getCurrentlyPlayingServiceReference().toString() self.eventName = self.eventName.split('/') self.eventName = self.eventName[-1] self.eventName = self.eventName.replace('.',' ') self.eventName = self.eventName.split('-') self.eventName = self.eventName[0] if self.eventName.endswith(' '): self.eventName = self.eventName[:-1] if self.localpath is not None and not search: if os.path.exists(self.localpath): self.getLocalDetails() else: if self.eventName: self["statusbar"].setText(_("Query IMDb: %s") % (self.eventName)) localfile = "/tmp/imdbquery.html" fetchurl = "http://imdb.com/find?q=" + quoteEventName(self.eventName) + "&s=tt&site=aka" print("[IMDB] getIMDB() Downloading Query " + fetchurl + " to " + localfile) download = downloadWithProgress(fetchurl,localfile) download.start().addCallback(self.IMDBquery).addErrback(self.http_failed) else: self["statusbar"].setText(_("Could't get Eventname"))
def getIMDB(self, search=False): global imdb_headers if config.plugins.imdb.language.value: imdb_headers = {'Accept-Language': config.plugins.imdb.language.value} else: imdb_headers = {} self.resetLabels() if not self.eventName: s = self.session.nav.getCurrentService() info = s and s.info() event = info and info.getEvent(0) # 0 = now, 1 = next if event: self.eventName = event.getEventName() else: self.eventName = self.session.nav.getCurrentlyPlayingServiceReference().toString() self.eventName = self.eventName.split('/') self.eventName = self.eventName[-1] self.eventName = self.eventName.replace('.',' ') self.eventName = self.eventName.split('-') self.eventName = self.eventName[0] if self.eventName.endswith(' '): self.eventName = self.eventName[:-1] if self.eventName: self["statusbar"].setText(_("Query IMDb: %s") % (self.eventName)) localfile = "/tmp/imdbquery.html" fetchurl = "http://www.imdb.com/find?ref_=nv_sr_fn&q=" + quoteEventName(self.eventName) + "&s=all" print("[IMDB] getIMDB() Downloading Query " + fetchurl + " to " + localfile) download = downloadWithProgress(fetchurl,localfile,headers=imdb_headers) download.start().addCallback(self.IMDBquery).addErrback(self.http_failed) else: self["statusbar"].setText(_("Couldn't get Eventname"))
def IMDBquery(self, string): self["statusbar"].setText(_("IMDb Download completed")) self.html2utf8(open("/tmp/imdbquery.html", "r").read()) self.generalinfos = self.generalinfomask.search(self.inhtml) if self.generalinfos: self.IMDBparse() else: if re.search("<title>Find - IMDb</title>", self.inhtml): pos = self.inhtml.find('<table class="findList">') pos2 = self.inhtml.find("</table>", pos) findlist = self.inhtml[pos:pos2] searchresultmask = re.compile( '<tr class="findResult (?:odd|even)">.*?<td class="result_text"> <a href="/title/(tt\d{7,7})/.*?"\s?>(.*?)</a>.*?</td>', re.DOTALL, ) searchresults = searchresultmask.finditer(findlist) self.resultlist = [(self.htmltags.sub("", x.group(2)), x.group(1)) for x in searchresults] Len = len(self.resultlist) self["menu"].l.setList(self.resultlist) if Len == 1: self["statusbar"].setText(_("Re-Query IMDb: %s...") % (self.resultlist[0][0],)) self.eventName = self.resultlist[0][1] localfile = "/tmp/imdbquery.html" fetchurl = "http://imdb.com/find?q=" + quoteEventName(self.eventName) + "&s=tt&site=aka" download = downloadWithProgress(fetchurl, localfile) download.start().addCallback(self.IMDBquery).addErrback(self.http_failed) elif Len > 1: self.Page = 1 self.showMenu() else: self["detailslabel"].setText(_("No IMDb match.")) self["statusbar"].setText(_("No IMDb match.") + " " + self.eventName) 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 = quoteEventName(self.eventName) localfile = "/tmp/imdbquery.html" fetchurl = "http://imdb.com/find?q=" + quoteEventName(self.eventName) + "&s=tt&site=aka" download = downloadWithProgress(fetchurl, localfile) download.start().addCallback(self.IMDBquery).addErrback(self.http_failed) else: self["detailslabel"].setText(_("IMDb query failed!"))
def start(self, checkname): if self.checkRunningJobs() < int(config.plugins.mediainfo.dllimit.value): print "[MediaInfo] Start Download: %s" % checkname agent = 'Mozilla/5.0 (Windows NT 6.1; rv:32.0) Gecko/20100101 Firefox/32.0' try: self.download = downloadWithProgress(self.url, self.local, agent=agent) self.download.addProgress(self.http_progress) self.download.start().addCallback(self.http_finished).addErrback(self.http_failed) except: print "[MediaInfo] useragent wird nicht supportet." self.download = downloadWithProgress(self.url, self.local) self.download.addProgress(self.http_progress) self.download.start().addCallback(self.http_finished).addErrback(self.http_failed) return True else: print "[MediaInfo] Max Download Slots Full %s" % checkname return False
def run(self, callback): from Tools.Downloader import downloadWithProgress self.callback = callback self.download = downloadWithProgress(self.url, self.path) self.download.addProgress(self.download_progress) self.download.start().addCallback(self.download_finished).addErrback(self.download_failed) print "[DownloadTask] downloading", self.url, "to", self.path
def fileDownload(self): from Tools.Downloader import downloadWithProgress self.download = downloadWithProgress(self.url, self.dstfilename) self.download.addProgress(self.progress) self.download.start().addCallback(self.finished).addErrback( self.failed) self.downloading(True) self['fname'].text = _('Downloading file: %s ...') % self.filename
def fileDownload(self): from Tools.Downloader import downloadWithProgress #print "[download] downloading %s to %s" % (self.url, self.dstfilename) self.download = downloadWithProgress(self.url, self.dstfilename) self.download.addProgress(self.progress) self.download.start().addCallback(self.finished).addErrback(self.failed) self.downloading(True) self["fname"].text = _("Downloading file: %s ...") % (self.filename)
def saveHtmlDetails(self): try: if self.savingpath is not None: isave = self.savingpath + ".imdbquery2.html" if self.fetchurl is not None: download = downloadWithProgress(self.fetchurl,isave) download.start().addCallback(self.IMDBsave).addErrback(self.http_failed) except Exception, e: print('[IMDb] saveHtmlDetails exception failure: ', str(e))
def processQueue(self): while self.dlConcurrent < 7 and len(self.dlQueue) > 0: url = self.dlQueue[0][0] file = self.dlQueue[0][1] self.download = downloadWithProgress(url, file) self.download.addProgress(self.httpProgress) self.download.start().addCallback(self.httpFinished).addErrback( self.httpFailed) self.dlConcurrent += 1 self.dlQueue.pop(0)
def downloadfile2(self,url = None,ofile=''): debug = True if True: self['package'].setText(self.name) self.setTitle(_('Connecting') + '...') self['status'].setText(_('Connecting') + ' to server....') self.downloading = True self.downloader = downloadWithProgress(self.url, self.target) self.downloader.addProgress(self.progress) self.downloader.start().addCallback(self.responseCompleted).addErrback(self.responseFailed)
def downloadWebSite(self): if config.CommitInfoSetup.commiturl.value == 'Enigma2': self["Commits"].setText("Enigma2") url = 'http://github.com/xtrend-boss/stbgui-new/commits/master' elif config.CommitInfoSetup.commiturl.value == 'XTA': self["Commits"].setText("XTA") url = 'http://github.com/xtrend-alliance/xta/commits/master' elif config.CommitInfoSetup.commiturl.value == 'TechniHD': self["Commits"].setText("TechniHD") url = 'http://github.com/xtrend-alliance/TechniHD/commits/master' download = downloadWithProgress(url, '/tmp/.commits') download.start().addCallback(self.download_finished).addErrback(self.download_failed)
def nfi_download(self): if self["destlist"].getCurrentDirectory() is None: self.switchList(self.LIST_TARGET) if self["feedlist"].isValid(): url = self["feedlist"].getNFIurl() self.nfilocal = self["destlist"].getCurrentDirectory()+'/'+self["feedlist"].getNFIname() print "[nfi_download] downloading %s to %s" % (url, self.nfilocal) self.download = downloadWithProgress(url,self.nfilocal) self.download.addProgress(self.nfi_progress) self["job_progressbar"].range = 1000 self.download.start().addCallback(self.nfi_finished).addErrback(self.nfi_failed) self.downloading(True)
def start(self, checkname): if self.checkRunningJobs() < int( config.plugins.mediainfo.dllimit.value): print "[MediaInfo] Start Download: %s" % checkname agent = 'Mozilla/5.0 (Windows NT 6.1; rv:32.0) Gecko/20100101 Firefox/32.0' try: self.download = downloadWithProgress(self.url, self.local, agent=agent) self.download.addProgress(self.http_progress) self.download.start().addCallback( self.http_finished).addErrback(self.http_failed) except: print "[MediaInfo] useragent wird nicht supportet." self.download = downloadWithProgress(self.url, self.local) self.download.addProgress(self.http_progress) self.download.start().addCallback( self.http_finished).addErrback(self.http_failed) return True else: print "[MediaInfo] Max Download Slots Full %s" % checkname return False
def nfi_download(self): if self["destlist"].getCurrentDirectory() is None: self.switchList(self.LIST_TARGET) if self["feedlist"].isValid(): url = self["feedlist"].getNFIurl() self.nfilocal = self["destlist"].getCurrentDirectory( ) + '/' + self["feedlist"].getNFIname() print "[nfi_download] downloading %s to %s" % (url, self.nfilocal) self.download = downloadWithProgress(url, self.nfilocal) self.download.addProgress(self.nfi_progress) self["job_progressbar"].range = 1000 self.download.start().addCallback(self.nfi_finished).addErrback( self.nfi_failed) self.downloading(True)
def flasherdownload_query(self, answer): if answer is False: self.downloading(False) self.switchList(self.LIST_SOURCE) return #url = self.feed_base + "/nfiflasher_" + self.box + ".tar.bz2" url = "http://www.dreamboxupdate.com/download/opendreambox/dreambox-nfiflasher-%s.tar.bz2" % self.box localfile = "/tmp/nfiflasher_image.tar.bz2" print "[flasherdownload_query] downloading %s to %s" % (url, localfile) self["statusbar"].text = ("Downloading %s..." % url) self.download = downloadWithProgress(url,localfile) self.download.addProgress(self.nfi_progress) self["job_progressbar"].range = 1000 self.download.start().addCallback(self.flasherdownload_finished).addErrback(self.flasherdownload_failed)
def downloadWebSite(self): if config.CommitInfoSetup.commiturl.value == 'Enigma2': self["Commits"].setText("Enigma2") url = 'http://github.com/XTAv2/Enigma2/commits/master' elif config.CommitInfoSetup.commiturl.value == 'XTA': self["Commits"].setText("XTA") url = 'http://github.com/XTAv2/xta/commits/master' elif config.CommitInfoSetup.commiturl.value == 'TechniHD': self["Commits"].setText("TechniHD") url = 'http://github.com/XTAv2/TechniHD/commits/master' elif config.CommitInfoSetup.commiturl.value == 'Metrix': self["Commits"].setText("Metrix") url = 'http://github.com/XTAv2/metrix-skin/commits/master' download = downloadWithProgress(url, '/tmp/.commits') download.start().addCallback(self.download_finished).addErrback(self.download_failed)
def startDownload(self, reply=True): if reply: if "://" in self.source: from Tools.Downloader import downloadWithProgress self["header"].setText(_("Downloading Image")) self["info"].setText(self.imagename) self.downloader = downloadWithProgress(self.source, self.zippedimage) self.downloader.addProgress(self.downloadProgress) self.downloader.addEnd(self.downloadEnd) self.downloader.addError(self.downloadError) self.downloader.start() else: self.unzip() else: self.abort()
def startDownload(self, reply=True): self.show() if reply: if "://" in self.source: from Tools.Downloader import downloadWithProgress self["header"].setText(_("Downloading Image")) self["info"].setText(self.imagename) self.downloader = downloadWithProgress(self.source, self.zippedimage) self.downloader.addProgress(self.downloadProgress) self.downloader.addEnd(self.downloadEnd) self.downloader.addError(self.downloadError) self.downloader.start() else: self.unzip() else: self.abort()
def flasherdownload_query(self, answer): if answer is False: self.downloading(False) self.switchList(self.LIST_SOURCE) return #url = self.feed_base + "/nfiflasher_" + self.box + ".tar.bz2" url = "http://www.dreamboxupdate.com/download/opendreambox/dreambox-nfiflasher-%s.tar.bz2" % self.box localfile = "/tmp/nfiflasher_image.tar.bz2" print "[flasherdownload_query] downloading %s to %s" % (url, localfile) self["statusbar"].text = ("Downloading %s..." % url) self.download = downloadWithProgress(url, localfile) self.download.addProgress(self.nfi_progress) self["job_progressbar"].range = 1000 self.download.start().addCallback( self.flasherdownload_finished).addErrback( self.flasherdownload_failed)
def getIMDB(self): self.resetLabels() if not self.eventName: s = self.session.nav.getCurrentService() info = s and s.info() event = info and info.getEvent(0) # 0 = now, 1 = next if event: self.eventName = event.getEventName() if self.eventName: self["statusbar"].setText(_("Query IMDb: %s...") % (self.eventName)) localfile = "/tmp/imdbquery.html" fetchurl = "http://imdb.com/find?q=" + self.event_quoted + "&s=tt&site=aka" print("[IMDB] getIMDB() Downloading Query " + fetchurl + " to " + localfile) download = downloadWithProgress(fetchurl,localfile) download.start().addCallback(self.IMDBquery).addErrback(self.http_failed) else: self["statusbar"].setText(_("Could't get Eventname"))
def changed(self, what): if self.instance: if not self.setpara: self.setpara = True sc = AVSwitch().getFramebufferScale() self.picload.setPara((self.instance.size().width(), self.instance.size().height(), sc[0], sc[1], self.use_cache == '1', 1, '#00000000')) if what[0] != self.CHANGED_CLEAR: pathdir = '' picartname = '' filename = self.source.text if filename is None: self.picon = False self.hide() return if self.filename == filename: self.picon = True self.show() return self.filename = filename if self.filename[:7] == 'path://': pos = self.filename.rfind('/') if pos != -1: path = self.filename[7:pos] name = self.filename[pos + 1:] if path.lower().endswith('video_ts'): path = path[:-8] picartname = self.findAicon(path, name) elif self.filename[:7] == 'file://': picartname = self.filename[7:] elif self.filename[:7] == 'http://': pos = self.filename.rfind('/') if pos != -1: self.picartname = '/tmp/.' + self.filename[pos + 1:] else: self.picartname = '/tmp/.httpcoverart' self.download = downloadWithProgress(self.filename, self.picartname) if self.filename.find('tvChannel.') != -1 and self.filename.endswith('.png'): self.download.start().addCallback(self.http_finished_png).addErrback(self.http_failed) else: self.download.start().addCallback(self.http_finished).addErrback(self.http_failed) return if picartname == '': if self.noCoverPixmap is None: self.picon = False self.hide() else: self.picartname = picartname self.instance.setPixmap(self.noCoverPixmap) self.show() else: self.picon = True if picartname != self.picartname: self.hide() self.picartname = picartname else: self.show() self.countTumbLoad = 0 self.ThumbTimer.start(500, True)
def run(self, callback): self.callback = callback self.download = downloadWithProgress(self.url, self.outputfile) self.download.addProgress(self.downloadProgress) self.download.start().addCallback(self.downloadFinished)\ .addErrback(self.downloadFailed)
def changed(self, what): if self.instance: if not self.setpara: self.setpara = True sc = AVSwitch().getFramebufferScale() self.picload.setPara( (self.instance.size().width(), self.instance.size().height(), sc[0], sc[1], self.use_cache == '1', 1, '#00000000')) if what[0] != self.CHANGED_CLEAR: pathdir = '' picartname = '' filename = self.source.text if filename is None: self.picon = False self.hide() return if self.filename == filename: self.picon = True self.show() return self.filename = filename if self.filename[:7] == 'path://': pos = self.filename.rfind('/') if pos != -1: path = self.filename[7:pos] name = self.filename[pos + 1:] if path.lower().endswith('video_ts'): path = path[:-8] picartname = self.findAicon(path, name) elif self.filename[:7] == 'file://': picartname = self.filename[7:] elif self.filename[:7] == 'http://': pos = self.filename.rfind('/') if pos != -1: self.picartname = '/tmp/.' + self.filename[pos + 1:] else: self.picartname = '/tmp/.httpcoverart' self.download = downloadWithProgress( self.filename, self.picartname) if self.filename.find( 'tvChannel.') != -1 and self.filename.endswith( '.png'): self.download.start().addCallback( self.http_finished_png).addErrback( self.http_failed) else: self.download.start().addCallback( self.http_finished).addErrback(self.http_failed) return if picartname == '': if self.noCoverPixmap is None: self.picon = False self.hide() else: self.picartname = picartname self.instance.setPixmap(self.noCoverPixmap) self.show() else: self.picon = True if picartname != self.picartname: self.hide() self.picartname = picartname else: self.show() self.countTumbLoad = 0 self.ThumbTimer.start(500, True)
ratingtext = self.ratingmask.search(self.inhtml) if ratingtext: ratingtext = ratingtext.group("rating") if ratingtext != '<span id="voteuser"></span>': text = ratingtext # + " / 10" rating = (_("User Rating") + ": " + text.encode('utf-8')) else: rating = (_("User Rating") + ": ") if poster: try: posterurl = self.postermask.search(self.inhtml) if posterurl and posterurl.group(1).find("jpg") > 0: posterurl = posterurl.group(1) postersave = self.savingpath + ".poster.jpg" print("[IMDB] downloading poster " + posterurl + " to " + postersave) download = downloadWithProgress(posterurl,postersave) download.start().addErrback(self.http_failed) except Exception, e: print('[IMDb] IMDBsavetxt exception failure in get poster: ', str(e)) return overview + "\n\n" + runtime + "\n" + genre + "\n" + country + "\n" + release + "\n" + rating + "\n" def openYttrailer(self): try: from Plugins.Extensions.TMBD.tmbdYTTrailer import tmbdYTTrailer except ImportError as ie: return ytTrailer = tmbdYTTrailer(self.session) ytTrailer.showTrailer(self.eventName)
def run(self, callback): self.callback = callback self.download = downloadWithProgress(self.url,self.path) self.download.addProgress(self.download_progress) self.download.start().addCallback(self.download_finished).addErrback(self.download_failed) print "[ImageDownloadTask] downloading", self.url, "to", self.path
def startDownload(self): from Tools.Downloader import downloadWithProgress print "[PPanel File] Downloading %s to %s" % (self.url, self.target) self.downloader = downloadWithProgress(str(self.url), "/tmp/tarball.tar.gz") self.downloader.addProgress(self.progress) self.downloader.start().addCallback(self.responseCompleted).addErrback(self.responseFailed)
def IMDBparse(self): 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["title"].setText(Titeltext) Detailstext = "" genreblock = self.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", "seasons"): if self.generalinfos.group(category): Detailstext += "\n" + self.generalinfos.group('g_'+category) + ": " + self.generalinfos.group(category).replace('<span class="itemprop" itemprop="name">','').replace('</span>','') for category in ("premiere", "country", "alternativ"): if self.generalinfos.group(category): Detailstext += "\n" + self.generalinfos.group('g_'+category) + ": " + self.htmltags.sub('', self.generalinfos.group(category).replace('\n',' ').replace("<br>", '\n').replace("<br />",'\n')) rating = self.ratingmask.search(self.inhtml) Ratingtext = _("no user rating yet") if rating: rating = rating.group("rating") if rating != '<span id="voteuser"></span>': Ratingtext = _("User Rating") + ": " + rating + " / 10" self.ratingstars = int(10*round(float(rating.replace(',','.')),1)) self["stars"].show() self["stars"].setValue(self.ratingstars) self["starsbg"].show() self["ratinglabel"].setText(Ratingtext) castresult = self.castmask.finditer(self.inhtml) if castresult: Casttext = "" for x in castresult: Casttext += "\n" + self.htmltags.sub('', x.group('actor')) if x.group('character'): Casttext += _(" as ") + self.htmltags.sub('', x.group('character').replace('/ ...','')).replace('\n', ' ') #if x.group('additional'): # Casttext += ' ' + x.group('additional') if Casttext: Casttext = _("Cast: ") + Casttext else: Casttext = _("No cast list found in the database.") self["castlabel"].setText(Casttext) posterurl = self.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) download = downloadWithProgress(posterurl,localfile) download.start().addCallback(self.IMDBPoster).addErrback(self.http_failed) else: self.IMDBPoster("kein Poster") extrainfos = self.extrainfomask.search(self.inhtml) if extrainfos: Extratext = "Extra Info\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').replace("<br />",'\n').replace('&view=simple&sort=alpha&ref_=tt_stry_pl" >',' ')) + "\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" Extratext = transHTML(Extratext) self["extralabel"].setText(Extratext) self["extralabel"].hide() self["key_blue"].setText(_("Extra Info")) self["detailslabel"].setText(Detailstext) self.callbackData = Detailstext
def run(self, callback): self.callback = callback self.download = downloadWithProgress(self.url, self.local) self.download.addProgress(self.http_progress) self.download.start().addCallback(self.http_finished).addErrback(self.http_failed)
def IMDBparse(self): 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").replace(self.NBSP, ' ').strip() if len(Titeltext) > 57: Titeltext = Titeltext[0:54] + "..." self["title"].setText(Titeltext) Detailstext = "" addnewline = '' genreblock = self.genreblockmask.search(self.inhtml) if genreblock: genres = ' '.join(self.htmltags.sub('', genreblock.group(0)).replace(self.NBSP, ' ').split()) if genres: Detailstext += addnewline + genres addnewline = "\n" self.callbackGenre = genres for category in ("director", "creator", "writer", "seasons"): if self.generalinfos.group(category): Detailstext += addnewline + self.generalinfos.group('g_'+category) + ": " + ' '.join(self.htmltags.sub('', self.generalinfos.group(category)).replace("\n", ' ').replace(self.NBSP, ' ').replace(self.RAQUO, '').replace(self.HELLIP + ' See all', '...').split()) addnewline = "\n" for category in ("premiere", "country", "alternativ"): if self.generalinfos.group(category): Detailstext += addnewline + self.generalinfos.group('g_'+category) + ": " + ' '.join(self.htmltags.sub('', self.generalinfos.group(category).replace('\n',' ')).split()) addnewline = "\n" rating = self.ratingmask.search(self.inhtml) Ratingtext = _("no user rating yet") if rating: rating = rating.group("rating") if rating != '<span id="voteuser"></span>': Ratingtext = _("User Rating") + ": " + rating + " / 10" self.ratingstars = int(10*round(float(rating.replace(',','.')),1)) self["stars"].show() self["stars"].setValue(self.ratingstars) self["starsbg"].show() self["ratinglabel"].setText(Ratingtext) castresult = self.castmask.finditer(self.inhtml) if castresult: Casttext = "" for x in castresult: Casttext += "\n" + self.htmltags.sub('', x.group('actor')) if x.group('character'): chartext = self.htmltags.sub('', x.group('character').replace('/ ...','')).replace('\n', ' ').replace(self.NBSP, ' ') Casttext += _(" as ") + ' '.join(chartext.split()) if config.plugins.imdb.showepisodeinfo.value and x.group('episodes'): Casttext += ' [' + self.htmltags.sub('', x.group('episodes')).strip() + ']' if Casttext: Casttext = _("Cast: ") + Casttext else: Casttext = _("No cast list found in the database.") self["castlabel"].setText(Casttext) posterurl = self.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) download = downloadWithProgress(posterurl,localfile) download.start().addCallback(self.IMDBPoster).addErrback(self.http_failed) else: self.IMDBPoster("kein Poster") Extratext = '' awardsresult = self.awardsmask.finditer(self.inhtml) if awardsresult: awardslist = [' '.join(x.group('awards').split()) for x in awardsresult] if awardslist: Extratext = _("Extra Info") + "\n\n" + ' | '.join(awardslist) + "\n" extrainfos = self.extrainfomask.search(self.inhtml) if extrainfos: if not Extratext: Extratext = _("Extra Info") + "\n" addspace = { "outline", "synopsis","tagline","runtime","locations","trivia","goofs","quotes","connections" } extraspace = '' for category in ("outline","synopsis","tagline","keywords","cert","runtime","language","color","aspect","sound","locations","company","trivia","goofs","quotes","connections"): if category in addspace: extraspace = "\n" if extrainfos.group(category): sep = ":\n" if category in ("outline", "synopsis") else ": " Extratext += extraspace if category == "outline": if "Add a Plot" in extrainfos.group(category): continue Extratext += _("Plot Outline") elif extrainfos.group('g_'+category): Extratext += extrainfos.group('g_'+category) else: Extratext += _("Unknown category") Extratext += sep + ' '.join(self.htmltags.sub('',extrainfos.group(category).replace("\n",' ').replace("<br>", '\n').replace("<br />",'\n')).replace(' |' + self.NBSP, '').replace(self.NBSP, ' ').split()) + "\n" extraspace = '' if extrainfos.group("g_comments"): Extratext += "\n" + extrainfos.group("g_comments") + ":\n" + extrainfos.group("commenttitle") + " [" + ' '.join(self.htmltags.sub('',extrainfos.group("commenter")).split()) + "]: " + self.htmltags.sub('',extrainfos.group("comment").replace("\n",' ').replace(self.NBSP, ' ').replace("<br>", '\n').replace("<br/>",'\n').replace("<br />",'\n')) + "\n" if Extratext: self["extralabel"].setText(Extratext) self["extralabel"].hide() self["key_blue"].setText(_("Extra Info")) self["detailslabel"].setText(Detailstext) self.callbackData = Detailstext
def IMDBparse(self): 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["title"].setText(Titeltext) Detailstext = "" genreblock = self.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", "seasons"): if self.generalinfos.group(category): Detailstext += "\n" + self.generalinfos.group('g_'+category) + ": " + self.generalinfos.group(category).replace('<span class="itemprop" itemprop="name">','').replace('</span>','') for category in ("premiere", "country", "alternativ"): if self.generalinfos.group(category): Detailstext += "\n" + self.generalinfos.group('g_'+category) + ": " + self.htmltags.sub('', self.generalinfos.group(category).replace('\n',' ').replace("<br>", '\n').replace("<br />",'\n')) rating = self.ratingmask.search(self.inhtml) Ratingtext = _("no user rating yet") if rating: rating = rating.group("rating") if rating != '<span id="voteuser"></span>': Ratingtext = _("User Rating") + ": " + rating + " / 10" self.ratingstars = int(10*round(float(rating.replace(',','.')),1)) self["stars"].show() self["stars"].setValue(self.ratingstars) self["starsbg"].show() self["ratinglabel"].setText(Ratingtext) castresult = self.castmask.finditer(self.inhtml) if castresult: Casttext = "" for x in castresult: Casttext += "\n" + self.htmltags.sub('', x.group('actor')) if x.group('character'): Casttext += _(" as ") + self.htmltags.sub('', x.group('character').replace('/ ...','')).replace('\n', ' ') if Casttext: Casttext = _("Cast: ") + Casttext else: Casttext = _("No cast list found in the database.") self["castlabel"].setText(Casttext) posterurl = self.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) download = downloadWithProgress(posterurl,localfile) download.start().addCallback(self.IMDBPoster).addErrback(self.http_failed) else: self.IMDBPoster("kein Poster") extrainfos = self.extrainfomask.search(self.inhtml) if extrainfos: Extratext = _("Extra Info\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').replace("<br />",'\n').replace('&view=simple&sort=alpha&ref_=tt_stry_pl" >',' ')) + "\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" Extratext = transHTML(Extratext) self["extralabel"].setText(Extratext) self["extralabel"].hide() self["key_blue"].setText(_("Extra Info")) self["detailslabel"].setText(Detailstext) self.callbackData = Detailstext
def IMDBparse(self): 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").replace( ' ', ' ').strip() if len(Titeltext) > 57: Titeltext = Titeltext[0:54] + "..." self.title_setText(Titeltext) Detailstext = "" stripmask = re.compile('\s{2,}', re.S) for category in ("originaltitle", "premiere", "country", "runtime", "seasons"): if self.generalinfos.group(category): Detailstext += self.generalinfos.group( 'g_' + category).title() + ": " + stripmask.sub( ' ', self.htmltags.sub( '', self.generalinfos.group(category).replace( '\n', ' ').replace('<br>', '\n').replace( '<br />', '\n'))).replace( ' | ', ', ').strip() + "\n" genreblock = self.genreblockmask.findall(self.inhtml) if genreblock: s = '' if len(genreblock) > 1: s = 's' Detailstext += "Genre%s: " % s for x in genreblock: genres = self.htmltags.sub('', x) Detailstext += genres + ", " if Detailstext[-2:] == ", ": Detailstext = Detailstext[:-2] Detailstext += "\n" for category in ("director", "creator", "writer"): if self.generalinfos.group(category): striplink1 = re.compile( '(<a href="/name/nm\d+.{0,1}\?ref_=tt_ov_..".{0,1}itemprop=\'url\'>)', re.S) striplink2 = re.compile( '(<a href="fullcredits\?ref_=tt_ov_..#.*?">)', re.S) Detailstext += self.generalinfos.group( 'g_' + category) + ": " + striplink2.sub( '', striplink1.sub( '', stripmask.sub( ' ', self.htmltags.sub( '', self.generalinfos.group(category)). replace('\n', '').replace('|', '')))) + "\n" rating = self.ratingmask.search(self.inhtml) Ratingtext = _("no user rating yet") if rating: ratingval = rating.group("rating") if ratingval != '<span id="voteuser"></span>': count = '' if rating.group("ratingcount"): count = ' (' + rating.group("ratingcount").replace( ',', '.') + ' ' + _("votes") + ')' Ratingtext = _( "User Rating") + ": " + ratingval + "/10" + count self.ratingstars = int( 10 * round(float(ratingval.replace(',', '.')), 1)) self["stars"].show() self["stars"].setValue(self.ratingstars) self["starsbg"].show() self["ratinglabel"].setText(str(Ratingtext)) castresult = self.castmask.finditer(self.inhtml) if castresult: Casttext = "" for x in castresult: Casttext += "\n" + self.htmltags.sub('', x.group('actor')) if x.group('character'): Casttext += " as " + stripmask.sub( ' ', self.htmltags.sub( '', x.group('character').replace( '/ ...', '').replace('\n', '').replace( ' ', '').replace( 'See full cast', ''))).strip() if Casttext: Casttext = "Cast: " + Casttext else: Casttext = _("No cast list found in the database.") self["castlabel"].setText(str(Casttext)) storylineresult = self.storylinemask.search(self.inhtml) if storylineresult: Storyline = "" if storylineresult.group("g_storyline"): Storyline = storylineresult.group( 'g_storyline') + ":\n" + re.sub( '\s{5,30}', ', ', self.htmltags.sub( '', storylineresult.group('storyline').replace( '\n', '').replace('<br>', '\n').replace( '<br />', '\n').replace(' ', '').replace( '"', '"').replace( '<span class="', '')).strip()) if Storyline == storylineresult.group('g_storyline') + ":\n": self["storylinelabel"].hide() else: self["storylinelabel"].setText(str(Storyline)) posterurl = self.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) download = downloadWithProgress(posterurl, localfile, headers=imdb_headers) download.start().addCallback(self.IMDBPoster).addErrback( self.http_failed) else: self.IMDBPoster("kein Poster") extrainfos = self.extrainfomask.search(self.inhtml) if extrainfos: Extratext = "" for category in ("tagline", "keywords", "cert", "mpaa", "language", "color", "aspect", "company", "sound", "locations", "trivia", "goofs", "quotes", "crazy", "connections"): if extrainfos.group('g_' + category): Extratext += extrainfos.group( 'g_' + category ) + ":\n" + re.sub( '\s{5,30}', ', ', self.htmltags.sub( '', extrainfos.group(category).replace( '\n', '').replace('<br>', '\n'). replace('<br />', '\n').replace( '&view=simple&sort=alpha&ref_=tt_stry_pl" >', ' ').replace(' ', '').replace( '"', '"').replace('|', ''). replace(' : ', ':').replace( ', ', ' / ')).strip()) + "\n\n" if extrainfos.group("g_comments"): stripmask = re.compile('\s{2,}', re.S) Extratext += extrainfos.group( "g_comments") + " [" + stripmask.sub( ' ', self.htmltags.sub('', extrainfos.group( "commenter"))) + "]:\n" + transHTML( self.htmltags.sub( '', extrainfos.group("comment").replace( "\n", ' '))).strip() self["extralabel"].setText(str(Extratext)) self["extralabel"].hide() self["key_blue"].setText(_("Extra Info")) else: self["key_blue"].setText("") self["detailslabel"].setText(str(Detailstext))
if ratingtext != '<span id="voteuser"></span>': text = ratingtext # + " / 10" rating = _("User Rating") + ": " + text else: rating = (_("User Rating") + ": ") # print'[IMDb] IMDBsavetxt rating: ', rating # get the poster.jpg if poster: try: posterurl = self.postermask.search(self.inhtml) if posterurl and posterurl.group(1).find("jpg") > 0: posterurl = posterurl.group(1) postersave = self.savingpath + ".poster.jpg" print("[IMDB] downloading poster " + posterurl + " to " + postersave) download = downloadWithProgress(posterurl,postersave) download.start().addErrback(self.http_failed) except Exception, e: print('[IMDb] IMDBsavetxt exception failure in get poster: ', str(e)) return overview + "\n\n" + runtime + "\n" + genre + "\n" + country + "\n" + release + "\n" + rating + "\n" def openYttrailer(self): try: from Plugins.Extensions.YTTrailer.plugin import YTTrailer, baseEPGSelection__init__ except ImportError as ie: pass if baseEPGSelection__init__ is None: return ytTrailer = YTTrailer(self.session)
def startDownload(self): self.status = "downloading" self.currentDownload = downloadWithProgress(self.url, self.filename) self.currentDownload.addProgress(self.setProgress) self.currentDownload.start().addCallback(self.downloadFinished).addErrback(self.downloadFailed)
def IMDBparse(self): 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").replace(' ',' ').strip() if len(Titeltext) > 57: Titeltext = Titeltext[0:54] + "..." self.title_setText(Titeltext) Detailstext = "" stripmask = re.compile('\s{2,}', re.S) for category in ("originaltitle", "premiere", "country", "runtime", "seasons"): if self.generalinfos.group(category): Detailstext += self.generalinfos.group('g_'+category).title() + ": " + stripmask.sub(' ', self.htmltags.sub('', self.generalinfos.group(category).replace('\n',' ').replace('<br>', '\n').replace('<br />','\n'))).replace(' | ',', ').strip() + "\n" genreblock = self.genreblockmask.findall(self.inhtml) if genreblock: s = '' if len(genreblock) > 1: s = 's' Detailstext += "Genre%s: " % s for x in genreblock: genres = self.htmltags.sub('', x) Detailstext += genres + ", " if Detailstext[-2:] == ", ": Detailstext = Detailstext[:-2] Detailstext += "\n" for category in ("director", "creator", "writer"): if self.generalinfos.group(category): striplink1 = re.compile('<a href="/name/nm\d+\?ref_=tt_ov_.."itemprop=\'url\'>', re.S) striplink2 = re.compile('(<a href="fullcredits\?ref_=tt_ov_..#.*?">)', re.S) Detailstext += self.generalinfos.group('g_'+category) + ": " + striplink2.sub('', striplink1.sub('', stripmask.sub(' ', self.htmltags.sub('', self.generalinfos.group(category)).replace('\n','').replace('|','')))) + "\n" rating = self.ratingmask.search(self.inhtml) Ratingtext = _("no user rating yet") if rating: ratingval = rating.group("rating") if ratingval != '<span id="voteuser"></span>': count = '' if rating.group("ratingcount"): count = ' (' + rating.group("ratingcount").replace(',','.') + ' ' + _("votes") +')' Ratingtext = _("User Rating") + ": " + ratingval + "/10" + count self.ratingstars = int(10*round(float(ratingval.replace(',','.')),1)) self["stars"].show() self["stars"].setValue(self.ratingstars) self["starsbg"].show() self["ratinglabel"].setText(str(Ratingtext)) castresult = self.castmask.finditer(self.inhtml) if castresult: Casttext = "" for x in castresult: Casttext += "\n" + self.htmltags.sub('', x.group('actor')) if x.group('character'): Casttext += " as " + stripmask.sub(' ', self.htmltags.sub('', x.group('character').replace('/ ...','').replace('\n','').replace(' ',''))).strip() if Casttext: Casttext = "Cast: " + Casttext else: Casttext = _("No cast list found in the database.") self["castlabel"].setText(str(Casttext)) storylineresult = self.storylinemask.search(self.inhtml) if storylineresult: Storyline = "" if storylineresult.group("g_storyline"): Storyline = storylineresult.group('g_storyline') + ":\n" + re.sub('\s{5,30}',', ', self.htmltags.sub('', storylineresult.group('storyline').replace('\n','').replace('<br>', '\n').replace('<br />','\n').replace(' ','').replace('"','"').replace('<span class="','')).strip()) if Storyline == storylineresult.group('g_storyline') + ":\n": self["storylinelabel"].hide() else: self["storylinelabel"].setText(str(Storyline)) posterurl = self.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) download = downloadWithProgress(posterurl,localfile,headers=imdb_headers) download.start().addCallback(self.IMDBPoster).addErrback(self.http_failed) else: self.IMDBPoster("kein Poster") extrainfos = self.extrainfomask.search(self.inhtml) if extrainfos: Extratext = "" for category in ("tagline","keywords","cert","mpaa","language","color","aspect","company","sound","locations","trivia","goofs","quotes","crazy","connections"): if extrainfos.group('g_'+category): Extratext += extrainfos.group('g_'+category) + ":\n" + re.sub('\s{5,30}',', ', self.htmltags.sub('', extrainfos.group(category).replace('\n','').replace('<br>', '\n').replace('<br />','\n').replace('&view=simple&sort=alpha&ref_=tt_stry_pl" >',' ').replace(' ','').replace('"','"').replace('|','').replace(' : ',':').replace(', ',' / ')).strip()) + "\n\n" if extrainfos.group("g_comments"): stripmask = re.compile('\s{2,}', re.S) Extratext += extrainfos.group("g_comments") + " [" + stripmask.sub(' ', self.htmltags.sub('', extrainfos.group("commenter"))) + "]:\n" + transHTML(self.htmltags.sub('',extrainfos.group("comment").replace("\n",' '))).strip() self["extralabel"].setText(str(Extratext)) self["extralabel"].hide() self["key_blue"].setText(_("Extra Info")) else: self["key_blue"].setText("") self["detailslabel"].setText(str(Detailstext))