Esempio n. 1
0
 private void SavePlaylistPositionToSettings(Playlist playlist)
 {
     Settings.Default.CurrentPlaylistLink = playlist.Link.ToString();
     Settings.Default.CurrentPlaylistPosition = playlist.CurrentPosition;
     Settings.Default.Save();
 }
Esempio n. 2
0
        public bool SetCurrentPlaylist(Link playlistLink)
        {
            var playlist = GetPlaylist(playlistLink);

            if (playlist == null)
            {
                libspotify.sp_playlistcontainer_add_playlist(playlistContainer.PlaylistContainerPtr, playlistLink.LinkPtr);
                Wait.For(() =>
                {
                    playlist = GetPlaylist(playlistLink);
                    return playlist != null;
                });
            }

            if (playlist == null)
            {
                return false;
            }

            if (currentPlaylist != null)
            {
                currentPlaylist.playlistChanged = null;
            }

            currentPlaylist = playlist;
            _logger.InfoFormat("Current playlist set to: {0}", currentPlaylist.Name);
            currentPlaylist.playlistChanged = PlaylistChanged;
            PlaylistChanged(currentPlaylist);
            return true;
        }
Esempio n. 3
0
 protected bool Equals(Playlist other)
 {
     return Equals(Link, other.Link);
 }
Esempio n. 4
0
        private void LoadPlaylists()
        {
            Playlists = new List<Playlist>();

            var playlistCount = libspotify.sp_playlistcontainer_num_playlists(PlaylistContainerPtr);

            for (var i = 0; i < playlistCount; i++)
            {
                var playlistType = libspotify.sp_playlistcontainer_playlist_type(PlaylistContainerPtr, i);
                if (playlistType != libspotify.sp_playlist_type.SP_PLAYLIST_TYPE_PLAYLIST)
                {
                    continue;
                }

                var playlistPtr = libspotify.sp_playlistcontainer_playlist(PlaylistContainerPtr, i);
                var playlist = new Playlist(playlistPtr, session);
                Playlists.Add(playlist);
            }
        }