Beispiel #1
0
        public static PlaylistContainer GetUserPlaylists(IntPtr userPtr)
        {
            if (Session.SessionPtr == IntPtr.Zero)
            {
                throw new ApplicationException("No session");
            }

            IntPtr ptr = IntPtr.Zero;

            try
            {
                ptr = libspotify.sp_session_publishedcontainer_for_user_create(Session.SessionPtr, GetUserCanonicalNamePtr(userPtr));

                PlaylistContainer c = PlaylistContainer.Get(ptr);

                waitFor(delegate
                {
                    return(c.IsLoaded &&
                           c.PlaylistsAreLoaded);
                }, REQUEST_TIMEOUT);

                return(c);
            }
            finally
            {
                //try {
                //    if (ptr != IntPtr.Zero)
                //        libspotify.sp_playlistcontainer_release(ptr);

                //} catch { }
            }
        }
Beispiel #2
0
        public static List <PlaylistContainer.PlaylistInfo> GetAllSessionPlaylists()
        {
            waitFor(delegate
            {
                return(PlaylistContainer.GetSessionContainer().IsLoaded &&
                       PlaylistContainer.GetSessionContainer().PlaylistsAreLoaded);
            }, REQUEST_TIMEOUT);

            return(PlaylistContainer.GetSessionContainer().GetAllPlaylists());
        }
Beispiel #3
0
        public static PlaylistContainer GetSessionContainer()
        {
            if (_sessionContainer == null)
            {
                if (Session.SessionPtr == IntPtr.Zero)
                {
                    throw new InvalidOperationException("No valid session.");
                }

                _sessionContainer = new PlaylistContainer(libspotify.sp_session_playlistcontainer(Session.SessionPtr));
            }

            return(_sessionContainer);
        }
Beispiel #4
0
        public static PlaylistContainer.PlaylistInfo GetPlaylistContainer(ulong folderID)
        {
            if (Session.SessionPtr == IntPtr.Zero)
            {
                throw new ApplicationException("No session");
            }

            waitFor(delegate
            {
                return(PlaylistContainer.GetSessionContainer().IsLoaded &&
                       PlaylistContainer.GetSessionContainer().PlaylistsAreLoaded);
            }, REQUEST_TIMEOUT);

            return(PlaylistContainer.GetSessionContainer().FindContainer(folderID));
        }