public static Playlist Create(Session session, Link link) { IntPtr ptr = libspotify.sp_playlist_create(session.sessionPtr, link.linkPtr); if (ptr != IntPtr.Zero) return new Playlist(ptr, session); else return null; }
public static Album CreateFromLink(Link link) { Album result = null; if(link.linkPtr != IntPtr.Zero) { lock(libspotify.Mutex) { IntPtr albumPtr = libspotify.sp_link_as_album(link.linkPtr); if(albumPtr != IntPtr.Zero) result = new Album(albumPtr); } } return result; }
public static Artist CreateFromLink(Link link) { Artist result = null; if(link.linkPtr != IntPtr.Zero) { lock(libspotify.Mutex) { IntPtr artistPtr = libspotify.sp_link_as_artist(link.linkPtr); if(artistPtr != IntPtr.Zero) result = new Artist(artistPtr); } } return result; }
public static Track CreateFromLink(Link link) { Track result = null; if(link.linkPtr != IntPtr.Zero) { lock(libspotify.Mutex) { IntPtr trackPtr = libspotify.sp_link_as_track(link.linkPtr); if(trackPtr != IntPtr.Zero) result = new Track(trackPtr); } } return result; }
public static Track CreateFromLink(Link link, out int offset) { Track result = null; offset = 0; if(link.linkPtr != IntPtr.Zero) { IntPtr offsetPtr = IntPtr.Zero; lock(libspotify.Mutex) { IntPtr trackPtr = libspotify.sp_link_as_track_and_offset(link.linkPtr, out offsetPtr); if(trackPtr != IntPtr.Zero) result = new Track(trackPtr); } offset = offsetPtr.ToInt32(); } return result; }
internal Playlist AddPlaylist(Link link) { CheckDisposed(true); Playlist result = null; lock(libspotify.Mutex) { IntPtr playlistPtr = libspotify.sp_playlistcontainer_add_playlist(containerPtr, link.linkPtr); int index; if(playlistIndexByPtr.TryGetValue(playlistPtr, out index)) result = playlists[index]; else result = null; } return result; }