def enable_xorg_bindings(self): """Enable the global X bindings using keybinder""" if os.environ.get("DISPLAY") is None: logger.debug( "X11 isn't running so we can't load the global keybinds") return from clay.hotkeys import hotkey_manager hotkey_manager.play_pause += self.play_pause hotkey_manager.next += self.next hotkey_manager.prev += lambda: self.seek_absolute(0)
def _make_call(protocol, *args, **kwargs): """ Wrapper function. """ logger.debug('GP::{}(*{}, **{})'.format(protocol.__name__, args, kwargs)) result = func(protocol, *args, **kwargs) # self._last_call_index += 1 # call_index = self._last_call_index # self.debug_file.write(json.dumps([ # call_index, # protocol.__name__, args, kwargs, # result # ]) + '\n') # self.debug_file.flush() return result
def __init__(self): self._x_hotkeys = {} self._hotkeys = self._parse_hotkeys() self.config = None self.play_pause = EventHook() self.next = EventHook() self.prev = EventHook() if IS_INIT: Keybinder.init() self.initialize() threading.Thread(target=Gtk.main).start() else: logger.debug("Not loading the global shortcuts.") notification_area.notify( ERROR_MESSAGE + ", this means the global shortcuts will not work.\n" + "You can check the log for more details.")
def _play(self): """ Pick current track from a queue and requests media stream URL. Completes in background. """ track = self.queue.get_current_track() if track is None: return self._is_loading = True self.broadcast_state() self.track_changed.fire(track) if settings.get('download_tracks', 'play_settings') or \ settings.get_is_file_cached(track.filename): path = settings.get_cached_file_path(track.filename) if path is None: logger.debug('Track %s not in cache, downloading...', track.store_id) track.get_url(callback=self._download_track) else: logger.debug('Track %s in cache, playing', track.store_id) self._play_ready(path, None, track) else: logger.debug('Starting to stream %s', track.store_id) track.get_url(callback=self._play_ready)