public static IObservable <PlayingMixContract> StartPlayingAsync(this MixContract mix) { var playingMix = from playToken in GetOrCreatePlayTokenAsync() from response in Downloader.GetDeserializedAsync <PlayResponseContract>(ApiUrl.Play(playToken, mix.Id)) .Repeat(2) .Log("StartPlayingAsync: Attempting") .TakeFirst(ValidResponse) .Log("StartPlayingAsync: Valid Response") from added in AddToRecentlyPlayedAsync(mix).Log("AddToRecentlyPlayedAsync: Done") select new PlayingMixContract { PlayToken = playToken, MixId = mix.Id, MixName = mix.Name, Cover = mix.Cover, Set = response.Set }; return(from playing in playingMix from tile in SetNowPlayingTileAsync( playing, DataStrings.Title_ApplicationName, DataStrings.Title_NowPlaying) .Log("SetNowPlayingTileAsync: Done") select playing); }
public static IObservable <ReviewsResponseContract> GetMixReviewsAsync(string mixId, int pageNumber, int perPage) { return(Downloader.GetDeserializedAsync <ReviewsResponseContract>(ApiUrl.MixReviews(mixId, pageNumber, perPage)).Catch <ReviewsResponseContract>(Observable.Return(new ReviewsResponseContract())).NotNull()); }