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


Python LoggingException.process方法代码示例

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


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

示例1: DoSearchQuery

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import process [as 别名]
    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,代码行数:33,代码来源:rte.py

示例2: AttemptLogin

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import process [as 别名]
    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,代码行数:57,代码来源:aertv.py

示例3: ListByDate

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import process [as 别名]
    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,代码行数:57,代码来源:tv3.py

示例4: ParseCommand

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import process [as 别名]
    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,代码行数:54,代码来源:tv3.py

示例5: executeCommand

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import process [as 别名]
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,代码行数:50,代码来源:default.py

示例6: DoSearchQuery

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import process [as 别名]
    def DoSearchQuery( self, query ):
        self.log(u"query: %s" % query, xbmc.LOGDEBUG)
        
        values = {u'queryString':query, u'limit':20}
#        headers = {'DNT':'1', 'X-Requested-With':'XMLHttpRequest' }
        headers = {}
        headers[u'DNT'] = u'1'
        headers[u'Referer'] = u'http://www.tv3.ie/3player/'  
        headers[u'Content-Type'] = u'application/x-www-form-urlencoded; charset=UTF-8'
        
        html = self.httpManager.GetWebPage( searchUrl, 1800, values = values, headers = headers )
        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

        # Fix fcuked up TV3 HTML formatting
        html = html.replace(u"<h3 id='search_heading'>Videos</h2>", "<h3 id='search_heading'>Videos</h3>")
        self.ListSearchShows(html)

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

示例7: ShowRootMenu

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import process [as 别名]
    def ShowRootMenu(self):
        self.log(u"", xbmc.LOGDEBUG)

        try:
            html = None
            html = self.httpManager.GetWebPage(rootMenuUrl, 60)

            if html is None or html == '':
                # Error getting %s Player "Home" page
                logException = LoggingException(self.language(30001) % self.GetProviderId())
                # 'Cannot show RTE root menu', Error getting RTE Player "Home" page
                logException.process(self.language(30002) % self.GetProviderId(), self.language(30001) % self.GetProviderId(), self.logLevel(xbmc.LOGERROR))
                return False

            soup = BeautifulSoup(html, selfClosingTags=['img'])
            categories = soup.find(u'div', u"dropdown-programmes")

            if categories == None:
                # "Can't find dropdown-programmes"
                logException = LoggingException(self.language(30003))
                # 'Cannot show RTE root menu', Error parsing web page
                logException.process(self.language(30002)  % self.GetProviderId(), self.language(30780), self.logLevel(xbmc.LOGERROR))
                #raise logException
                return False

            listItems = []

            try:
                listItems.append( self.CreateSearchItem() )
            except (Exception) as exception:
                if not isinstance(exception, LoggingException):
                    exception = LoggingException.fromException(exception)

                # Not fatal, just means that we don't have the search option
                exception.process(severity = xbmc.LOGWARNING)

            if False == self.AddAllLinks(listItems, categories, autoThumbnails = True):
                return False

            newLabel = u"Live"
            thumbnailPath = self.GetThumbnailPath(newLabel)
            newListItem = xbmcgui.ListItem( label=newLabel )
            newListItem.setThumbnailImage(thumbnailPath)
            url = self.GetURLStart() + u'&live=1'
            listItems.append( (url, newListItem, True) )

            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)

            # Cannot show root menu
            exception.addLogMessage(self.language(30010))
            exception.process(severity = self.logLevel(xbmc.LOGERROR))
            return False
开发者ID:vmware,项目名称:workflowTools,代码行数:64,代码来源:rte.py

示例8: ParseCommand

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import process [as 别名]
    def ParseCommand(self, mycgi):
        (listshows, episodeId, listAvailable, search, page, live, resume) = mycgi.Params( u'listshows', u'episodeId', u'listavailable', u'search', u'page', u'live', u'resume'  )
        self.log(u"", xbmc.LOGDEBUG)
        self.log(u"listshows: %s, episodeId %s, listAvailable %s, search %s, page %s, resume: %s" % (str(listshows), episodeId, str(listAvailable), str(search), page, str(resume)), xbmc.LOGDEBUG)


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

            #return self.PlayEpisode(episodeId)
            return self.PlayVideoWithDialog(self.PlayEpisode, (episodeId, resumeFlag))

        if search <> '':
            if page == '':
                return self.DoSearch()
            else:
                return self.DoSearchQuery( queryUrl = urlRoot + page)

        if page == '':
            if live <> '':
                return self.ShowLiveMenu()

            # "Can't find 'page' parameter "
            logException = LoggingException(logMessage = self.language(30030))
            # 'Cannot proceed', Error processing command
            logException.process(self.language(30010), self.language(30780), self.logLevel(xbmcc.LOGERROR))
            return False

        page = page
        # TODO Test this
        self.log(u"page = %s" % page, xbmc.LOGDEBUG)
        #self.log(u"type(page): " + repr(type(page)), xbmc.LOGDEBUG)
        ##page = mycgi.URLUnescape(page)
        #self.log(u"page = %s" % page, xbmc.LOGDEBUG)
        #self.log(u"type(mycgi.URLUnescape(page)): " + repr(type(page)), xbmc.LOGDEBUG)
#        self.log(u"mycgi.URLUnescape(page) = %s" % page, xbmc.LOGDEBUG)

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

        try:
            self.log(u"urlRoot: " + urlRoot + u", page: " + page )
            html = None
            html = self.httpManager.GetWebPage( urlRoot + page, 1800 )
        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 web page
            exception.addLogMessage(self.language(30050))
            exception.process(severity = self.logLevel(xbmc.LOGERROR))
            return False

        if live <> '':
            #return self.PlayLiveTV(html)
            return self.PlayVideoWithDialog(self.PlayLiveTV, (html, None))

        if listshows <> u'':
            return self.ListShows(html)

        if listAvailable <> u'':

            soup = BeautifulSoup(html)
            availableLink = soup.find('a', 'button-more-episodes')

            if availableLink is None:
                pattern= "/player/ie/show/(.+)/"
                match=re.search(pattern, html, re.DOTALL)

                if match is not None:
                    episodeId = match.group(1)
                    resumeFlag = False
                    if resume <> u'':
                        resumeFlag = True

                    return self.PlayVideoWithDialog(self.PlayEpisode, (episodeId, resumeFlag))


            return self.ListAvailable(html)

        return self.ListSubMenu(html)
开发者ID:vmware,项目名称:workflowTools,代码行数:89,代码来源:rte.py

示例9: Login

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import process [as 别名]
    def Login(self):
        self.log(u"", xbmc.LOGDEBUG)
        """
        {
            'epg': 'WEB_STD',
            'user': {
                'decay': 40,
                'email': 'email',
                'fname': 'fname',
                'id': '87354',
                'ipicid': 'aertv530916c892b25',
                'is_paid_subscriber': 0/1,
                'lname': 'lname',
                'login': True,
                'mailchimp': None,
                'packages': [
                    {
                        'code': 'WEB_STD',
                        'desc': 'Free Channel Pack',
                        'package_id': '1'
                    },
                    {
                        "code":"AERTV_PLUS",
                        "desc":"Aertv Plus",
                        "package_id":"6"
                    }                    
                ],
                'session': 'YWVydHY1MzA5MTZjODkyYjI0_1393452432',
                'status': '1',
                'val_code': None
            }
        }
        """
        
        loginJSON = None
        
        email = self.addon.getSetting( u'AerTV_email' ).decode(u'utf8')
        password = self.addon.getSetting( u'AerTV_password' ).decode(u'utf8')
        
        if len(email) == 0 or len(password) == 0:
            if not xbmcvfs.exists(self.aertvNoticeFilePath):
                file = open(self.aertvNoticeFilePath, u'w')
                try:
                    file.write(" ")
                finally:
                    file.close()
                    
                dialog = xbmcgui.Dialog()
                dialog.ok(self.language(30105), self.language(30106))
                
                self.addon.openSettings(sys.argv[ 0 ])
                
                email = self.addon.getSetting( u'AerTV_email' ).decode(u'utf8')
                password = self.addon.getSetting( u'AerTV_password' ).decode(u'utf8')
                
            if len(email) == 0 or len(password) == 0:
                self.log(u"No AerTV login details", xbmc.LOGDEBUG)
                return False

        try:
            loginJSON = self.LoginViaCookie()
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            # 'AerTV login failed', 
            exception.addLogMessage(self.language(30101))
            exception.process(severity = self.logLevel(xbmc.LOGWARNING))
        
                
        if loginJSON is None:
            try:
                values = [{u'api':u'login'},{u'user':email},{u'pass':password}]
                loginJSON = self.AttemptLogin(values, logUrl = False)

                self.log(u"After weblogin loginJSON is None: " + unicode(loginJSON is None), xbmc.LOGDEBUG)
                
                if loginJSON is None:
                    # 'AerTV login failed', 
                    exception = LoggingException(self.language(30101))
                    # "Status Message: %s
                    exception.process(severity = self.logLevel(xbmc.LOGERROR))
                    return False
                
                self.log(u"Login successful", xbmc.LOGDEBUG)
                
                sessionId = loginJSON[u'user'][u'session']
                
                days02 = 2*24*60*60
                expiry = int(time.time()) + days02
                    
                self.log(u"Aertv_login expiry: " + unicode(expiry), xbmc.LOGDEBUG)
                
                sessionCookie = self.MakeCookie(u'Aertv_login', sessionId, domain, expiry )
                self.cookiejar.set_cookie(sessionCookie)
                self.cookiejar.save()

                loginJSON = self.LoginViaCookie()
                
            except (Exception) as exception:
#.........这里部分代码省略.........
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:103,代码来源:aertv.py

示例10: ShowRootMenu

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import process [as 别名]
    def ShowRootMenu(self):
        self.log(u"", xbmc.LOGDEBUG)
        try:
            html = None
            html = self.httpManager.GetWebPage(rootMenuUrl, 300)
    
            if html is None or html == u'':
                # Error getting %s Player "Home" page
                logException = LoggingException(logMessage = self.language(30001) % self.GetProviderId())
                # 'Cannot show TV3 root menu', Error getting TV3 Player "Home" page
                logException.process(self.language(30002) % self.GetProviderId(), self.language(30001) % self.GetProviderId(), self.logLevel(xbmc.LOGERROR))
                #raise logException
                return False
    
            #soup = BeautifulSoup(html, selfClosingTags=['img'])
            categories = self.GetCategories(html)
    
            if len(categories) == 0:
                # "Can't find dropdown-programmes"
                logException = LoggingException(logMessage = self.language(30003))
                # 'Cannot show TV3 root menu', Error parsing web page
                logException.process(self.language(30002), self.language(30780), self.logLevel(xbmc.LOGERROR))
                #raise logException
                return False
            
            listItems = []
    
            # Search
            newLabel = self.language(30500)
            thumbnailPath = self.GetThumbnailPath(newLabel)
            newListItem = xbmcgui.ListItem( label=newLabel )
            newListItem.setThumbnailImage(thumbnailPath)
            url = self.GetURLStart() + u'&search=1'
            listItems.append( (url, newListItem, True) )
    
#            self.AddFeatured(listItems, html)        
            self.AddCategories(listItems, categories)        
    
            # All Shows - A to Z
            newLabel = self.language(30061)
            thumbnailPath = self.GetThumbnailPath(newLabel)
            newListItem = xbmcgui.ListItem( label=newLabel )
            newListItem.setThumbnailImage(thumbnailPath)
            url = self.GetURLStart() + u'&allShows=1'
            listItems.append( (url, newListItem, True) )

            # All Shows - By Date
            newLabel = self.language(30062)
            thumbnailPath = self.GetThumbnailPath(newLabel)
            newListItem = xbmcgui.ListItem( label=newLabel )
            newListItem.setThumbnailImage(thumbnailPath)
            url = self.GetURLStart() + u'&calendar=1'
            listItems.append( (url, newListItem, True) )
    
            xbmcplugin.addDirectoryItems( handle=self.pluginHandle, items=listItems )
            xbmcplugin.endOfDirectory( handle=self.pluginHandle, succeeded=True )
        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)
                
            # Cannot show root menu
            exception.addLogMessage(self.language(30010))
            exception.process(severity = self.logLevel(xbmc.LOGERROR))
            return False

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


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