Merge pull request #625 from chme/spotify_metadata

[spotify] Set track fields "time added" and "time modified"
This commit is contained in:
ejurgensen 2018-11-24 13:16:07 +01:00 committed by GitHub
commit a8d3a045f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1282,6 +1282,9 @@ map_track_to_mfi(struct media_file_info *mfi, const struct spotify_track *track,
mfi->path = strdup(track->uri); mfi->path = strdup(track->uri);
mfi->fname = strdup(track->uri); mfi->fname = strdup(track->uri);
mfi->time_modified = track->mtime;
mfi->time_added = track->mtime;
if (album) if (album)
{ {
mfi->album_artist = safe_strdup(album->artist); 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->genre = safe_strdup(album->genre);
mfi->compilation = album->is_compilation; mfi->compilation = album->is_compilation;
mfi->year = album->release_year; mfi->year = album->release_year;
mfi->time_modified = album->mtime;
} }
else else
{ {
@ -1303,8 +1305,6 @@ map_track_to_mfi(struct media_file_info *mfi, const struct spotify_track *track,
mfi->compilation = true; mfi->compilation = true;
else else
mfi->compilation = track->is_compilation; 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); 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; break;
parse_metadata_track(jsontrack, &track); parse_metadata_track(jsontrack, &track);
track.mtime = album.mtime;
ret = track_add(&track, &album, NULL, dir_id); ret = track_add(&track, &album, NULL, dir_id);