diff options
author | Max Kellermann <max@duempel.org> | 2011-09-13 21:01:35 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-09-13 21:01:35 +0200 |
commit | 2fe1b5034d85b9d80ec555a8736d6bbef2eaf901 (patch) | |
tree | 1a05031ab7deab2ac6a43e66544b7a1c32464d02 /src/db_plugin.h | |
parent | b4430839a3413893a027f7a0fc5494af8198e1bb (diff) | |
download | mpd-2fe1b5034d85b9d80ec555a8736d6bbef2eaf901.tar.gz mpd-2fe1b5034d85b9d80ec555a8736d6bbef2eaf901.tar.xz mpd-2fe1b5034d85b9d80ec555a8736d6bbef2eaf901.zip |
db_plugin: add method get_song()
New db_get_song() implementation.
Diffstat (limited to 'src/db_plugin.h')
-rw-r--r-- | src/db_plugin.h | 21 |
1 files changed, 21 insertions, 0 deletions
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 |