db/plugins/simple/Song: pass StorageFileInfo to UpdateFile()
Eliminates a redundant GetInfo() call.
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include <string>
|
||||
|
||||
struct Directory;
|
||||
struct StorageFileInfo;
|
||||
class ExportedSong;
|
||||
class DetachedSong;
|
||||
class Storage;
|
||||
@@ -119,6 +120,7 @@ struct Song : IntrusiveListHook<> {
|
||||
* recognized
|
||||
*/
|
||||
static SongPtr LoadFile(Storage &storage, std::string_view name_utf8,
|
||||
const StorageFileInfo &info,
|
||||
Directory &parent);
|
||||
|
||||
/**
|
||||
@@ -126,7 +128,7 @@ struct Song : IntrusiveListHook<> {
|
||||
*
|
||||
* @return true on success, false if the file was not recognized
|
||||
*/
|
||||
bool UpdateFile(Storage &storage);
|
||||
bool UpdateFile(Storage &storage, const StorageFileInfo &info);
|
||||
|
||||
#ifdef ENABLE_ARCHIVE
|
||||
static SongPtr LoadFromArchive(ArchiveFile &archive,
|
||||
|
||||
@@ -41,7 +41,8 @@ try {
|
||||
FmtDebug(update_domain, "reading {}/{}",
|
||||
directory.GetPath(), name);
|
||||
|
||||
auto new_song = Song::LoadFile(storage, name, directory);
|
||||
auto new_song = Song::LoadFile(storage, name, info,
|
||||
directory);
|
||||
if (!new_song) {
|
||||
FmtDebug(update_domain,
|
||||
"ignoring unrecognized file {}/{}",
|
||||
@@ -63,7 +64,7 @@ try {
|
||||
} else if (info.mtime != song->mtime || walk_discard) {
|
||||
FmtNotice(update_domain, "updating {}/{}",
|
||||
directory.GetPath(), name);
|
||||
if (song->UpdateFile(storage))
|
||||
if (song->UpdateFile(storage, info))
|
||||
song->mark = true;
|
||||
else
|
||||
FmtDebug(update_domain,
|
||||
|
||||
Reference in New Issue
Block a user