コード例 #1
0
def autostart(session):
    global utf8ToLatin
    if utf8ToLatin is None:
        from Plugins.Extensions.ProjectValerie.DMC_Plugins.DMC_SyncExtras.Utf8 import utf8ToLatin

    try:
        root = Resource()

        #Dynamic Pages Main => WebMainActions
        root.putChild("", WebMainActions.Home())
        root.putChild("movies", WebMainActions.Movies())
        root.putChild("tvshows", WebMainActions.TvShows())
        root.putChild("episodes", WebMainActions.Episodes())
        root.putChild("failed", WebMainActions.Failed())
        root.putChild("sync", WebMainActions.Sync())
        root.putChild("extras", WebMainActions.Extras())
        root.putChild("options", WebMainActions.Options())
        root.putChild("logs", WebMainActions.Logs())
        root.putChild("valerie", WebMainActions.Valerie())
        root.putChild("enigma", WebMainActions.Enigma())
        root.putChild("globalSettings", WebMainActions.GlobalSetting())
        root.putChild("syncSettings", WebMainActions.SyncSettings())
        root.putChild("backup", WebMainActions.Backup())
        root.putChild("restore", WebMainActions.Restore())

        #Static Pages, CSS, JS
        root.putChild(
            "content",
            File(utf8ToLatin(config.plugins.pvmc.pluginfolderpath.value +
                             u"/DMC_Plugins/DMC_WebInterfaceExtras/content"),
                 defaultType="text/plain"))

        #Folder Lists
        root.putChild(
            "vlog",
            File(config.plugins.pvmc.tmpfolderpath.value + 'log',
                 defaultType="text/plain"))
        root.putChild("elog", File('/hdd/', defaultType="text/plain"))
        root.putChild(
            "media",
            File(config.plugins.pvmc.configfolderpath.value + '/media',
                 defaultType="text/plain"))
        root.putChild(
            "dumps",
            File(config.plugins.pvmc.tmpfolderpath.value + 'dumps',
                 defaultType="text/plain"))

        #Action pages without MainMenu-Entry => WebSubActions
        root.putChild("action", WebSubActions.MediaActions())
        root.putChild("mediaForm", WebSubActions.MediaForm())
        root.putChild("addRecord", WebSubActions.AddRecord())
        root.putChild("alternatives", WebSubActions.Alternatives())
        root.putChild("function", WebSubActions.WebFunctions())
        root.putChild("syncronize", WebSubActions.SyncFunctions())

        site = Site(root)
        port = config.plugins.pvmc.plugins.webinterface.port.value
        reactor.listenTCP(port, site, interface="0.0.0.0")
    except Exception, ex:
        printl("Exception(Can be ignored): " + str(ex), __name__, "W")
コード例 #2
0
def autostart(session):
	printl("autostart->")
	try:
		thread = BackgroundDbLoader(session)
		thread.start()
	except Exception, ex:
		printl("Exception(Can be ignored): " + str(ex), __name__, "W")
コード例 #3
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
コード例 #4
0
def autostartPlugin(session):
    if isInetAvailable():
        from Plugins.Extensions.ProjectValerie.DMC_Plugins.DMC_SyncExtras.plugin import autostart
        autostart(session)
    else:
        printl("Can not sync as no internet connection available!", __name__,
               "W")
コード例 #5
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
コード例 #6
0
ファイル: Manager.py プロジェクト: steve4744/project-valerie
    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
コード例 #7
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
コード例 #8
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)
コード例 #9
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)
コード例 #10
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")
コード例 #11
0
	def preLoadData(self):
		printl("->", self, "S")
		self._setInstalledRevision()
		self._setCurrentUpdateType()
		if self._setUpdateXmlDict():
			self._setLatestRevisionAndUrl()
		printl("<-", self, "C")
コード例 #12
0
ファイル: Manager.py プロジェクト: Rikitik/project-valerie
    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
コード例 #13
0
ファイル: Manager.py プロジェクト: Rikitik/project-valerie
    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
コード例 #14
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)
コード例 #15
0
 def preLoadData(self):
     printl("->", self, "S")
     self._setInstalledRevision()
     self._setCurrentUpdateType()
     if self._setUpdateXmlDict():
         self._setLatestRevisionAndUrl()
     printl("<-", self, "C")
コード例 #16
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")
コード例 #17
0
	def __init__(self):
		printl("->", self, "S")
		
		try:
			self.load()
		except Exception, ex: 
			printl("Exception(" + str(type(ex)) + "): " + str(ex), self, "E")
コード例 #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 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
コード例 #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 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
コード例 #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 _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()
コード例 #25
0
    def __init__(self):
        printl("->", self, "S")

        try:
            self.load()
        except Exception, ex:
            printl("Exception(" + str(type(ex)) + "): " + str(ex), self, "E")
コード例 #26
0
def autostart(session):
    printl("autostart->")
    try:
        thread = InternetTime(session)
        thread.start()
    except Exception, ex:
        printl("Exception(Can be ignored): " + str(ex), __name__, "W")
コード例 #27
0
	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")
コード例 #28
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)
コード例 #29
0
    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")
コード例 #30
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
コード例 #31
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)
コード例 #32
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
コード例 #33
0
	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")
コード例 #34
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)
コード例 #35
0
	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")
コード例 #36
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)
コード例 #37
0
    def loadOldPathsConf(self):
        try:
            _dict = {}
            _dict["xml"] = {}
            _dict["xml"]["filetypes"] = {}
            _dict["xml"]["searchpaths"] = {}

            fconf = open(
                config.plugins.pvmc.configfolderpath.value + "paths.conf", "r")
            _dict["xml"]["filetypes"]["filetype"] = fconf.readline().strip(
            ).split("|")

            pathsList = []
            for path in fconf.readlines():
                path = path.strip()
                p = path.split('|')
                path = p[0]

                folderType = u"MOVIE_AND_TV"
                if len(p) > 1:
                    folderType = p[1]

                useFolder = False
                if len(p) > 2 and p[2] == u"FOLDERNAME":
                    useFolder = True

                if len(path) > 0:
                    enabled = True
                    if path[0] == '#':
                        enabled = False
                        path = path[1:]

                    pathsList.append({
                        "directory": path,
                        "usefolder": useFolder,
                        "enabled": enabled,
                        "type": folderType
                    })

            _dict["xml"]["searchpaths"]["searchpath"] = pathsList
            print _dict["xml"]

            fconf.close()
            return _dict

        except Exception, ex:
            printl("no paths.xml or paths.conf found ...", self, "H")
            printl("trying to repair ...", self, "H")
            self.checkPathXml()
            printl("retrying to load ...", self, "H")
            Xml2Dict.__init__(
                self, config.plugins.pvmc.configfolderpath.value + "paths.xml")

            if Xml2Dict.load(self):
                printl("reloading worked", self, "H")
                _dict = Xml2Dict.get(self)
                return _dict
            else:
                printl("something went wrong", self, "E")
コード例 #38
0
class DMC_SubtitleDownloader(ChoiceBox):
	service = "OpenSubtitles"

	def __init__(self, session, args):
		global Manager
		global utf8ToLatin
		if Manager is None:
			from Plugins.Extensions.ProjectValerie.DMC_Plugins.DMC_SyncExtras.Manager import Manager
		if utf8ToLatin is None:
			from Plugins.Extensions.ProjectValerie.DMC_Plugins.DMC_SyncExtras.Utf8 import utf8ToLatin
		self.session = session
		self.service = config.plugins.pvmc.plugins.subdown.provider.value
		self.language_1 = config.plugins.pvmc.plugins.subdown.language1.value
		self.language_2 = config.plugins.pvmc.plugins.subdown.language2.value
		self.language_3 = config.plugins.pvmc.plugins.subdown.language3.value
		
		year = str(args["Year"])
		title = args["Title"] # + " (" + str(year) + ")"
		if args.has_key("Season"):
			season = str(args["Season"])
			episode = str(args["Episode"])
			
			#tvshowEntry = Manager("SubtitleDownloader").getElement_ByUsingPrimaryKey(Manager.TVSHOWS, \
			#	dict({'thetvdbid': args["TheTvDbId"]}))			
			tvshowEntry = Manager("SubtitleDownloader").getMedia(args["Id"])
			tvshow = tvshowEntry.Title
		else:
			season = ""
			episode = ""
			tvshow = ""
		self.file_original_path = args["Path"]
		
		set_temp = False
		rar = False
		
		self.tmp_sub_dir = "/tmp/subdir"
		try:
			shutil.rmtree(str(self.tmp_sub_dir))
		except Exception, ex:
			printl("Exception: " + str(ex), __name__, "E")
		os.mkdir(str(self.tmp_sub_dir))
		self.sub_folder = self.file_original_path.rsplit("/", 1)[0]
		
		exec ( "from DMC_SubtitleDownloaderExtras.services.%s import service as Service" % (self.service))
		self.Service = Service
		printl("Searching sub for " + str(self.file_original_path), self, "I")
		self.subtitles_list, self.session_id, msg = self.Service.search_subtitles( self.file_original_path, title, tvshow, year, season, episode, set_temp, rar, self.language_1, self.language_2, self.language_3 )
		
		subtitleList = []
		for subtitle in self.subtitles_list:
			printl("Subtitle: " + str(subtitle), self, "D")
			lang = ""
			if subtitle.has_key("language_id"):
				lang = utf8ToLatin(subtitle["language_id"])
			elif subtitle.has_key("language_name"):
				lang = utf8ToLatin(subtitle["language_name"])
			subtitleList.append(("[" + lang + "] " + utf8ToLatin(subtitle["filename"]), "CALLFUNC", self.Download_Subtitles, subtitle))
		
		ChoiceBox.__init__(self, self.session, list = subtitleList, title = self.file_original_path)
コード例 #39
0
 def checkforupdate(self, selection=None):
     if selection is None:
         selection = self.selection
     if selection == "yes":
         config.plugins.pvmc.checkforupdate.value = "Active"
     else:
         config.plugins.pvmc.checkforupdate.value = "Passive"
     printl(" -> " + str(config.plugins.pvmc.checkforupdate.value), self)
コード例 #40
0
ファイル: Utf8.py プロジェクト: steve4744/project-valerie
 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
コード例 #41
0
ファイル: Utf8.py プロジェクト: steve4744/project-valerie
 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")
コード例 #42
0
	def getTvdbId(self, info, elem):
		try:
			eID = self.getElem(elem, "id")
			if eID is not None and eID.data is not None and len(eID.data) > 0:
				info.TheTvDbId = eID.data
				return info
		except Exception, ex:
			printl("Exception: " + str(ex), self)
コード例 #43
0
	def getSeriesName(self, info, elem):
		try:
			eTitle = self.getElem(elem, "SeriesName")
			if eTitle is not None and eTitle.data is not None and len(eTitle.data) > 0:
				info.Title = eTitle.data
				return info
		except Exception, ex:
			printl("Exception: " + str(ex), self)
コード例 #44
0
 def notifyEntryPlaying(self, entry, flags):
     printl("", self, "D")
     args = self.buildInfoPlaybackArgs(entry)
     args["status"] = "playing"
     plugins = getPlugins(where=Plugin.INFO_PLAYBACK)
     for plugin in plugins:
         printl("plugin.name=" + str(plugin.name), self, "D")
         plugin.fnc(args, flags)
コード例 #45
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)
コード例 #46
0
	def getRuntime(self, info, elem):
		try:
			eRuntime = self.getElem(elem, "Runtime")
			if eRuntime is not None and eRuntime.data is not None and len(eRuntime.data) > 0:
				info.Runtime = int(eRuntime.data.strip())
				return info
		except Exception, ex:
			printl("Exception: " + str(ex), self)
コード例 #47
0
def stop_e2(session):
	printl("->", __name__, "S")
	try:
		import os
		os.system("chmod 777 " + config.plugins.pvmc.configfolderpath.value + "stop.sh")
		os.system("/bin/sh " + config.plugins.pvmc.configfolderpath.value + "stop.sh")
	except Exception, e:
		printl("Exception(" + str(type(ex)) + "): " + str(ex), self, "W")
コード例 #48
0
 def getImdbIdFromNfo(self, lines):
     printl("", self)
     try:
         for line in lines:
             if self.searchForImdbAndTvdbId(line):
                 return self
     except Exception, ex:
         printl("Exception (ef): " + str(ex), self, "E")
コード例 #49
0
ファイル: DMC_Wizard.py プロジェクト: Rikitik/project-valerie
 def autostart(self, selection=None):
     if selection is None:
         selection = self.selection
     if selection == "yes":
         config.plugins.pvmc.autostart.value = True
     else:
         config.plugins.pvmc.autostart.value = False
     printl("-> " + str(config.plugins.pvmc.autostart.value), self)
コード例 #50
0
 def uselocal(self, selection=None):
     if selection is None:
         selection = self.selection
     if selection == "yes":
         config.plugins.pvmc.uselocal.value = True
     else:
         config.plugins.pvmc.uselocal.value = False
     printl("-> " + str(config.plugins.pvmc.uselocal.value), self)
コード例 #51
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")
コード例 #52
0
 def autostart(self, selection=None):
     if selection is None:
         selection = self.selection
     if selection == "yes":
         config.plugins.pvmc.autostart.value = True
     else:
         config.plugins.pvmc.autostart.value = False
     printl("-> " + str(config.plugins.pvmc.autostart.value), self)
コード例 #53
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)
コード例 #54
0
ファイル: DMC_Wizard.py プロジェクト: Rikitik/project-valerie
 def uselocal(self, selection=None):
     if selection is None:
         selection = self.selection
     if selection == "yes":
         config.plugins.pvmc.uselocal.value = True
     else:
         config.plugins.pvmc.uselocal.value = False
     printl("-> " + str(config.plugins.pvmc.uselocal.value), self)
コード例 #55
0
ファイル: DMC_Wizard.py プロジェクト: Rikitik/project-valerie
 def checkforupdate(self, selection=None):
     if selection is None:
         selection = self.selection
     if selection == "yes":
         config.plugins.pvmc.checkforupdate.value = "Active"
     else:
         config.plugins.pvmc.checkforupdate.value = "Passive"
     printl(" -> " + str(config.plugins.pvmc.checkforupdate.value), self)
コード例 #56
0
 def getTvdbId(self, info, elem):
     try:
         eID = self.getElem(elem, "id")
         if eID is not None and eID.data is not None and len(eID.data) > 0:
             info.TheTvDbId = eID.data
             return info
     except Exception, ex:
         printl("Exception: " + str(ex), self)
コード例 #57
0
 def getMediaValues(self,
                    type,
                    order=None,
                    firstRecord=0,
                    numberOfRecords=9999999):
     printl("->", self, "S")
     return self.dbHandler.getMediaValues(type, order, firstRecord,
                                          numberOfRecords)
コード例 #58
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)
コード例 #59
0
 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")
コード例 #60
0
    def postWidgetCreate(self, instance):
        self.sequence = None

        if self.skinAttributes is not None:
            for (attrib, value) in self.skinAttributes:
                if attrib == "text":
                    self.setData(value)
        else:
            printl("self.skinAttributes is None!!!", self, "W")