db: add compile-time option to disable database

This commit is contained in:
Max Kellermann
2014-01-30 20:29:48 +01:00
parent 34b309b99a
commit 4465e2c46b
25 changed files with 297 additions and 57 deletions

View File

@@ -64,6 +64,8 @@ playlist_open_in_playlist_dir(const char *uri, Mutex &mutex, Cond &cond,
return playlist_open_path(path_fs.c_str(), mutex, cond, is_r);
}
#ifdef ENABLE_DATABASE
/**
* Load a playlist from the configured music directory.
*/
@@ -80,6 +82,8 @@ playlist_open_in_music_dir(const char *uri, Mutex &mutex, Cond &cond,
return playlist_open_path(path.c_str(), mutex, cond, is_r);
}
#endif
SongEnumerator *
playlist_mapper_open(const char *uri, Mutex &mutex, Cond &cond,
InputStream **is_r)
@@ -91,12 +95,14 @@ playlist_mapper_open(const char *uri, Mutex &mutex, Cond &cond,
return playlist;
}
#ifdef ENABLE_DATABASE
if (uri_safe_local(uri)) {
auto playlist = playlist_open_in_music_dir(uri, mutex, cond,
is_r);
if (playlist != nullptr)
return playlist;
}
#endif
return nullptr;
}

View File

@@ -79,6 +79,7 @@ playlist_check_load_song(DetachedSong &song)
apply_song_metadata(song, tmp);
return true;
} else {
#ifdef ENABLE_DATABASE
DetachedSong *tmp = DatabaseDetachSong(uri, IgnoreError());
if (tmp == nullptr)
return false;
@@ -86,6 +87,9 @@ playlist_check_load_song(DetachedSong &song)
apply_song_metadata(song, *tmp);
delete tmp;
return true;
#else
return false;
#endif
}
}