Beispiel #1
0
		string CreateScrobbleQueryParams (IEnumerable<Track> batch)
		{
			var queryParameters = new QueryParameters {
				Tuple.Create ("method", "track.scrobble"),
				Tuple.Create ("api_key", LastFMAppCredentials.APIKey),
				Tuple.Create ("sk", SessionKey),
			};

			int trackNumber = 0;
			foreach (var track in batch) {
				queryParameters.AddIndexed ("artist", track.TrackArtist, trackNumber);
				queryParameters.AddIndexed ("track", track.Name, trackNumber);
				queryParameters.AddIndexed ("timestamp", track.Timestamp.ToString (), trackNumber);
				queryParameters.AddIndexed ("album", track.Album, trackNumber);
				queryParameters.AddIndexed ("trackNumber", track.Number.ToString (), trackNumber);
				queryParameters.AddIndexed ("duration", track.Duration.ToString (), trackNumber);
				if (!string.IsNullOrEmpty (track.AlbumArtist))
					queryParameters.AddIndexed ("albumArtist", track.AlbumArtist, trackNumber);
				if (!string.IsNullOrEmpty (track.MusicBrainzId))
					queryParameters.AddIndexed ("mbid", track.MusicBrainzId, trackNumber);
				trackNumber ++;
			}

			return queryParameters.GenerateQueryString (LastFMAppCredentials.SharedSecret);
		}