def __init__(self, container, callbacks):
     self._container = weakref.proxy(container)
     self._callbacks = callbacks
     self._callback_struct = _playlistcontainer.callbacks(
         _playlistcontainer.cb_playlist_added(WeakMethod(self._playlist_added)),
         _playlistcontainer.cb_playlist_removed(WeakMethod(self._playlist_removed)),
         _playlistcontainer.cb_playlist_moved(WeakMethod(self._playlist_moved)),
         _playlistcontainer.cb_container_loaded(WeakMethod(self._container_loaded)),
     )
     self._callback_struct_ptr = ctypes.pointer(self._callback_struct)
Example #2
0
 def set_callback(self, callback):
     if inspect.isfunction(callback):
         self.__callback = callback
     
     elif inspect.ismethod(callback):
         self.__callback = WeakMethod(callback)
     
     else:
         raise TypeError('Only functions and method are accepted as arguments.')
Example #3
0
 def __init__(self, inbox, callbacks):
     self.__inbox = inbox
     self.__callbacks = callbacks
     self.__c_callback = _inbox.inboxpost_complete_cb(
         WeakMethod(self.inboxpost_complete)
     )
Example #4
0
 def __init__(self, search, callbacks):
     self.__search = weakref.proxy(search)
     self.__callbacks = callbacks
     self.__c_callback = _search.search_complete_cb(
         WeakMethod(self.search_complete))
Example #5
0
 def __init__(self, artistbrowse, callbacks):
     self.__artistbrowse = weakref.proxy(artistbrowse)
     self.__callbacks = callbacks
     self.__c_callback = _artistbrowse.artistbrowse_complete_cb(
         WeakMethod(self.artistbrowse_complete)
     )
Example #6
0
 def __init__(self, session, callbacks, manager):
     self.__session = weakref.proxy(session)
     self.__callbacks = callbacks
     self.__manager = manager
     self.__struct = _session.callbacks(
         _session.cb_logged_in(WeakMethod(self._logged_in)),
         _session.cb_logged_out(WeakMethod(self._logged_out)),
         _session.cb_metadata_updated(WeakMethod(self._metadata_updated)),
         _session.cb_connection_error(WeakMethod(self._connection_error)),
         _session.cb_message_to_user(WeakMethod(self._message_to_user)),
         _session.cb_notify_main_thread(WeakMethod(
             self._notify_main_thread)),
         _session.cb_music_delivery(WeakMethod(self._music_delivery)),
         _session.cb_play_token_lost(WeakMethod(self._play_token_lost)),
         _session.cb_log_message(WeakMethod(self._log_message)),
         _session.cb_end_of_track(WeakMethod(self._end_of_track)),
         _session.cb_streaming_error(WeakMethod(self._streaming_error)),
         _session.cb_userinfo_updated(WeakMethod(self._userinfo_updated)),
         _session.cb_start_playback(WeakMethod(self._start_playback)),
         _session.cb_stop_playback(WeakMethod(self._stop_playback)),
         _session.cb_get_audio_buffer_stats(
             WeakMethod(self._get_audio_buffer_stats)),
         _session.cb_offline_status_updated(
             WeakMethod(self._offline_status_updated)),
         _session.cb_offline_error(WeakMethod(self._offline_error)),
         _session.cb_credentials_blob_updated(
             WeakMethod(self._credentials_blob_updated)),
         _session.cb_connectionstate_updated(
             WeakMethod(self._connectionstate_updated)),
         _session.cb_scrobble_error(WeakMethod(self._scrobble_error)),
         _session.cb_private_session_mode_changed(
             WeakMethod(self._private_session_mode_changed)),
     )
Example #7
0
 def __init__(self, toplistbrowse, callbacks):
     self.__toplistbrowse = toplistbrowse
     self.__callbacks = callbacks
     self.__c_callback = _toplistbrowse.toplistbrowse_complete_cb(
         WeakMethod(self.toplistbrowse_complete))
Example #8
0
 def __init__(self, image, callbacks):
     self.__image = weakref.proxy(image)
     self.__callbacks = callbacks
     self.__c_callback = _image.image_loaded_cb(
         WeakMethod(self.image_loaded))
Example #9
0
 def __init__(self, playlist, callbacks):
     self._playlist = weakref.proxy(playlist)
     self._callbacks = callbacks
     self._callback_struct = _playlist.callbacks(
         _playlist.cb_tracks_added(WeakMethod(self._tracks_added)),
         _playlist.cb_tracks_removed(WeakMethod(self._tracks_removed)),
         _playlist.cb_tracks_moved(WeakMethod(self._tracks_moved)),
         _playlist.cb_playlist_renamed(WeakMethod(self._playlist_renamed)),
         _playlist.cb_playlist_state_changed(
             WeakMethod(self._playlist_state_changed)),
         _playlist.cb_playlist_update_in_progress(
             WeakMethod(self._playlist_update_in_progress)),
         _playlist.cb_playlist_metadata_updated(
             WeakMethod(self._playlist_metadata_updated)),
         _playlist.cb_track_created_changed(
             WeakMethod(self._track_created_changed)),
         _playlist.cb_track_seen_changed(
             WeakMethod(self._track_seen_changed)),
         _playlist.cb_description_changed(
             WeakMethod(self._description_changed)),
         _playlist.cb_image_changed(WeakMethod(self._image_changed)),
         _playlist.cb_track_message_changed(
             WeakMethod(self._track_message_changed)),
         _playlist.cb_subscribers_changed(
             WeakMethod(self._subscribers_changed)),
     )
     self._callback_struct_ptr = ctypes.pointer(self._callback_struct)