Пример #1
0
        public async Task <Artist> GetArtist(Spotify sp, SpotterAzure_dbContext dbContext)
        {
            IQueryable <Artist> artists = dbContext.Artists.Where(x => x.ArtistId == this.ArtistId);

            if (artists.Any())
            {
                artists.First().GetArtist(sp, dbContext);

                return(artists.First());
            }
            else
            {
                Artist art = new Artist(this, sp);
                return(art);
            }
        }
Пример #2
0
        public async Task <ArtistDetails> GetArtist(Spotify sp, SpotterAzure_dbContext dbContext)
        {
            if (DateTime.Now.AddDays(-7) > this.TrueAt.Value || this.Details == null)
            {
                try
                {
                    FullArtist features = await sp.spotify.Artists.Get(this.ArtistId);

                    this.Details = JObject.FromObject(features).ToString();
                    dbContext.Update(this);
                }
                catch
                {
                    return(null);
                }
            }

            return(JObject.Parse(this.Details).ToObject <ArtistDetails>());
        }
Пример #3
0
        public async Task <Features> GetFeatures(Spotify sp, SpotterAzure_dbContext dbContext)
        {
            if (DateTime.Now.AddDays(-7) > this.TrueAt.Value || this.Features == null)
            {
                try
                {
                    TrackAudioFeatures features = await sp.spotify.Tracks.GetAudioFeatures(TrackId);

                    this.Features = JObject.FromObject(features).ToString();
                }
                catch
                {
                    return(null);
                }
                finally
                {
                    dbContext.Tracks.Update(this);
                }
            }

            return(JObject.Parse(this.Features).ToObject <Features>());
        }
Пример #4
0
 public Artist(Track track, Spotify sp)
 {
     this.ArtistId = track.ArtistId;
     SetArtist(sp);
     this.TrueAt = DateTime.Now;
 }
Пример #5
0
 public Session(string AuthToken, Spotify user)
 {
     SpotId         = user.SpotId;
     this.AuthToken = encoder.Encode(AuthToken);
 }