本文整理汇总了Python中feeluown.logger.LOG.info方法的典型用法代码示例。如果您正苦于以下问题:Python LOG.info方法的具体用法?Python LOG.info怎么用?Python LOG.info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类feeluown.logger.LOG
的用法示例。
在下文中一共展示了LOG.info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: keyboard_tap_callback
# 需要导入模块: from feeluown.logger import LOG [as 别名]
# 或者: from feeluown.logger.LOG import info [as 别名]
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
示例2: load_user_infos
# 需要导入模块: from feeluown.logger import LOG [as 别名]
# 或者: from feeluown.logger.LOG import info [as 别名]
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")
示例3: init
# 需要导入模块: from feeluown.logger import LOG [as 别名]
# 或者: from feeluown.logger.LOG import info [as 别名]
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()
示例4: on_set_favorite_btn_clicked
# 需要导入模块: from feeluown.logger import LOG [as 别名]
# 或者: from feeluown.logger.LOG import info [as 别名]
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
示例5: update_user_playlists
# 需要导入模块: from feeluown.logger import LOG [as 别名]
# 或者: from feeluown.logger.LOG import info [as 别名]
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
示例6: __init__
# 需要导入模块: from feeluown.logger import LOG [as 别名]
# 或者: from feeluown.logger.LOG import info [as 别名]
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())
示例7: http_request
# 需要导入模块: from feeluown.logger import LOG [as 别名]
# 或者: from feeluown.logger.LOG import info [as 别名]
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}
示例8: check_release
# 需要导入模块: from feeluown.logger import LOG [as 别名]
# 或者: from feeluown.logger.LOG import info [as 别名]
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))
示例9: run
# 需要导入模块: from feeluown.logger import LOG [as 别名]
# 或者: from feeluown.logger.LOG import info [as 别名]
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()
示例10: run_event_loop
# 需要导入模块: from feeluown.logger import LOG [as 别名]
# 或者: from feeluown.logger.LOG import info [as 别名]
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 []
示例11: save_login_time
# 需要导入模块: from feeluown.logger import LOG [as 别名]
# 或者: from feeluown.logger.LOG import info [as 别名]
def save_login_time(self):
user = UserDb.get_user(self.uid)
user.record_login_time()
LOG.info('Save user login time')
示例12: save_cookies
# 需要导入模块: from feeluown.logger import LOG [as 别名]
# 或者: from feeluown.logger.LOG import info [as 别名]
def save_cookies(self):
user = UserDb.get_user(self.uid)
user.update(_cookies=pickle.dumps(self.ne.cookies))
LOG.info('Save user cookies')
示例13: save_user_pw
# 需要导入模块: from feeluown.logger import LOG [as 别名]
# 或者: from feeluown.logger.LOG import info [as 别名]
def save_user_pw(self, username, password):
user = UserDb.get_user(self.uid)
if user is not None:
user.update(username=username, password=password)
LOG.info('Save user\'s username and password ')
示例14: init
# 需要导入模块: from feeluown.logger import LOG [as 别名]
# 或者: from feeluown.logger.LOG import info [as 别名]
def init():
LOG.info("Load mpris plugin")
dbus.mainloop.pyqt5.DBusQtMainLoop(set_as_default=True)
MprisServer()
示例15: save
# 需要导入模块: from feeluown.logger import LOG [as 别名]
# 或者: from feeluown.logger.LOG import info [as 别名]
def save(self, path=CONFIG_FILE_PATH):
with open(path, 'w') as f:
f.write(yaml.dump(self._data))
LOG.info('save user config.')