本文整理汇总了Python中remuco.log.error函数的典型用法代码示例。如果您正苦于以下问题:Python error函数的具体用法?Python error怎么用?Python error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __handle_message_request
def __handle_message_request(self, client, id, bindata):
request = serial.unpack(Request, bindata)
if request is None:
return
reply = ListReply(client, request.request_id, id, request.page, path=request.path)
if id == message.REQ_PLAYLIST:
self.request_playlist(reply)
elif id == message.REQ_QUEUE:
self.request_queue(reply)
elif id == message.REQ_MLIB:
self.request_mlib(reply, request.path)
elif id == message.REQ_FILES:
reply.nested, reply.ids, reply.names = self.__filelib.get_level(request.path)
reply.send()
elif id == message.REQ_SEARCH:
self.request_search(reply, request.path)
else:
log.error("** BUG ** unexpected request message: %d" % id)
示例2: notify
def notify(title, text):
"""Notify the user that a new device has been loggend."""
try:
bus = dbus.SessionBus()
except DBusException as e:
log.error("no dbus session bus (%s)" % e)
return
try:
proxy = bus.get_object("org.freedesktop.Notifications",
"/org/freedesktop/Notifications")
notid = dbus.Interface(proxy, "org.freedesktop.Notifications")
except DBusException as e:
log.error("failed to connect to notification daemon (%s)" % e)
return
try:
caps = notid.GetCapabilities()
except DBusException as e:
return
if not caps or "body-markup" not in caps:
text = text.replace("<b>", "")
text = text.replace("</b>", "")
try:
notid.Notify("Remuco", 0, "phone", title, text, [], {}, 15)
except DBusException as e:
log.warning("user notification failed (%s)" % e)
return
示例3: __init__
def __init__(self, clients, pinfo, msg_handler_fn, config):
""" Create a new server.
@param clients:
a list to add connected clients to
@param pinfo:
player info (type data.PlayerInfo)
@param msg_handler_fn:
callback function for passing received messages to
@param config:
adapter configuration
"""
self.__clients = clients
self.__msg_handler_fn = msg_handler_fn
self.__pinfo_msg = build_message(message.CONN_PINFO, pinfo)
self.__sid = None
self._pinfo = pinfo
self._config = config
self._sock = None
# set up socket
try:
self._sock = self._create_socket()
self._sock.settimeout(_Server.SOCKET_TIMEOUT)
except (IOError, socket.error), e:
# TODO: socket.error may be removed when 2.5 support is dropped
log.error("failed to set up %s server (%s)" % (self._get_type(), e))
return
示例4: __handle_message
def __handle_message(self, client, id, bindata):
if message.is_control(id):
log.debug("control from client %s" % client)
self.__handle_message_control(id, bindata)
elif message.is_action(id):
log.debug("action from client %s" % client)
self.__handle_message_action(id, bindata)
elif message.is_request(id):
log.debug("request from client %s" % client)
self.__handle_message_request(client, id, bindata)
elif id == message.PRIV_INITIAL_SYNC:
msg = net.build_message(message.SYNC_STATE, self.__state)
client.send(msg)
msg = net.build_message(message.SYNC_PROGRESS, self.__progress)
client.send(msg)
msg = net.build_message(message.SYNC_ITEM, self.__item(client))
client.send(msg)
else:
log.error("** BUG ** unexpected message: %d" % id)
示例5: send
def send(self, msg):
"""Send a message to the client.
@param msg:
complete message (incl. ID and length) in binary format
(net.build_message() is your friend here)
@see: net.build_message()
"""
if msg is None:
log.error("** BUG ** msg is None")
return
if self.__sock is None:
log.debug("cannot send message to %s, already disconnected" % self)
return
if self.__psave:
log.debug("%s is in sleep mode, send nothing" % self)
return
self.__snd_buff = "%s%s" % (self.__snd_buff, msg)
# if not already trying to send data ..
if self.__sid_out == 0:
# .. do it when it is possible:
self.__sid_out = gobject.io_add_watch(self.__sock, gobject.IO_OUT,
self.__io_send)
示例6: __handle_message_action
def __handle_message_action(self, id, bindata):
a = serial.unpack(Action, bindata)
if a is None:
return
if id == message.ACT_PLAYLIST:
self.action_playlist_item(a.id, a.positions, a.items)
elif id == message.ACT_QUEUE:
self.action_queue_item(a.id, a.positions, a.items)
elif id == message.ACT_MLIB and a.id < 0: # list action id
self.action_mlib_list(a.id, a.path)
elif id == message.ACT_MLIB and a.id > 0: # item action id
self.action_mlib_item(a.id, a.path, a.positions, a.items)
elif id == message.ACT_FILES:
uris = self.__util_files_to_uris(a.items)
self.action_files(a.id, a.items, uris)
elif id == message.ACT_SEARCH:
self.action_search_item(a.id, a.positions, a.items)
else:
log.error("** BUG ** unexpected action message: %d" % id)
示例7: get_buff
def get_buff(self):
if isinstance(self.__data, str):
return self.__data
elif isinstance(self.__data, array.array):
return self.__data.tostring()
else:
log.error("** BUG ** unexpected buffer type")
示例8: ctrl_toggle_fullscreen
def ctrl_toggle_fullscreen(self):
"""Toggle full screen mode.
@note: Override if it is possible and makes sense.
"""
log.error("** BUG ** in feature handling")
示例9: ctrl_previous
def ctrl_previous(self):
"""Play the previous item.
@note: Override if it is possible and makes sense.
"""
log.error("** BUG ** in feature handling")
示例10: getx
def getx(self, key, default, converter=None, save=True):
"""Get the value of a non-standard, player specific option.
@param key:
config option name
@param default:
default value (as string!)
@keyword converter:
value converter function, e.g. `int`
@keyword save:
save default value in config file if not yet set
@return:
option value, optionally converted
"""
key = "x-%s" % key
if not self.__cp.has_option(self.player, key) and save:
self.__cp.set(self.player, key, default)
self.__save()
try:
value = self.__cp.get(self.player, key)
except ConfigParser.NoOptionError:
value = default
converter = converter or (lambda v: v)
try:
return converter(value)
except Exception, e:
log.error("malformed option '%s: %s' (%s)" % (key, value, e))
return converter(default) # if this fails then, it's a bug
示例11: ctrl_toggle_playing
def ctrl_toggle_playing(self):
"""Toggle play and pause.
@note: Override if it is possible and makes sense.
"""
log.error("** BUG ** in feature handling")
示例12: notify
def notify(title, text):
"""Notify the user that a new device has been loggend."""
try:
bus = dbus.SessionBus()
except DBusException, e:
log.error("no dbus session bus (%s)" % e)
return
示例13: action_search_item
def action_search_item(self, action_id, positions, ids):
if action_id == IA_ENQUEUE.id:
self.__enqueue_items(ids)
else:
log.error("** BUG ** unexpected action: %d" % action_id)
示例14: action_files
def action_files(self, action_id, files, uris):
if action_id == FA_ENQUEUE.id:
subprocess.Popen(["totem", "--enqueue"] + uris)
elif action_id == FA_SETPL.id:
subprocess.Popen(["totem", "--replace"] + uris)
else:
log.error("** BUG ** unexpected action ID")
示例15: ctrl_toggle_shuffle
def ctrl_toggle_shuffle(self):
"""Toggle shuffle mode.
@note: Override if it is possible and makes sense.
@see: update_shuffle()
"""
log.error("** BUG ** in feature handling")