|
@@ -322,26 +322,26 @@ func (app *App) AutomateSection(title string) error {
|
322
|
322
|
} else if token.Expiry.Before(time.Now()) {
|
323
|
323
|
log.Println("Token has expired")
|
324
|
324
|
} else {
|
325
|
|
- playlistId, tracks := findPlaylist(changedWikiText)
|
|
325
|
+ playlistID, tracks := findPlaylist(changedWikiText)
|
326
|
326
|
currentTracks, err := app.db.FindPlaylistBySection(section.title)
|
327
|
327
|
if err != nil {
|
328
|
328
|
log.Println("Failed to find tracks from DB", err)
|
329
|
329
|
}
|
330
|
330
|
log.Println("Checking if playlist needs updating", currentTracks, tracks)
|
331
|
|
- if len(tracks) > 0 && (err != nil || reflect.DeepEqual(currentTracks, tracks)) {
|
|
331
|
+ if len(tracks) > 0 && (err != nil || !reflect.DeepEqual(currentTracks, tracks)) {
|
332
|
332
|
|
333
|
|
- if playlistId == "" {
|
|
333
|
+ if playlistID == "" {
|
334
|
334
|
|
335
|
335
|
info, err := app.spotify.client.CreatePlaylistForUser(app.credentials.SpotifyUser, title+" "+section.title, true)
|
336
|
336
|
if err != nil {
|
337
|
337
|
log.Println("Error creating playlist to Spotify")
|
338
|
338
|
return err
|
339
|
339
|
}
|
340
|
|
- playlistId = info.ID
|
|
340
|
+ playlistID = info.ID
|
341
|
341
|
changedWikiText = appendPlaylist(changedWikiText, info)
|
342
|
342
|
message = message + fmt.Sprintf("Added link to Spotify playlist for week %d.", weekNumber)
|
343
|
343
|
}
|
344
|
|
- err := app.spotify.client.ReplacePlaylistTracks(app.credentials.SpotifyUser, playlistId, tracks...)
|
|
344
|
+ err := app.spotify.client.ReplacePlaylistTracks(app.credentials.SpotifyUser, playlistID, tracks...)
|
345
|
345
|
if err != nil {
|
346
|
346
|
log.Println("Error updating playlist to Spotify")
|
347
|
347
|
return err
|