Esempio n. 1
0
        public static void AddTracksLink(Uri link, DownloadList list)
        {
            if (Helpers.GetAgent(link) == Agent.Spotify)
            {
                if (SpotifyAgent.ResolveLink(link) == SpotifyLinkType.Playlist)
                {
                    foreach (Track track in SpotifyAgent.GetPlaylistTracks(SpotifyAgent.GetUserId(link), SpotifyAgent.GetPlaylistId(link)))
                    {
                        list.TrackList.Add(track);
                    }
                }

                else if (SpotifyAgent.ResolveLink(link) == SpotifyLinkType.Album)
                {
                    foreach (Track track in SpotifyAgent.GetAlbumTracks(SpotifyAgent.GetAlbumId(link)))
                    {
                        list.TrackList.Add(track);
                    }
                }

                else if (SpotifyAgent.ResolveLink(link) == SpotifyLinkType.Track)
                {
                    list.TrackList.Add(SpotifyAgent.GetTrack(SpotifyAgent.GetTrackId(link)));
                }
            }
        }
Esempio n. 2
0
 public static void DownloadNextList(DownloadList list)
 {
     foreach (Track track in list.TrackList)
     {
         Track refTrack = track;
         if (track.Platform == Agent.Spotify)
         {
             YouTubeAgent.DownloadSearch(ref refTrack, list.DestinationPath, list.TrackFormat, list.TrackQuality);
             if (list.TrackFormat == Format.mp3)
             {
                 Helpers.AddMp3Tags(refTrack.Path, refTrack);
             }
         }
     }
 }
Esempio n. 3
0
        public static DownloadList NewList(string name, Uri path)
        {
            if (!Directory.Exists(path.LocalPath))
            {
                Directory.CreateDirectory(path.LocalPath);
            }

            DownloadList newList = new DownloadList
            {
                Name            = name,
                DestinationPath = path,
                Progress        = 0,
                TrackList       = new List <Track>(),
            };

            DownloadLists.Add(newList);
            return(newList);
        }
Esempio n. 4
0
 public static void DequeueList(DownloadList list)
 {
     DownloadNextList(DownloadQueue.First());
 }
Esempio n. 5
0
 public static void UnqueueList(DownloadList list)
 {
     DownloadQueue.Remove(list);
 }
Esempio n. 6
0
 public static void EnqueueList(DownloadList list)
 {
     DownloadQueue.Add(list);
 }