MPD
playlist.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2003-2010 The Music Player Daemon Project
3  * http://www.musicpd.org
4  *
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.
9  *
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  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef MPD_PLAYLIST_H
21 #define MPD_PLAYLIST_H
22 
23 #include "queue.h"
24 
25 #include <stdbool.h>
26 
27 #define PLAYLIST_COMMENT '#'
28 
41 };
42 
43 struct playlist {
47  struct queue queue;
48 
53  bool playing;
54 
61 
67  unsigned error_count;
68 
74  int current;
75 
83  int queued;
84 };
85 
87 extern struct playlist g_playlist;
88 
89 void
91 
92 void
94 
95 void
97 
98 void
100 
101 void
103 
107 static inline const struct queue *
109 {
110  return &playlist->queue;
111 }
112 
113 void
115 
116 #ifndef WIN32
117 
121 enum playlist_result
122 playlist_append_file(struct playlist *playlist, const char *path, int uid,
123  unsigned *added_id);
124 #endif
125 
126 enum playlist_result
127 playlist_append_uri(struct playlist *playlist, const char *file,
128  unsigned *added_id);
129 
130 enum playlist_result
132  struct song *song, unsigned *added_id);
133 
134 enum playlist_result
135 playlist_delete(struct playlist *playlist, unsigned song);
136 
143 enum playlist_result
144 playlist_delete_range(struct playlist *playlist, unsigned start, unsigned end);
145 
146 enum playlist_result
147 playlist_delete_id(struct playlist *playlist, unsigned song);
148 
149 void
151 
152 enum playlist_result
153 playlist_play(struct playlist *playlist, int song);
154 
155 enum playlist_result
156 playlist_play_id(struct playlist *playlist, int song);
157 
158 void
160 
161 void
163 
164 void
166 
167 void
168 playlist_shuffle(struct playlist *playlist, unsigned start, unsigned end);
169 
170 void
171 playlist_delete_song(struct playlist *playlist, const struct song *song);
172 
173 enum playlist_result
174 playlist_move_range(struct playlist *playlist, unsigned start, unsigned end, int to);
175 
176 enum playlist_result
177 playlist_move_id(struct playlist *playlist, unsigned id, int to);
178 
179 enum playlist_result
180 playlist_swap_songs(struct playlist *playlist, unsigned song1, unsigned song2);
181 
182 enum playlist_result
183 playlist_swap_songs_id(struct playlist *playlist, unsigned id1, unsigned id2);
184 
185 bool
186 playlist_get_repeat(const struct playlist *playlist);
187 
188 void
189 playlist_set_repeat(struct playlist *playlist, bool status);
190 
191 bool
192 playlist_get_random(const struct playlist *playlist);
193 
194 void
195 playlist_set_random(struct playlist *playlist, bool status);
196 
197 bool
198 playlist_get_single(const struct playlist *playlist);
199 
200 void
201 playlist_set_single(struct playlist *playlist, bool status);
202 
203 bool
204 playlist_get_consume(const struct playlist *playlist);
205 
206 void
207 playlist_set_consume(struct playlist *playlist, bool status);
208 
209 int
211 
212 int
214 
215 unsigned
216 playlist_get_song_id(const struct playlist *playlist, unsigned song);
217 
218 int
219 playlist_get_length(const struct playlist *playlist);
220 
221 unsigned long
222 playlist_get_version(const struct playlist *playlist);
223 
224 enum playlist_result
225 playlist_seek_song(struct playlist *playlist, unsigned song, float seek_time);
226 
227 enum playlist_result
229  unsigned id, float seek_time);
230 
231 void
233 
234 #endif