1 /* the Music Player Daemon (MPD)
2 * Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
3 * This project's homepage is: http://www.musicpd.org
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "../config.h"
27 #include <sys/param.h>
30 #define PLAYLIST_FILE_SUFFIX "m3u"
31 #define PLAYLIST_COMMENT '#'
33 typedef struct _Playlist
{
35 /* holds version a song was modified on */
46 mpd_uint32 queueversion
;
49 extern int playlist_saveAbsolutePaths
;
51 void initPlaylist(void);
53 void finishPlaylist(void);
55 void readPlaylistState(FILE *);
57 void savePlaylistState(FILE *);
59 int clearPlaylist(int fd
);
61 int clearStoredPlaylist(int fd
, char *utf8file
);
63 int addToPlaylist(int fd
, char *file
, int printId
);
65 int addToStoredPlaylist(int fd
, char *file
, char *utf8file
);
67 int addSongToPlaylist(int fd
, Song
* song
, int printId
);
69 int showPlaylist(int fd
);
71 int deleteFromPlaylist(int fd
, int song
);
73 int deleteFromPlaylistById(int fd
, int song
);
75 int playlistInfo(int fd
, int song
);
77 int playlistId(int fd
, int song
);
79 int stopPlaylist(int fd
);
81 int playPlaylist(int fd
, int song
, int stopOnError
);
83 int playNextPlaylistQueue(int fd
, int stopOnError
);
85 int playPlaylistById(int fd
, int song
, int stopOnError
);
87 int nextSongInPlaylist(int fd
);
89 void syncPlayerAndPlaylist(void);
91 int previousSongInPlaylist(int fd
);
93 int shufflePlaylist(int fd
);
95 int savePlaylist(int fd
, char *utf8file
);
97 int deletePlaylist(int fd
, char *utf8file
);
99 int deletePlaylistById(int fd
, char *utf8file
);
101 void deleteASongFromPlaylist(Song
* song
);
103 int moveSongInPlaylist(int fd
, int from
, int to
);
105 int moveSongInPlaylistById(int fd
, int id
, int to
);
107 int swapSongsInPlaylist(int fd
, int song1
, int song2
);
109 int swapSongsInPlaylistById(int fd
, int id1
, int id2
);
111 int loadPlaylist(int fd
, char *utf8file
);
113 int getPlaylistRepeatStatus(void);
115 int setPlaylistRepeatStatus(int fd
, int status
);
117 int getPlaylistRandomStatus(void);
119 int setPlaylistRandomStatus(int fd
, int status
);
121 int getPlaylistCurrentSong(void);
123 int getPlaylistSongId(int song
);
125 int getPlaylistLength(void);
127 unsigned long getPlaylistVersion(void);
129 unsigned long getPlaylistQueueVersion(void);
131 void playPlaylistIfPlayerStopped(void);
133 int seekSongInPlaylist(int fd
, int song
, float time
);
135 int seekSongInPlaylistById(int fd
, int id
, float time
);
137 void playlistVersionChange(void);
139 int playlistChanges(int fd
, mpd_uint32 version
);
141 int playlistChangesPosId(int fd
, mpd_uint32 version
);
143 int PlaylistInfo(int fd
, char *utf8file
, int detail
);
145 void searchForSongsInPlaylist(int fd
, int numItems
, LocateTagItem
* items
);
147 void findSongsInPlaylist(int fd
, int numItems
, LocateTagItem
* items
);
149 void clearPlaylistQueue(void);
151 int addToPlaylistQueueById(int fd
, int song
, int toPosition
);
153 int deleteFromPlaylistQueue(int fd
, int song
);
155 int deleteFromPlaylistQueueInternal(int song
);
157 int playlistQueueInfo(int fd
);