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

Python logger.log函数代码示例

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

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



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

示例1: create_dir

def create_dir(dir):
    if not os.path.exists(dir):
        try:
            logger.log('TRAKT :: Creating dir %s' % dir, 'INFO')
            os.makedirs(dir)
        except:
            logger.log('TRAKT :: Problem creating dir %s' % dir, 'ERROR')
开发者ID:LordGaav,项目名称:maraschino,代码行数:7,代码来源:traktplus.py


示例2: xhr_headphones_artists

def xhr_headphones_artists(mobile=False):
    logger.log("HEADPHONES :: Fetching artists list", "INFO")
    artists = []

    try:
        headphones = headphones_api("getIndex")
        updates = headphones_api("getVersion")
    except Exception as e:
        if mobile:
            headphones_exception(e)
            return artists
        return headphones_exception(e)

    for artist in headphones:
        if not "Fetch failed" in artist["ArtistName"]:
            try:
                artist["Percent"] = int(100 * float(artist["HaveTracks"]) / float(artist["TotalTracks"]))
            except:
                artist["Percent"] = 0

            if not hp_compact() and not mobile:
                try:
                    artist["ThumbURL"] = hp_artistart(artist["ArtistID"])
                except:
                    pass
            artists.append(artist)

    if mobile:
        return artists

    return render_template(
        "headphones-artists.html", headphones=True, artists=artists, updates=updates, compact=hp_compact()
    )
开发者ID:titan04,项目名称:maraschino,代码行数:33,代码来源:headphones.py


示例3: xhr_headphones_artist_action

def xhr_headphones_artist_action(artistid, action, mobile=False):
    if action == "pause":
        logger.log("HEADPHONES :: Pausing artist", "INFO")
        command = "pauseArtist&id=%s" % artistid
    elif action == "resume":
        logger.log("HEADPHONES :: Resuming artist", "INFO")
        command = "resumeArtist&id=%s" % artistid
    elif action == "refresh":
        logger.log("HEADPHONES :: Refreshing artist", "INFO")
        command = "refreshArtist&id=%s" % artistid
    elif action == "remove":
        logger.log("HEADPHONES :: Removing artist", "INFO")
        command = "delArtist&id=%s" % artistid
    elif action == "add":
        logger.log("HEADPHONES :: Adding artist", "INFO")
        command = "addArtist&id=%s" % artistid

    try:
        if command == "remove":
            headphones_api(command, False)
        elif command == "pause":
            headphones_api(command, False)
        elif command == "resume":
            headphones_api(command, False)
        else:
            Thread(target=headphones_api, args=(command, False)).start()
    except Exception as e:
        if mobile:
            headphones_exception(e)
            return jsonify(error="failed")

        return headphones_exception(e)

    return jsonify(status="successful")
开发者ID:titan04,项目名称:maraschino,代码行数:34,代码来源:headphones.py


示例4: xhr_trakt_recommendations

def xhr_trakt_recommendations(type=None, mobile=False):
    if not type:
        type = get_setting_value('trakt_default_media')

    logger.log('TRAKT :: Fetching %s recommendations' % type, 'INFO')

    url = 'http://api.trakt.tv/recommendations/%s/%s' % (type, trakt_apikey())

    params = {
        'hide_collected': True,
        'hide_watchlisted': True
    }
    try:
        recommendations = trak_api(url, params)
    except Exception as e:
        trakt_exception(e)
        return render_template('traktplus/trakt-base.html', message=e)

    random.shuffle(recommendations)

    for item in recommendations:
        item['poster'] = cache_image(item['images']['poster'], type)

    while THREADS:
        time.sleep(1)

    if mobile:
        return recommendations

    return render_template('traktplus/trakt-recommendations.html',
        type=type.title(),
        recommendations=recommendations,
        title='Recommendations',
    )
开发者ID:mboeru,项目名称:maraschino,代码行数:34,代码来源:traktplus.py


示例5: json_login

def json_login():
    if not loginToPlex():
        return jsonify(success=False, msg='Failed to login to plex.tv, plese make sure this is a valid username/password.')

    # Delete info for previous accounts
    try:
        PlexServer.query.delete()
    except:
        logger.log('Plex :: Failed to delete old server info', 'WARNING')

    # Populate servers for new user
    if not getServers():
        return jsonify(success=False, msg='Failed to retrieve server information from https://plex.tv/pms/servers.')

    # Set active server to 0 (no server selected)
    try:
        active_server = get_setting('active_server')

        if not active_server:
            active_server = Setting('active_server', 0)
            db_session.add(active_server)
            db_session.commit()

        else:
            active_server.value = 0
            db_session.add(active_server)
            db_session.commit()

    except:
        logger.log('Plex :: Failed to reset server, please make sure to select new one.', 'WARNING')

    # return a list of (server name, server id)
    return jsonify(success=True, servers=listServers())
开发者ID:RoostayFish,项目名称:maraschino,代码行数:33,代码来源:noneditable.py


示例6: 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


示例7: 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


示例8: xhr_sickrage

def xhr_sickrage():
    params = '/?cmd=future&sort=date'

    try:
        sickrage = sickrage_api(params)

        compact_view = get_setting_value('sickrage_compact') == '1'
        show_airdate = get_setting_value('sickrage_airdate') == '1'

        if sickrage['result'].rfind('success') >= 0:
        	
            logger.log('SICKRAGE :: Successful API call to %s' % params, 'DEBUG')
            sickrage = sickrage['data']

            for time in sickrage:
                for episode in sickrage[time]:
                    episode['image'] = get_pic(episode['indexerid'], 'banner')
                    logger.log('SICKRAGE :: Successful %s' % (episode['image']), 'DEBUG')
    except:
        return render_template('sickrage.html',
            sickrage='',
        )

    return render_template('sickrage.html',
        url=sickrage_url_no_api(),
        app_link=sickrage_url_no_api(),
        sickrage=sickrage,
        missed=sickrage['missed'],
        today=sickrage['today'],
        soon=sickrage['soon'],
        later=sickrage['later'],
        compact_view=compact_view,
        show_airdate=show_airdate,
        
    )
开发者ID:mboeru,项目名称:maraschino,代码行数:35,代码来源:sickrage.py


示例9: 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:kaylix,项目名称:maraschino,代码行数:27,代码来源:library.py


示例10: xhr_headphones_album

def xhr_headphones_album(albumid, mobile=False):
    logger.log('HEADPHONES :: Fetching album', 'INFO')

    try:
        headphones = headphones_api('getAlbum&id=%s' % albumid)
    except Exception as e:
        return headphones_exception(e)

    album = headphones['album'][0]

    try:
        album['ThumbURL'] = hp_albumart(album['AlbumID'])
    except:
        pass

    album['TotalDuration'] = 0

    for track in headphones['tracks']:
        if track['TrackDuration'] == None:
            track['TrackDuration'] = 0
        album['TotalDuration'] = album['TotalDuration'] + int(track['TrackDuration'])
        track['TrackDuration'] = convert_track_duration(track['TrackDuration'])

    album['TotalDuration'] = convert_track_duration(album['TotalDuration'])
    album['Tracks'] = len(headphones['tracks'])

    if mobile:
        return headphones
    return render_template('headphones/album.html',
        album=headphones,
        headphones=True,
        compact=hp_compact(),
    )
开发者ID:Blind3y3Design,项目名称:maraschino,代码行数:33,代码来源:headphones.py


示例11: xhr_trakt_hated

def xhr_trakt_hated(user, type):
    logger.log('TRAKT :: Fetching %s\'s hated %s' % (user, type), 'INFO')
    apikey = get_setting_value('trakt_api_key')

    url = 'http://api.trakt.tv/user/library/%s/hated.json/%s/%s/' % (type, apikey, user)

    try:
        result = urllib.urlopen(url).read()
    except:
        logger.log('TRAKT :: Problem fething URL', 'ERROR')
        return render_template('trakt-base.html', message=url_error)

    trakt = json.JSONDecoder().decode(result)

    amount = len(trakt)

    if trakt == []:
        trakt = [{'empty': True}]

    return render_template('trakt-hated.html',
        hated = trakt,
        amount = amount,
        type = type.title(),
        user = user,
        title = 'Hated',
    )
开发者ID:LordGaav,项目名称:maraschino,代码行数:26,代码来源:traktplus.py


示例12: download_image

def download_image(image, file_path):
    try:
        logger.log('TRAKT :: Creating file %s' % file_path, 'INFO')
        downloaded_image = file(file_path, 'wb')
    except:
        logger.log('TRAKT :: Failed to create file %s' % file_path, 'ERROR')
        logger.log('TRAKT :: Using remote image', 'INFO')
        threads.pop()
        return image

    try:
        logger.log('TRAKT :: Downloading %s' % image, 'INFO')
        image_on_web = urllib.urlopen(image)
        while True:
            buf = image_on_web.read(65536)
            if len(buf) == 0:
                break
            downloaded_image.write(buf)
        downloaded_image.close()
        image_on_web.close()
    except:
        logger.log('TRAKT :: Failed to download %s' % image, 'ERROR')

    threads.pop()

    return
开发者ID:LordGaav,项目名称:maraschino,代码行数:26,代码来源:traktplus.py


示例13: xhr_trakt_trending

def xhr_trakt_trending(type):
    logger.log('TRAKT :: Fetching trending %s' % type, 'INFO')
    apikey = get_setting_value('trakt_api_key')

    url = 'http://api.trakt.tv/%s/trending.json/%s' % (type, apikey)

    try:
        result = urllib.urlopen(url).read()
    except:
        logger.log('TRAKT :: Problem fething URL', 'ERROR')
        return render_template('trakt-base.html', message=url_error)

    trakt = json.JSONDecoder().decode(result)

    if len(trakt) > 20:
        trakt = trakt[:20]

    for item in trakt:
        item['images']['poster'] = cache_image(item['images']['poster'], type)

    while threads:
        time.sleep(1)

    return render_template('trakt-trending.html',
        trending = trakt,
        type = type.title(),
        title = 'Trending',
    )
开发者ID:LordGaav,项目名称:maraschino,代码行数:28,代码来源:traktplus.py


示例14: gitUpdate

def gitUpdate():
    """Update Maraschino using git"""
    output, err = runGit('pull origin %s' % branch)

    if not output:
        logger.log('Couldn\'t download latest version', 'ERROR')
        maraschino.USE_GIT = False
        return 'failed'

    for line in output.split('\n'):

        if 'Already up-to-date.' in line:
            logger.log('UPDATER :: Already up to date', 'INFO')
            logger.log('UPDATER :: Git output: ' + str(output), 'DEBUG')
            return 'complete'
        elif line.endswith('Aborting.'):
            logger.log('UPDATER :: Unable to update from git: '+line, 'ERROR')
            logger.log('UPDATER :: Output: ' + str(output), 'DEBUG')
            maraschino.USE_GIT = False
            return 'failed'

    maraschino.CURRENT_COMMIT = maraschino.LATEST_COMMIT
    writeVersion(maraschino.LATEST_COMMIT)
    maraschino.COMMITS_BEHIND = 0

    return 'complete'
开发者ID:DejaVu,项目名称:maraschino,代码行数:26,代码来源:updater.py


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


示例16: xhr_library_info

def xhr_library_info(type, id):
    logger.log('LIBRARY :: Retrieving %s details' % type, 'INFO')
    xbmc = jsonrpclib.Server(server_api_address())

    try:
        if type == 'movie':
            library = xbmc.VideoLibrary.GetMovieDetails(movieid=id, properties=['title', 'rating', 'year', 'genre', 'plot', 'director', 'thumbnail', 'trailer', 'playcount', 'resume'])
            title = library['moviedetails']['title']

        elif type == 'tvshow':
            library = xbmc.VideoLibrary.GetTVShowDetails(tvshowid=id, properties=['title', 'rating', 'year', 'genre', 'plot', 'premiered', 'thumbnail', 'playcount', 'studio'])
            title = library['tvshowdetails']['title']

        elif type == 'episode':
            library = xbmc.VideoLibrary.GetEpisodeDetails(episodeid=id, properties=['season', 'tvshowid', 'title', 'rating', 'plot', 'thumbnail', 'playcount', 'firstaired', 'resume'])
            title = library['episodedetails']['title']

        elif type == 'artist':
            library = xbmc.AudioLibrary.GetArtistDetails(artistid=id, properties=['description', 'thumbnail', 'genre'])
            title = library['artistdetails']['label']

        elif type == 'album':
            library = xbmc.AudioLibrary.GetAlbumDetails(albumid=id, properties=['artistid', 'title', 'artist', 'year', 'genre', 'description', 'albumlabel', 'rating', 'thumbnail'])
            title = library['albumdetails']['title']

    except:
        logger.log('LIBRARY :: %s' % xbmc_error, 'ERROR')
        return render_library(message=xbmc_error)

    return render_library(library, title)
开发者ID:elsingaa,项目名称:maraschino,代码行数:30,代码来源:library.py


示例17: 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


示例18: xhr_trakt_friends

def xhr_trakt_friends(user=None, mobile=False):
    logger.log('TRAKT :: Fetching friends list', 'INFO')
    pending = []
    if not user:
        friends_url = 'http://api.trakt.tv/user/friends.json/%s/%s' % (trakt_apikey(), get_setting_value('trakt_username'))
        pending_url = 'http://api.trakt.tv/friends/requests/%s' % trakt_apikey()
    else:
        friends_url = 'http://api.trakt.tv/user/friends.json/%s/%s' % (trakt_apikey(), user)

    try:
        friends = trak_api(friends_url)
        if not user:
            pending = trak_api(pending_url)
    except Exception as e:
        trakt_exception(e)
        return render_template('traktplus/trakt-base.html', message=e)

    if mobile:
        return friends

    return render_template('traktplus/trakt-friends.html',
        friends=friends,
        pending=pending,
        title='Friends',
    )
开发者ID:mboeru,项目名称:maraschino,代码行数:25,代码来源:traktplus.py


示例19: start_script

def start_script(script_id):
    #first get the script we want
    script = None
    message = None
    script = Script.query.filter(Script.id == script_id).first()
    now = datetime.datetime.now()

    command = os.path.join(maraschino.SCRIPT_DIR,script.script)

    if (script.parameters):
        command = ''.join([command, ' ', script.parameters])

    #Parameters needed for scripts that update
    host = maraschino.HOST
    port = maraschino.PORT
    webroot = maraschino.WEBROOT

    if not webroot:
        webroot = '/'

    file_ext = os.path.splitext(script.script)[1]

    if (file_ext == '.py'):
        if (script.updates == 1):        
            #these are extra parameters to be passed to any scripts ran, so they 
            #can update the status if necessary
            extras = '--i "%s" --p "%s" --s "%s" --w "%s"' % (host, port, script.id, webroot)

            #the command in all its glory
            command = ''.join([command, ' ', extras])
            script.status="Script Started at: %s" % now.strftime("%m-%d-%Y %H:%M")
        else:
            script.status="Last Ran: %s" % now.strftime("%m-%d-%Y %H:%M")

        command =  ''.join(['python ', command])

    elif (file_ext in ['.sh', '.pl', '.cmd']):
        if (script.updates == 1):
            extras = '%s %s %s %s' % (host, port, script.id, webroot)
            #the command in all its glory
            command = ''.join([command, ' ', extras])
            script.status="Script Started at: %s" % now.strftime("%m-%d-%Y %H:%M")
        else:
            script.status="Last Ran: %s" % now.strftime("%m-%d-%Y %H:%M")

        if(file_ext == '.pl'):
            command = ''.join(['perl ', command])

        if(file_ext == '.cmd'):
            command = ''.join([command])


    logger.log('SCRIPT_LAUNCHER :: %s' % command, 'INFO')
    #now run the command
    subprocess.Popen(command, shell=True)

    db_session.add(script)
    db_session.commit()

    return script_launcher()  
开发者ID:disengaged,项目名称:maraschino,代码行数:60,代码来源:mobile.py


示例20: xhr_trakt_get_lists

def xhr_trakt_get_lists(user=None, mobile=False):
    if not user:
        user = get_setting_value('trakt_username')

    logger.log('TRAKT :: Fetching %s\'s custom lists' % user, 'INFO')
    url = 'http://api.trakt.tv/user/lists.json/%s/%s' % (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 request.method == 'GET':
        if mobile:
            return trakt

        return render_template('traktplus/trakt-custom_lists.html',
            lists=trakt,
            user=user,
            title='lists'
        )

    else:
        return render_template('traktplus/trakt-add_to_list.html',
            lists=trakt,
            custom_lists=True,
            media=request.form,
        )
开发者ID:mboeru,项目名称:maraschino,代码行数:29,代码来源:traktplus.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python tools.get_setting_value函数代码示例发布时间:2022-05-27
下一篇:
Python db_session.delete函数代码示例发布时间: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