• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python tools.get_setting_value函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了get_setting_value函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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',
    )
开发者ID:mboeru,项目名称:maraschino,代码行数:31,代码来源:traktplus.py


示例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
开发者ID:RoostayFish,项目名称:maraschino,代码行数:31,代码来源:noneditable.py


示例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)
开发者ID:wjbridge,项目名称:maraschino,代码行数:59,代码来源:performance.py


示例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
开发者ID:alejandroblanco82,项目名称:maraschino,代码行数:8,代码来源:couchpotato.py


示例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
开发者ID:alejandroblanco82,项目名称:maraschino,代码行数:8,代码来源:headphones.py


示例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
开发者ID:kaylix,项目名称:maraschino,代码行数:10,代码来源:library.py


示例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
开发者ID:stefaanlepever,项目名称:maraschino,代码行数:10,代码来源:library.py


示例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
开发者ID:alejandroblanco82,项目名称:maraschino,代码行数:11,代码来源:couchpotato.py


示例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
开发者ID:titan04,项目名称:maraschino,代码行数:12,代码来源:headphones.py


示例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
开发者ID:kaiquewdev,项目名称:maraschino,代码行数:12,代码来源:couchpotato.py


示例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)
开发者ID:alejandroblanco82,项目名称:maraschino,代码行数:13,代码来源:traktplus.py


示例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")
开发者ID:RoostayFish,项目名称:maraschino,代码行数:14,代码来源:couchpotato.py


示例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')
开发者ID:kaiquewdev,项目名称:maraschino,代码行数:14,代码来源:couchpotato.py


示例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
开发者ID:kaylix,项目名称:maraschino,代码行数:15,代码来源:library.py


示例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',
    )
开发者ID:mboeru,项目名称:maraschino,代码行数:25,代码来源:traktplus.py


示例16: xbmc_get_moviesets

def xbmc_get_moviesets(xbmc, setid):
    logger.log('LIBRARY :: Retrieving movie set: %s' % setid, 'INFO')
    version = xbmc.Application.GetProperties(properties=['version'])['version']['major']

    sort = xbmc_sort('movies')
    properties = ['playcount', 'thumbnail', 'year', 'rating', 'set']
    params = {'sort': sort, 'properties': properties}

    if version == 11: #Eden
        params['properties'].append('setid')

    else: #Frodo
        params['filter'] = {'setid':setid}

    movies = xbmc.VideoLibrary.GetMovies(**params)['movies']

    if version == 11: #Eden
        movies = [x for x in movies if setid in x['setid']]
        setlabel = xbmc.VideoLibrary.GetMovieSetDetails(setid=setid)['setdetails']['label']
        for movie in movies:
            movie['set'] = setlabel

    if get_setting_value('xbmc_movies_hide_watched') == '1':
        movies = [x for x in movies if not x['playcount']]

    movies[0]['setid'] = setid
    return movies
开发者ID:stefaanlepever,项目名称:maraschino,代码行数:27,代码来源:library.py


示例17: server_settings

def server_settings():
    servers = XbmcServer.query.order_by(XbmcServer.position)

    if servers.count() == 0:
        return {
            'hostname': None,
            'port': None,
            'username': None,
            'password': None,
        }

    active_server = get_setting_value('active_server')

    # if active server is not defined, set it

    if not active_server:
        active_server = Setting('active_server', servers.first().id)
        db_session.add(active_server)
        db_session.commit()

    try:
        server = servers.get(active_server)

    except:
        logger.log('Could not retrieve active server, falling back on first entry' , 'WARNING')
        server = servers.first()

    return {
        'hostname': server.hostname,
        'port': server.port,
        'username': server.username,
        'password': server.password,
        'type': server.type,
        'mac_address': server.mac_address,
    }
开发者ID:elsingaa,项目名称:maraschino,代码行数:35,代码来源:noneditable.py


示例18: get_process_performance

def get_process_performance():
    ''' Gets the list of processes that are using the most CPU and RAM on the system '''
    global processList
    global enableThread
       
    #Create anmed tuple to store list
    Process = namedtuple('Process', "pid name cpu_percent memory_percent")
      
    Plist = [ ]

    #Create a list of all processes with info about them
    for pid in psutil.process_iter():
        try:
            #Do we have a process that has 'python'
            if ('python' in pid.name.lower()):
                #get python script name
                Plist.append(Process(pid=pid.pid, name=extractPythonScriptName(pid), cpu_percent=round(pid.get_cpu_percent(), 3), memory_percent=round(pid.get_memory_percent(), 2)))
            else:
                #Use generic name
                Plist.append(Process(pid=pid.pid, name=pid.name, cpu_percent=round(pid.get_cpu_percent(), 3), memory_percent=round(pid.get_memory_percent(), 2)))
        
        except psutil.AccessDenied:
            pass
    
    #Sort the list first by CPU then by Memory. Get top x
    Plist = sorted(Plist, key=lambda x: (x.cpu_percent, x.memory_percent), reverse=True)
    
    #Assign list
    processList = Plist[:int(get_setting_value('top_process_number'))]
开发者ID:wjbridge,项目名称:maraschino,代码行数:29,代码来源:performance.py


示例19: xbmc_get_seasons

def xbmc_get_seasons(xbmc, tvshowid):
    logger.log('LIBRARY :: Retrieving seasons for tvshowid: %s' % tvshowid, 'INFO')
    version = xbmc.Application.GetProperties(properties=['version'])['version']['major']
    params = {'sort': xbmc_sort('seasons')}

    if version < 12 and params['sort']['method'] in ['rating', 'playcount', 'random']: #Eden
        logger.log('LIBRARY :: Sort method "%s" is not supported in XBMC Eden. Reverting to "label"' % params['sort']['method'], 'INFO')
        change_sort('seasons', 'label')
        params['sort'] = xbmc_sort('seasons')

    params['tvshowid'] = tvshowid
    params['properties'] = ['playcount', 'showtitle', 'tvshowid', 'season', 'thumbnail', 'episode']

    seasons = xbmc.VideoLibrary.GetSeasons(**params)['seasons']

    if get_setting_value('xbmc_seasons_hide_watched') == '1':
        seasons = [x for x in seasons if not x['playcount']]

    #Add episode playcounts to seasons
    for season in seasons:
        episodes = xbmc.VideoLibrary.GetEpisodes(
            tvshowid=tvshowid,
            season=season['season'],
            properties=['playcount']
        )['episodes']
        season['unwatched'] = len([x for x in episodes if not x['playcount']])

    return seasons
开发者ID:stefaanlepever,项目名称:maraschino,代码行数:28,代码来源:library.py


示例20: xbmc_get_episodes

def xbmc_get_episodes(xbmc, tvshowid, season):
    logger.log("LIBRARY :: Retrieving episodes for tvshowid: %s season: %s" % (tvshowid, season), "INFO")
    version = xbmc.Application.GetProperties(properties=["version"])["version"]["major"]
    params = {"sort": xbmc_sort("episodes")}

    if version < 12 and params["sort"]["method"] in ["rating", "playcount", "random"]:  # Eden
        logger.log(
            'LIBRARY :: Sort method "%s" is not supported in XBMC Eden. Reverting to "episode"'
            % params["sort"]["method"],
            "INFO",
        )
        change_sort("episodes", "episode")
        params["sort"] = xbmc_sort("episodes")

    params["tvshowid"] = tvshowid
    params["season"] = season
    params["properties"] = [
        "playcount",
        "season",
        "episode",
        "tvshowid",
        "showtitle",
        "thumbnail",
        "firstaired",
        "rating",
    ]

    episodes = xbmc.VideoLibrary.GetEpisodes(**params)["episodes"]

    if get_setting_value("xbmc_episodes_hide_watched") == "1":
        episodes = [x for x in episodes if not x["playcount"]]

    return episodes
开发者ID:kaylix,项目名称:maraschino,代码行数:33,代码来源:library.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python marathon.MarathonClient类代码示例发布时间:2022-05-27
下一篇:
Python logger.log函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap