db/simple: add an AudioFormat to each Song

This commit is contained in:
Max Kellermann
2018-07-06 13:22:17 +02:00
parent c05bca6f2c
commit 72b6c09a73
11 changed files with 68 additions and 7 deletions

View File

@@ -77,19 +77,23 @@ Song::UpdateFile(Storage &storage) noexcept
return false;
TagBuilder tag_builder;
auto new_audio_format = AudioFormat::Undefined();
const auto path_fs = storage.MapFS(relative_uri.c_str());
if (path_fs.IsNull()) {
const auto absolute_uri =
storage.MapUTF8(relative_uri.c_str());
if (!tag_stream_scan(absolute_uri.c_str(), tag_builder))
if (!tag_stream_scan(absolute_uri.c_str(), tag_builder,
&new_audio_format))
return false;
} else {
if (!ScanFileTagsWithGeneric(path_fs, tag_builder))
if (!ScanFileTagsWithGeneric(path_fs, tag_builder,
&new_audio_format))
return false;
}
mtime = info.mtime;
audio_format = new_audio_format;
tag_builder.Commit(tag);
return true;
}