Esempio n. 1
0
        public void CheckAction(Account user, DateTime lastCheck)
        {
            var              api             = _spotifyService.GetSpotifyWebApi(_spotifyService.GetSpotifyToken(user));
            FollowedArtists  followedArtists = _spotifyService.GetFollowedArtists(api);
            NewAlbumReleases releases        = _spotifyService.GetNewReleases(api);

            for (int i = 0; i < followedArtists.Artists.Items.Count; i++)
            {
                for (int j = 0; j < releases.Albums.Items.Count; j++)
                {
                    for (int k = 0; k < releases.Albums.Items[j].Artists.Count; k++)
                    {
                        if (followedArtists.Artists.Items[i].Id == releases.Albums.Items[j].Artists[k].Id &&
                            lastCheck < _spotifyService.GetDateFromString(releases.Albums.Items[j].ReleaseDate, releases.Albums.Items[j].ReleaseDatePrecision))
                        {
                            _newReleases.Add(releases.Albums.Items[j]);
                        }
                    }
                }
            }
        }