| libmpd-database.h | | libmpd-database.h | |
| | | | |
| skipping to change at line 23 | | skipping to change at line 23 | |
| * | | * | |
| * You should have received a copy of the GNU General Public | | * You should have received a copy of the GNU General Public | |
| * License along with this program; if not, write to the | | * License along with this program; if not, write to the | |
| * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
| * Boston, MA 02111-1307, USA. | | * Boston, MA 02111-1307, USA. | |
| */ | | */ | |
| | | | |
| #ifndef __MPD_LIB_DATABASE__ | | #ifndef __MPD_LIB_DATABASE__ | |
| #define __MPD_LIB_DATABASE__ | | #define __MPD_LIB_DATABASE__ | |
| | | | |
|
| /** \defgroup 80database Database | | /** \defgroup database Database | |
| */ | | */ | |
| /*@{*/ | | /*@{*/ | |
| | | | |
| /** | | /** | |
| * @param mi A #MpdObj | | * @param mi A #MpdObj | |
| * @param artist an artist name | | * @param artist an artist name | |
| * | | * | |
| * Grab's a list of albums of a certain artist from mpd. | | * Grab's a list of albums of a certain artist from mpd. | |
| * if artist is %NULL it grabs all albums | | * if artist is %NULL it grabs all albums | |
| * | | * | |
| | | | |
| skipping to change at line 106 | | skipping to change at line 106 | |
| * | | * | |
| * Saves the current playlist to a file. | | * Saves the current playlist to a file. | |
| * | | * | |
| * @returns a #MpdError. #MPD_OK if succesfull, | | * @returns a #MpdError. #MPD_OK if succesfull, | |
| * #MPD_DATABASE_PLAYLIST_EXIST when the playlist allready exists. | | * #MPD_DATABASE_PLAYLIST_EXIST when the playlist allready exists. | |
| */ | | */ | |
| int mpd_database_save_playlist (MpdObj *mi,
char *name); | | int mpd_database_save_playlist (MpdObj *mi,
char *name); | |
| | | | |
| /** | | /** | |
| * @param mi a #MpdObj | | * @param mi a #MpdObj | |
|
| * @param field The table field | | * @param table table | |
| * @returns a #MpdData | | * @param string string to search for | |
| | | * @param exact if #TRUE only return exact matches | |
| | | * WARNING: This function is deprecated, use mpd_database_search_start | |
| | | * @returns a #MpdData list | |
| */ | | */ | |
|
| MpdData * mpd_database_get_unique_tags (MpdObj *mi, int fie | | MpdData * mpd_database_find(MpdObj *mi, int table, char *string, int exact) | |
| ld,...); | | ; | |
| | | | |
| /** | | /** | |
| * @param mi a #MpdObj | | * @param mi a #MpdObj | |
|
| * @param exact 1 for exact search 0 for fuzzy | | * @param path a NULL terminated path string | |
| * @returns a #MpdData | | * | |
| | | * Gets the contents of a directory, it can return songs, directories and p | |
| | | laylists | |
| | | * | |
| | | * @returns a #MpdData list with songs, directories and playlists | |
| */ | | */ | |
|
| MpdData * mpd_database_find_adv (MpdObj *mi,int exact, ...); | | MpdData * mpd_database_get_directory(MpdObj *mi,char *path); | |
| | | | |
| /** | | /** | |
| * @param mi a #MpdObj | | * @param mi a #MpdObj | |
|
| * @param table table | | * @param playlist the playlist you need the content off. | |
| * @param string string to search for | | * | |
| * @param exact if #TRUE only return exact matches | | * Only works with patched mpd. | |
| | | * Check for %mpd_server_command_allowed(mi, "listPlaylistInfo"); | |
| * | | * | |
| * @returns a #MpdData list | | * @returns a #MpdData list | |
| */ | | */ | |
|
| MpdData * mpd_database_find(MpdObj *mi, int table, char *string, int exact)
; | | MpdData *mpd_database_get_playlist_content(MpdObj *mi,char *playlist); | |
| | | | |
|
| MpdData * mpd_database_get_directory(MpdObj *mi,char *path); | | | |
| /*@}*/ | | /*@}*/ | |
|
| | | | |
| | | /** \defgroup advsearch Database Advanced Search | |
| | | * \ingroup database | |
| | | * The following functions provide an interface to the improved search capa | |
| | | bilities of mpd 0.12.0. | |
| | | */ | |
| | | /*@{*/ | |
| | | /** | |
| | | * @param mi A #MpdObj | |
| | | * @param path an Path to a file | |
| | | * | |
| | | * Grabs the song info for a single file. Make sure you pass an url to a so | |
| | | ng | |
| | | * and not a directory, that might result in strange behauviour. | |
| | | * | |
| | | * @returns a #mpd_Song | |
| | | */ | |
| | | mpd_Song * mpd_database_get_fileinfo(MpdObj *mi,const char *path); | |
| | | | |
| | | /** | |
| | | * @param mi A #MpdObj | |
| | | * @param field A #mpd_TagItems | |
| | | * @param value a string that %field needs to match | |
| | | * | |
| | | * Adds a constraint to the search | |
| | | */ | |
| | | void mpd_database_search_add_constraint(MpdObj *mi, mpd_TagItems field, cha | |
| | | r *value); | |
| | | | |
| | | /** | |
| | | * @param mi A #MpdObj | |
| | | * @param exact a boolean indicating if the search is fuzzy or exact | |
| | | * | |
| | | * Starts a search, you can add "constraints" by calling mpd_database_searc | |
| | | h_add_constraint | |
| | | * For Example if you want all songs by Eric Clapton you could do: | |
| | | * | |
| | | * @code | |
| | | * mpd_database_search_start(mi, TRUE); | |
| | | * mpd_database_search_add_constraint(mi, MPD_TAG_ITEM_ARTIST, "Eric Clapto | |
| | | n"); | |
| | | * data= mpd_database_search_commit(mi); | |
| | | * @endcode | |
| | | * | |
| | | * If you only want the songs from the album unplugged: | |
| | | * | |
| | | * @code | |
| | | * mpd_database_search_start(mi, TRUE); | |
| | | * mpd_database_search_add_constraint(mi, MPD_TAG_ITEM_ARTIST, "Eric Clapto | |
| | | n"); | |
| | | * mpd_database_search_add_constraint(mi, MPD_TAG_ITEM_ALBUM, "Unplugged"); | |
| | | * data= mpd_database_search_commit(mi); | |
| | | * @endcode | |
| | | * | |
| | | * This function requires mpd 0.12.0 or higher | |
| | | */ | |
| | | | |
| | | void mpd_database_search_start(MpdObj *mi, int exact); | |
| | | | |
| | | /** | |
| | | * @param mi a #MpdObj | |
| | | * @param field a #mpd_TagItems | |
| | | * | |
| | | * Starts a field search, f.e. if you want a list of all albums, you do; | |
| | | * | |
| | | * @code | |
| | | * mpd_database_search_field_start(mi, MPD_TAG_ITEM_ALBUM); | |
| | | * data = mpd_database_search_commit(mi); | |
| | | * @endcode | |
| | | * | |
| | | * You can add constraints using mpd_database_search_add_constraint, for ex | |
| | | ample if you want | |
| | | * all albums by eric clapton: | |
| | | * | |
| | | * @code | |
| | | * mpd_database_search_field_start(mi, MPD_TAG_ITEM_ALBUM); | |
| | | * mpd_database_search_add_constraint(mi, MPD_TAG_ITEM_ARTIST, "Eric Clapto | |
| | | n"); | |
| | | * data = mpd_database_search_commit(mi); | |
| | | * @endcode | |
| | | */ | |
| | | void mpd_database_search_field_start(MpdObj *mi, mpd_TagItems field); | |
| | | | |
| | | /** | |
| | | * @param mi A #MpdObj | |
| | | * | |
| | | * Commits the search and gathers the result in a #MpdData list. | |
| | | * | |
| | | * @returns a #MpdData list with the search result,or NULL when nothing is | |
| | | found | |
| | | */ | |
| | | MpdData * mpd_database_search_commit(MpdObj *mi); | |
| | | | |
| | | /*@}*/ | |
| | | | |
| | | /** \defgroup searchdeprecated Deprecated database search functions | |
| | | * \ingroup database | |
| | | * The following functions are deprecated | |
| | | */ | |
| | | /*@{*/ | |
| | | /** | |
| | | * @param mi a #MpdObj | |
| | | * @param field The table field | |
| | | * @returns a #MpdData | |
| | | */ | |
| | | MpdData * mpd_database_get_unique_tags (MpdObj *mi, int fie | |
| | | ld,...) __attribute__((deprecated)); | |
| | | /** | |
| | | * @param mi a #MpdObj | |
| | | * @param exact 1 for exact search 0 for fuzzy | |
| | | * | |
| | | * WARNING: This function is deprecated, use mpd_database_search_start | |
| | | * @returns a #MpdData | |
| | | */ | |
| | | MpdData * mpd_database_find_adv (MpdObj *mi,int exact, ...) | |
| | | __attribute__((deprecated)); | |
| | | /*@}*/ | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 9 change blocks. |
| 13 lines changed or deleted | | 139 lines changed or added | |
|
| libmpd-playlist.h | | libmpd-playlist.h | |
| | | | |
| skipping to change at line 59 | | skipping to change at line 59 | |
| * @param songid a SongId | | * @param songid a SongId | |
| * | | * | |
| * returns the mpd_Song for playlist entry with songid. | | * returns the mpd_Song for playlist entry with songid. | |
| * | | * | |
| * @returns a mpd_Song | | * @returns a mpd_Song | |
| */ | | */ | |
| mpd_Song * mpd_playlist_get_song (MpdObj *mi, int son
gid); | | mpd_Song * mpd_playlist_get_song (MpdObj *mi, int son
gid); | |
| | | | |
| /** | | /** | |
| * @param mi a #MpdObj | | * @param mi a #MpdObj | |
|
| | | * @param songpos a Songpos | |
| * | | * | |
|
| * returns the mpd_Song for the currently playing song | | * returns the mpd_Song for playlist entry with songpos. | |
| * | | * | |
| * @returns a mpd_Song | | * @returns a mpd_Song | |
| */ | | */ | |
|
| | | | |
| | | mpd_Song * mpd_playlist_get_song_from_pos(MpdObj *mi, int songpos); | |
| | | | |
| | | /** | |
| | | * @param mi a #MpdObj | |
| | | * | |
| | | * returns the mpd_Song for the currently playing song | |
| | | * | |
| | | * @returns a mpd_Song, this is an internally cached version, and should no | |
| | | t be free'ed. It's also not guaranteed to stay valid (it will be inside the | |
| | | same function if no other mpd_* function gets called.) | |
| | | * if you need to keep it around, make a copy. | |
| | | */ | |
| mpd_Song * mpd_playlist_get_current_song (MpdObj *mi); | | mpd_Song * mpd_playlist_get_current_song (MpdObj *mi); | |
| | | | |
| /** | | /** | |
| * mpd_playlist_clear | | * mpd_playlist_clear | |
| * @param mi a #MpdObj | | * @param mi a #MpdObj | |
| * | | * | |
| * Clears the playlist | | * Clears the playlist | |
| * | | * | |
| * @returns | | * @returns | |
| */ | | */ | |
| | | | |
| skipping to change at line 116 | | skipping to change at line 128 | |
| * @param mi a #MpdObj | | * @param mi a #MpdObj | |
| * @param old_playlist_id The id of the old playlist you want to get the ch
anges with. | | * @param old_playlist_id The id of the old playlist you want to get the ch
anges with. | |
| * | | * | |
| * Get's a list of the song that changed between the current and the old pl
aylist | | * Get's a list of the song that changed between the current and the old pl
aylist | |
| * | | * | |
| * @returns a #MpdData list | | * @returns a #MpdData list | |
| */ | | */ | |
| MpdData * mpd_playlist_get_changes (MpdObj *mi,int old_
playlist_id); | | MpdData * mpd_playlist_get_changes (MpdObj *mi,int old_
playlist_id); | |
| | | | |
| /** | | /** | |
|
| | | * @param mi a #MpdObj | |
| | | * @param old_playlist_id The id of the old playlist you want to get the ch | |
| | | anges with. | |
| | | * | |
| | | * Get's a list of the song id/pos that changed between the current and the | |
| | | old playlist | |
| | | * Check if this command is availible. | |
| | | * | |
| | | * @returns a #MpdData list | |
| | | */ | |
| | | MpdData * mpd_playlist_get_changes_posid(MpdObj *mi,int old_playlist_id); | |
| | | | |
| | | /** | |
| * @param mi a #MpdObj | | * @param mi a #MpdObj | |
| * | | * | |
| * @returns The number of songs in the current playlist. | | * @returns The number of songs in the current playlist. | |
| */ | | */ | |
| int mpd_playlist_get_playlist_length (MpdObj *mi); | | int mpd_playlist_get_playlist_length (MpdObj *mi); | |
| | | | |
| /** | | /** | |
| * @param mi a #MpdObj | | * @param mi a #MpdObj | |
| * @param path the path of the song to be added. | | * @param path the path of the song to be added. | |
| * | | * | |
| | | | |
| skipping to change at line 152 | | skipping to change at line 175 | |
| /** | | /** | |
| * @param mi a #MpdObj | | * @param mi a #MpdObj | |
| * @param songpos a song pos. | | * @param songpos a song pos. | |
| * | | * | |
| * Delete's a single song by it's position. | | * Delete's a single song by it's position. | |
| * | | * | |
| * @returns a #MpdError | | * @returns a #MpdError | |
| */ | | */ | |
| int mpd_playlist_delete_pos(MpdObj *mi, int songpos); | | int mpd_playlist_delete_pos(MpdObj *mi, int songpos); | |
| | | | |
|
| /*@}*/ | | /** | |
| /** \defgroup advsearch Playlist Advanced Search | | * @param mi a #MpdObj | |
| * \ingroup Playlist | | * @param path a path to a song | |
| * These functions only function when connected to mpd version 0.12.0 or h | | * | |
| igher | | * Add a single path and return the id | |
| | | * Only use this to add a single list, if you need to add multiple songs, | |
| | | * use the #mpd_playlist_queue_add for improved performance | |
| | | * | |
| | | * @returns a #MpdError or the songid of the added song | |
| */ | | */ | |
|
| /*@{*/ | | | |
| | | | |
|
| /* mpd svn only functions 0.12.0 */ | | int mpd_playlist_add_get_id(MpdObj *mi, char *path); | |
| /* TODO: rewrite this */ | | | |
| | | | |
| /*@}*/ | | /*@}*/ | |
| | | | |
| /** \defgroup comqueue Command Queue | | /** \defgroup comqueue Command Queue | |
| * \ingroup Playlist | | * \ingroup Playlist | |
| * These functions allow you to queue commands, and send them | | * These functions allow you to queue commands, and send them | |
| * in one command list to mpd. This is very efficient. | | * in one command list to mpd. This is very efficient. | |
| * It's adviced to use these for large deletes and add's. | | * It's adviced to use these for large deletes and add's. | |
| * These functions doesn't cause an extra overhead compared to the non_queu
e functions. | | * These functions doesn't cause an extra overhead compared to the non_queu
e functions. | |
| * Because the non_queue functions just wrap the following. | | * Because the non_queue functions just wrap the following. | |
| | | | |
| skipping to change at line 224 | | skipping to change at line 250 | |
| * @param mi a #MpdObj | | * @param mi a #MpdObj | |
| * | | * | |
| * Commits the queue'd commands in a command list. This is an efficient way
of doing alot of add's/removes. | | * Commits the queue'd commands in a command list. This is an efficient way
of doing alot of add's/removes. | |
| * | | * | |
| * @returns a #MpdError | | * @returns a #MpdError | |
| */ | | */ | |
| int mpd_playlist_queue_commit (MpdObj *mi); | | int mpd_playlist_queue_commit (MpdObj *mi); | |
| | | | |
| /*@}*/ | | /*@}*/ | |
| | | | |
|
| /** \defgroup playlistdeprecated Deprecated functions | | | |
| * \ingroup Playlist | | | |
| * These functions are removed from the playlist module, because they read/ | | | |
| control the database. | | | |
| * They are present for backwards compatibility | | | |
| */ | | | |
| /*@{*/ | | | |
| /* | | | |
| int mpd_playlist_update_dir (MpdObj *mi, char *path) __a | | | |
| ttribute__((deprecated)); | | | |
| MpdData * mpd_playlist_get_albums (MpdObj *mi, char *artist) _ | | | |
| _attribute__((deprecated)); | | | |
| MpdData * mpd_playlist_get_artists (MpdObj *mi) __attribute__(( | | | |
| deprecated)); | | | |
| MpdData * mpd_playlist_get_directory (MpdObj *mi,char *path)__att | | | |
| ribute__((deprecated)); | | | |
| MpdData * mpd_playlist_find (MpdObj *mi, int table, char | | | |
| *string, int exact) __attribute__((deprecated)); | | | |
| MpdData * mpd_playlist_token_find (MpdObj *mi, char *string) _ | | | |
| _attribute__((deprecated)); | | | |
| | | | |
| int mpd_playlist_delete (MpdObj *mi,char *pa | | | |
| th) __attribute__((deprecated)); | | | |
| int mpd_playlist_save (MpdObj *mi,char *pa | | | |
| th) __attribute__((deprecated)); | | | |
| MpdData * mpd_playlist_get_unique_tags (MpdObj *mi, int fie | | | |
| ld,...) __attribute__((deprecated)); | | | |
| MpdData * mpd_playlist_find_adv (MpdObj *mi,int exact, ...) | | | |
| __attribute__((deprecated)); | | | |
| | | | |
| */ | | | |
| /*@}*/ | | | |
| #endif | | #endif | |
| | | | |
End of changes. 8 change blocks. |
| 41 lines changed or deleted | | 38 lines changed or added | |
|
| libmpdclient.h | | libmpdclient.h | |
| /* libmpdclient | | /* libmpdclient | |
|
| (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu) | | (c)2003-2007 by Warren Dukes (warren.dukes@gmail.com) | |
| This project's homepage is: http://www.musicpd.org | | This project's homepage is: http://www.musicpd.org | |
| | | | |
| Redistribution and use in source and binary forms, with or without | | Redistribution and use in source and binary forms, with or without | |
| modification, are permitted provided that the following conditions | | modification, are permitted provided that the following conditions | |
| are met: | | are met: | |
| | | | |
| - Redistributions of source code must retain the above copyright | | - Redistributions of source code must retain the above copyright | |
| notice, this list of conditions and the following disclaimer. | | notice, this list of conditions and the following disclaimer. | |
| | | | |
| - Redistributions in binary form must reproduce the above copyright | | - Redistributions in binary form must reproduce the above copyright | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 31 | |
| ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION O
R | | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION O
R | |
| CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
| NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
|
| | | | |
| */ | | */ | |
| | | | |
|
| /** \defgroup libmpdclient Libmpdclient low level functions | | | |
| * Libmpdclient library that libmpd wraps. | | | |
| */ | | | |
| /*@{*/ | | | |
| #ifndef LIBMPDCLIENT_H | | #ifndef LIBMPDCLIENT_H | |
| #define LIBMPDCLIENT_H | | #define LIBMPDCLIENT_H | |
| | | | |
| #ifdef WIN32 | | #ifdef WIN32 | |
|
| #define __W32API_USE_DLLIMPORT__ 1 | | # define __W32API_USE_DLLIMPORT__ 1 | |
| #endif | | #endif | |
| | | | |
| #include <sys/time.h> | | #include <sys/time.h> | |
| #include <stdarg.h> | | #include <stdarg.h> | |
| #define MPD_BUFFER_MAX_LENGTH 50000 | | #define MPD_BUFFER_MAX_LENGTH 50000 | |
|
| | | #define MPD_ERRORSTR_MAX_LENGTH 1000 | |
| #define MPD_WELCOME_MESSAGE "OK MPD " | | #define MPD_WELCOME_MESSAGE "OK MPD " | |
| | | | |
| #define MPD_ERROR_TIMEOUT 10 /* timeout trying to talk to mpd */ | | #define MPD_ERROR_TIMEOUT 10 /* timeout trying to talk to mpd */ | |
| #define MPD_ERROR_SYSTEM 11 /* system error */ | | #define MPD_ERROR_SYSTEM 11 /* system error */ | |
| #define MPD_ERROR_UNKHOST 12 /* unknown host */ | | #define MPD_ERROR_UNKHOST 12 /* unknown host */ | |
| #define MPD_ERROR_CONNPORT 13 /* problems connecting to port on host */ | | #define MPD_ERROR_CONNPORT 13 /* problems connecting to port on host */ | |
| #define MPD_ERROR_NOTMPD 14 /* mpd not running on port at host */ | | #define MPD_ERROR_NOTMPD 14 /* mpd not running on port at host */ | |
| #define MPD_ERROR_NORESPONSE 15 /* no response on attempting to connect *
/ | | #define MPD_ERROR_NORESPONSE 15 /* no response on attempting to connect *
/ | |
| #define MPD_ERROR_SENDING 16 /* error sending command */ | | #define MPD_ERROR_SENDING 16 /* error sending command */ | |
| #define MPD_ERROR_CONNCLOSED 17 /* connection closed by mpd */ | | #define MPD_ERROR_CONNCLOSED 17 /* connection closed by mpd */ | |
| | | | |
| skipping to change at line 94 | | skipping to change at line 90 | |
| MPD_TAG_ITEM_ARTIST, | | MPD_TAG_ITEM_ARTIST, | |
| MPD_TAG_ITEM_ALBUM, | | MPD_TAG_ITEM_ALBUM, | |
| MPD_TAG_ITEM_TITLE, | | MPD_TAG_ITEM_TITLE, | |
| MPD_TAG_ITEM_TRACK, | | MPD_TAG_ITEM_TRACK, | |
| MPD_TAG_ITEM_NAME, | | MPD_TAG_ITEM_NAME, | |
| MPD_TAG_ITEM_GENRE, | | MPD_TAG_ITEM_GENRE, | |
| MPD_TAG_ITEM_DATE, | | MPD_TAG_ITEM_DATE, | |
| MPD_TAG_ITEM_COMPOSER, | | MPD_TAG_ITEM_COMPOSER, | |
| MPD_TAG_ITEM_PERFORMER, | | MPD_TAG_ITEM_PERFORMER, | |
| MPD_TAG_ITEM_COMMENT, | | MPD_TAG_ITEM_COMMENT, | |
|
| | | MPD_TAG_ITEM_DISC, | |
| MPD_TAG_ITEM_FILENAME, | | MPD_TAG_ITEM_FILENAME, | |
|
| | | MPD_TAG_ITEM_ANY, | |
| MPD_TAG_NUM_OF_ITEM_TYPES | | MPD_TAG_NUM_OF_ITEM_TYPES | |
|
| }mpd_TagItems; | | } mpd_TagItems; | |
| | | | |
| extern char * mpdTagItemKeys[MPD_TAG_NUM_OF_ITEM_TYPES]; | | extern char * mpdTagItemKeys[MPD_TAG_NUM_OF_ITEM_TYPES]; | |
| | | | |
| /* internal stuff don't touch this struct */ | | /* internal stuff don't touch this struct */ | |
| typedef struct _mpd_ReturnElement { | | typedef struct _mpd_ReturnElement { | |
| char * name; | | char * name; | |
| char * value; | | char * value; | |
| } mpd_ReturnElement; | | } mpd_ReturnElement; | |
| | | | |
| /* mpd_Connection | | /* mpd_Connection | |
| * holds info about connection to mpd | | * holds info about connection to mpd | |
| * use error, and errorStr to detect errors | | * use error, and errorStr to detect errors | |
| */ | | */ | |
| typedef struct _mpd_Connection { | | typedef struct _mpd_Connection { | |
| /* use this to check the version of mpd */ | | /* use this to check the version of mpd */ | |
| int version[3]; | | int version[3]; | |
| /* IMPORTANT, you want to get the error messages from here */ | | /* IMPORTANT, you want to get the error messages from here */ | |
|
| char errorStr[MPD_BUFFER_MAX_LENGTH+1]; | | char errorStr[MPD_ERRORSTR_MAX_LENGTH+1]; | |
| int errorCode; | | int errorCode; | |
| int errorAt; | | int errorAt; | |
| /* this will be set to MPD_ERROR_* if there is an error, 0 if not */ | | /* this will be set to MPD_ERROR_* if there is an error, 0 if not */ | |
| int error; | | int error; | |
| /* DON'T TOUCH any of the rest of this stuff */ | | /* DON'T TOUCH any of the rest of this stuff */ | |
| int sock; | | int sock; | |
| char buffer[MPD_BUFFER_MAX_LENGTH+1]; | | char buffer[MPD_BUFFER_MAX_LENGTH+1]; | |
| int buflen; | | int buflen; | |
| int bufstart; | | int bufstart; | |
| int doneProcessing; | | int doneProcessing; | |
| | | | |
| skipping to change at line 265 | | skipping to change at line 263 | |
| char * album; | | char * album; | |
| /* track, maybe NULL if there is no tag */ | | /* track, maybe NULL if there is no tag */ | |
| char * track; | | char * track; | |
| /* name, maybe NULL if there is no tag; it's the name of the current | | /* name, maybe NULL if there is no tag; it's the name of the current | |
| * song, f.e. the icyName of the stream */ | | * song, f.e. the icyName of the stream */ | |
| char * name; | | char * name; | |
| /* date */ | | /* date */ | |
| char *date; | | char *date; | |
| | | | |
| /* added by qball */ | | /* added by qball */ | |
|
| | | /* Genre */ | |
| char *genre; | | char *genre; | |
|
| | | /* Composer */ | |
| char *composer; | | char *composer; | |
|
| | | /* Performer */ | |
| | | char *performer; | |
| | | /* Disc */ | |
| | | char *disc; | |
| | | /* Comment */ | |
| | | char *comment; | |
| | | | |
| /* length of song in seconds, check that it is not MPD_SONG_NO_TIME
*/ | | /* length of song in seconds, check that it is not MPD_SONG_NO_TIME
*/ | |
| int time; | | int time; | |
| /* if plchanges/playlistinfo/playlistid used, is the position of the | | /* if plchanges/playlistinfo/playlistid used, is the position of the | |
| * song in the playlist */ | | * song in the playlist */ | |
| int pos; | | int pos; | |
| /* song id for a song in the playlist */ | | /* song id for a song in the playlist */ | |
| int id; | | int id; | |
| } mpd_Song; | | } mpd_Song; | |
| | | | |
| /* mpd_newSong | | /* mpd_newSong | |
| * use to allocate memory for a new mpd_Song | | * use to allocate memory for a new mpd_Song | |
| * file, artist, etc all initialized to NULL | | * file, artist, etc all initialized to NULL | |
| * if your going to assign values to file, artist, etc | | * if your going to assign values to file, artist, etc | |
| * be sure to malloc or strdup the memory | | * be sure to malloc or strdup the memory | |
| * use mpd_freeSong to free the memory for the mpd_Song, it will also | | * use mpd_freeSong to free the memory for the mpd_Song, it will also | |
| * free memory for file, artist, etc, so don't do it yourself | | * free memory for file, artist, etc, so don't do it yourself | |
| */ | | */ | |
|
| mpd_Song * mpd_newSong(); | | mpd_Song * mpd_newSong(void); | |
| | | | |
| /* mpd_freeSong | | /* mpd_freeSong | |
| * use to free memory allocated by mpd_newSong | | * use to free memory allocated by mpd_newSong | |
| * also it will free memory pointed to by file, artist, etc, so be careful | | * also it will free memory pointed to by file, artist, etc, so be careful | |
| */ | | */ | |
| void mpd_freeSong(mpd_Song * song); | | void mpd_freeSong(mpd_Song * song); | |
| | | | |
| /* mpd_songDup | | /* mpd_songDup | |
| * works like strDup, but for a mpd_Song | | * works like strDup, but for a mpd_Song | |
| */ | | */ | |
| | | | |
| skipping to change at line 311 | | skipping to change at line 317 | |
| * used to store info fro directory (right now that just the path) | | * used to store info fro directory (right now that just the path) | |
| */ | | */ | |
| typedef struct _mpd_Directory { | | typedef struct _mpd_Directory { | |
| char * path; | | char * path; | |
| } mpd_Directory; | | } mpd_Directory; | |
| | | | |
| /* mpd_newDirectory | | /* mpd_newDirectory | |
| * allocates memory for a new directory | | * allocates memory for a new directory | |
| * use mpd_freeDirectory to free this memory | | * use mpd_freeDirectory to free this memory | |
| */ | | */ | |
|
| mpd_Directory * mpd_newDirectory (); | | mpd_Directory * mpd_newDirectory(void); | |
| | | | |
| /* mpd_freeDirectory | | /* mpd_freeDirectory | |
| * used to free memory allocated with mpd_newDirectory, and it frees | | * used to free memory allocated with mpd_newDirectory, and it frees | |
| * path of mpd_Directory, so be careful | | * path of mpd_Directory, so be careful | |
| */ | | */ | |
| void mpd_freeDirectory(mpd_Directory * directory); | | void mpd_freeDirectory(mpd_Directory * directory); | |
| | | | |
| /* mpd_directoryDup | | /* mpd_directoryDup | |
| * works like strdup, but for mpd_Directory | | * works like strdup, but for mpd_Directory | |
| */ | | */ | |
| | | | |
| skipping to change at line 337 | | skipping to change at line 343 | |
| * stores info about playlist file returned by lsinfo | | * stores info about playlist file returned by lsinfo | |
| */ | | */ | |
| typedef struct _mpd_PlaylistFile { | | typedef struct _mpd_PlaylistFile { | |
| char * path; | | char * path; | |
| } mpd_PlaylistFile; | | } mpd_PlaylistFile; | |
| | | | |
| /* mpd_newPlaylistFile | | /* mpd_newPlaylistFile | |
| * allocates memory for new mpd_PlaylistFile, path is set to NULL | | * allocates memory for new mpd_PlaylistFile, path is set to NULL | |
| * free this memory with mpd_freePlaylistFile | | * free this memory with mpd_freePlaylistFile | |
| */ | | */ | |
|
| mpd_PlaylistFile * mpd_newPlaylistFile(); | | mpd_PlaylistFile * mpd_newPlaylistFile(void); | |
| | | | |
| /* mpd_freePlaylist | | /* mpd_freePlaylist | |
| * free memory allocated for freePlaylistFile, will also free | | * free memory allocated for freePlaylistFile, will also free | |
| * path, so be careful | | * path, so be careful | |
| */ | | */ | |
| void mpd_freePlaylistFile(mpd_PlaylistFile * playlist); | | void mpd_freePlaylistFile(mpd_PlaylistFile * playlist); | |
| | | | |
| /* mpd_playlistFileDup | | /* mpd_playlistFileDup | |
| * works like strdup, but for mpd_PlaylistFile | | * works like strdup, but for mpd_PlaylistFile | |
| */ | | */ | |
| | | | |
| skipping to change at line 375 | | skipping to change at line 381 | |
| */ | | */ | |
| int type; | | int type; | |
| /* the actual data you want, mpd_Song, mpd_Directory, etc */ | | /* the actual data you want, mpd_Song, mpd_Directory, etc */ | |
| union { | | union { | |
| mpd_Directory * directory; | | mpd_Directory * directory; | |
| mpd_Song * song; | | mpd_Song * song; | |
| mpd_PlaylistFile * playlistFile; | | mpd_PlaylistFile * playlistFile; | |
| } info; | | } info; | |
| } mpd_InfoEntity; | | } mpd_InfoEntity; | |
| | | | |
|
| mpd_InfoEntity * mpd_newInfoEntity(); | | mpd_InfoEntity * mpd_newInfoEntity(void); | |
| | | | |
| void mpd_freeInfoEntity(mpd_InfoEntity * entity); | | void mpd_freeInfoEntity(mpd_InfoEntity * entity); | |
| | | | |
| /* INFO COMMANDS AND STUFF */ | | /* INFO COMMANDS AND STUFF */ | |
| | | | |
| /* use this function to loop over after calling Info/Listall functions */ | | /* use this function to loop over after calling Info/Listall functions */ | |
| mpd_InfoEntity * mpd_getNextInfoEntity(mpd_Connection * connection); | | mpd_InfoEntity * mpd_getNextInfoEntity(mpd_Connection * connection); | |
| | | | |
| /* fetches the currently seeletect song (the song referenced by status->son
g | | /* fetches the currently seeletect song (the song referenced by status->son
g | |
| * and status->songid*/ | | * and status->songid*/ | |
| | | | |
| skipping to change at line 397 | | skipping to change at line 403 | |
| | | | |
| /* songNum of -1, means to display the whole list */ | | /* songNum of -1, means to display the whole list */ | |
| void mpd_sendPlaylistInfoCommand(mpd_Connection * connection, int songNum); | | void mpd_sendPlaylistInfoCommand(mpd_Connection * connection, int songNum); | |
| | | | |
| /* songId of -1, means to display the whole list */ | | /* songId of -1, means to display the whole list */ | |
| void mpd_sendPlaylistIdCommand(mpd_Connection * connection, int songId); | | void mpd_sendPlaylistIdCommand(mpd_Connection * connection, int songId); | |
| | | | |
| /* use this to get the changes in the playlist since version _playlist_ */ | | /* use this to get the changes in the playlist since version _playlist_ */ | |
| void mpd_sendPlChangesCommand(mpd_Connection * connection, long long playli
st); | | void mpd_sendPlChangesCommand(mpd_Connection * connection, long long playli
st); | |
| | | | |
|
| | | /** | |
| | | * @param connection: A valid and connected mpd_Connection. | |
| | | * @param playlist: The playlist version you want the diff with. | |
| | | * A more bandwidth efficient version of the mpd_sendPlChangesCommand. | |
| | | * It only returns the pos+id of the changes song. | |
| | | */ | |
| | | void mpd_sendPlChangesPosIdCommand(mpd_Connection * connection, long long p | |
| | | laylist); | |
| | | | |
| /* recursivel fetches all songs/dir/playlists in "dir* (no metadata is | | /* recursivel fetches all songs/dir/playlists in "dir* (no metadata is | |
| * returned) */ | | * returned) */ | |
| void mpd_sendListallCommand(mpd_Connection * connection, const char * dir); | | void mpd_sendListallCommand(mpd_Connection * connection, const char * dir); | |
| | | | |
| /* same as sendListallCommand, but also metadata is returned */ | | /* same as sendListallCommand, but also metadata is returned */ | |
| void mpd_sendListallInfoCommand(mpd_Connection * connection, const char * d
ir); | | void mpd_sendListallInfoCommand(mpd_Connection * connection, const char * d
ir); | |
| | | | |
| /* non-recursive version of ListallInfo */ | | /* non-recursive version of ListallInfo */ | |
| void mpd_sendLsInfoCommand(mpd_Connection * connection, const char * dir); | | void mpd_sendLsInfoCommand(mpd_Connection * connection, const char * dir); | |
| | | | |
| | | | |
| skipping to change at line 423 | | skipping to change at line 437 | |
| const char * str); | | const char * str); | |
| | | | |
| void mpd_sendFindCommand(mpd_Connection * connection, int table, | | void mpd_sendFindCommand(mpd_Connection * connection, int table, | |
| const char * str); | | const char * str); | |
| | | | |
| /* LIST TAG COMMANDS */ | | /* LIST TAG COMMANDS */ | |
| | | | |
| /* use this function fetch next artist entry, be sure to free the returned | | /* use this function fetch next artist entry, be sure to free the returned | |
| * string. NULL means there are no more. Best used with sendListArtists | | * string. NULL means there are no more. Best used with sendListArtists | |
| */ | | */ | |
|
| | | | |
| char * mpd_getNextArtist(mpd_Connection * connection); | | char * mpd_getNextArtist(mpd_Connection * connection); | |
| | | | |
| char * mpd_getNextAlbum(mpd_Connection * connection); | | char * mpd_getNextAlbum(mpd_Connection * connection); | |
| | | | |
|
| char * mpd_getNextTag(mpd_Connection *connection, int table); | | char * mpd_getNextTag(mpd_Connection *connection, int type); | |
| | | | |
| /* list artist or albums by artist, arg1 should be set to the artist if | | /* list artist or albums by artist, arg1 should be set to the artist if | |
| * listing albums by a artist, otherwise NULL for listing all artists or al
bums | | * listing albums by a artist, otherwise NULL for listing all artists or al
bums | |
| */ | | */ | |
| void mpd_sendListCommand(mpd_Connection * connection, int table, | | void mpd_sendListCommand(mpd_Connection * connection, int table, | |
| const char * arg1); | | const char * arg1); | |
| | | | |
|
| void mpd_sendListTagCommand(mpd_Connection * connection, int table,...); | | | |
| void mpd_sendVListTagCommand(mpd_Connection * connection,int ret_table, va_ | | | |
| list arglist); | | | |
| | | | |
| /* SIMPLE COMMANDS */ | | /* SIMPLE COMMANDS */ | |
| | | | |
| void mpd_sendAddCommand(mpd_Connection * connection, const char * file); | | void mpd_sendAddCommand(mpd_Connection * connection, const char * file); | |
| | | | |
|
| | | int mpd_sendAddIdCommand(mpd_Connection *connection, const char *file); | |
| | | | |
| void mpd_sendDeleteCommand(mpd_Connection * connection, int songNum); | | void mpd_sendDeleteCommand(mpd_Connection * connection, int songNum); | |
| | | | |
| void mpd_sendDeleteIdCommand(mpd_Connection * connection, int songNum); | | void mpd_sendDeleteIdCommand(mpd_Connection * connection, int songNum); | |
| | | | |
| void mpd_sendSaveCommand(mpd_Connection * connection, const char * name); | | void mpd_sendSaveCommand(mpd_Connection * connection, const char * name); | |
| | | | |
| void mpd_sendLoadCommand(mpd_Connection * connection, const char * name); | | void mpd_sendLoadCommand(mpd_Connection * connection, const char * name); | |
| | | | |
| void mpd_sendRmCommand(mpd_Connection * connection, const char * name); | | void mpd_sendRmCommand(mpd_Connection * connection, const char * name); | |
| | | | |
| | | | |
| skipping to change at line 558 | | skipping to change at line 571 | |
| /** | | /** | |
| * @param connection a #mpd_Connection | | * @param connection a #mpd_Connection | |
| * | | * | |
| * returns the next supported command. | | * returns the next supported command. | |
| * | | * | |
| * @returns a string, needs to be free'ed | | * @returns a string, needs to be free'ed | |
| */ | | */ | |
| char *mpd_getNextCommand(mpd_Connection *connection); | | char *mpd_getNextCommand(mpd_Connection *connection); | |
| | | | |
| /** | | /** | |
|
| | | * @param connection a MpdConnection | |
| | | * @param path the path to the playlist. | |
| | | * | |
| | | * List the content, with full metadata, of a stored playlist. | |
| | | * | |
| | | */ | |
| | | void mpd_sendListPlaylistInfoCommand(mpd_Connection *connection, char *path | |
| | | ); | |
| | | | |
| | | /** | |
| | | * @param connection a MpdConnection | |
| | | * @param path the path to the playlist. | |
| | | * | |
| | | * List the content of a stored playlist. | |
| | | * | |
| | | */ | |
| | | void mpd_sendListPlaylistCommand(mpd_Connection *connection, char *path); | |
| | | | |
| | | /** | |
| * @param connection a #mpd_Connection | | * @param connection a #mpd_Connection | |
| * @param exact if to match exact | | * @param exact if to match exact | |
| * | | * | |
| * starts a search, use mpd_addConstraintSearch to add | | * starts a search, use mpd_addConstraintSearch to add | |
| * a constraint to the search, and mpd_commitSearch to do the actual search | | * a constraint to the search, and mpd_commitSearch to do the actual search | |
| */ | | */ | |
|
| void mpd_startSearch(mpd_Connection * connection,int exact); | | void mpd_startSearch(mpd_Connection *connection, int exact); | |
| | | | |
| /** | | /** | |
| * @param connection a #mpd_Connection | | * @param connection a #mpd_Connection | |
|
| * @param field | | * @param type | |
| * @param name | | * @param name | |
|
| * | | | |
| */ | | */ | |
|
| void mpd_addConstraintSearch(mpd_Connection *connection, int field, char *n | | void mpd_addConstraintSearch(mpd_Connection *connection, int type, char *na | |
| ame); | | me); | |
| | | | |
| /** | | /** | |
| * @param connection a #mpd_Connection | | * @param connection a #mpd_Connection | |
|
| * | | | |
| */ | | */ | |
| void mpd_commitSearch(mpd_Connection *connection); | | void mpd_commitSearch(mpd_Connection *connection); | |
| | | | |
| /** | | /** | |
| * @param connection a #mpd_Connection | | * @param connection a #mpd_Connection | |
|
| * @param field The field to search | | * @param type The type to search for | |
| * | | * | |
| * starts a search for fields... f.e. get a list of artists would be: | | * starts a search for fields... f.e. get a list of artists would be: | |
|
| | | * @code | |
| * mpd_startFieldSearch(connection, MPD_TAG_ITEM_ARTIST); | | * mpd_startFieldSearch(connection, MPD_TAG_ITEM_ARTIST); | |
| * mpd_commitSearch(connection); | | * mpd_commitSearch(connection); | |
|
| | | * @endcode | |
| * | | * | |
| * or get a list of artist in genre "jazz" would be: | | * or get a list of artist in genre "jazz" would be: | |
| * @code | | * @code | |
| * mpd_startFieldSearch(connection, MPD_TAG_ITEM_ARTIST); | | * mpd_startFieldSearch(connection, MPD_TAG_ITEM_ARTIST); | |
| * mpd_addConstraintSearch(connection, MPD_TAG_ITEM_GENRE, "jazz") | | * mpd_addConstraintSearch(connection, MPD_TAG_ITEM_GENRE, "jazz") | |
| * mpd_commitSearch(connection); | | * mpd_commitSearch(connection); | |
| * @endcode | | * @endcode | |
| * | | * | |
| * mpd_startSearch will return a list of songs (and you need mpd_getNextIn
foEntity) | | * mpd_startSearch will return a list of songs (and you need mpd_getNextIn
foEntity) | |
|
| * this one will return a list of only one field (the field specified with
field) and you need | | * this one will return a list of only one field (the one specified with ty
pe) and you need | |
| * mpd_getNextTag to get the results | | * mpd_getNextTag to get the results | |
| */ | | */ | |
|
| void mpd_startFieldSearch(mpd_Connection * connection,int field); | | void mpd_startFieldSearch(mpd_Connection *connection, int type); | |
| | | #ifdef __cplusplus | |
| #ifdef _cplusplus | | | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
|
| /*@}*/ | | | |
| | | | |
End of changes. 33 change blocks. |
| 30 lines changed or deleted | | 62 lines changed or added | |
|