#145 : Correction pas d'accueil en changement des creds spotify.
This commit is contained in:
@@ -22,6 +22,12 @@ public class SeedDataSpotify
|
||||
this.options = optionsAccessor.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Générer les données de la base a l'aide des données de spotify.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token.</param>
|
||||
/// <returns>Jeu de données.</returns>
|
||||
/// <exception cref="InvalidOperationException">Erreur de connexion a spotify.</exception>
|
||||
public async Task<SeedDataSet> GenererJeuDeDonneesAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
// Verification des parametres pour l'acces a Spotify.
|
||||
@@ -35,7 +41,7 @@ public class SeedDataSpotify
|
||||
var artistes = new List<Artiste>();
|
||||
var titres = new List<Titre>();
|
||||
var commentaires = new List<Commentaire>();
|
||||
var artistIds = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
var artistIds = new HashSet<string>();
|
||||
int nextArtistId = 1;
|
||||
int nextStyleId = 1;
|
||||
int nextTitreId = 1;
|
||||
@@ -68,7 +74,7 @@ public class SeedDataSpotify
|
||||
token,
|
||||
cancellationToken);
|
||||
|
||||
foreach (var album in albums?.Items.GroupBy(a => a.Name, StringComparer.OrdinalIgnoreCase).Select(g => g.First()) ??[])
|
||||
foreach (var album in albums?.Items.GroupBy(a => a.Name).Select(g => g.First()) ??[])
|
||||
{
|
||||
var tracks = await this.GetAsync<SpotifyTracksResponseDto>(
|
||||
$"https://api.spotify.com/v1/albums/{album.Id}/tracks?market={this.options.Market}&limit={Math.Clamp(this.options.TracksPerAlbum, 1, 10)}",
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
@foreach (var style in titre.Styles)
|
||||
{
|
||||
<a asp-controller="Titre"
|
||||
<a asp-controller="Titres"
|
||||
asp-action="Style"
|
||||
asp-route-id="@style.Libelle"
|
||||
class="text-decoration-none me-1">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"Seeder": "Spotify",
|
||||
"Repository": "Db",
|
||||
"SpotifySeeder": {
|
||||
"ClientId": "754247cf73e047bf9d6acf44977b6c4a",
|
||||
"ClientSecret": "0e674c5ac1c249f1af711fb08a919a02"
|
||||
"ClientId": "",
|
||||
"ClientSecret": ""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
"PostGreSQLConnection": "Host=localhost;Port=5432;Username=admin;Password=admin123;Database=webzine_db"
|
||||
},
|
||||
"SpotifySeeder": {
|
||||
"ClientId": "754247cf73e047bf9d6acf44977b6c4a",
|
||||
"ClientSecret": "0e674c5ac1c249f1af711fb08a919a02",
|
||||
"ClientId": "",
|
||||
"ClientSecret": "",
|
||||
"Market": "FR",
|
||||
"Genres": [ "rock", "pop", "jazz", "hip hop", "electronic", "metal", "hyper pop" ],
|
||||
"ArtistsPerGenre": 50,
|
||||
"Genres": [ "rock", "pop", "jazz", "hip hop", "electronic", "metal", "hyper pop", "shatta", "french%20rap" ],
|
||||
"ArtistsPerGenre": 5,
|
||||
"AlbumsPerArtist": 20,
|
||||
"TracksPerAlbum": 40,
|
||||
"MaxCommentsPerTrack": 3
|
||||
|
||||
Reference in New Issue
Block a user