Beispiel #1
0
        private async Task <CityTracks> tracksFromTemp(double temperature)
        {
            var token = await Spotify.GetToken(Config.Value.spotify_id, Config.Value.spotify_secret);

            var ret = new CityTracks
            {
                Temperature = temperature
            };

            if (temperature > 30)
            {
                ret.Tracks = await Spotify.GetPartyTracks(token.AccessToken);

                ret.Type = "Party";
            }
            else if (temperature >= 15 && temperature <= 30)
            {
                ret.Tracks = await Spotify.GetPopTracks(token.AccessToken);

                ret.Type = "Pop";
            }
            else if (temperature >= 10 && temperature <= 14)
            {
                ret.Tracks = await Spotify.GetRockTracks(token.AccessToken);

                ret.Type = "Rock";
            }
            else
            {
                ret.Tracks = await Spotify.GetClassicalTracks(token.AccessToken);

                ret.Type = "Clasical";
            }

            return(ret);
        }