public async Task <GoogleMusicMutateResponse> CreateStationAsync(Album album) { dynamic createMutation = new { clientId = Guid.NewGuid().ToString().ToLowerInvariant(), deleted = false, imageType = 1, // TODO: ? imageUrl = album.ArtUrl, lastModifiedTimestamp = "-1", name = album.Title, recentTimestamp = ((long)album.Recent.ToUnixFileTime() * 1000L).ToString("G", CultureInfo.InvariantCulture), seed = new { seedType = 4, albumId = album.GoogleAlbumId }, tracks = new object[0] }; var mutation = new RequestCreateMutation() { Create = createMutation, IncludeFeed = true, NumEntries = 25, Params = new { contentFilter = this.settingsService.GetBlockExplicitSongsInRadio() ? 2 : 1 } }; return(await this.googleMusicApisService.PostAsync <GoogleMusicMutateResponse>( EditStation, new { mutations = new[] { mutation } })); }
public async Task <GoogleMusicMutateResponse> CreateStationAsync(Song song) { dynamic createMutation; if (song.TrackType == StreamType.EphemeralSubscription) { createMutation = new { clientId = Guid.NewGuid().ToString().ToLowerInvariant(), deleted = false, imageType = 1, // TODO: ? lastModifiedTimestamp = "-1", name = song.Title, recentTimestamp = ((long)song.Recent.ToUnixFileTime() * 1000L).ToString("G", CultureInfo.InvariantCulture), seed = new { seedType = 2, trackId = song.SongId }, tracks = new object[0] }; } else { createMutation = new { clientId = Guid.NewGuid().ToString().ToLowerInvariant(), deleted = false, imageType = 1, // TODO: ? imageUrl = song.AlbumArtUrl, lastModifiedTimestamp = "-1", name = song.Title, recentTimestamp = ((long)song.Recent.ToUnixFileTime() * 1000L).ToString("G", CultureInfo.InvariantCulture), seed = new { seedType = 1, trackLockerId = song.SongId }, tracks = new object[0], }; } var mutation = new RequestCreateMutation() { Create = createMutation, IncludeFeed = true, NumEntries = 25, Params = new { contentFilter = this.settingsService.GetBlockExplicitSongsInRadio() ? 2 : 1 } }; return(await this.googleMusicApisService.PostAsync <GoogleMusicMutateResponse>( EditStation, new { mutations = new[] { mutation } })); }