

@staticmethod
@ffi.callback('void(sp_playlist *playlist, sp_track **tracks, int num_tracks, int position, void *userdata)')
def tracks_added(sp_playlist, sp_tracks, num_tracks, index, userdata):
    logger.debug('Tracks added to playlist')
    playlist = Playlist._cached(spotify._session_instance, sp_playlist, add_ref=True)
    tracks = [spotify.Track(spotify._session_instance, sp_track=sp_tracks[i], add_ref=True) for i in range(num_tracks)]
    playlist.emit(PlaylistEvent.TRACKS_ADDED, playlist, tracks, int(index))

dataset/ETHPy150Open mopidy/pyspotify/spotify/playlist.py _PlaylistCallbacks.tracks_added/original