Esempio n. 1
0
        Track CreateTrackFromLink(string aLink)
        {
            Link  link  = Link.CreateFromString(aLink);
            Track track = link.AsTrack();

            track.AddRef();
            link.Release();
            return(track);
        }
Esempio n. 2
0
        internal static Track GetTrack(
            string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(null);
            }

            Link link = Session.GetLink(id);

            return(link == null ? null : link.AsTrack());
        }
Esempio n. 3
0
        private async Task LoadQueue()
        {
            var queue = await _robot.Brain.Get <string[]>("SpotifyQueue");

            if (queue == null)
            {
                return;
            }
            _queue.Clear();
            await Login();

            foreach (var trackUrl in queue)
            {
                Link link = _session.ParseLink(trackUrl);
                AddToQueue(await link.AsTrack());
            }
        }
Esempio n. 4
0
 IEnumerable <Track> CreateTracksFromLinks(IEnumerable <string> aLinks)
 {
     foreach (string linkString in aLinks)
     {
         Link link = Link.CreateFromString(linkString);
         if (link == null)
         {
             Console.WriteLine("{0} is not a spotify link, skipping", linkString);
             continue;
         }
         Track track = link.AsTrack();
         if (track == null)
         {
             Console.WriteLine("{0} is not a track link, skipping", linkString);
             link.Release();
             continue;
         }
         track.AddRef();
         link.Release();
         yield return(track);
     }
 }