def __init__(self, session, spath, moviename):
		Screen.__init__(self, session)
		self.session = session
#		self.service = service
		self.spath = spath
		self["actions"] = HelpableActionMap(self, "EMCMovieInfo",
		{
			"EMCEXIT":		self.exit,
			"EMCOK":		self.ok,
			"EMCMenu":		self.setup,
			"EMCINFO":		self.info,
		}, -1)

		self.onLayoutFinish.append(self.layoutFinished)
#		(moviepath,ext) = os.path.splitext(service.getPath())  #do we need this line ?

		self.moviename = getMovieNameWithoutExt(moviename)
		moviename = getMovieNameWithoutPhrases(self.moviename) 

		self["movie_name"] = Label(_("Search results for:") + "   " + moviename)
		self["setup"] = Label(_("Setup"))
		self["save"] = Label(_("Save"))
		self["movieinfo"] = Label(_("Movie Info"))

		movielist = getMovieList(moviename)
		if movielist is not None:
			self["movielist"] = MenuList(movielist[0])
			self["resulttext"] = Label(str(movielist[1]) + " " + _("movies found!"))
		else:
			self["movielist"] = MenuList([])
			self["resulttext"] = Label(_("An error occured! Internet connection broken?"))
Ejemplo n.º 2
0
	def display_exist(self, search_title, path):
		self.counter += 1
		self.counter_exist = self.counter_exist + 1
		search_title = getMovieNameWithoutPhrases(getMovieNameWithoutExt(search_title))
		self.count = ("%s: %s " + _("from") + " %s") % (self.showSearchSiteName, self.counter, self.count_movies)
		self["info"].setText(self.count)
		self["m_info"].setText(search_title)
		self["exist"].setText(_("Exist: %s") % str(self.counter_exist))
		self.menulist.append(imdb_show(search_title, path, _("Exist"), "", search_title))
		self["menulist"].l.setList(self.menulist)
		self["menulist"].l.setItemHeight(28)
		if self.count_movies == self.counter:
			self.check = "true"
			self.init_ende()
Ejemplo n.º 3
0
	def display_download(self, movie_title, search_title, path):
		self.counter += 1
		self.counter_download = self.counter_download + 1
		search_title = getMovieNameWithoutPhrases(getMovieNameWithoutExt(search_title))
		self.end_time = time.clock()
		elapsed = (self.end_time - self.start_time) * 10
		self.count = ("%s: %s " + _("from") + " %s") % (self.showSearchSiteName, self.counter, self.count_movies)
		self["info"].setText(self.count)
		self["m_info"].setText(movie_title)
		self["download"].setText(_("Download: %s") % str(self.counter_download))
		self.menulist.append(imdb_show(movie_title, path, str(elapsed), "", search_title))
		self["menulist"].l.setList(self.menulist)
		self["menulist"].l.setItemHeight(28)
		if self.count_movies == self.counter:
			self.check = "true"
			self.init_ende()
Ejemplo n.º 4
0
    def __init__(self, session, spath, moviename):
        Screen.__init__(self, session)
        self.session = session
        #		self.service = service
        self.spath = spath
        self["actions"] = HelpableActionMap(
            self, "EMCMovieInfo", {
                "EMCEXIT": self.exit,
                "EMCOK": self.ok,
                "EMCMenu": self.setup,
                "EMCINFO": self.info,
            }, -1)

        self.onLayoutFinish.append(self.layoutFinished)
        #		(moviepath,ext) = os.path.splitext(service.getPath())  #do we need this line ?

        self.moviename = getMovieNameWithoutExt(moviename)
        moviename = getMovieNameWithoutPhrases(self.moviename)

        self["movie_name"] = Label(
            _("Search results for:") + "   " + moviename)
        self["setup"] = Label(_("Setup"))
        self["save"] = Label(_("Save"))
        self["movieinfo"] = Label(_("Movie Info"))

        response = self.fetchdata(
            "http://api.themoviedb.org/3/search/movie?api_key=8789cfd3fbab7dccf1269c3d7d867aff&query="
            + moviename.replace(" ", "+"))
        if response is not None:
            movies = response["results"]
            movielist = []
            for mov in movies:
                movielist.append((_(str(mov["title"])), mov["id"]))

            self["movielist"] = MenuList(movielist)
            self["resulttext"] = Label(
                str(len(movies)) + " " + _("movies found!"))
        else:
            self["movielist"] = MenuList([])
            self["resulttext"] = Label(
                _("An error occured! Internet connection broken?"))
Ejemplo n.º 5
0
	def openPlaylistCB(self, path):
		if path:
			plist = open(path, "r")
			from MovieCenter import getPlayerService, getMovieNameWithoutExt, getMovieNameWithoutPhrases
			emcplaylist.delCurrentPlaylist()
			if os.path.splitext(path)[1] == ".e2pls":
				while True:
					service = plist.readline()
					if service == "":
						break
					service = service.replace('\n','')
					spos = service.find('/')
					servicepath = service[spos:]
					service = servicepath.split('/')[-1]
					ext = os.path.splitext(servicepath)[1]
					name = getMovieNameWithoutExt(service)
					name = getMovieNameWithoutPhrases(name)
					service = getPlayerService(servicepath, service, ext)
					added = emcplaylist.addToCurrentPlaylist(servicepath, name, service)

			if added:
				self["playlist"].readPlaylist()
				self["playlist"].refreshList()
	def verwaltung(self):
		self.menulist = []
		self.count_movies = len(self.m_list)
		self.vm_list = self.m_list[:]
		count_existing = 0
		count_na = 0

		for each in sorted(self.vm_list):
			(title, path) = each
			title = getMovieNameWithoutPhrases(getMovieNameWithoutExt(title))
			path = re.sub(self.file_format + "$", '.jpg', path)
			if os.path.exists(path):
				count_existing += 1
				self.menulist.append(imdb_show(title, path, _("Exist"), "", title))
			else:
				count_na += 1
				self.menulist.append(imdb_show(title, path, _("N/A"), "", title))

		if self.menulist:
			self["menulist"].l.setList(self.menulist)
			self["menulist"].l.setItemHeight(image())
			self.check = True
			self.showInfo()
			self["done_msg"].setText((_("Total") + ": %s - " + _("Exist") + ": %s - " + _("N/A") + ": %s") % (self.count_movies, count_existing, count_na))
	def __init__(self, session, spath, moviename):
		Screen.__init__(self, session)
		self.session = session
#		self.service = service
		self.spath = spath
		self["actions"] = HelpableActionMap(self, "EMCMovieInfo",
		{
			"EMCEXIT":		self.exit,
			"EMCOK":		self.ok,
			"EMCMenu":		self.setup,
			"EMCINFO":		self.info,
		}, -1)

		self.onLayoutFinish.append(self.layoutFinished)
#		(moviepath,ext) = os.path.splitext(service.getPath())  #do we need this line ?

		self.moviename = getMovieNameWithoutExt(moviename)
		moviename = getMovieNameWithoutPhrases(self.moviename) 

		self["movie_name"] = Label(_("Search results for:") + "   " + moviename)
		self["setup"] = Label(_("Setup"))
		self["save"] = Label(_("Save"))
		self["movieinfo"] = Label(_("Movie Info"))

		response=self.fetchdata("http://api.themoviedb.org/3/search/movie?api_key=8789cfd3fbab7dccf1269c3d7d867aff&query=" + moviename.replace(" ","+"))
		if response is not None:
			movies = response["results"]
			movielist = []
			for mov in movies:
				movielist.append((_(str(mov["title"])), mov["id"]))

			self["movielist"] = MenuList(movielist)
			self["resulttext"] = Label(str(len(movies)) + " " + _("movies found!"))
		else:
			self["movielist"] = MenuList([])
			self["resulttext"] = Label(_("An error occured! Internet connection broken?"))
Ejemplo n.º 8
0
	def verwaltung(self):
		self.menulist = []
		self.count_movies = len(self.m_list)
		self.vm_list = self.m_list[:]
		count_existing = 0
		count_na = 0

		for each in sorted(self.vm_list):			
			(title, path) = each
			title = getMovieNameWithoutPhrases(getMovieNameWithoutExt(title))
			path = re.sub(self.file_format + "$", '.jpg', path)
			if os.path.exists(path):
				count_existing += 1
				self.menulist.append(imdb_show(title, path, _("Exist"), "", title))
			else:
				count_na += 1
				self.menulist.append(imdb_show(title, path, _("N/A"), "", title))

		if self.menulist:
			self["menulist"].l.setList(self.menulist)
			self["menulist"].l.setItemHeight(28)
			self.check = "true"
			self.showInfo()
			self["done_msg"].setText((_("Total") + ": %s - " + _("Exist") + ": %s - " + _("N/A") + ": %s") % (self.count_movies, count_existing, count_na))
	def imdb(self):
		if self.running:
			print "EMC iMDB: Search already Running."

		elif not self.running:
			print "EMC iMDB: Search started..."
			self["done_msg"].show()
			self.no_cover()
			self.running = True
			self.counter_download = 0
			self.counter_exist = 0
			self.counter_no_poster = 0
			self.t_elapsed = 0
			self.menulist = []
			self.count_movies = len(self.m_list)
			self["exist"].setText(_("Exist: %s") % "0")
			self["no_poster"].setText(_("No Cover: %s") % "0")
			self["download"].setText(_("Download: %s") % "0")
			self["done_msg"].setText(_("Searching..."))
			self.starttime = 0
			self.t_start_time = time.clock()
			self.s_supertime = time.time()
			self.cm_list = self.m_list[:]
			self.search_list = []
			self.exist_list = []
			self.check = False
			self["done_msg"].setText(_("Creating Search List.."))
			self.counting = 0
			self.count_total = len(self.cm_list)
			urls = []
			for each in sorted(self.cm_list):
				(title, path) = each
				cover_path = re.sub(self.file_format + "$", '.jpg', path)
				if os.path.exists(cover_path):
					self.counter_exist += 1
					self.counting += 1
					self.menulist.append(imdb_show(title, cover_path, _("Exist"), "", title))
					self["m_info"].setText(title)
					self["no_poster"].setText(_("No Cover: %s") % str(self.counter_no_poster))
					self["exist"].setText(_("Exist: %s") % str(self.counter_exist))
					self["download"].setText(_("Download: %s") % str(self.counter_download))
					self["menulist"].l.setList(self.menulist)
					self["menulist"].l.setItemHeight(image())
					self.check = True
					print "EMC iMDB: Cover vorhanden - %s" % title
				else:
					filename = path
					title = getMovieNameWithoutPhrases(getMovieNameWithoutExt(title))
					if re.search('[Ss][0-9]+[Ee][0-9]+', title) is not None:
						season = None
						episode = None
						seasonEpisode = re.findall('.*?[Ss]([0-9]+)[Ee]([0-9]+)', title, re.S|re.I)
						if seasonEpisode:
							(season, episode) = seasonEpisode[0]
						name2 = re.sub('[Ss][0-9]+[Ee][0-9]+.*[a-zA-Z0-9_]+','', title, flags=re.S|re.I)
						url = 'http://thetvdb.com/api/GetSeries.php?seriesname=%s&language=de' % name2.replace(' ','%20')
						urls.append(("serie", title, url, cover_path, season, episode))
					else:
						url = 'http://api.themoviedb.org/3/search/movie?api_key=8789cfd3fbab7dccf1269c3d7d867aff&query=%s&language=de' % title.replace(' ','%20')
						urls.append(("movie", title, url, cover_path, None, None))

			if len(urls) != 0:
				ds = defer.DeferredSemaphore(tokens=2)
				downloads = [ds.run(self.download, url).addCallback(self.parseWebpage, type, title, url, cover_path, season, episode).addErrback(self.dataError) for type, title, url, cover_path, season, episode in urls]
				finished = defer.DeferredList(downloads).addErrback(self.dataError2)
			else:
				self["done_msg"].setText(_("No Movies found!"))
Ejemplo n.º 10
0
    def __init__(self, session, moviename, spath=None):
        Screen.__init__(self, session)
        #self.session = session
        self.moviename = getMovieNameWithoutExt(moviename)
        moviename = getMovieNameWithoutPhrases(self.moviename)
        self.movielist = None
        self.spath = spath
        self["previewcover"] = Pixmap()
        self.picload = ePicLoad()
        try:
            self.picload_conn = self.picload.PictureData.connect(
                self.showPreviewCoverCB)
        except:
            self.picload.PictureData.get().append(self.showPreviewCoverCB)
        self.previewTimer = eTimer()
        try:
            self.previewTimer_conn = self.previewTimer.timeout.connect(
                self.showPreviewCover)
        except:
            self.previewTimer.callback.append(self.showPreviewCover)
        self.selectionTimer = eTimer()
        try:
            self.selectionTimer_conn = self.selectionTimer.timeout.connect(
                self.updateSelection)
        except:
            self.selectionTimer.callback.append(self.updateSelection)
        self["previewlist"] = MenuList([])
        self.page = 0
        self.id = None
        self.cat = None
        self["contenttxt"] = ScrollLabel()
        self["runtime"] = Label("")
        self["runtimetxt"] = Label("")
        self["genre"] = Label("")
        self["genretxt"] = Label("")
        self["country"] = Label("")
        self["countrytxt"] = Label("")
        self["release"] = Label("")
        self["releasetxt"] = Label("")
        self["rating"] = Label("")
        self["ratingtxt"] = Label("")
        self["stars"] = ProgressBar()
        self["starsbg"] = Pixmap()
        self["stars"].hide()
        self["starsbg"].hide()
        self["setup"] = Label(_("Setup"))
        self["key_menu"] = Pixmap()
        self["save"] = Label(_("Save"))
        self["key_green"] = Pixmap()
        self.ratingstars = -1
        self.movielist = getMovieList(moviename)
        if self.movielist is not None:
            self["previewlist"] = MenuList(self.movielist[0])
            if self.movielist[1] > 1:
                self.page = 1
                self["movie_name"] = Label(
                    _("Search results for:") + "   " + moviename)
            else:
                self.page = 0
                sel = self["previewlist"].l.getCurrentSelection()
                if sel is not None:
                    preview = getMovieInfo(sel[1], sel[2])
                    if preview is not None:
                        self.id = sel[1]
                        self.cat = sel[2]
                self["previewlist"].hide()
                self["movie_name"] = Label(
                    _("Movie Information Preview for:") + "   " + moviename)
        else:
            self["movie_name"] = Label(
                _("Search results for:") + "   " + moviename)
            self["contenttxt"].setText(_("Nothing was found !"))

        # for file-operations
        self.txtsaved = False
        self.jpgsaved = False
        self.mpath = None

        self.onLayoutFinish.append(self.layoutFinished)
        self["actions"] = HelpableActionMap(
            self,
            "EMCMovieInfo",
            {
                "EMCEXIT": self.exit,
                "EMCUp": self.pageUp,
                "EMCDown": self.pageDown,
                "EMCOK": self.ok,
                "EMCGreen": self.save,
                "EMCMenu": self.setup,
                #"EMCINFO":	self.info,
                #"EMCRed":	self.red,
            },
            -1)
        self["previewlist"].onSelectionChanged.append(self.selectionChanged)
	def __init__(self, session, moviename, spath=None):
		Screen.__init__(self, session)
		#self.session = session
		self.moviename = getMovieNameWithoutExt(moviename)
		moviename = getMovieNameWithoutPhrases(self.moviename)
		self.movielist = None
		self.spath = spath
		self["previewcover"] = Pixmap()
		self.picload = ePicLoad()
		try:
			self.picload_conn = self.picload.PictureData.connect(self.showPreviewCoverCB)
		except:
			self.picload.PictureData.get().append(self.showPreviewCoverCB)
		self.previewTimer = eTimer()
		try:
			self.previewTimer_conn = self.previewTimer.timeout.connect(self.showPreviewCover)
		except:
			self.previewTimer.callback.append(self.showPreviewCover)
		self.selectionTimer = eTimer()
		try:
			self.selectionTimer_conn = self.selectionTimer.timeout.connect(self.updateSelection)
		except:
			self.selectionTimer.callback.append(self.updateSelection)
		self["previewlist"] = MenuList([])
		self.page = 0
		self.id = None
		self.cat = None
		self["contenttxt"] = ScrollLabel()
		self["runtime"] = Label("")
		self["runtimetxt"] = Label("")
		self["genre"] = Label("")
		self["genretxt"] = Label("")
		self["country"] = Label("")
		self["countrytxt"] = Label("")
		self["release"] = Label("")
		self["releasetxt"] = Label("")
		self["rating"] = Label("")
		self["ratingtxt"] = Label("")
		self["stars"] = ProgressBar()
		self["starsbg"] = Pixmap()
		self["stars"].hide()
		self["starsbg"].hide()
		self["setup"] = Label(_("Setup"))
		self["key_menu"] = Pixmap()
		self["save"] = Label(_("Save"))
		self["key_green"] = Pixmap()
		self.ratingstars = -1
		self.movielist = getMovieList(moviename)
		if self.movielist is not None:
			self["previewlist"] = MenuList(self.movielist[0])
			if self.movielist[1] > 1:
				self.page = 1
				self["movie_name"] = Label(_("Search results for:") + "   " + moviename)
			else:
				self.page = 0
				sel = self["previewlist"].l.getCurrentSelection()
				if sel is not None:
					preview = getMovieInfo(sel[1], sel[2])
					if preview is not None:
						self.id = sel[1]
						self.cat = sel[2]
				self["previewlist"].hide()
				self["movie_name"] = Label(_("Movie Information Preview for:") + "   " + moviename)
		else:
			self["movie_name"] = Label(_("Search results for:") + "   " + moviename)
			self["contenttxt"].setText(_("Nothing was found !"))

		# for file-operations
		self.txtsaved = False
		self.jpgsaved = False
		self.mpath = None

		self.onLayoutFinish.append(self.layoutFinished)
		self["actions"] = HelpableActionMap(self, "EMCMovieInfo",
		{
			"EMCEXIT":	self.exit,
			"EMCUp":	self.pageUp,
			"EMCDown":	self.pageDown,
			"EMCOK":	self.ok,
			"EMCGreen":	self.save,
			"EMCMenu":	self.setup,
			#"EMCINFO":	self.info,
			#"EMCRed":	self.red,
		}, -1)
		self["previewlist"].onSelectionChanged.append(self.selectionChanged)
Ejemplo n.º 12
0
	def imdb_start(self):
		self["done_msg"].setText(_("Searching.."))
		self.starttime = time.time()
		self.run10 = "false"
		for i in xrange(10):
			#if self.search_list:
			if not len(self.search_list) == 0:
				(title, path) = self.search_list.pop()
				title = getMovieNameWithoutPhrases(getMovieNameWithoutExt(title))

				self.start_time = time.clock()

				if config.EMC.imdb.search.value == "0":
					self.name = title.replace(' ','.').replace(':','.').replace('..','.')
					path = re.sub(self.file_format + "$", '.jpg', path)
					search_title = self.name.replace('.',' ')

					if not os.path.exists(path):
						self.counter3 += 1
						url = "http://www.imdbapi.com/?t=" + self.name.replace('ö','%F6').replace(' ','%20').replace('.','%20')
						print "EMC imdbapi.com:", url
						getPage(url, timeout = 10).addCallback(self.imdbapi, search_title, path).addErrback(self.errorLoad, search_title)

				if config.EMC.imdb.search.value == "1":
					self.name = title.replace(' ','+').replace(':','+').replace('-','').replace('++','+')
					path = re.sub(self.file_format + "$", '.jpg', path)
					search_title = self.name.replace('+',' ')

					if not os.path.exists(path):
						self.counter3 += 1
						url = "http://api.themoviedb.org/2.1/Movie.search/de/xml/8789cfd3fbab7dccf1269c3d7d867aff/" + self.name
						print "EMC themoviedb.org:", url
						getPage(url, timeout = 10).addCallback(self.themoviedb, search_title, path).addErrback(self.errorLoad, search_title)

				if config.EMC.imdb.search.value == "2":
					self.name = title.replace(' ','+').replace(':','+').replace('-','').replace('++','+')
					path = re.sub(self.file_format + "$", '.jpg', path)
					search_title = self.name.replace('+',' ')

					if not os.path.exists(path):
						self.counter3 += 1
						url = "http://ofdbgw.home-of-root.de/search/%s" % self.name
						#url = "http://ofdbgw.home-of-root.de/search/" + self.name
						print "EMC ofdb.de:", url				
						getPage(url).addCallback(self.ofdb_search, search_title, path).addErrback(self.errorLoad, search_title)

				if config.EMC.imdb.search.value == "3":
					self.name = title.replace(':', ' ').replace('-', ' ').replace('++', '+')
					path = re.sub(self.file_format + "$", '.jpg', path)
					search_title = urllib.quote(self.name.replace('+', ' '))

					if not os.path.exists(path):
						self.counter3 += 1
						url = "http://www.csfd.cz/hledat/?q=%s" % search_title
						print "EMC csfd.cz:", url				
						getPage(url).addCallback(self.csfd_search, self.name, path).addErrback(self.errorLoad, self.name)

			else:
				print "EMC iMDB: MovieList is empty, search is DONE. - BREAK..."
				#self.e_supertime = time.time()
				#total_movie = self.counter3 + self.counter2 
				#total_time = self.e_supertime - self.s_supertime
				#avg = (total_time / total_movie)
				#self.done = _("%s Filme in %.1f sec gefunden. Avg. Speed: %.1f sec") % (total_movie, total_time, avg) 
				#self["done_msg"].setText(self.done)
				#self.running = "false"
				break