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


Python logger.LOG类代码示例

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


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

示例1: load_user_infos

    def load_user_infos(cls, data):
        avatar_url = data["avatar"]
        request = QNetworkRequest(QUrl(avatar_url))
        cls.controller.network_manager.get(request)
        cls.controller.network_manager.network_queue.put(ViewOp.set_login_label_avatar)

        ViewOp.ui.MY_LIST_WIDGET.empty_layout()
        ViewOp.ui.COLLECTION_LIST_WIDGET.empty_layout()

        playlists = cls.controller.api.get_user_playlist()
        if not cls.controller.api.is_response_ok(playlists):
            return

        playlist_num = len(playlists)

        for playlist in playlists:
            pid = playlist["id"]

            w = PlaylistItem()
            w.set_playlist_item(playlist)
            w.signal_text_btn_clicked.connect(cls.on_playlist_btn_clicked)

            if cls.controller.api.is_playlist_mine(playlist):
                ViewOp.ui.MY_LIST_WIDGET.layout().addWidget(w)
                if pid == cls.controller.api.favorite_pid:
                    favorite_playlist_detail = cls.controller.api.get_playlist_detail(pid)
                    cls.controller.state["current_pid"] = pid
                    ViewOp.ui.WEBVIEW.load_playlist(favorite_playlist_detail)
                else:
                    if playlist_num <= 50:
                        app_event_loop = asyncio.get_event_loop()
                        app_event_loop.call_soon(cls.controller.api.get_playlist_detail, pid)
            else:
                ViewOp.ui.COLLECTION_LIST_WIDGET.layout().addWidget(w)
        LOG.info("load user infos finished")
开发者ID:IzumiSagiri,项目名称:FeelUOwn,代码行数:35,代码来源:view_api.py

示例2: play_mv_by_mvid

    def play_mv_by_mvid(cls, mvid):
        mv_model = ControllerApi.api.get_mv_detail(mvid)
        if not ControllerApi.api.is_response_ok(mv_model):
            return

        url_high = mv_model['url_high']
        clipboard = QApplication.clipboard()
        clipboard.setText(url_high)

        cls.view.ui.STATUS_BAR.showMessage(
                u"程序已经将视频的播放地址复制到剪切板", 5000)
        if platform.system() == "Linux":
            ControllerApi.player.pause()
            ControllerApi.notify_widget.show_message(
                    "通知", "正在尝试调用VLC视频播放器播放MV")
            try:
                subprocess.Popen(['vlc', url_high, '--play-and-exit', '-f'])
            except:
                LOG.error('call vlc player failed')
        elif platform.system().lower() == 'Darwin'.lower():
            ControllerApi.player.pause()
            ControllerApi.notify_widget.show_message(
                    "通知", "准备调用 QuickTime Player 播放mv")
            try:
                subprocess.Popen(['open', '-a', 'QuickTime Player', url_high])
            except:
                LOG.error('call quicktime player failed')
开发者ID:Lsgo,项目名称:FeelUOwn,代码行数:27,代码来源:controller_api.py

示例3: init

def init():
    if not is_linux():
        return 0
    from .service import MprisServer
    import dbus.mainloop.pyqt5
    LOG.info("Load mpris plugin")
    dbus.mainloop.pyqt5.DBusQtMainLoop(set_as_default=True)
    MprisServer()
开发者ID:1635594911,项目名称:FeelUOwn,代码行数:8,代码来源:__init__.py

示例4: load

 def load(self, path=CONFIG_FILE_PATH):
     # load default config first, there may be some new key field which not
     # exists in user config
     with open(DEFAULT_CONFIG_FILE_PATH, 'r') as f:
         self._data.update(yaml.load(f))
     try:
         with open(path, 'r') as f:
             update_dict_recursive(self._data, yaml.load(f))
     except OSError:
         LOG.error('user config file not found, will load default config')
开发者ID:1635594911,项目名称:FeelUOwn,代码行数:10,代码来源:config.py

示例5: _init_plugins

 def _init_plugins(self):
     plugins = feeluown.config['plugin']
     for plugin_module_name in plugins.keys():
         if plugins[plugin_module_name]:
             try:
                 plugin = importlib.import_module('feeluown.plugin.' +
                                                  plugin_module_name)
             except ImportError:
                 LOG.error('load module %s failed.' % plugin_module_name)
                 continue
             plugin.init()
开发者ID:1635594911,项目名称:FeelUOwn,代码行数:11,代码来源:glue.py

示例6: on_set_favorite_btn_clicked

 def on_set_favorite_btn_clicked(cls, checked=True):
     if not cls.controller.state["current_mid"]:
         return False
     data = cls.controller.api.set_music_to_favorite(cls.controller.state["current_mid"], checked)
     cls.controller.desktop_mini.content.is_song_like = checked
     if not cls.controller.api.is_response_ok(data):
         ViewOp.ui.LOVE_SONG_BTN.setChecked(not checked)
         cls.controller.desktop_mini.content.is_song_like = not checked
         return False
     playlist_detail = cls.controller.api.get_playlist_detail(cls.controller.api.favorite_pid, cache=False)
     if not cls.controller.api.is_response_ok(playlist_detail):
         ViewOp.ui.STATUS_BAR.showMessage("刷新 -喜欢列表- 失败")
         return False
     if cls.controller.state["current_pid"] == cls.controller.api.favorite_pid:
         LOG.info("喜欢列表的歌曲发生变化")
         ViewOp.ui.WEBVIEW.load_playlist(playlist_detail)
     return True
开发者ID:IzumiSagiri,项目名称:FeelUOwn,代码行数:17,代码来源:view_api.py

示例7: update_user_playlists

    def update_user_playlists(self):
        user = UserDb.get_user(self.uid)
        data = self.ne.user_playlist(self.uid)
        if not self.is_response_avaible(data):
            return data

        playlist = data['playlist']
        result_playlists = []
        for i, brief_playlist in enumerate(playlist):
            brief_playlist['uid'] = brief_playlist['userId']
            brief_playlist['type'] = brief_playlist['specialType']
            result_playlists.append(
                BriefPlaylistModel(brief_playlist).get_dict())
        self._set_favorite_pid(result_playlists)
        LOG.info('update user playlists info')
        user.update(_playlists=pickle.dumps(result_playlists))
        return result_playlists
开发者ID:Lsgo,项目名称:FeelUOwn,代码行数:17,代码来源:normalize.py

示例8: __init__

    def __init__(self, parent=None):
        super().__init__(parent)
        ControllerApi.player = Player(self)

        ui = UiMainWidget()
        ViewOp.ui = ui
        ViewOp.controller = ControllerApi
        ui.setup_ui(self)

        engine = create_engine(
            'sqlite:////%s' % DATABASE_SQLITE,
            connect_args={'check_same_thread': False},
            echo=False)
        Base.metadata.create_all(engine)
        Session = sessionmaker()
        Session.configure(bind=engine)
        session = Session()
        LOG.info('db connected: %s' % DATABASE_SQLITE)

        ControllerApi.session = session
        ControllerApi.view = ViewOp
        ControllerApi.desktop_mini = DesktopMiniLayer()
        ControllerApi.lyric_widget = LyricWidget()
        ControllerApi.notify_widget = NotifyWidget()

        ControllerApi.network_manager = NetworkManager(self)
        ControllerApi.current_playlist_widget = CurrentMusicTable()

        self._search_shortcut = QShortcut(QKeySequence('Ctrl+F'), self)
        self._minimize_shortcut = QShortcut(QKeySequence('Ctrl+M'), self)
        self._pre_focus = QShortcut(QKeySequence('Ctrl+['), self)
        self._next_focus = QShortcut(QKeySequence('Ctrl+]'), self)

        self.setAttribute(Qt.WA_MacShowFocusRect, False)
        self.setWindowIcon(QIcon(WINDOW_ICON))
        self.setWindowTitle('FeelUOwn')

        self.mode_manager = ModesManger()
        self._init_signal_binding()
        self.load_config()

        app_event_loop = asyncio.get_event_loop()
        app_event_loop.call_later(1, self._init_plugins)
        app_event_loop.call_later(6, TipsManager.show_start_tip)
        asyncio.Task(VersionManager.check_release())
开发者ID:1635594911,项目名称:FeelUOwn,代码行数:45,代码来源:glue.py

示例9: http_request

 def http_request(self, method, action, query=None, urlencoded=None, callback=None, timeout=3):
     LOG.info('method=%s url=%s query=%s' % (method, action, query))
     try:
         res = None
         if method == "GET":
             res = requests.get(action, headers=self.headers, cookies=self.cookies, timeout=timeout)
         elif method == "POST":
             res = requests.post(action, data=query, headers=self.headers, cookies=self.cookies, timeout=timeout)
         elif method == "POST_UPDATE":
             res = requests.post(action, data=query, headers=self.headers, cookies=self.cookies, timeout=timeout)
             self.cookies.update(res.cookies.get_dict())
         content = show_requests_progress(res, self.signal_load_progress)
         content_str = content.decode('utf-8')
         content_dict = json.loads(content_str)
         return content_dict
     except Exception as e:
         LOG.error(str(e))
         return {"code": 408}
开发者ID:Lsgo,项目名称:FeelUOwn,代码行数:18,代码来源:api.py

示例10: keyboard_tap_callback

def keyboard_tap_callback(proxy, type_, event, refcon):
    from AppKit import NSKeyUp, NSEvent, NSBundle

    NSBundle.mainBundle().infoDictionary()["NSAppTransportSecurity"] = dict(NSAllowsArbitraryLoads=True)
    if type_ < 0 or type_ > 0x7FFFFFFF:
        LOG.error("Unkown mac event")
        run_event_loop()
        LOG.error("restart mac key board event loop")
        return event
    try:
        key_event = NSEvent.eventWithCGEvent_(event)
    except:
        LOG.info("mac event cast error")
        return event
    if key_event.subtype() == 8:
        key_code = (key_event.data1() & 0xFFFF0000) >> 16
        key_state = (key_event.data1() & 0xFF00) >> 8
        if key_code in (16, 19, 20):
            # 16 for play-pause, 19 for next, 20 for previous
            if key_state == NSKeyUp:
                if key_code is 19:
                    ControllerApi.player.play_next()
                elif key_code is 20:
                    ControllerApi.player.play_last()
                elif key_code is 16:
                    ControllerApi.player.play_or_pause()
            return None
    return event
开发者ID:IzumiSagiri,项目名称:FeelUOwn,代码行数:28,代码来源:mac.py

示例11: run

    def run(self):
        # Monitor keypress and button press
        LOG.info("Linux multimedia hotkey start")
        ctx = self.disp.record_create_context(
            0,
            [record.AllClients],
            [{
                'core_requests': (0, 0),
                'core_replies': (0, 0),
                'ext_requests': (0, 0, 0, 0),
                'ext_replies': (0, 0, 0, 0),
                'delivered_events': (0, 0),
                'device_events': (X.KeyReleaseMask, X.ButtonReleaseMask),
                'errors': (0, 0),
                'client_started': False,
                'client_died': False,
            }])
        self.disp.record_enable_context(ctx, self.handler)
        self.disp.record_free_context(ctx)

        while 1:
            # Infinite wait, doesn't do anything as no events are grabbed
            event = self.root.display.next_event()
开发者ID:1635594911,项目名称:FeelUOwn,代码行数:23,代码来源:linux.py

示例12: run_event_loop

def run_event_loop():
    LOG.info("try to load mac hotkey event loop")
    import Quartz
    from AppKit import NSSystemDefined

    # Set up a tap, with type of tap, location, options and event mask
    tap = Quartz.CGEventTapCreate(
        Quartz.kCGSessionEventTap,  # Session level is enough for our needs
        Quartz.kCGHeadInsertEventTap,  # Insert wherever, we do not filter
        Quartz.kCGEventTapOptionDefault,
        # NSSystemDefined for media keys
        Quartz.CGEventMaskBit(NSSystemDefined),
        keyboard_tap_callback,
        None,
    )

    run_loop_source = Quartz.CFMachPortCreateRunLoopSource(None, tap, 0)
    Quartz.CFRunLoopAddSource(Quartz.CFRunLoopGetCurrent(), run_loop_source, Quartz.kCFRunLoopDefaultMode)
    # Enable the tap
    Quartz.CGEventTapEnable(tap, True)
    # and run! This won't return until we exit or are terminated.
    Quartz.CFRunLoopRun()
    LOG.error("Mac hotkey event loop exit")
    return []
开发者ID:IzumiSagiri,项目名称:FeelUOwn,代码行数:24,代码来源:mac.py

示例13: check_release

 def check_release(cls):
     url = 'https://api.github.com/repos/cosven/FeelUOwn/releases'
     LOG.info('正在查找新版本...')
     try:
         loop = asyncio.get_event_loop()
         future = loop.run_in_executor(
                 None, partial(requests.get, url, timeout=5))
         res = yield from future
         if not res.status_code == 200:
             LOG.warning('connect to api.github.com timeout')
             return
         releases = res.json()
         for release in releases:
             if release['tag_name'] > cls.current_version:
                 title = u'发现新版本 %s hoho' % release['tag_name']
                 LOG.info(title)
                 content = release['name']
                 ControllerApi.notify_widget.show_message(title, content)
                 ViewOp.ui.STATUS_BAR.showMessage(title, 5000)
                 break
     except Exception as e:
         LOG.error(str(e))
开发者ID:Lsgo,项目名称:FeelUOwn,代码行数:22,代码来源:version_manager.py

示例14: Next

 def Next(self):
     LOG.info('dbus: call play_next')
     ControllerApi.player.play_next()
开发者ID:1635594911,项目名称:FeelUOwn,代码行数:3,代码来源:service.py

示例15: load_config

 def load_config(self):
     LOG.info('load user config')
     ControllerApi.player.set_play_mode(
         feeluown.config['player']['playback_mode'])
     self.resize(feeluown.config['width'],
                 feeluown.config['height'])
开发者ID:1635594911,项目名称:FeelUOwn,代码行数:6,代码来源:glue.py


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