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


Python utilities.log函数代码示例

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


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

示例1: is_authorized

 def is_authorized(self):
     if self.is_token_empty():
         return False
     if self.authorized == None:
         self.authorized = self.check_authorization() != False
     log("Is authorized ~ " + str(self.authorized))
     return self.authorized
开发者ID:beam,项目名称:script.tvshowtime.rework,代码行数:7,代码来源:TVShowTimeClient.py

示例2: dump_build_information

def dump_build_information(args):
    """Log the packages provided & depended on by this build

    This function logs all packages that will be built if this build
    succeeds. This includes 'virtual' packages, i.e. packages like 'sh'
    that don't really exist but are provided by 'bash'.

    This is so that if this build fails, any build that depends on a
    package provided by this build knows who to blame when it can't
    install its dependencies.

    This function also logs what packages are depended on by this build.
    """
    pkgbuild = os.path.join(args.abs_dir, "PKGBUILD")
    provides = []
    provides += [strip_version_info(name) for name in interpret_bash_array(pkgbuild, "pkgname")]
    provides += [strip_version_info(name) for name in interpret_bash_array(pkgbuild, "provides")]

    log("provide_info", None, output=provides)

    depends = []
    depends += [strip_version_info(name) for name in interpret_bash_array(pkgbuild, "depends")]
    depends += [strip_version_info(name) for name in interpret_bash_array(pkgbuild, "makedepends")]

    log("dep_info", "This build depends on the following packages", output=depends)
开发者ID:karkhaz,项目名称:tuscan,代码行数:25,代码来源:main.py

示例3: login

	def login(self,username,password):
			log(__name__,'Logging in to Titulky.com')
			login_postdata = urllib.urlencode({'Login': username, 'Password': password, 'foreverlog': '1','Detail2':''} )
			request = urllib2.Request(self.server_url + '/index.php',login_postdata)
			response = urllib2.urlopen(request).read()
			log(__name__,'Got response')
			return not response.find('BadLogin')>-1
开发者ID:yurybubnov,项目名称:script.fansubs.subtitles,代码行数:7,代码来源:service.py

示例4: getAllSubtitles

def getAllSubtitles(subtitlePageID,languageList,subtitlesList):
    # Retrieve the subtitles page (html)
    try:
        subtitlePage = getURL(BASE_URL + subtitlePageID)
    except:
        # Didn't find the page - no such episode?
        return
    # Didn't find the page - no such episode?
    if (not subtitlePage):
        return
    # Find subtitles dictionary declaration on page
    tempStart = subtitlePage.index("subtitles_groups = ")
    # Look for the following line break
    tempEnd = subtitlePage.index("\n",subtitlePage.index("subtitles_groups = "))
    toExec = "foundSubtitles = "+subtitlePage[tempStart+len("subtitles_groups = "):tempEnd]
    # Remove junk at the end of the line
    toExec = toExec[:toExec.rfind("}")+1]
    exec(toExec)
    log( __name__ ,"Built webpage dictionary")
    for language in foundSubtitles.keys():
        if (twotofull(language) in languageList): 
            for translator in foundSubtitles[language]:
                for quality in foundSubtitles[language][translator]:
                    for rating in foundSubtitles[language][translator][quality]:
                        subtitlesList.append({'rating': rating, 'sync': False,
                            'filename': foundSubtitles[language][translator][quality][rating]["subtitle_version"],
                            'subtitle_id': foundSubtitles[language][translator][quality][rating]["id"],
                            'language_flag': 'flags/' + language + '.gif',
                            'language_name': twotofull(language),
                            'key': foundSubtitles[language][translator][quality][rating]["key"]})
开发者ID:jmarcet,项目名称:script.xbmc.subtitles,代码行数:30,代码来源:service.py

示例5: search_subtitles

def search_subtitles( file_original_path, title, tvshow, year, season, episode, set_temp, rar, language1, language2, language3, stack ): #standard input
    subtitles_list = []
    msg = ""

    log(__name__, "Search GomTV with a file name, "+file_original_path)
    movieFullPath = xbmc.Player().getPlayingFile()
    video_hash = hashFileMD5( movieFullPath, buff_size=1024*1024 )
    if video_hash is None:
        msg = _(755)
        return subtitles_list, "", msg  #standard output
    webService = GomTvWebService()
    if len(tvshow) > 0:                                            # TvShow
        OS_search_string = ("%s S%.2dE%.2d" % (tvshow,
                                           int(season),
                                           int(episode),)
                                          ).replace(" ","+")      
    else:                                                          # Movie or not in Library
        if str(year) == "":                                          # Not in Library
            title, year = xbmc.getCleanMovieTitle( title )
        else:                                                        # Movie in Library
            year  = year
            title = title
        OS_search_string = title.replace(" ","+")
    subtitles_list = webService.SearchSubtitlesFromTitle( OS_search_string ,video_hash)
    log(__name__, "Found %d subtitles in GomTV" %len(subtitles_list))

    return subtitles_list, "", msg  #standard output
开发者ID:SMALLplayer,项目名称:smallplayer-image-creator,代码行数:27,代码来源:service.py

示例6: search_subtitles

def search_subtitles( file_original_path, title, tvshow, year, season, episode, set_temp, rar, lang1, lang2, lang3, stack ): #standard input     
  ok = False
  msg = ""
  osdb_server = OSDBServer()
  osdb_server.create()    
  subtitles_list = []
  file_size = ""
  hashTry = ""
  language1 = languageTranslate(lang1,0,1)
  language2 = languageTranslate(lang2,0,1)
  language3 = languageTranslate(lang3,0,1)  
  if set_temp : 
    hash_search = False
    file_size   = "000000000"
    SubHash     = "000000000000"
  else:
    try:
      file_size, SubHash   = xbmc.subHashAndFileSize(file_original_path)
      log( __name__ ,"xbmc module hash and size")
      hash_search = True
    except:  
      file_size   = ""
      SubHash     = ""
      hash_search = False
  
  if file_size != "" and SubHash != "":
    log( __name__ ,"File Size [%s]" % file_size )
    log( __name__ ,"File Hash [%s]" % SubHash)
  if hash_search :
    log( __name__ ,"Search for [%s] by hash" % (os.path.basename( file_original_path ),))
    subtitles_list, session_id = osdb_server.searchsubtitles_pod( SubHash ,language1, language2, language3, stack)
  if not subtitles_list:
    log( __name__ ,"Search for [%s] by name" % (os.path.basename( file_original_path ),))
    subtitles_list = osdb_server.searchsubtitlesbyname_pod( title, tvshow, season, episode, language1, language2, language3, year, stack )
  return subtitles_list, "", "" #standard output
开发者ID:yurybubnov,项目名称:script.fansubs.subtitles,代码行数:35,代码来源:service.py

示例7: search_subtitles

def search_subtitles(
    file_original_path, title, tvshow, year, season, episode, set_temp, rar, lang1, lang2, lang3, stack
):  # standard input
    subtitles_list = []
    msg = ""
    if len(tvshow) == 0:
        searchstring = title
    if len(tvshow) > 0:
        searchstring = "%s S%#02dE%#02d" % (tvshow, int(season), int(episode))
    log(__name__, "Search string = %s" % (searchstring))

    swedish = 0
    if string.lower(lang1) == "swedish":
        swedish = 1
    elif string.lower(lang2) == "swedish":
        swedish = 2
    elif string.lower(lang3) == "swedish":
        swedish = 3

    if swedish > 0:
        getallsubs(searchstring, "sv", "Swedish", subtitles_list)

    if swedish == 0:
        msg = "Won't work, Swesub.nu is only for Swedish subtitles."

    return subtitles_list, "", msg  # standard output
开发者ID:sbentin,项目名称:script.xbmc.subtitles,代码行数:26,代码来源:service.py

示例8: release

    def release(self, datasetID, size=0):
		if size <= self.__threshold:
			self.__fast_queue.release(datasetID)
 			log("DatasetProcessorManager.release(dataset="+str(datasetID)+",size=" + repr(size) + ") from the __fast_queue")
		else:
			self.__slow_queue.release(datasetID)
			log("DatasetProcessorManager.release(dataset="+str(datasetID)+",size=" + repr(size) + ") from the __slow_queue")
开发者ID:kosio,项目名称:EpiExplorer,代码行数:7,代码来源:DatasetProcessorManager.py

示例9: getAllSubtitles

def getAllSubtitles(fname, subtitlePageID, languageList):
    # Retrieve the subtitles page (html)
    subs = []
    subtitlePage = getURL(BASE_URL + "getajax.php?moviedetailssubtitles=" + subtitlePageID[1:])
    # Create a list of all subtitles found on page
    foundSubtitles = re.findall(COMBINED, subtitlePage)
    for (fid, language, title, fid2, language2, title2) in foundSubtitles:
        log(__name__, "%s Is sendspace?: %s" % (debug_pretext, bool(fid2 and len(fid2) > 0)))
        # Create Dictionery for XBMC Gui
        if fid2 and len(fid2) > 0:
            fid = fid2
            language = language2
            title = title2
        # Check if the subtitles found match one of our languages was selected
        # by the user
        if sratimToScript(language) in languageList:
            rating = getrating(title, fname)
            subs.append(
                {
                    "rating": str(rating),
                    "sync": rating >= 8,
                    "filename": title,
                    "subtitle_id": fid,
                    "language_flag": "flags/" + languageTranslate(sratimToScript(language), 0, 2) + ".gif",
                    "language_name": sratimToScript(language),
                    "sendspace": (fid2 and len(fid2) > 0),
                }
            )
    return sorted(subs, key=lambda x: int(float(x["rating"])), reverse=True)
开发者ID:CaTzil,项目名称:XBMC-1,代码行数:29,代码来源:service.py

示例10: getallsubs

def getallsubs(searchstring, languageshort, languagelong, subtitles_list):
    url = (
        main_url
        + "search.php?q=&r=0&s=S%F6k&in="
        + urllib.quote_plus(searchstring)
        + "&ex=&ep=&be="
        + urllib.quote_plus(searchstring)
        + "&adv=0"
    )
    content = geturl(url)
    if content is not None:
        log(__name__, "Getting '%s' subs ..." % (languageshort))
        for matches in re.finditer(subtitle_pattern, content, re.IGNORECASE | re.DOTALL):
            id = matches.group(1)
            filename = string.strip(matches.group(2))
            log(__name__, "Subtitles found: %s (id = %s)" % (filename, id))
            subtitles_list.append(
                {
                    "rating": "0",
                    "no_files": 1,
                    "filename": filename,
                    "sync": False,
                    "id": id,
                    "language_flag": "flags/" + languageshort + ".gif",
                    "language_name": languagelong,
                }
            )
开发者ID:sbentin,项目名称:script.xbmc.subtitles,代码行数:27,代码来源:service.py

示例11: getrating

def getrating(subsfile, videofile):
    x = 0
    rating = 0
    log(__name__, "# Comparing Releases:\n %s [subtitle-rls] \n %s  [filename-rls]" % (subsfile, videofile))
    videofile = "".join(videofile.split(".")[:-1]).lower()
    subsfile = subsfile.lower().replace(".", "")
    videofile = videofile.replace(".", "")
    for release_type in releases_types:
        if release_type in videofile:
            x += 1
            if release_type in subsfile:
                rating += 1
    if x:
        rating = (rating / float(x)) * 4
    # Compare group name
    if videofile.split("-")[-1] == subsfile.split("-")[-1]:
        rating += 1
    # Group name didnt match
    # try to see if group name is in the beginning (less info on file less weight)
    elif videofile.split("-")[0] == subsfile.split("-")[-1]:
        rating += 0.5
    if rating > 0:
        rating = rating * 2
    log(__name__, "# Result is:  %f" % rating)
    return round(rating)
开发者ID:CaTzil,项目名称:XBMC-1,代码行数:25,代码来源:service.py

示例12: search_show_url

	def search_show_url(self, title, show_list):
		log(__name__,"Starting search by TV Show: %s" % title)
		if not title: return None

		for threshold_ratio in range(100,50,-5):
			if threshold_ratio == None: return show_list
			tv_show_list = []
			for tv_show in show_list:
				matcher = SequenceMatcher(None, re.sub(r'(?i)^The ',"", tv_show["title"]), re.sub(r'(?i)^The ',"", title)).ratio() * 100
				if matcher >= threshold_ratio: tv_show_list.append(tv_show)

			if tv_show_list: break

		if not tv_show_list: tv_show_list = show_list

		if (len(tv_show_list) == 0):
			log(__name__,"No TV Show found")
			return None
		elif (len(tv_show_list) == 1):
			log(__name__,"One TV Show found, autoselecting")
			tvshow_url = tv_show_list[0]['url']
		else:
			log(__name__,"More TV Shows found, user dialog for select")
			menu_dialog = []
			for tv_show in tv_show_list: menu_dialog.append(tv_show['title'])
			dialog = xbmcgui.Dialog()
			found_tv_show_id = dialog.select(self._t(32003), menu_dialog)
			if (found_tv_show_id == -1): return None # cancel dialog
			tvshow_url = tv_show_list[found_tv_show_id]['url']

		tvshow_url = "/titulky/serial-" + tvshow_url
		log(__name__,"Selected show URL: " + tvshow_url)
		return tvshow_url
开发者ID:beam,项目名称:service.subtitles.nextweek.cz,代码行数:33,代码来源:NextWeekClient.py

示例13: mark_episode_in_range_from_start

 def mark_episode_in_range_from_start(self, tvdb_show_id, last_season=None, last_episode=None, watched=True):
     action = "show_progress" if watched == True else "delete_show_progress"
     log(
         "Mark episodes in range: "
         + action
         + " - "
         + str(tvdb_show_id)
         + " / "
         + str(last_season)
         + " / "
         + str(last_episode)
     )
     try:
         values = {"show_id": int(tvdb_show_id)}
         if last_season:
             values["season"] = int(last_season)
         if last_episode:
             values["episode"] = int(last_episode)
         res = urllib2.urlopen(self.base_api_url + action + "?access_token=" + self.token, urllib.urlencode(values))
         data = json.loads(res.read())
     except urllib2.HTTPError as res:
         data = {"result": "KO", "error": res}
     self.store_api_rate(res.headers)
     log(data)
     return data["result"] == "OK"
开发者ID:beam,项目名称:script.tvshowtime.rework,代码行数:25,代码来源:TVShowTimeClient.py

示例14: getAllSubtitles

def getAllSubtitles(subtitlePageID,languageList,fname):
    # Retrieve the subtitles page (html)
    subs= []
    try:
        subtitlePage = getURL(BASE_URL + subtitlePageID)
    except:
        # Didn't find the page - no such episode?
        return
    # Didn't find the page - no such episode?
    if (not subtitlePage):
        return
    # Find subtitles dictionary declaration on page
    toExec = "foundSubtitles = " + subtitlePage
    # Remove junk at the end of the line
    toExec = toExec[:toExec.rfind("}")+1]
    # Replace "null" with "None"
    toExec = toExec.replace("null","None")
    exec(toExec) in globals(), locals()
    log( __name__ ,"Built webpage dictionary")
    for language in foundSubtitles.keys():
        if (languageTranslate(language, 2, 0) in languageList): 
            for translator in foundSubtitles[language]:
                for quality in foundSubtitles[language][translator]:
                    for rating in foundSubtitles[language][translator][quality]:
                        title=foundSubtitles[language][translator][quality][rating]["subtitle_version"]
                        Srating=getrating(title,fname)
                        subs.append({'rating': str(Srating), 'sync': Srating>=8,
                            'filename': title,
                            'subtitle_id': foundSubtitles[language][translator][quality][rating]["id"],
                            'language_flag': 'flags/' + language + '.gif',
                            'language_name': languageTranslate(language, 2, 0),
                            'key': foundSubtitles[language][translator][quality][rating]["key"],
                            'notes': re.search('http://www\.sendspace\.com/file/\w+$',foundSubtitles[language][translator][quality][rating]["notes"])})
    # sort, to put syncs on top
    return sorted(subs,key=lambda x: int(float(x['rating'])),reverse=True)
开发者ID:CaTzil,项目名称:XBMC-1,代码行数:35,代码来源:service.py

示例15: text

def text():
    utilities.log( "Fetching Text Forecast for '%s (%s)' from the Met Office..." % (REGIONAL_LOCATION, REGIONAL_LOCATION_ID))
    with urlcache.URLCache(ADDON_DATA_PATH) as cache:
        filename = cache.get(TEXT_FORECAST_URL, text_expiry)
        data=json.load(open(filename))
    try:
        rf = data['RegionalFcst']
        issuedat = utilities.strptime(rf['issuedAt'].rstrip('Z'), DATAPOINT_DATETIME_FORMAT).replace(tzinfo=pytz.utc)
        WINDOW.setProperty('TextForecast.IssuedAt', issuedat.astimezone(TZ).strftime(ISSUEDAT_FORMAT))#@UndefinedVariable
        count = 0
        for period in rf['FcstPeriods']['Period']:
            #have to check type because json can return list or dict here
            if isinstance(period['Paragraph'],list):
                for paragraph in period['Paragraph']:
                    WINDOW.setProperty('Text.Paragraph%d.Title' % count, paragraph['title'].rstrip(':').lstrip('UK Outlook for'))#@UndefinedVariable
                    WINDOW.setProperty('Text.Paragraph%d.Content' % count, paragraph['$'])#@UndefinedVariable
                    count+=1
            else:
                WINDOW.setProperty('Text.Paragraph%d.Title' % count, period['Paragraph']['title'].rstrip(':').lstrip('UK Outlook for'))#@UndefinedVariable
                WINDOW.setProperty('Text.Paragraph%d.Content' % count, period['Paragraph']['$'])#@UndefinedVariable
                count+=1
    except KeyError as e:
        e.args = ("Key Error in JSON File", "Key '{0}' not found while processing file from url:".format(e.args[0]), TEXT_FORECAST_URL)
        raise
    WINDOW.setProperty('TextForecast.IsFetched', 'true')#@UndefinedVariable
开发者ID:ReSearchITEng,项目名称:allinclusive-kodi-pi,代码行数:25,代码来源:properties.py


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