Exemplo n.º 1
0
        public SongMatch(ZuneTrack original, List<SpotifyTrack> candidates)
        {
            OriginalTrack = original;
            Candidates = candidates;

            if (candidates.Count > 0)
            {
                MatchedTrack = candidates[0];
            }
        }
Exemplo n.º 2
0
        public static ZuneTrack FromXElementFactory(XElement element)
        {
            if (element == null)
            {
                throw new ArgumentException("Received Null in factory method.");
            }

            ZuneTrack t = new ZuneTrack
            {
                Title = (string)element.Attribute("trackTitle"),
                AlbumTitle = (string)element.Attribute("albumTitle"),
                Artist = (string)element.Attribute("trackArtist"),
                AlbumArtist = (string)element.Attribute("albumArtist"),
                Duration = (int)element.Attribute("duration"),
                Identifier = (string)element.Attribute("src"),
                IsExplicit = false // We have no way of determining this from playlist info.
            };

            return t;
        }
Exemplo n.º 3
0
        public static async Task<SongMatch> FromZuneTrackFactory(ZuneTrack originalTrack)
        {
            IMusicLookupService lookupService = new SpotifySearchService();
            List<MusicTrack> tracks = await lookupService.FindTracksAsync(originalTrack.Title, originalTrack.Artist, originalTrack.AlbumTitle);

            return new SongMatch(originalTrack, tracks.Cast<SpotifyTrack>().ToList());
        }
Exemplo n.º 4
0
 public void Setup()
 {
     element = XElement.Parse(SampleTrackXml);
     testTrack = ZuneTrack.FromXElementFactory(element);
 }