MPD 0.17~git
src/sticker.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2003-2011 The Music Player Daemon Project
00003  * http://www.musicpd.org
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License along
00016  * with this program; if not, write to the Free Software Foundation, Inc.,
00017  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018  */
00019 
00020 /*
00021  * This is the sticker database library.  It is the backend of all the
00022  * sticker code in MPD.
00023  *
00024  * "Stickers" are pieces of information attached to existing MPD
00025  * objects (e.g. song files, directories, albums).  Clients can create
00026  * arbitrary name/value pairs.  MPD itself does not assume any special
00027  * meaning in them.
00028  *
00029  * The goal is to allow clients to share additional (possibly dynamic)
00030  * information about songs, which is neither stored on the client (not
00031  * available to other clients), nor stored in the song files (MPD has
00032  * no write access).
00033  *
00034  * Client developers should create a standard for common sticker
00035  * names, to ensure interoperability.
00036  *
00037  * Examples: song ratings; statistics; deferred tag writes; lyrics;
00038  * ...
00039  *
00040  */
00041 
00042 #ifndef STICKER_H
00043 #define STICKER_H
00044 
00045 #include <glib.h>
00046 
00047 #include <stdbool.h>
00048 
00049 struct sticker;
00050 
00058 bool
00059 sticker_global_init(const char *path, GError **error_r);
00060 
00064 void
00065 sticker_global_finish(void);
00066 
00070 bool
00071 sticker_enabled(void);
00072 
00077 char *
00078 sticker_load_value(const char *type, const char *uri, const char *name);
00079 
00084 bool
00085 sticker_store_value(const char *type, const char *uri,
00086                     const char *name, const char *value);
00087 
00092 bool
00093 sticker_delete(const char *type, const char *uri);
00094 
00099 bool
00100 sticker_delete_value(const char *type, const char *uri, const char *name);
00101 
00107 void
00108 sticker_free(struct sticker *sticker);
00109 
00117 const char *
00118 sticker_get_value(const struct sticker *sticker, const char *name);
00119 
00127 void
00128 sticker_foreach(const struct sticker *sticker,
00129                 void (*func)(const char *name, const char *value,
00130                              gpointer user_data),
00131                 gpointer user_data);
00132 
00140 struct sticker *
00141 sticker_load(const char *type, const char *uri);
00142 
00153 bool
00154 sticker_find(const char *type, const char *base_uri, const char *name,
00155              void (*func)(const char *uri, const char *value,
00156                           gpointer user_data),
00157              gpointer user_data);
00158 
00159 #endif