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


Python common.Logger类代码示例

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


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

示例1: isVideoHostedByYou

 def isVideoHostedByYou(self, video_url):
     isVideoHoster = False
     videoId = self.getVideoId(video_url)
     if videoId is not None:
         Logger.logDebug('Snapper selected = ' + self.getModuleName() + ' for video URL = ' + video_url)
         isVideoHoster = True
     return isVideoHoster
开发者ID:jigarsavla,项目名称:apple-tv2-xbmc,代码行数:7,代码来源:SnapVideo.py

示例2: callBackDialogProgressBar

def callBackDialogProgressBar(function_obj, function_args, heading, failure_message=None, line1='Please wait...', line2='Retrieved $current_index of $total_it items', line3='To go back, press the Cancel button'):
    total_iteration = len(function_args)
    current_index = 0
    ProgressDisplayer().end()
    pDialog = None
    if not SUPPRESS_DIALOG_MSG:
        pDialog = xbmcgui.DialogProgress()
        pDialog.create(heading, line1, line2.replace('$total_it', str(total_iteration)).replace('$current_index', str(current_index)), line3)
        pDialog.update(1)
    Logger.logDebug('Total Iterations = ' + str(total_iteration))
    function_returns = []
    isCanceled = False
    for arg in function_args:
        try:
            returnedObj = function_obj(arg)
            if returnedObj is not None and type(returnedObj) is list:
                function_returns.extend(returnedObj)
            elif returnedObj is not None:
                function_returns.append(returnedObj)
            if not SUPPRESS_DIALOG_MSG and pDialog is not None:
                current_index = current_index + 1
                percent = (current_index * 100) / total_iteration
                pDialog.update(percent, line1, line2.replace('$total_it', str(total_iteration)).replace('$current_index', str(current_index)), line3)
                if (pDialog.iscanceled()):
                    isCanceled = True
                    break
        except Exception, e:
            if not SUPPRESS_DIALOG_MSG and pDialog is not None and failure_message is not None:
                pDialog.close()
                dialog = xbmcgui.Dialog()
                dialog.ok('[B][COLOR red]FAILED: [/COLOR][/B]Info Retrieval Process', failure_message, 'You may like to try again later or use other source if available')
            Logger.logFatal(e)
            raise Exception(ExceptionHandler.DONOT_DISPLAY_ERROR, '')
        if isCanceled:
            raise Exception(ExceptionHandler.PROCESS_STOPPED, 'It looks like you don\'t want wait more|Process was stopped in between')
开发者ID:jigarsavla,项目名称:apple-tv2-xbmc,代码行数:35,代码来源:XBMCInterfaceUtils.py

示例3: parseSignature

def parseSignature(s):
    ''' use decryption solution by Youtube-DL project '''
    if len(s) == 93:
        return s[86:29:-1] + s[88] + s[28:5:-1]
    elif len(s) == 92:
        return s[25] + s[3:25] + s[0] + s[26:42] + s[79] + s[43:79] + s[91] + s[80:83]
    elif len(s) == 91:
        return s[84:27:-1] + s[86] + s[26:5:-1]
    elif len(s) == 90:
        return s[25] + s[3:25] + s[2] + s[26:40] + s[77] + s[41:77] + s[89] + s[78:81]
    elif len(s) == 89:
        return s[84:78:-1] + s[87] + s[77:60:-1] + s[0] + s[59:3:-1]
    elif len(s) == 88:
        return s[7:28] + s[87] + s[29:45] + s[55] + s[46:55] + s[2] + s[56:87] + s[28]
    elif len(s) == 87:
        return s[6:27] + s[4] + s[28:39] + s[27] + s[40:59] + s[2] + s[60:]
    elif len(s) == 86:
        return s[80:72:-1] + s[16] + s[71:39:-1] + s[72] + s[38:16:-1] + s[82] + s[15::-1]
    elif len(s) == 85:
        return s[3:11] + s[0] + s[12:55] + s[84] + s[56:84]
    elif len(s) == 84:
        return s[78:70:-1] + s[14] + s[69:37:-1] + s[70] + s[36:14:-1] + s[80] + s[:14][::-1]
    elif len(s) == 83:
        return s[80:63:-1] + s[0] + s[62:0:-1] + s[63]
    elif len(s) == 82:
        return s[80:37:-1] + s[7] + s[36:7:-1] + s[0] + s[6:0:-1] + s[37]
    elif len(s) == 81:
        return s[56] + s[79:56:-1] + s[41] + s[55:41:-1] + s[80] + s[40:34:-1] + s[0] + s[33:29:-1] + s[34] + s[28:9:-1] + s[29] + s[8:0:-1] + s[9]
    elif len(s) == 80:
        return s[1:19] + s[0] + s[20:68] + s[19] + s[69:80]
    elif len(s) == 79:
        return s[54] + s[77:54:-1] + s[39] + s[53:39:-1] + s[78] + s[38:34:-1] + s[0] + s[33:29:-1] + s[34] + s[28:9:-1] + s[29] + s[8:0:-1] + s[9]
    else:
        Logger.logFatal(u'Unable to decrypt signature, key length %d not supported; retrying might work' % (len(s)))
        return s
开发者ID:shauryaanand,项目名称:desimc,代码行数:35,代码来源:YouTube.py

示例4: retrieveVideoInfo

def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:

        html = HttpUtils.HttpClient().getHtmlContent(url='http://vimeo.com/' + str(video_id))
        referrerObj = re.compile('"timestamp":(.+?),"signature":"(.+?)"').findall(html)[0]
        req_sig_exp = referrerObj[0]
        req_sig = referrerObj[1]
        
        img_link = re.compile('itemprop="thumbnailUrl" content="(.+?)"').findall(html)[0]
        video_title = re.compile('"title":"(.+?)"').findall(html)[0]
        
        qual = 'sd'
        video_link = "http://player.vimeo.com/play_redirect?clip_id=%s&sig=%s&time=%s&quality=%s&codecs=H264,VP8,VP6&type=moogaloop_local&embed_location=" % (video_id, req_sig, req_sig_exp, qual)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
        
        if(re.search('"hd":1', html)):
            qual = 'hd'
            video_link = "http://player.vimeo.com/play_redirect?clip_id=%s&sig=%s&time=%s&quality=%s&codecs=H264,VP8,VP6&type=moogaloop_local&embed_location=" % (video_id, req_sig, req_sig_exp, qual)
            video_info.add_video_link(VIDEO_QUAL_HD_720, video_link)
            
        video_info.set_video_stopped(False)
        video_info.set_video_image(img_link)
        video_info.set_video_name(video_title)
        
    except Exception, e:
        Logger.logError(e)
        video_info.set_video_stopped(True)
开发者ID:jigarsavla,项目名称:apple-tv2-xbmc,代码行数:31,代码来源:Vimeo.py

示例5: retrieveVideoInfo

def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_info_link = 'http://movzap.com/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        
        paramSet = re.compile("return p\}\(\'(.+?)\',(\d\d),(\d\d),\'(.+?)\'").findall(html)
        if len(paramSet) > 0:
            video_info_link = AddonUtils.parsePackedValue(paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]), paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'')
            
            img_data = re.compile(r"image:\'(.+?)\'").findall(video_info_link)
            if len(img_data) == 1:
                video_info.set_video_image(img_data[0])
            video_link = re.compile(r"file:\'(.+?)\'").findall(video_info_link)[0]
        else:
            video_link = re.compile("'file': '(.+?)'").findall(html)[0]
        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
        
    except Exception, e:
        Logger.logError(e)
        video_info.set_video_stopped(True)
开发者ID:jigarsavla,项目名称:apple-tv2-xbmc,代码行数:25,代码来源:Movzap.py

示例6: __addMovieInfo_in_item

def __addMovieInfo_in_item(item):
    if item.get_next_action_name() == 'Movie_Streams':
        year = unicode(item.get_moving_data()['movieYear'], errors='ignore').encode('utf-8')
        title = unicode(item.get_moving_data()['movieTitle'], errors='ignore').encode('utf-8')
        meta = None
        try:
            global __metaget__
            if __metaget__ is None:
                __metaget__ = metahandlers.MetaData()
            meta = __metaget__.get_meta('movie', title, year=year)
        except:
            Logger.logDebug('Failed to load metahandler module')
        xbmc_item = item.get_xbmc_list_item_obj()
        
        if(meta is not None):
            xbmc_item.setIconImage(meta['thumb_url'])
            xbmc_item.setThumbnailImage(meta['cover_url'])
            videoInfo = {'trailer_url':meta['trailer_url']}
            for key, value in meta.items():
                if type(value) is str:
                    value = unicode(value).encode('utf-8')
                videoInfo[key] = value
            xbmc_item.setInfo('video', videoInfo)
            xbmc_item.setProperty('fanart_image', meta['backdrop_url'])
            item.add_request_data('videoInfo', videoInfo)
            
            contextMenuItems = []
            contextMenuItems.append(('Movie Information', 'XBMC.Action(Info)'))
            xbmc_item.addContextMenuItems(contextMenuItems, replaceItems=False)
        else:
            xbmc_item.setInfo('video', {'title':title, 'year':year})
            item.add_request_data('videoInfo', {'title':title, 'year':year})
开发者ID:jigarsavla,项目名称:apple-tv2-xbmc,代码行数:32,代码来源:Metadata.py

示例7: getVideoInfo

 def getVideoInfo(self, video_url):
     videoInfo = None
     videoId = self.getVideoId(video_url)
     if videoId is not None:
         Logger.logDebug('Snapper selected = ' + self.getModuleName() + ' for video URL = ' + video_url)
         videoInfo = self.__getVideoInfo(videoId)
     return videoInfo
开发者ID:jigarsavla,项目名称:apple-tv2-xbmc,代码行数:7,代码来源:SnapVideo.py

示例8: retrieveVideoLinks

def retrieveVideoLinks(request_obj, response_obj):
    video_source_id = 1
    video_source_img = None
    video_source_name = None
    video_part_index = 0
    video_playlist_items = []
    ignoreAllLinks = False
    
    content = BeautifulSoup.SoupStrainer('blockquote', {'class':re.compile(r'\bpostcontent\b')})
    soup = HttpClient().getBeautifulSoup(url=request_obj.get_data()['episodeUrl'], parseOnlyThese=content)
    for e in soup.findAll('br'):
        e.extract()
    Logger.logDebug(soup)
    if soup.has_key('div'):
        soup = soup.findChild('div', recursive=False)
    prevChild = ''
    prevAFont = None
    for child in soup.findChildren():
        if (child.name == 'img' or child.name == 'b' or (child.name == 'font' and not child.findChild('a'))):
            if (child.name == 'b' and prevChild == 'a') or (child.name == 'font' and child == prevAFont):
                continue
            else:
                if len(video_playlist_items) > 0:
                    response_obj.addListItem(__preparePlayListItem__(video_source_id, video_source_img, video_source_name, video_playlist_items))
                if video_source_img is not None:
                    video_source_id = video_source_id + 1
                    video_source_img = None
                    video_source_name = None
                    video_part_index = 0
                    video_playlist_items = []
                ignoreAllLinks = False
        elif not ignoreAllLinks and child.name == 'a' and not re.search('multi', str(child['href']), re.IGNORECASE):
            video_part_index = video_part_index + 1
            video_link = {}
            video_link['videoTitle'] = 'Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) + ' | ' + child.getText()
            video_link['videoLink'] = str(child['href'])
            try:
                try:
                    __prepareVideoLink__(video_link)
                except Exception, e:
                    Logger.logFatal(e)
                    video_hosting_info = SnapVideo.findVideoHostingInfo(video_link['videoLink'])
                    if video_hosting_info is None or video_hosting_info.get_video_hosting_name() == 'UrlResolver by t0mm0':
                        raise
                    video_link['videoSourceImg'] = video_hosting_info.get_video_hosting_image()
                    video_link['videoSourceName'] = video_hosting_info.get_video_hosting_name()
                video_playlist_items.append(video_link)
                video_source_img = video_link['videoSourceImg']
                video_source_name = video_link['videoSourceName']
                
                item = ListItem()
                item.add_request_data('videoLink', video_link['videoLink'])
                item.add_request_data('videoTitle', video_link['videoTitle'])
                item.set_next_action_name('SnapAndPlayVideo')
                xbmcListItem = xbmcgui.ListItem(label='Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) , iconImage=video_source_img, thumbnailImage=video_source_img)
                item.set_xbmc_list_item_obj(xbmcListItem)
                response_obj.addListItem(item)
                prevAFont = child.findChild('font')
            except:
开发者ID:jigarsavla,项目名称:apple-tv2-xbmc,代码行数:59,代码来源:DR_TVShows.py

示例9: retrievePlaylistVideoItems

def retrievePlaylistVideoItems(playlistId):
    Logger.logFatal('YouTube Playlist ID = ' + playlistId)
    soupXml = HttpUtils.HttpClient().getBeautifulSoup('http://gdata.youtube.com/feeds/api/playlists/' + playlistId + '?max-results=50')
    videoItemsList = []
    for media in soupXml.findChildren('media:player'):
        videoUrl = str(media['url'])
        videoItemsList.append(videoUrl)
    return videoItemsList
开发者ID:shauryaanand,项目名称:desimc,代码行数:8,代码来源:YouTube.py

示例10: retrieveReloadedPlaylistVideoItems

def retrieveReloadedPlaylistVideoItems(playlistId):
    Logger.logFatal('YouTube Reloaded Playlist ID = ' + playlistId)
    soupXml = HttpUtils.HttpClient().getBeautifulSoup('http://gdata.youtube.com/feeds/api/playlists/' + playlistId)
    videoItemsList = []
    for media in soupXml.findChildren('track'):
        videoUrl = media.findChild('location').getText()
        videoItemsList.append(videoUrl)
    return videoItemsList
开发者ID:shauryaanand,项目名称:desimc,代码行数:8,代码来源:YouTube.py

示例11: run_multi

def run_multi(func, args, name, i, repeat):
    log_name = os.path.join(log_dir, "%d.%s.log" % (i, name))
    log = Logger(strm=open(log_name, "w"))
    for j in range(repeat):
        t = func(*args)
        t.start()
        t.join()
        log.log(t.get())
    del log
开发者ID:telgniw,项目名称:CCBenchmark,代码行数:9,代码来源:test-table.py

示例12: addEmbeddedVideoInfoInPlayableItems

def addEmbeddedVideoInfoInPlayableItems(request_obj, response_obj):
    items = response_obj.get_item_list()
    playable_items = []
    for item in items:
        if item.get_next_action_name() == 'Play':
            playable_items.append(item)
    try:
        XBMCInterfaceUtils.callBackDialogProgressBar(getattr(sys.modules[__name__], '__addEmbeddedVideoInfo_in_item__'), playable_items, 'Retrieving video info', 'Failed to retrieve video information, please try again later')
    except Exception, e:
        Logger.logFatal(e)
开发者ID:jigarsavla,项目名称:apple-tv2-xbmc,代码行数:10,代码来源:SnapVideo.py

示例13: addVideoInfoInPlayableItems

def addVideoInfoInPlayableItems(request_obj, response_obj):
    items = response_obj.get_item_list()
    playable_items = []
    for item in items:
        if item.get_next_action_name() == 'Play':
            playable_items.append(item)
    try:
        XBMCInterfaceUtils.callBackDialogProgressBar(getattr(sys.modules[__name__], '__addVideoInfo_in_item'), playable_items, 'Retrieving video info', failure_message=None)
    except Exception, e:
        Logger.logFatal(e)
开发者ID:jigarsavla,项目名称:apple-tv2-xbmc,代码行数:10,代码来源:SnapVideo.py

示例14: __retrieveChannelTVShows__

def __retrieveChannelTVShows__(tvChannelObj):
    running_tvshows = []
    finished_tvshows = []
    try:
        running_tvshows = __retrieveTVShows__(tvChannelObj["running_tvshows_url"])
        if(len(running_tvshows) == 0):
            running_tvshows.append({"name":"ENTER TO VIEW :: This is the only easy way to view!", "url":BASE_WSITE_URL + tvChannelObj["running_tvshows_url"]})
    except Exception, e:
        Logger.logFatal(e)
        Logger.logDebug('Failed to load a channel... Continue retrieval of next tv show')
开发者ID:jigarsavla,项目名称:apple-tv2-xbmc,代码行数:10,代码来源:DR_TVShows.py

示例15: performAction

 def performAction(self, actionId):
     ProgressDisplayer().start('Processing request...')
     while actionId is not None:
         Logger.logInfo('Action to be performed ::' + actionId)
         turtle_route = self.getTurtleRoute(actionId)
         for move in turtle_route.moves:
             self.moveTurtle(move)
         actionId = self.judgeTurtleNextAction(turtle_route)
         
     ProgressDisplayer().end()
开发者ID:jigarsavla,项目名称:apple-tv2-xbmc,代码行数:10,代码来源:TurtleContainer.py


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