From bb959fdec98d6f28c19905736294be060ac9baf0 Mon Sep 17 00:00:00 2001 From: chme Date: Tue, 20 Mar 2018 18:20:36 +0100 Subject: [PATCH] [spotify] Use added_at as time_added and time_modified Saved albums and playlist items have a "added at" attribut use it as created instead of probably unexpected current time. --- src/spotify_webapi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/spotify_webapi.c b/src/spotify_webapi.c index a519e9d8..642de2c1 100644 --- a/src/spotify_webapi.c +++ b/src/spotify_webapi.c @@ -1282,6 +1282,9 @@ map_track_to_mfi(struct media_file_info *mfi, const struct spotify_track *track, mfi->path = strdup(track->uri); mfi->fname = strdup(track->uri); + mfi->time_modified = track->mtime; + mfi->time_added = track->mtime; + if (album) { mfi->album_artist = safe_strdup(album->artist); @@ -1289,7 +1292,6 @@ map_track_to_mfi(struct media_file_info *mfi, const struct spotify_track *track, mfi->genre = safe_strdup(album->genre); mfi->compilation = album->is_compilation; mfi->year = album->release_year; - mfi->time_modified = album->mtime; } else { @@ -1303,8 +1305,6 @@ map_track_to_mfi(struct media_file_info *mfi, const struct spotify_track *track, mfi->compilation = true; else mfi->compilation = track->is_compilation; - - mfi->time_modified = time(NULL); } snprintf(virtual_path, PATH_MAX, "/spotify:/%s/%s/%s", mfi->album_artist, mfi->album, mfi->title); @@ -1407,6 +1407,7 @@ saved_album_add(json_object *item, int index, int total, void *arg) break; parse_metadata_track(jsontrack, &track); + track.mtime = album.mtime; ret = track_add(&track, &album, NULL, dir_id);