本文整理汇总了Python中utilities.log函数的典型用法代码示例。如果您正苦于以下问题:Python log函数的具体用法?Python log怎么用?Python log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: download_subtitles
def download_subtitles (subtitles_list, pos, zip_subs, tmp_sub_dir, sub_folder, session_id): #standard input
cj = CookieJar()
headers = {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Charset': 'UTF-8,*;q=0.5',
'Accept-Encoding': 'gzip,deflate,sdch',
'Accept-Language': 'pl,pl-PL;q=0.8,en-US;q=0.6,en;q=0.4',
'Connection': 'keep-alive',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.83 Safari/537.1',
'Referer': 'http://napisy24.pl/'
}
values = { 'form_logowanieMail' : __addon__.getSetting( "n24user" ), 'form_logowanieHaslo' : __addon__.getSetting( "n24pass" ), 'postAction' : 'sendLogowanie' }
data = urlencode(values)
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
request = urllib2.Request("http://napisy24.pl/logowanie/", data, headers)
response = opener.open(request)
request = urllib2.Request(subtitles_list[pos][ "link" ], "", headers)
f = opener.open(request)
local_tmp_file = os.path.join(tmp_sub_dir, "zipsubs.zip")
log( __name__ ,"Saving subtitles to '%s'" % (local_tmp_file))
local_file = open(zip_subs, "w" + "b")
local_file.write(f.read())
local_file.close()
opener.open("http://napisy24.pl/index.php?sendAction=Wyloguj")
language = subtitles_list[pos][ "language_name" ]
return True, language, "" #standard output
开发者ID:SMALLplayer,项目名称:smallplayer-image-creator,代码行数:28,代码来源:service.py
示例17: observation
def observation():
utilities.log( "Fetching Hourly Observation for '%s (%s)' from the Met Office..." % (OBSERVATION_LOCATION, OBSERVATION_LOCATION_ID))
with urlcache.URLCache(ADDON_DATA_PATH) as cache:
filename = cache.get(HOURLY_LOCATION_OBSERVATION_URL, observation_expiry)
data=json.load(open(filename))
try:
dv = data['SiteRep']['DV']
dataDate = utilities.strptime(dv.get('dataDate').rstrip('Z'), DATAPOINT_DATETIME_FORMAT).replace(tzinfo=pytz.utc)
WINDOW.setProperty('HourlyObservation.IssuedAt', dataDate.astimezone(TZ).strftime(ISSUEDAT_FORMAT))#@UndefinedVariable
try:
latest_period = dv['Location']['Period'][-1]
except KeyError:
latest_period = dv['Location']['Period']
try:
latest_obs = latest_period['Rep'][-1]
except KeyError:
latest_obs = latest_period['Rep']
WINDOW.setProperty('Current.Condition', WEATHER_CODES[latest_obs.get('W', 'na')][1])#@UndefinedVariable
WINDOW.setProperty('Current.Visibility', latest_obs.get('V', 'n/a'))#@UndefinedVariable
WINDOW.setProperty('Current.Pressure', latest_obs.get('P', 'n/a'))#@UndefinedVariable
WINDOW.setProperty('Current.Temperature', str(round(float(latest_obs.get('T', 'n/a')))).split('.')[0])#@UndefinedVariable
WINDOW.setProperty('Current.Wind', latest_obs.get('S', 'n/a'))#@UndefinedVariable
WINDOW.setProperty('Current.WindDirection', latest_obs.get('D', 'n/a'))#@UndefinedVariable
WINDOW.setProperty('Current.WindGust', latest_obs.get('G', 'n/a'))#@UndefinedVariable
WINDOW.setProperty('Current.OutlookIcon', '%s.png' % WEATHER_CODES[latest_obs.get('W', 'na')][0])#@UndefinedVariable
WINDOW.setProperty('Current.FanartCode', '%s.png' % WEATHER_CODES[latest_obs.get('W','na')][0])#@UndefinedVariable
WINDOW.setProperty('Current.DewPoint', str(round(float(latest_obs.get('Dp', 'n/a')))).split('.')[0])#@UndefinedVariable
WINDOW.setProperty('Current.Humidity', str(round(float(latest_obs.get('H', 'n/a')))).split('.')[0])#@UndefinedVariable
WINDOW.setProperty('HourlyObservation.IsFetched', 'true')#@UndefinedVariable
except KeyError as e:
e.args = ("Key Error in JSON File", "Key '{0}' not found while processing file from url:".format(e.args[0]), HOURLY_LOCATION_OBSERVATION_URL)
raise
开发者ID:ReSearchITEng,项目名称:allinclusive-kodi-pi,代码行数:33,代码来源:properties.py
示例18: download
def download(self,link):
dest_dir = os.path.join(xbmc.translatePath(self.addon.getAddonInfo('profile').decode("utf-8")), 'temp')
dest = os.path.join(dest_dir, "download.tmp")
log(__name__,'Downloading subtitles from %s' % link)
res = urllib.urlopen(link)
subtitles_filename = re.search("Content\-Disposition: attachment; filename=\"(.+?)\"",str(res.info())).group(1)
log(__name__,'Filename: %s' % subtitles_filename)
subtitles_format = re.search("\.(\w+?)$", subtitles_filename, re.IGNORECASE).group(1)
log(__name__,"Subs in %s" % subtitles_format)
subtitles_data = res.read()
log(__name__,'Saving to file %s' % dest)
zip_file = open(dest,'wb')
zip_file.write(subtitles_data)
zip_file.close()
final_dest = os.path.join(dest_dir, "download." + subtitles_format)
log(__name__,'Changing filename to %s' % final_dest)
os.rename(dest, final_dest)
return final_dest
开发者ID:beam,项目名称:service.subtitles.edna.cz,代码行数:26,代码来源:EdnaClient.py
示例19: daily
def daily():
utilities.log( "Fetching Daily Forecast for '%s (%s)' from the Met Office..." % (FORECAST_LOCATION, FORECAST_LOCATION_ID))
with urlcache.URLCache(ADDON_DATA_PATH) as cache:
filename = cache.get(DAILY_LOCATION_FORECAST_URL, daily_expiry)
data=json.load(open(filename))
try:
dv = data['SiteRep']['DV']
dataDate = utilities.strptime(dv.get('dataDate').rstrip('Z'), DATAPOINT_DATETIME_FORMAT).replace(tzinfo=pytz.utc)
WINDOW.setProperty('DailyForecast.IssuedAt', dataDate.astimezone(TZ).strftime(ISSUEDAT_FORMAT))#@UndefinedVariable
for p, period in enumerate(dv['Location']['Period']):
WINDOW.setProperty('Day%d.Title' %p, time.strftime(SHORT_DAY_FORMAT, time.strptime(period.get('value'), DATAPOINT_DATE_FORMAT)))#@UndefinedVariable
for rep in period['Rep']:
weather_type = rep.get('W', 'na')
if rep.get('$') == 'Day':
WINDOW.setProperty('Day%d.HighTemp' %p, rep.get('Dm', 'na'))#@UndefinedVariable
WINDOW.setProperty('Day%d.HighTempIcon' %p, rep.get('Dm'))#@UndefinedVariable
WINDOW.setProperty('Day%d.Outlook' %p, WEATHER_CODES.get(weather_type)[1])#@UndefinedVariable
WINDOW.setProperty('Day%d.OutlookIcon' % p, WEATHER_ICON_PATH % WEATHER_CODES.get(weather_type, 'na')[0])#@UndefinedVariable
WINDOW.setProperty('Day%d.WindSpeed' % p, rep.get('S', 'na'))#@UndefinedVariable
WINDOW.setProperty('Day%d.WindDirection' % p, rep.get('D', 'na').lower())#@UndefinedVariable
elif rep.get('$') == 'Night':
WINDOW.setProperty('Day%d.LowTemp' %p, rep.get('Nm', 'na'))#@UndefinedVariable
WINDOW.setProperty('Day%d.LowTempIcon' %p, rep.get('Nm'))#@UndefinedVariable
except KeyError as e:
e.args = ("Key Error in JSON File", "Key '{0}' not found while processing file from url:".format(e.args[0]), DAILY_LOCATION_FORECAST_URL)
raise
WINDOW.setProperty('DailyForecast.IsFetched', 'true')#@UndefinedVariable
开发者ID:ReSearchITEng,项目名称:allinclusive-kodi-pi,代码行数:29,代码来源:properties.py
示例20: login
def login(username, password):
log( __name__ , " Logging in with username '%s' ..." % (username))
content= geturl(main_url + 'index.php')
if content is not None:
match = re.search('logouticon.png', content, re.IGNORECASE | re.DOTALL)
if match:
return 1
else:
match = re.search(unique_pattern, content, re.IGNORECASE | re.DOTALL)
if match:
return_value = match.group(1)
unique_name = match.group(2)
unique_value = match.group(3)
login_postdata = urllib.urlencode({'username': username, 'passwd': password, 'remember': 'yes', 'Submit': 'Login', 'remember': 'yes', 'option': 'com_user', 'task': 'login', 'silent': 'true', 'return': return_value, unique_name: unique_value} )
cj = cookielib.CookieJar()
my_opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
urllib2.install_opener(my_opener)
request = urllib2.Request(main_url + 'index.php',login_postdata)
response = urllib2.urlopen(request).read()
match = re.search('logouticon.png', response, re.IGNORECASE | re.DOTALL)
if match:
return 1
else:
return 0
else:
return 0
开发者ID:Saviq,项目名称:script.xbmc.subtitles,代码行数:26,代码来源:service.py
注:本文中的utilities.log函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论