Esempio n. 1
0
        public async Task<List<EventExt>> GetArtistPastEvents(ArtistExt artist)
        {
            int perPage = 50;

            ArtistType artistType = new ArtistType();
            artistType.Type = ArtistTypeEnum.Songkick;
            artistType.ArtistId = artist.Id.Value;

            var pastEvents = new List<EventExt>();
            var response = await _songkickClient.ArtistPastEvents(artistType, 1, perPage);

            if (int.Parse(response.ResultsPage.TotalEntries) != 0)
            {
                pastEvents.AddRange(response.ResultsPage.Results.Events);

                var max = Math.Ceiling(double.Parse(response.ResultsPage.TotalEntries) / perPage);

                for (int page = 2; page <= max; page++)
                {
                    response = await _songkickClient.ArtistPastEvents(artistType, 1, perPage);
                    pastEvents.AddRange(response.ResultsPage.Results.Events);
                }
            }

            return pastEvents;
        }
Esempio n. 2
0
        public async Task<List<EventExt>> GetArtistUpcomingEvents(ArtistExt artist)
        {
            ArtistType artistType = new ArtistType();
            artistType.Type = ArtistTypeEnum.Songkick;
            artistType.ArtistId = artist.Id.Value;

            ContentResponse response = await _songkickClient.ArtistUpcomingEvents(artistType);
            return response.ResultsPage.Results.Events;
        }
Esempio n. 3
0
        private async Task GetMappingAndImage(ArtistExt artist)
        {
            if (artist.IsDefaultImage)
            {
                try
                {
                    var artistId = artist.Id.Value;
                    var mapping = await _dataService.GetMapping(artistId.ToString());

                    if (mapping != null)
                    {
                        var groove = mapping.Groove;

                        DispatcherHelper.CheckBeginInvokeOnUI(() =>
                        {
                            artist.SetImageUrl($"http://musicimage.xboxlive.com/content/music.{groove}/image?locale=en-US");
                        });

                        Debug.WriteLine(string.Format("{0},{1}", artist.DisplayName, mapping.Groove));
                    }
                    else
                    {
                        Debug.WriteLine(string.Format("{0},{1}", artist.DisplayName, "NOT FOUND"));
                    }

                }
                catch (Exception)
                {
                    var loader = new ResourceLoader("Errors");
                    DialogService.DisplayError(loader.GetString("Network/Caption"), loader.GetString("Network/Message"), "");
                }
            }
        }
Esempio n. 4
0
 public Task<List<EventExt>> GetArtistPastEvents(ArtistExt artist)
 {
     throw new NotImplementedException();
 }