コード例 #1
0
	def __init__(self):
		printl("->", self, "S")
		
		try:
			makedirs(config.plugins.pvmc.configfolderpath.value)
		except OSError, ex: 
			printl("Exception(" + str(type(ex)) + "): " + str(ex), self, "E")
コード例 #2
0
	def preLoadData(self):
		printl("->", self, "S")
		self._setInstalledRevision()
		self._setCurrentUpdateType()
		self._setUpdateXmlDict()
		self._setLatestRevisionAndUrl()
		printl("<-", self, "C")
コード例 #3
0
ファイル: MediaInfo.py プロジェクト: TELE-TWIN/ProjectValerie
	def isNfoAvailable(self, name):
		try:
			printl("Check presence of nfo file: " + Utf8.utf8ToLatin(name + u".nfo"), self, "I")
			if os.path.isfile(Utf8.utf8ToLatin(name + u".nfo")):
				return True
		except Exception, ex:
			printl("Exception (ef): " + str(ex), self, "E")
コード例 #4
0
ファイル: MediaInfo.py プロジェクト: TELE-TWIN/ProjectValerie
	def __str__(self):
		ustr = u""
		try:
			ustr = self.Path + u" / " + self.Filename + u" . " + self.Extension
			ustr += u"\n\tType:         " + self.strMediaType(self.getMediaType())
			ustr += u"\n\tImdbId:       " + self.ImdbId
			ustr += u"\n\tTheTvDbId:    " + self.TheTvDbId
			ustr += u"\n\tTitle:        " + self.Title
			ustr += u"\n\tSearchString: " + self.SearchString
			ustr += u"\n\tYear:         " + unicode(self.Year)
			ustr += u"\n\tMonth:        " + unicode(self.Month)
			ustr += u"\n\tDay:          " + unicode(self.Day)
			ustr += u"\n\tResolution:   " + self.Resolution
			ustr += u"\n\tSound:        " + self.Sound
			#ustr += "\n\tAlternatives:  " + unicode(self.Alternatives)
			#ustr += "\n\tDirectors:     " + unicode(self.Directors)
			#ustr += "\n\tWriters:       " + unicode(self.Writers)
			ustr += "\n\tRuntime:       " + unicode(self.Runtime)
			ustr += "\n\tGenres:        " + unicode(self.Genres)
			ustr += "\n\tTagLine:       " + self.Tag
			ustr += "\n\tPopularity:    " + unicode(self.Popularity)
			ustr += "\n\tPlot:          " + self.Plot
			if self.isTypeEpisode():
				ustr += "\n\tSeason:        " + unicode(self.Season)
				ustr += "\n\tEpisode:       " + unicode(self.Episode)
			ustr += "\n\n"
			#ustr += "\n\tPoster:	   " + unicode(self.Poster)
			#ustr += "\n\tBackdrop:	 " + unicode(self.Backdrop)
			#ustr += "\n\n"
			#printl("type(ustr): " + str(type(ustr)), self)
		
		except Exception, ex:
			printl("Exception (ef): " + str(ex), self, "E")
コード例 #5
0
def decode_htmlentities(string):
	def substitute_entity(match):
		ent = match.group(3)
		if match.group(1) == "#":
			# decoding by number
			if match.group(2) == '':
				# number is in decimal
				return unichr(int(ent))
			elif match.group(2) == 'x':
				# number is in hex
				return unichr(int('0x'+ent, 16))
		else:
			# they were using a name
			cp = n2cp.get(ent)
			if cp: return unichr(cp)
			else: return match.group()
	
	entity_re = re.compile(r'&(#?)(x?)(\w+);')
	try:
		var = entity_re.subn(substitute_entity, string)[0]
	except Exception, ex:
		printl("Exception: " + str(ex), __name__)
		#source_encoding = "iso-8859-1"
		#string = string.encode(source_encoding)
		#string = unicode(string, 'utf-8')
		#var = entity_re.subn(substitute_entity, string)[0]
		var = None
コード例 #6
0
ファイル: MediaInfo.py プロジェクト: TELE-TWIN/ProjectValerie
	def isEnigma2Recording(self, name):
		try:
			if os.path.isfile(Utf8.utf8ToLatin(name + u".meta")):
				printl("Found E2 meta file: " + str(Utf8.utf8ToLatin(name + u".meta")), self)
				return True
		except Exception, ex:
			printl("Exception (ef): " + str(ex), self, "E")
コード例 #7
0
	def __init__(self, session):
		printl("->", self, "S")
		Screen.__init__(self, session)
		
		self.APILevel = getAPILevel(self)
		printl("APILevel=" + str(self.APILevel), self)
		
		if self.APILevel >= 2:
			self["API"] = DataElement()
			
		if self.APILevel == 1:
			self.skin = PVMC_Update.skinDeprecated
		
		self.working = False
		self.Console = Console()
		self["text"] = ScrollLabel(_("Checking for updates ..."))
		
		self["actions"] = NumberActionMap(["WizardActions", "InputActions", "EPGSelectActions"],
		{
			"ok": self.close,
			"back": self.close
		}, -1)
		
		self.onLayoutFinish.append(self.setCustomTitle)
		self.onFirstExecBegin.append(self.checkForUpdate)
コード例 #8
0
ファイル: sync.py プロジェクト: TELE-TWIN/ProjectValerie
def checkDefaults():
	
	try:
		printl("Check " + config.plugins.pvmc.tmpfolderpath.value, __name__)
		os.makedirs(config.plugins.pvmc.tmpfolderpath.value) 
	except OSError, e:
		printl("\t- OK", __name__)
コード例 #9
0
ファイル: Manager.py プロジェクト: TELE-TWIN/ProjectValerie
	def syncElement(self, path, filename, extension, imdbid, istvshow, oldelement=None):
		printl(str(path) + " " + str(filename) + " " + str(extension) + " " + str(imdbid) + " " + str(istvshow), self)
		
		element = None
		
		if oldelement is None:
			element = MediaInfo(path, filename, extension)
			element.parse()
			element.ImdbId = imdbid
		else:
			element = oldelement #.copy()
		
		if istvshow:
			element.setMediaType(MediaInfo.SERIE)
		else:
			element.setMediaType(MediaInfo.MOVIE)
		
		results = Sync().syncWithId(element)
		if results is not None:
			return results
		else:
			if istvshow is False:
				element.setMediaType(MediaInfo.SERIE)
			else:
				element.setMediaType(MediaInfo.MOVIE)
			
			results = Sync().syncWithId(element)
			if results is not None:
				return results
		return None
コード例 #10
0
ファイル: Manager.py プロジェクト: TELE-TWIN/ProjectValerie
	def insertMediaWithDict(self, type, key_value_dict):
		key_value_dict["MediaType"] = type
		ret = self.db.insertMediaWithDict(key_value_dict)
		if ret["status"]<=0:
			printl("Insert Media - Failed " + ret["message"], self)	
			
		return ret
コード例 #11
0
	def getSeasonArtByTheTvDbId(self, info):
		url = self.apiSeriesByID;
		url = re.sub("<seriesid>", info.TheTvDbId, url)
		url = re.sub("<lang>", u"banners", url)
		xml = WebGrabber.getXml(url, cache=False);
		
		if xml is None:
			WebGrabber.removeFromCache(url)
			printl(" <- None (xml is None)", self)
			return None
		
		movieList = xml.getElementsByTagName("Banners")
		seasonsFound = []
		info.SeasonPoster.clear()
		for eMovie in movieList:
			for p in eMovie.getElementsByTagName("Banner"):
				bannerType = p.getElementsByTagName("BannerType")[0].childNodes[0].data
				bannerType2 = p.getElementsByTagName("BannerType2")[0].childNodes[0].data
				bannerPath = p.getElementsByTagName("BannerPath")[0].childNodes[0].data
				if bannerType == "season" and bannerType2 == "season":
					season = p.getElementsByTagName("Season")[0].childNodes[0].data
					if season not in seasonsFound:
						seasonsFound.append(season)
						info.SeasonPoster[str(season)] = self.apiArt + bannerPath
		if len(info.SeasonPoster.values()) > 0:
			return info
		
		return None
コード例 #12
0
	def standby(self):
		printl("->", self, "S")
		import Screens.Standby
		if config.plugins.pvmc.onpowerpress.value == "Standby":
			self.session.open(Screens.Standby.Standby)
		else:
			self.session.open(Screens.Standby.TryQuitMainloop, 1)
コード例 #13
0
	def __init__(self):
		printl("->", self, "S")
		
		try:
			self.load()
		except Exception, ex: 
			printl("Exception(" + str(type(ex)) + "): " + str(ex), self, "E")
コード例 #14
0
def autostart(session):
	printl("autostart->")
	try:
		thread = BackgroundDbLoader(session)
		thread.start()
	except Exception, ex:
		printl("Exception(Can be ignored): " + str(ex), __name__, "W")
コード例 #15
0
	def _getMediaFiles(self, mediaType=None, statusOk=True, getAll=False): # for dump only
		printl("->", self, "S")
		newList	= {}
		
		self._mediaFilesCheckLoaded()
		start_time = time.time()
		addRecord = False
		if (getAll):
			for key in self._dbMediaFiles:
				newList[key] = self._dbMediaFiles[key]
		else:
			for key in self._dbMediaFiles:
				if self._checkKeyValid(key):
					#printl("compare*"+str(self._dbMediaFiles[key].getMediaType())+"*"+str(mediaType))
					# check media type
					if mediaType is not None and self._dbMediaFiles[key].getMediaType() != mediaType:
						continue
					#check Status
					if statusOk and not self._dbMediaFiles[key].isStatusOk():
						continue
					if not statusOk and self._dbMediaFiles[key].isStatusOk():
						continue
							
					newList[key] = self._dbMediaFiles[key]

		elapsed_time = time.time() - start_time
		printl("Took: " + str(elapsed_time), self)
		return newList # return always a copy, user don't use db
コード例 #16
0
	def _insertFakeSerie (self, forSerie):
		printl("_insertFake", self)
		fake = MediaInfo()
		fake.MediaType = MediaInfo.SERIE
		fake.TheTvDbId = forSerie
		fake.Title = "AutoInserted for serie: "+ str(forSerie)
		return self.insertMedia(fake)
コード例 #17
0
	def saveTablesDB(self):
		printl("->", self, "S")
		if self.TablesCommited:
			printl("Nothing to Commit", self)
			return
		start_time = time.time()
		try:
			fd = open(self.TABLESDB + ".new", "wb")
			pickle.dump(self._dbTables, fd, pickle.HIGHEST_PROTOCOL)
			fd.close()
			
			#Makes sure that if saveing fails that at least the db is not lost
			if os.path.exists(self.TABLESDB):
				os.remove(self.TABLESDB)
				
			os.rename(self.TABLESDB + ".new", self.TABLESDB)
			
			self.TablesCommited = True
			
		except Exception, ex:
			print ex
			print '-'*60
			import sys, traceback
			traceback.print_exc(file=sys.stdout)
			print '-'*60
コード例 #18
0
	def _getMediaKeyWithTheTvDbId(self, thetvdbid, mediaType=None):
		#printl("->", self, "S")
		
		self._mediaFilesCheckLoaded()
		#start_time = time.time()
		k = None
		if self.USE_INDEXES:
			pass
		else:			
			# without indexing 0.02
			for key in self._dbMediaFiles:
				if self._checkKeyValid(key):		# only for Pickle					
					if self._dbMediaFiles[key].TheTvDbId == thetvdbid:
						if mediaType is None:
							printl("result key: "+ str(key)+ "  for thetvdbid:" + str(thetvdbid), self, "H")
							k = key
							break
						elif self._dbMediaFiles[key].MediaType == mediaType:
							printl("result key: "+ str(key)+ "  for thetvdbid: " + str(thetvdbid) + " with mediaType: " + str(mediaType), self, "H")
							k = key
							break
							
		#elapsed_time = time.time() - start_time
		#printl("Took: " + str(elapsed_time), self)
		return k
コード例 #19
0
	def _getDBVersion(self, records):
		printl("->", self, "S")
		if records.has_key(self.CONFIGKEY):
			return records[self.CONFIGKEY]
		else:
			printl("DB without version")
			return 0
コード例 #20
0
	def _upgradeMediaFiles(self, records):
		#printl("->", self, "S")
		currentDBVersion = self._getDBVersion(records)
		printl("DBVersion: " + str(currentDBVersion))
		if self.DB_VERSION_MEDIAFILES < 5:
			printl("DB Not correctly updated!!!!!!, aborting....")
			os.abort()
			
		elif self.DB_VERSION_MEDIAFILES == currentDBVersion:
			printl("DB already updated!")
		else:
			printl("Upgrading database to version: " + str(self.DB_VERSION_MEDIAFILES) )
			#   Let's run some Upgrade Scripts... :)
			for updateToVersion in range(currentDBVersion+1, self.DB_VERSION_MEDIAFILES+1):
				printl("Applying upgrade to version : " + str(updateToVersion))
				if updateToVersion==6:
					self._upgrade_MF_6()
					self._setDBVersion(records, updateToVersion)
				elif updateToVersion==7:
					pass
					#self._upgrade_MF_7()
					#self._setDBVersion(records, updateToVersion)
				elif updateToVersion==8:
					pass
				
			self.saveMediaFiles()
コード例 #21
0
def autostart(session):
	printl("autostart->")
	try:
		thread = InternetTime(session)
		thread.start()
	except Exception, ex:
		printl("Exception(Can be ignored): " + str(ex), __name__, "W")
コード例 #22
0
	def getRuntime(self, info, html):
		printl("->", self)
		runtime = self.getDetails(html)
		if runtime is None:
			printl("<- (if runtime is None: a)", self, "W")
			return None
		#print "runtime", runtime
		pos = runtime.find(self.DIV_RUNTIME_START)
		if pos < 0:
			#printl("Details " + runtime, self, "W")
			printl("<- (if pos < 0: b)", self, "W")
			return None
		
		runtime = runtime[pos + len(self.DIV_RUNTIME_START):]
		
		pos = runtime.find(self.DIV_RUNTIME_END)
		if pos < 0:
			printl("<- (if pos < 0: c)", self, "W")
			return None
		runtime = runtime[0:pos]
		runtime = runtime.strip()
		
		runtime = runtime.split(" ")
		try:
			if len(runtime) == 2:
				info.Runtime = int(runtime[0])
			elif len(runtime) == 4:
				info.Runtime = int(runtime[0]) * 60 + int(runtime[2])
		except Exception, ex:
			printl("Exception: " + str(ex), self, "E")
			return None
コード例 #23
0
	def getVotes(self, info, html):
		#print "getVotes ->"
		votes = html
		
		pos = votes.find(self.DIV_VOTES_START)
		if pos < 0:
			#print "getVotes <-", "pos < 0: a"
			return None
		
		votes = votes[pos + len(self.DIV_VOTES_START):]
		
		pos = votes.find(self.DIV_VOTES_END)
		if pos < 0:
			#print "getVotes <-", "pos < 0: b"
			return None
		
		votes = votes[0:pos]
		
		votes = re.sub("<strong>", "", votes)
		votes = votes.strip()
		
		if len(votes) > 2:
			try:
				votes = votes.split(".")[0]
			except Exception, ex:
				printl("Exception: " + str(ex), self)
コード例 #24
0
	def __init__(self, session, libraryName, loadLibrary, playEntry, viewName, select=None, sort=None, filter=None):
		
		self.showiframe = Showiframe()
		
		DMC_View.__init__(self, session, libraryName, loadLibrary, playEntry, viewName, select, sort, filter)
		
		self["poster"]  = Pixmap()
		self["title"] = Label()
		
		if self.APILevel >= 5:
			self["shortDescriptionContainer"] = Label()
			self["cnt_poster"]  = Pixmap()
			self["cnt_title"] = Label()
			self["cnt_shortDescription"] = Label()
		
		self["key_red"] = StaticText(_("Sort: ") + _("Default"))
		self["key_green"] = StaticText("")
		self["key_yellow"] = StaticText("")
		self["key_blue"] = StaticText(self.viewName[0])
		
		try:
			from StillPicture import StillPicture
			self["backdrop"] = StillPicture(session)
			self.ShowStillPicture = True
		except Exception, ex:
			printl("Exception: " + str(ex), self)
コード例 #25
0
	def getLanguage(self, elem):
		try:
			eLang = self.getElem(elem, "Language")
			if eLang is not None and eLang.data is not None and len(eLang.data) > 0:
				return eLang.data
		except Exception, ex:
			printl("Exception: " + str(ex), self)
コード例 #26
0
	def insertMediaWithDict(self, key_value_dict):
		printl("->", self, "S")
		type = key_value_dict["MediaType"]
		
		m = MediaInfo()
		self._fillMediaInfo(m, key_value_dict)
		
		return self.insertMedia(m)
コード例 #27
0
def haveRTC():
	try:
		rtc = open("/proc/stb/fp/rtc", "r")
		time = rtc.readline().strip()
		if len(time) > 0 and time != "0":
			return True
	except Exception, ex:
		printl("Exception(" + str(ex) + ")", __name__, "I")
コード例 #28
0
ファイル: Utf8.py プロジェクト: TELE-TWIN/ProjectValerie
 def open(self, file, arg):
     try:
         # Issue #151, efo => use bytestring for file name
         self.fd = codecs.open(file.encode(), arg, "utf-8")
         return True
     except Exception, ex:
         printl("Exception: " + str(ex), self, "W")
         printl("Converting Filename to latin and retrying", self, "W")
コード例 #29
0
ファイル: Utf8.py プロジェクト: TELE-TWIN/ProjectValerie
 def read(self):
     if self.fd is not None:
         try:
             rtv = self.fd.read()[:-1]
             return rtv
         except Exception, ex:
             printl("Exception: " + str(ex), self, "E")
             return None
コード例 #30
0
 def notifyEntryStopped(self, flags):
     printl("", self, "D")
     args = {}
     args["status"] = "stopped"
     plugins = getPlugins(where=Plugin.INFO_PLAYBACK)
     for plugin in plugins:
         printl("plugin.name=" + str(plugin.name), self, "D")
         plugin.fnc(args, flags)