本文整理汇总了Python中maraschino.tools.get_setting_value函数的典型用法代码示例。如果您正苦于以下问题:Python get_setting_value函数的具体用法?Python get_setting_value怎么用?Python get_setting_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_setting_value函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: xhr_trakt_trending
def xhr_trakt_trending(type=None, mobile=False):
if not type:
type = get_setting_value('trakt_default_media')
limit = int(get_setting_value('trakt_trending_limit'))
logger.log('TRAKT :: Fetching trending %s' % type, 'INFO')
url = 'http://api.trakt.tv/%s/trending.json/%s' % (type, trakt_apikey())
try:
trakt = trak_api(url)
except Exception as e:
trakt_exception(e)
return render_template('traktplus/trakt-base.html', message=e)
if mobile:
return trakt
if len(trakt) > limit:
trakt = trakt[:limit]
for item in trakt:
item['images']['poster'] = cache_image(item['images']['poster'], type)
while THREADS:
time.sleep(1)
return render_template('traktplus/trakt-trending.html',
trending=trakt,
type=type.title(),
title='Trending',
)
示例2: loginToPlex
def loginToPlex(username=None, password=None):
global user
if username is None:
if not get_setting_value('myPlex_username') or not get_setting_value('myPlex_password'):
logger.log('Plex :: Missing Plex Credentials in db', 'INFO')
return False
else:
username = get_setting_value('myPlex_username')
password = get_setting_value('myPlex_password')
logger.log('Plex :: Logging into plex.tv', 'INFO')
try:
user = User(username, password)
user, token = user.MyPlexSignIn()
if user is '':
logger.log('Plex :: Log in FAILED', 'ERROR')
return False # failed to sign in
setting = get_setting('myPlex_token')
if not setting:
setting = Setting('myPlex_token')
setting.value = token
db_session.add(setting)
db_session.commit()
logger.log('Plex :: Log in successful', 'INFO')
return True
except:
logger.log('Plex :: Log in FAILED', 'ERROR')
return False
示例3: xhr_performance
def xhr_performance():
global processSchedule
global processList
info = {}
settings = {}
if (processSchedule == None):
logger.log("Process List SCHEDULE Job is Starting", 'INFO')
SCHEDULE.add_interval_job(get_process_performance, seconds=5)
processSchedule = 1
#Get Memory Status and NetIO Status
physicalMemory = psutil.virtual_memory()
swapMemory = psutil.swap_memory()
netio = psutil.net_io_counters(False)
#Get settings
settings['show_cpu_utilization'] = get_setting_value('show_cpu_utilization')
settings['show_network_utilization'] = get_setting_value('show_network_utilization')
settings['show_process_utilization'] = get_setting_value('show_process_utilization')
#Get Memory Stats
info['usedPhyMemory'] = convert_bytes(physicalMemory.used)
info['availPhyMemory'] = convert_bytes(physicalMemory.free)
info['totalPhyMemory'] = convert_bytes(physicalMemory.total)
info['usedSwapMemory'] = convert_bytes(swapMemory.used)
info['availSwapMemory'] = convert_bytes(swapMemory.free)
info['totalSwapMemory'] = convert_bytes(swapMemory.total)
#Display Network Status
if (settings['show_network_utilization'] == '1'):
info['bytesSent'] = convert_bytes(netio.bytes_sent)
info['bytesSentRate'] = updateSentRate(netio.bytes_sent)
info['bytesRecv'] = convert_bytes(netio.bytes_recv)
info['bytesRecvRate'] = updateDownloadRate(netio.bytes_recv)
info['packetSent'] = convert_bytes(netio.packets_sent).replace('B', '')
info['packetRecv'] = convert_bytes(netio.packets_recv).replace('B', '')
info['errin'] = netio.errin
info['errout'] = netio.errout
# must have some delay to prevent errors
if (settings['show_cpu_utilization'] == '1'):
i = 0
cpuList = [ ]
cpuPerCore = namedtuple('CPUPerCore', "index CPUpercentage")
for item in psutil.cpu_percent(0.1, True):
cpuList.append(cpuPerCore(index=i, CPUpercentage=item))
i += 1
info['totalCPUCol'] = i #used for html format table
info['cpuPercent'] = cpuList
info['cpuOverall'] = psutil.cpu_percent(0.1, False)
info['cpuTimes'] = psutil.cpu_times_percent(0.1, False)
if (settings['show_process_utilization'] == '1'):
info['processPerformance'] = processList
# Render the template for our module
return render_template('performance.html', result = info, settings = settings)
示例4: login_string
def login_string():
try:
login = '%s:%[email protected]' % (get_setting_value('couchpotato_user'), get_setting_value('couchpotato_password'))
except:
login = ''
return login
示例5: headphones_url
def headphones_url():
port = get_setting_value('headphones_port')
url_base = get_setting_value('headphones_host')
if port:
url_base = '%s:%s' % (url_base, port)
return headphones_http() + url_base
示例6: xbmc_sort
def xbmc_sort(media_type):
"""
Return sort values for media type.
"""
sort = {}
sort["method"] = get_setting_value("xbmc_" + media_type + "_sort")
sort["ignorearticle"] = get_setting_value("library_ignore_the") == "1"
sort["order"] = get_setting_value("xbmc_" + media_type + "_sort_order")
return sort
示例7: xbmc_sort
def xbmc_sort(media_type):
'''
Return sort values for media type.
'''
sort = {}
sort['method'] = get_setting_value('xbmc_'+media_type+'_sort')
sort['ignorearticle'] = get_setting_value('library_ignore_the') == '1'
sort['order'] = get_setting_value('xbmc_'+media_type+'_sort_order')
return sort
示例8: couchpotato_url_no_api
def couchpotato_url_no_api():
port = get_setting_value('couchpotato_port')
url_base = get_setting_value('couchpotato_ip')
if port:
url_base = '%s:%s' % ( url_base, port )
if login_string():
return couchpotato_http() + login_string() + url_base
return couchpotato_http() + url_base
示例9: headphones_url
def headphones_url():
port = get_setting_value("headphones_port")
url_base = get_setting_value("headphones_host")
webroot = get_setting_value("headphones_webroot")
if port:
url_base = "%s:%s" % (url_base, port)
if webroot:
url_base = "%s/%s" % (url_base, webroot)
return headphones_http() + url_base
示例10: couchpotato_url_no_api
def couchpotato_url_no_api():
port = get_setting_value('couchpotato_port')
url_base = get_setting_value('couchpotato_ip')
webroot = get_setting_value('couchpotato_webroot')
if port:
url_base = '%s:%s' % (url_base, port)
if webroot:
url_base = '%s/%s' % (url_base, webroot)
return couchpotato_http() + url_base
示例11: trak_api
def trak_api(url, params={}):
username = get_setting_value('trakt_username')
password = hashlib.sha1(get_setting_value('trakt_password')).hexdigest()
params = json.JSONEncoder().encode(params)
request = urllib2.Request(url, params)
base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
request.add_header("Authorization", "Basic %s" % base64string)
response = urllib2.urlopen(request)
response = response.read()
return json.JSONDecoder().decode(response)
示例12: couchpotato_proxy
def couchpotato_proxy(url):
username = get_setting_value("couchpotato_user")
password = get_setting_value("couchpotato_password")
url = "%s/file.cache/%s" % (couchpotato_url(), url)
req = urllib2.Request(url)
if username and password:
base64string = base64.encodestring("%s:%s" % (username, password)).replace("\n", "")
req.add_header("Authorization", "Basic %s" % base64string)
img = StringIO.StringIO(urllib2.urlopen(req).read())
logger.log("CouchPotato :: Fetching image from %s" % (url), "DEBUG")
return send_file(img, mimetype="image/jpeg")
示例13: couchpotato_proxy
def couchpotato_proxy(url):
username = get_setting_value('couchpotato_user')
password = get_setting_value('couchpotato_password')
url = '%s/file.cache/%s' % (couchpotato_url(), url)
request = urllib2.Request(url)
if username and password:
base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
request.add_header("Authorization", "Basic %s" % base64string)
img = StringIO.StringIO(urllib2.urlopen(request).read())
logger.log('CouchPotato :: Fetching image from %s' % (url), 'DEBUG')
return send_file(img, mimetype='image/jpeg')
示例14: xbmc_get_movies
def xbmc_get_movies(xbmc):
logger.log("LIBRARY :: Retrieving movies", "INFO")
sort = xbmc_sort("movies")
properties = ["playcount", "thumbnail", "year", "rating", "set"]
movies = xbmc.VideoLibrary.GetMovies(sort=sort, properties=properties)["movies"]
if get_setting_value("xbmc_movies_view_sets") == "1":
movies = xbmc_movies_with_sets(xbmc, movies)
if get_setting_value("xbmc_movies_hide_watched") == "1":
movies = [x for x in movies if not x["playcount"]]
return movies
示例15: xhr_trakt_watchlist
def xhr_trakt_watchlist(user, type=None, mobile=False):
if not type:
type = get_setting_value('trakt_default_media')
logger.log('TRAKT :: Fetching %s\'s %s watchlist' % (user, type), 'INFO')
url = 'http://api.trakt.tv/user/watchlist/%s.json/%s/%s/' % (type, trakt_apikey(), user)
try:
trakt = trak_api(url)
except Exception as e:
trakt_exception(e)
return render_template('traktplus/trakt-base.html', message=e)
if mobile:
return trakt
if trakt == []:
trakt = [{'empty': True}]
return render_template('traktplus/trakt-watchlist.html',
watchlist=trakt,
type=type.title(),
user=user,
title='Watchlist',
)