From 2fe1b5034d85b9d80ec555a8736d6bbef2eaf901 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 13 Sep 2011 21:01:35 +0200 Subject: db_plugin: add method get_song() New db_get_song() implementation. --- src/db_plugin.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/db_plugin.h') diff --git a/src/db_plugin.h b/src/db_plugin.h index a5c57bbad..5fec2529e 100644 --- a/src/db_plugin.h +++ b/src/db_plugin.h @@ -58,6 +58,15 @@ struct db_plugin { * Close the database, free allocated memory. */ void (*close)(struct db *db); + + /** + * Look up a song (including tag data) in the database. + * + * @param the URI of the song within the music directory + * (UTF-8) + */ + struct song *(*get_song)(struct db *db, const char *uri, + GError **error_r); }; G_GNUC_MALLOC @@ -68,6 +77,7 @@ db_plugin_new(const struct db_plugin *plugin, const struct config_param *param, assert(plugin != NULL); assert(plugin->init != NULL); assert(plugin->finish != NULL); + assert(plugin->get_song != NULL); assert(error_r == NULL || *error_r == NULL); struct db *db = plugin->init(param, error_r); @@ -108,4 +118,15 @@ db_plugin_close(struct db *db) db->plugin->close(db); } +static inline struct song * +db_plugin_get_song(struct db *db, const char *uri, GError **error_r) +{ + assert(db != NULL); + assert(db->plugin != NULL); + assert(db->plugin->get_song != NULL); + assert(uri != NULL); + + return db->plugin->get_song(db, uri, error_r); +} + #endif -- cgit v1.2.3