00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef MPD_DATABASE_H
00021 #define MPD_DATABASE_H
00022
00023 #include "gcc.h"
00024
00025 #include <glib.h>
00026
00027 #include <sys/time.h>
00028 #include <stdbool.h>
00029
00030 struct config_param;
00031 struct directory;
00032 struct db_selection;
00033 struct db_visitor;
00034
00040 bool
00041 db_init(const struct config_param *path, GError **error_r);
00042
00043 void
00044 db_finish(void);
00045
00050 G_GNUC_PURE
00051 struct directory *
00052 db_get_root(void);
00053
00057 gcc_nonnull(1)
00058 G_GNUC_PURE
00059 struct directory *
00060 db_get_directory(const char *name);
00061
00062 gcc_nonnull(1)
00063 G_GNUC_PURE
00064 struct song *
00065 db_get_song(const char *file);
00066
00067 gcc_nonnull(1,2)
00068 bool
00069 db_visit(const struct db_selection *selection,
00070 const struct db_visitor *visitor, void *ctx,
00071 GError **error_r);
00072
00073 gcc_nonnull(1,2)
00074 bool
00075 db_walk(const char *uri,
00076 const struct db_visitor *visitor, void *ctx,
00077 GError **error_r);
00078
00079 bool
00080 db_save(GError **error_r);
00081
00082 bool
00083 db_load(GError **error);
00084
00085 G_GNUC_PURE
00086 time_t
00087 db_get_mtime(void);
00088
00092 G_GNUC_PURE
00093 static inline bool
00094 db_exists(void)
00095 {
00096
00097
00098 return db_get_mtime() > 0;
00099 }
00100
00101 #endif