aboutsummaryrefslogtreecommitdiffstats
path: root/src/db/update/UpdateSong.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-29 20:16:43 +0100
committerMax Kellermann <max@duempel.org>2014-01-30 18:47:05 +0100
commitc6725884bc155da431889468c86c546f0f64f9a1 (patch)
tree61d89751ecc98db9600620ac1788f32dea9214e1 /src/db/update/UpdateSong.cxx
parenta31738f6f1473f4f621bc16513ed0c6024749389 (diff)
downloadmpd-c6725884bc155da431889468c86c546f0f64f9a1.tar.gz
mpd-c6725884bc155da431889468c86c546f0f64f9a1.tar.xz
mpd-c6725884bc155da431889468c86c546f0f64f9a1.zip
db/update: convert to OO API
Move global variables into the new classes. That may allow multiple update threads for multiple databases one day.
Diffstat (limited to 'src/db/update/UpdateSong.cxx')
-rw-r--r--src/db/update/UpdateSong.cxx29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/db/update/UpdateSong.cxx b/src/db/update/UpdateSong.cxx
index ac2d01cd2..afd609f9a 100644
--- a/src/db/update/UpdateSong.cxx
+++ b/src/db/update/UpdateSong.cxx
@@ -18,11 +18,8 @@
*/
#include "config.h" /* must be first for large file support */
-#include "UpdateSong.hxx"
-#include "UpdateInternal.hxx"
+#include "Service.hxx"
#include "UpdateIO.hxx"
-#include "UpdateDatabase.hxx"
-#include "UpdateContainer.hxx"
#include "UpdateDomain.hxx"
#include "db/DatabaseLock.hxx"
#include "db/Directory.hxx"
@@ -32,10 +29,10 @@
#include <unistd.h>
-static void
-update_song_file2(Directory &directory,
- const char *name, const struct stat *st,
- const char *suffix)
+inline void
+UpdateWalk::UpdateSongFile2(Directory &directory,
+ const char *name, const char *suffix,
+ const struct stat *st)
{
db_lock();
Song *song = directory.FindSong(name);
@@ -47,7 +44,7 @@ update_song_file2(Directory &directory,
directory.GetPath(), name);
if (song != nullptr) {
db_lock();
- delete_song(directory, song);
+ editor.DeleteSong(directory, song);
db_unlock();
}
@@ -56,10 +53,10 @@ update_song_file2(Directory &directory,
if (!(song != nullptr && st->st_mtime == song->mtime &&
!walk_discard) &&
- update_container_file(directory, name, st, suffix)) {
+ UpdateContainerFile(directory, name, suffix, st)) {
if (song != nullptr) {
db_lock();
- delete_song(directory, song);
+ editor.DeleteSong(directory, song);
db_unlock();
}
@@ -92,7 +89,7 @@ update_song_file2(Directory &directory,
"deleting unrecognized file %s/%s",
directory.GetPath(), name);
db_lock();
- delete_song(directory, song);
+ editor.DeleteSong(directory, song);
db_unlock();
}
@@ -101,13 +98,13 @@ update_song_file2(Directory &directory,
}
bool
-update_song_file(Directory &directory,
- const char *name, const char *suffix,
- const struct stat *st)
+UpdateWalk::UpdateSongFile(Directory &directory,
+ const char *name, const char *suffix,
+ const struct stat *st)
{
if (!decoder_plugins_supports_suffix(suffix))
return false;
- update_song_file2(directory, name, st, suffix);
+ UpdateSongFile2(directory, name, suffix, st);
return true;
}