diff options
author | Max Kellermann <max@duempel.org> | 2014-01-29 18:14:57 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-02-05 10:04:03 +0100 |
commit | 9ae7f186bc43749383594807b1d751b5389161e7 (patch) | |
tree | 0cafbfde8316c4b1a9ded19060d3020977a604dd /src/db/update/UpdateSong.cxx | |
parent | f8d114be42663006d162311c1ecaf4306e0b72e4 (diff) | |
download | mpd-9ae7f186bc43749383594807b1d751b5389161e7.tar.gz mpd-9ae7f186bc43749383594807b1d751b5389161e7.tar.xz mpd-9ae7f186bc43749383594807b1d751b5389161e7.zip |
LocalStorage: new API abstracting filesystem walk
Prepare to make this a new plugin API, for example to use a SMB share
for the music_directory.
Diffstat (limited to '')
-rw-r--r-- | src/db/update/UpdateSong.cxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/db/update/UpdateSong.cxx b/src/db/update/UpdateSong.cxx index 751d8bfe9..2868249e7 100644 --- a/src/db/update/UpdateSong.cxx +++ b/src/db/update/UpdateSong.cxx @@ -25,6 +25,7 @@ #include "db/Directory.hxx" #include "db/Song.hxx" #include "decoder/DecoderList.hxx" +#include "storage/FileInfo.hxx" #include "Log.hxx" #include <unistd.h> @@ -32,13 +33,13 @@ inline void UpdateWalk::UpdateSongFile2(Directory &directory, const char *name, const char *suffix, - const struct stat *st) + const FileInfo &info) { db_lock(); Song *song = directory.FindSong(name); db_unlock(); - if (!directory_child_access(directory, name, R_OK)) { + if (!directory_child_access(storage, directory, name, R_OK)) { FormatError(update_domain, "no read permissions on %s/%s", directory.GetPath(), name); @@ -48,9 +49,9 @@ UpdateWalk::UpdateSongFile2(Directory &directory, return; } - if (!(song != nullptr && st->st_mtime == song->mtime && + if (!(song != nullptr && info.mtime == song->mtime && !walk_discard) && - UpdateContainerFile(directory, name, suffix, st)) { + UpdateContainerFile(directory, name, suffix, info)) { if (song != nullptr) editor.LockDeleteSong(directory, song); @@ -75,7 +76,7 @@ UpdateWalk::UpdateSongFile2(Directory &directory, modified = true; FormatDefault(update_domain, "added %s/%s", directory.GetPath(), name); - } else if (st->st_mtime != song->mtime || walk_discard) { + } else if (info.mtime != song->mtime || walk_discard) { FormatDefault(update_domain, "updating %s/%s", directory.GetPath(), name); if (!song->UpdateFile()) { @@ -92,11 +93,11 @@ UpdateWalk::UpdateSongFile2(Directory &directory, bool UpdateWalk::UpdateSongFile(Directory &directory, const char *name, const char *suffix, - const struct stat *st) + const FileInfo &info) { if (!decoder_plugins_supports_suffix(suffix)) return false; - UpdateSongFile2(directory, name, suffix, st); + UpdateSongFile2(directory, name, suffix, info); return true; } |