public Track FromLink(TrackLink trackLink)
        {
            string songIdAsString = trackLink["S"];

            int songId;

            if (int.TryParse(songIdAsString, out songId))
            {
                string artistIdAsString = trackLink["A"];
                string songName = trackLink["N"];
                string artistName = trackLink["AR"];

                int artistId;

                if (int.TryParse(artistIdAsString, out artistId))
                {
                    return new GroovesharkTrack(songId, artistId)
                           {
                               Name = songName,
                               Artist = artistName
                           };
                }
            }

            return null;
        }
예제 #2
0
        public static TrackLink FromUri(string trackLinkUri)
        {
            TrackLink link = new TrackLink();

            link.Decrypt(trackLinkUri);
            return(link);
        }
 public override TrackLink ToLink()
 {
     TrackLink link = new TrackLink("8tracks");
     link["MixId"] = MixId.ToString(CultureInfo.InvariantCulture);
     link["TokenId"] = TokenId.ToString(CultureInfo.InvariantCulture);
     link["TrackId"] = TrackId.ToString(CultureInfo.InvariantCulture);
     return link;
 }
        public Track FromLink(TrackLink trackLink)
        {
            string trackId = trackLink["TrackId"];

            // TODO : Implement properly

            return new SpotifyTrack {TrackId = trackId};
        }
 public override TrackLink ToLink()
 {
     TrackLink link = new TrackLink("gs");
     link["S"] = SongID.ToString(CultureInfo.InvariantCulture);
     link["A"] = ArtistID.ToString(CultureInfo.InvariantCulture);
     link["N"] = Name;
     link["AR"] = Artist;
     return link;
 }
        public void ParseTrackLink_DataIsDecrypted()
        {
            TrackLink expected = new TrackLink("test");
            expected["argument1"] = "some_value";
            expected["argument2"] = "another_value";

            Assert.IsNotNull(expected.Uri);

            TrackLink result = TrackLink.FromUri(expected.Uri);

            Assert.AreEqual(expected.Uri, result.Uri);
            Assert.AreEqual(expected.TrackSource, result.TrackSource);
            Assert.AreEqual(expected["argument1"], result["argument1"]);
            Assert.AreEqual(expected["argument2"], result["argument2"]);
        }
 public static TrackLink FromUri(string trackLinkUri)
 {
     TrackLink link = new TrackLink();
     link.Decrypt(trackLinkUri);
     return link;
 }
 public override TrackLink ToLink()
 {
     TrackLink link = new TrackLink("spotify");
     link["TrackId"] = TrackId;
     return link;
 }
 public bool SupportsLink(TrackLink trackLink)
 {
     return trackLink.TrackSource == "gs";
 }
예제 #10
0
 public bool SupportsLink(TrackLink trackLink)
 {
     return TrackSources.Any(s => s.Value.SupportsLink(trackLink));
 }
예제 #11
0
        public Track FromLink(TrackLink trackLink)
        {
            var source = TrackSources.FirstOrDefault(s => s.Value.SupportsLink(trackLink));

            if (source != null)
            {
                return source.Value.FromLink(trackLink);
            }

            return null;
        }