当前位置: 首页>>代码示例>>Python>>正文


Python loggingexception.LoggingException类代码示例

本文整理汇总了Python中loggingexception.LoggingException的典型用法代码示例。如果您正苦于以下问题:Python LoggingException类的具体用法?Python LoggingException怎么用?Python LoggingException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LoggingException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: DoSearchQuery

    def DoSearchQuery( self, query = None, queryUrl = None):
        if query is not None:
            queryUrl = urlRoot + self.GetSearchURL() + mycgi.URLEscape(query)

        self.log(u"queryUrl: %s" % queryUrl, xbmc.LOGDEBUG)
        try:
            html = None
            html = self.httpManager.GetWebPage( queryUrl, 1800 )
            if html is None or html == '':
                # Data returned from web page: %s, is: '%s'
                logException = LoggingException(logMessage = self.language(30060) % ( __SEARCH__ + mycgi.URLEscape(query), html))

                # Error getting web page
                logException.process(self.language(30050), u'', severity = self.logLevel(xbmc.LOGWARNING))
                return False

            self.ListSearchShows(html)

            return True
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            if html is not None:
                msg = "html:\n\n%s\n\n" % html
                exception.addLogMessage(msg)

            # Error performing query %s
            exception.addLogMessage(self.language(30052) % query)
            exception.process(severity = self.logLevel(xbmc.LOGERROR))
            return False
开发者ID:vmware,项目名称:workflowTools,代码行数:31,代码来源:rte.py

示例2: PlayEpisode

    def PlayEpisode(self, page, resumeFlag):
        self.log(u"", xbmc.LOGDEBUG)

        try:
            html = None
            self.log(u"urlRoot: " + urlRoot + u", page: " + page )
            html = self.httpManager.GetWebPage( urlRoot + page, 1800 )
            #raise Exception("test1", "test2")
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            if html is not None:
                msg = u"html:\n\n%s\n\n" % html
                exception.addLogMessage(msg)
                
            # Error getting web page
            exception.addLogMessage(self.language(30050))
            exception.process(severity = self.logLevel(xbmc.LOGERROR))
            return False

        soup = BeautifulSoup(html)

        ageCheck = soup.find(u'div', {u'id':u'age_check_form_row'})
        
        if ageCheck is not None:
            
            if self.dialog.iscanceled():
                return False
            # "Getting episode info"
            self.dialog.update(25, self.language(30084))
            try:
                html = None
                html = self.httpManager.GetWebPage( urlRoot + page, 1800, values = {u'age_ok':'1'} )
                soup = BeautifulSoup(html)
            except (Exception) as exception:
                exception = LoggingException.fromException(exception)
    
                if html is not None:
                    msg = u"html:\n\n%s\n\n" % html
                    exception.addLogMessage(msg)
                    
                # Error getting web page: %s
                exception.addLogMessage(self.language(30050) + u": " + ( urlRoot + page ) )
    
                # Error getting web page
                exception.process(self.language(30050), u'', severity = self.logLevel(xbmc.LOGERROR))
                return False
    
        rtmpVar = self.InitialiseRTMP(soup)

        infoLabels = self.GetEpisodeInfo(soup)
        thumbnail = soup.find(u'meta', {u'property' : u'og:image'})[u'content']
        defaultFilename = infoLabels[u'Title']

        resumeKey = unicode(zlib.crc32(page))
        return self.PlayOrDownloadEpisode(infoLabels, thumbnail, rtmpVar, defaultFilename, url = None, subtitles = None, resumeKey = resumeKey, resumeFlag = resumeFlag)
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:57,代码来源:tv3.py

示例3: AttemptLogin

    def AttemptLogin(self, values, logUrl = False):
        self.log(u"", xbmc.LOGDEBUG)
        try:
            loginJSONText = None
            loginJSON = None
            
            url = self.GetAPIUrl(values)

            loginJSONText = self.httpManager.GetWebPageDirect(url, logUrl = logUrl)
            loginJSON = _json.loads(loginJSONText)
            
            for key in loginJSON:
                self.log(u"loginJSON['%s'] exists" % key, xbmc.LOGDEBUG)
                
            if u'user' in loginJSON:
                self.log(u"loginJSON['user']", xbmc.LOGDEBUG)

                for key in loginJSON[u'user']:
                    if key == u'fname' or key == u'lname' or key == 'email':
                        self.log(u"loginJSON['user']['%s'] exists" % key, xbmc.LOGDEBUG)
                    else:
                        self.log(u"loginJSON['user']['%s'] = %s" % (key, utils.drepr(loginJSON[u'user'][key])), xbmc.LOGDEBUG)
                        
                         
            # Check for failed login
            if loginJSON[u'user'][u'login'] != True:
                # Show error message
                if u'status' in loginJSON[u'user']: 
                    statusMessage = loginJSON[u'user'][u'status']
                else:
                    statusMessage = u"None"
                
                    
                # 'AerTV login failed', 
                logException = LoggingException(self.language(30101))
                # "Status Message: %s
                logException.process(self.language(30102) % statusMessage, u"", xbmc.LOGDEBUG)

                return None
            
            self.log(u"AerTV successful login", xbmc.LOGDEBUG)
            return loginJSON
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            if loginJSONText is not None:
                msg = u"loginJSONText:\n\n%s\n\n" % loginJSONText
                exception.addLogMessage(msg)
            
            if loginJSON is not None:
                msg = u"epgJSON:\n\n%s\n\n" % utils.drepr(loginJSON)
                exception.addLogMessage(msg)

            raise exception
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:55,代码来源:aertv.py

示例4: ListByDate

    def ListByDate(self, date):
        values = {u'queryString' : date}
        
        html = None
        html = self.httpManager.GetWebPage( calendarUrl, 3600, values = values)
        if html is None or html == u'':
            # Data returned from web page: %s, is: '%s'
            logException = LoggingException(logMessage = self.language(30060) % ( searchUrl, html ))

            # Error getting web page
            logException.process(self.language(30050), u'', self.logLevel(xbmc.LOGERROR))
            return False

        soup = BeautifulSoup(html)

        listItems = []
        htmlparser = HTMLParser.HTMLParser()
        videos = soup.findAll(u'div', {u'id':u'tooltip_showvideo_cal'})
        
        if len(videos) == 1 and len(videos[0].findAll(u'a')) == 0:
            # No videos broadcast on this date.
            xbmc.executebuiltin(u'XBMC.Notification(IrishTV, %s)' % (videos[0].text))
            return True
        
        for video in videos:
            try:
                anchors = video.findAll(u'a')
                
                time = anchors[2].small.text
                title = self.fullDecode( anchors[1].b.text + u", " + time )
                description = self.fullDecode( anchors[3].text )
                infoLabels = {u'Title': title, u'Plot': description, u'PlotOutline': description}
    
                page = anchors[0][u'href']
                thumbnail = anchors[0].img[u'src']
                
                self.AddEpisodeItem(title, thumbnail, infoLabels, page, listItems)
            except (Exception) as exception:
                if not isinstance(exception, LoggingException):
                    exception = LoggingException.fromException(exception)
                
                if video is not None:
                    msg = u"video:\n\n%s\n\n" % video
                    exception.addLogMessage(msg)
                    
                # "Error processing video"
                exception.addLogMessage(logMessage = self.language(30063) % u"video\n" + repr(video))
                # "Error processing video"
                exception.process(self.language(30063) % programme % u"video\n", u"", xbmc.LOGWARNING)
                continue
            
        xbmcplugin.addDirectoryItems( handle=self.pluginHandle, items=listItems )
        xbmcplugin.endOfDirectory( handle=self.pluginHandle, succeeded=True )
            
        return True
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:55,代码来源:tv3.py

示例5: ParseCommand

    def ParseCommand(self, mycgi):
        (category, search, allShows, calendar, date, page, thumbnail, resume) = mycgi.Params( u'category', u'search', u'allShows', u'calendar', u'date', u'page', u'thumbnail', u'resume' )
        self.log(u"category: %s, search: %s, allShows: %s, calendar: %s, date: %s, page: %s, thumbnail: %s, resume: %s" % (category, str(search), str(allShows), calendar, date, page, thumbnail, str(resume)), xbmc.LOGDEBUG)

        if search <> u'':
            return self.DoSearch()
        
        if category <> u'':
            return self.ShowCategory(category)

        if allShows <> u'':
            if thumbnail <> u'':
                return self.ListAToZ(thumbnail)
            else:
                return self.ListAToZ()

        if calendar <> u'':
            return self.ListCalendar()
            
        if date <> u'':
            return self.ListByDate(date)
            
        if page == u'':
            # "Can't find 'page' parameter "
            logException = LoggingException(logMessage = self.language(30030))
            # 'Cannot proceed', Error processing command
            logException.process(self.language(30755), self.language(30780), self.logLevel(xbmc.LOGERROR))
            return False

        self.log(u"page = %s" % page, xbmc.LOGDEBUG)
        page = mycgi.URLUnescape(page)
        self.log(u"mycgi.URLUnescape(page) = %s" % page, xbmc.LOGDEBUG)

        if u' ' in page:
            page = page.replace(u' ', u'%20')

        resumeFlag = False
        if resume <> u'':
            resumeFlag = True

        try:
            return self.PlayVideoWithDialog(self.PlayEpisode, (page, resumeFlag))
            
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)
            
            # "Error playing or downloading episode %s"
            exception.addLogMessage(self.language(30051) % u"")
            # "Error processing video"
            exception.process(severity = self.logLevel(xbmc.LOGERROR))
            return False
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:52,代码来源:tv3.py

示例6: executeCommand

def executeCommand():
	pluginHandle = int(sys.argv[1])
	success = False

	if ( mycgi.EmptyQS() ):
		success = ShowProviders()
	else:
		(providerName, clearCache, testForwardedIP) = mycgi.Params( u'provider', u'clearcache', u'testforwardedip' )

		if clearCache != u'':
			httpManager.ClearCache()
			return True
		
		elif testForwardedIP != u'':
			provider = Provider()
			provider.addon = addon

			httpManager.SetDefaultHeaders( provider.GetHeaders() )
			forwardedIP = provider.CreateForwardedForIP('0.0.0.0')
			
			return TestForwardedIP(forwardedIP)
			
		elif providerName != u'':
			log(u"providerName: " + providerName, xbmc.LOGDEBUG)
			if providerName <> u'':
				provider = providerfactory.getProvider(providerName)
				
				if provider is None:
					# ProviderFactory return none for providerName: %s
					logException = LoggingException(language(30000) % providerName)
					# 'Cannot proceed', Error processing provider name
					logException.process(language(30755), language(30020), xbmc.LOGERROR)
					return False
				
				if provider.initialise(httpManager, sys.argv[0], pluginHandle, addon, language, PROFILE_DATA_FOLDER, RESOURCE_PATH):
					success = provider.ExecuteCommand(mycgi)
					log (u"executeCommand done", xbmc.LOGDEBUG)

				"""
				print cookiejar
				print 'These are the cookies we have received so far :'

				for index, cookie in enumerate(cookiejar):
					print index, '  :  ', cookie
				cookiejar.save() 
				"""

	return success
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:48,代码来源:default.py

示例7: ListShows

    def ListShows(self, html):
        self.log(u"", xbmc.LOGDEBUG)
        listItems = []

        try:
            soup = BeautifulSoup(html, selfClosingTags=[u'img'])
            episodes = soup.findAll(u'a', u"thumbnail-programme-link")

            for episode in episodes:
                self.AddEpisodeToList(listItems, episode)

            xbmcplugin.addDirectoryItems( handle=self.pluginHandle, items=listItems )
            xbmcplugin.endOfDirectory( handle=self.pluginHandle, succeeded=True )

            return True
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            if html is not None:
                msg = "html:\n\n%s\n\n" % html
                exception.addLogMessage(msg)

            # Error getting list of shows
            exception.addLogMessage(self.language(30049))
            # Error getting list of shows
            exception.process(severity = self.logLevel(xbmc.LOGERROR))
            return False
开发者ID:vmware,项目名称:workflowTools,代码行数:28,代码来源:rte.py

示例8: CallBitlyApi

    def CallBitlyApi(self, username, key, apiUrl, longUrl, dataType, episodeId, series ):
        self.log("longUrl: %s", xbmc.LOGDEBUG)
        try:
            values = {
                  u'callback': '%s%d' % (dataType, int(round(time.time() * 1000.0))),
                  #u'longUrl': (longUrl + u"id=%s&title=%s" % (episodeId, series)).encode(u'latin1'),
                  u'longUrl': (longUrl).encode(u'latin1'),
                  u'apiKey': key,
                  u'login': username
                  }

            jsonData = self.httpManager.GetWebPage(apiUrl, 20000, values = values)
            
            jsonText = utils.extractJSON (jsonData)
            bitlyJSON = _json.loads(jsonText)
            
            return bitlyJSON[u'data'][u'url'] 
        
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            # Error calling bit.ly API
            exception.addLogMessage(self.language(30038))
            exception.process(severity = self.logLevel(xbmc.LOGERROR))

            raise exception
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:27,代码来源:tg4.py

示例9: ShowRootMenu

    def ShowRootMenu(self):
        self.log(u"", xbmc.LOGDEBUG)
        try:
            listItems = []
            liveItemTuple = None
            searchItemTuple = None

            self.AddMenuItem(listItems, u"Search", u'Cuardaigh', u'&search=1')
            self.AddMenuItem(listItems, u"Latest", u"Is Déanaí", u'&latest=1')
            self.AddMenuItem(listItems, u"Categories", u'Catag\u00f3ir\u00ed', u'&categories=1')
            self.AddMenuItem(listItems, u"Popular", u"Is Coitianta", u'&popular=1')

            # TODO Fix live TV
            ##self.AddLiveMenuItem(listItems, u"Live", u"Beo", u'&live=1')

            xbmcplugin.addDirectoryItems( handle=self.pluginHandle, items=listItems )
            xbmcplugin.endOfDirectory( handle=self.pluginHandle, succeeded=True )
            
            return True
        
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            if xml is not None:
                msg = u"xml:\n\n%s\n\n" % xml
                exception.addLogMessage(msg)
            
            # Cannot show root menu
            exception.addLogMessage(self.language(30010))
            exception.process(severity = self.logLevel(xbmc.LOGERROR))
            return False
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:32,代码来源:tg4.py

示例10: GetSearchURL

    def GetSearchURL(self):
        try:
            rootMenuHtml = None
            html = None
            rootMenuHtml = self.httpManager.GetWebPage(rootMenuUrl, 60)
            playerJSUrl = self.GetPlayerJSURL(rootMenuHtml)

            html = self.httpManager.GetWebPage(playerJSUrl, 20000)

            programmeSearchIndex = html.find('Programme Search')
            match=re.search("window.location.href = \'(.*?)\'", html[programmeSearchIndex:])
            searchURL = match.group(1)

        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            if rootMenuHtml is not None:
                msg = "rootMenuHtml:\n\n%s\n\n" % rootMenuHtml
                exception.addLogMessage(msg)

            if html is not None:
                msg = "html:\n\n%s\n\n" % html
                exception.addLogMessage(msg)

            # Error getting search url: Using default %s
            exception.addLogMessage(self.language(30054) + searchUrlDefault)
            exception.process(severity = self.logLevel(xbmc.LOGWARNING))
            searchURL = searchUrlDefault

        return searchURL
开发者ID:vmware,项目名称:workflowTools,代码行数:31,代码来源:rte.py

示例11: PlayOrDownloadEpisode

 def PlayOrDownloadEpisode(self, infoLabels, thumbnail, rtmpVar = None, defaultFilename = u'', url = None, subtitles = None, resumeKey = None, resumeFlag = False):
     try:
         action = self.GetAction(infoLabels[u'Title'])
 
         if self.dialog.iscanceled():
             return False
         
         if ( action == 1 ):
             # Play
             # "Preparing to play video"
             self.dialog.update(50, self.language(30085))
             self.Play(infoLabels, thumbnail, rtmpVar, url, subtitles, resumeKey, resumeFlag)
     
         elif ( action == 0 ):
                 # Download
                 # "Preparing to download video"
             self.dialog.update(50, self.language(30086))
             self.Download(rtmpVar, defaultFilename, subtitles)
 
         return True
     except (Exception) as exception:
         if not isinstance(exception, LoggingException):
             exception = LoggingException.fromException(exception)
 
         # Error playing or downloading episode %s
         exception.process(self.language(30051) % u'', u'', self.logLevel(xbmc.LOGERROR))
         return False
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:27,代码来源:provider.py

示例12: GetLiveVideoParams

    def GetLiveVideoParams(self, js):
        self.log(u"", xbmc.LOGDEBUG)

        try:
            pattern = u"function (getLivePlayer.+?)^}"
            match=re.search(pattern, js, re.MULTILINE | re.DOTALL)
            getLivePlayer = match.group(1)
            
            pattern = u'} else {\s+id\s*=\s*[\'"](\d+?)[\'"]'
            videoId = re.search(pattern, getLivePlayer, re.DOTALL).group(1)
            
            pattern='progTitle\s*=\s*"(.+?)"'
            progTitle = re.search(pattern, getLivePlayer, re.DOTALL).group(1)
            
            return (videoId, progTitle)
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)
            
            if playerFunctionsJs is not None:
                msg = u"playerFunctionsJs:\n\n%s\n\n" % playerFunctionsJs
                exception.addLogMessage(msg)
                
            # Unable to determine live video parameters. Using default values.
            exception.addLogMessage(self.language(30022))
            exception.process(severity = xbmc.LOGWARNING)

            return (defaultLiveVideoId, defaultLiveProgTitle)
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:28,代码来源:tg4.py

示例13: AddLiveMenuItem

    def AddLiveMenuItem(self, listItems, labelEN, labelIE, urlFragment):
        try:
            if self.languageCode == u'en':
                newLabel = labelEN
            else:
                newLabel = labelIE
            
            thumbnailPath = self.GetThumbnailPath(newLabel)

            schedule = self.GetLiveSchedule()
            newLabel = newLabel + "  [" + schedule + "]"
            newListItem = xbmcgui.ListItem( label=newLabel )
            newListItem.setThumbnailImage(thumbnailPath)
            newListItem.setProperty("Video", "true")
            #newListItem.setProperty('IsPlayable', 'true')

            url = self.GetURLStart() + urlFragment
                
            listItems.append( (url, newListItem, False) )
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            # Not fatal, just means that we don't have the news option
            exception.process(severity = xbmc.LOGWARNING)
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:25,代码来源:tg4.py

示例14: GetSWFPlayer

    def GetSWFPlayer(self):
        self.log(u"", xbmc.LOGDEBUG)

        try:
            xml = self.httpManager.GetWebPage(configUrl, 20000)
            soup = BeautifulStoneSoup(xml)

            swfPlayer = soup.find("player")['url']

            if swfPlayer.find('.swf') > 0:
                swfPlayer=re.search("(.*\.swf)", swfPlayer).groups()[0]

            if swfPlayer.find('http') == 0:
                # It's an absolute URL, do nothing.
                pass
            elif swfPlayer.find('/') == 0:
                # If it's a root URL, append it to the base URL:
                swfPlayer = urljoin(urlRoot, swfPlayer)
            else:
                # URL is relative to config.xml
                swfPlayer = urljoin(configUrl, swfPlayer)

            return swfPlayer

        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            # Unable to determine swfPlayer URL. Using default: %s
            exception.addLogMessage(self.language(30520) % swfDefault)
            exception.process(severity = self.logLevel(xbmc.LOGWARNING))
            return swfDefault
开发者ID:vmware,项目名称:workflowTools,代码行数:32,代码来源:rte.py

示例15: GetQSData

    def GetQSData(self, vidId, bitlyUrl, js):
        self.log("", xbmc.LOGDEBUG)
        
        try:
            pattern = u"function (createPlayerHtml.+?)^}"
            match=re.search(pattern, js, re.MULTILINE | re.DOTALL)
            createPlayerHtml = match.group(1)
            
            bc_params = {}
            pattern = u"[^/][^/]\s+(bc_params\s*\[.+?\]\s*=.+?);"
            paramAppends = re.findall(pattern, createPlayerHtml)
            
            for paramAppend in paramAppends:
                paramAppend = paramAppend.replace(u'true', u'True')
                paramAppend = paramAppend.replace(u'["', u'[u"')
                paramAppend = paramAppend.replace(u'= "', u'= u"')
                self.log(u"paramAppend: %s" % paramAppend, xbmc.LOGDEBUG)
                exec(paramAppend)
            
            if bc_params < 10:
                self.log(self.language(30036), xbmc.LOGWARNING)
                self.log(utils.drepr(bc_params), xbmc.LOGDEBUG)
                return self.GetDefaultQSData(vidId, bitlyUrl)
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            # Unable to determine qsdata. Using default values.
            exception.addLogMessage(self.language(40600))
            exception.process(severity = xbmc.LOGWARNING)

            return self.GetDefaultQSData(vidId, bitlyUrl)
            
        return bc_params
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:34,代码来源:tg4.py


注:本文中的loggingexception.LoggingException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。