Example #1
0
        public void TestiTunesAdapter_GetPlaylists()
        {
            iTunesAdapter    ita       = new iTunesAdapter();
            IList <Playlist> playlists = ita.GetPlaylists();

            Playlist testPlaylist = playlists.FirstOrDefault(p => p.Name == TEST_PLAYLIST);

            Assert.IsTrue(true);
        }
Example #2
0
        public void TestiTunesAdapter_GetPlaylistDetails()
        {
            iTunesAdapter ita = new iTunesAdapter();

            IList <Playlist> playlists    = ita.GetPlaylists();
            Playlist         testPlaylist = playlists.FirstOrDefault(p => p.Name == TEST_PLAYLIST);

            ita.LoadPlaylist(testPlaylist);

            Assert.IsNotNull(testPlaylist.Name);
            Assert.IsTrue(testPlaylist.Songs.Count > 0);
        }
Example #3
0
        public void CreatePlaylist(string playlistName)
        {
            // Abort if playlist already exists
            if (_spotify.PlaylistExists(playlistName) != null)
            {
                _Log.InfoFormat("Playlist already exists,{0}", playlistName);
                return;
            }

            // Get playlist from iTunes
            IList <Playlist> playlists     = _iTunes.GetPlaylists();
            Playlist         songsToImport = playlists.FirstOrDefault(p => p.Name == playlistName);

            _iTunes.LoadPlaylist(songsToImport);

            // Create Spotify playlist and populate it
            SpotifyPlaylist spotifyPlaylist = _spotify.CreatePlaylist(playlistName, false).Result;

            _spotify.AddSongsToPlaylist(spotifyPlaylist, songsToImport.Songs);
        }