aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-07 13:39:31 +0200
committerMax Kellermann <max@duempel.org>2008-09-07 13:39:31 +0200
commit8d2830b3f9ab52e1b2dd54d82ae3aaf39e61abe8 (patch)
tree84f58989cf38f05cd9d55f4bc55bd1ce916d4958 /src/playlist.h
parent20feb0cbbab3c1516f0309a87c3d27f9801c7938 (diff)
downloadmpd-8d2830b3f9ab52e1b2dd54d82ae3aaf39e61abe8.tar.gz
mpd-8d2830b3f9ab52e1b2dd54d82ae3aaf39e61abe8.tar.xz
mpd-8d2830b3f9ab52e1b2dd54d82ae3aaf39e61abe8.zip
playlist: don't pass "fd" to playlist.c functions
The playlist library shouldn't talk to the client if possible. Introduce the "enum playlist_result" type which the caller (i.e. command.c) may use to generate an error message.
Diffstat (limited to 'src/playlist.h')
-rw-r--r--src/playlist.h48
1 files changed, 29 insertions, 19 deletions
diff --git a/src/playlist.h b/src/playlist.h
index ff05dca24..44800cb72 100644
--- a/src/playlist.h
+++ b/src/playlist.h
@@ -24,6 +24,18 @@
#define PLAYLIST_FILE_SUFFIX "m3u"
#define PLAYLIST_COMMENT '#'
+enum playlist_result {
+ PLAYLIST_RESULT_SUCCESS,
+ PLAYLIST_RESULT_ERRNO,
+ PLAYLIST_RESULT_NO_SUCH_SONG,
+ PLAYLIST_RESULT_NO_SUCH_LIST,
+ PLAYLIST_RESULT_LIST_EXISTS,
+ PLAYLIST_RESULT_BAD_NAME,
+ PLAYLIST_RESULT_BAD_RANGE,
+ PLAYLIST_RESULT_NOT_PLAYING,
+ PLAYLIST_RESULT_TOO_LARGE
+};
+
typedef struct _Playlist {
Song **songs;
/* holds version a song was modified on */
@@ -55,27 +67,27 @@ void clearPlaylist(void);
int clearStoredPlaylist(int fd, const char *utf8file);
-int addToPlaylist(int fd, const char *file, int *added_id);
+enum playlist_result addToPlaylist(const char *file, int *added_id);
int addToStoredPlaylist(int fd, const char *file, const char *utf8file);
-int addSongToPlaylist(int fd, Song * song, int *added_id);
+enum playlist_result addSongToPlaylist(Song * song, int *added_id);
void showPlaylist(int fd);
-int deleteFromPlaylist(int fd, int song);
+enum playlist_result deleteFromPlaylist(int song);
-int deleteFromPlaylistById(int fd, int song);
+enum playlist_result deleteFromPlaylistById(int song);
-int playlistInfo(int fd, int song);
+enum playlist_result playlistInfo(int fd, int song);
-int playlistId(int fd, int song);
+enum playlist_result playlistId(int fd, int song);
void stopPlaylist(void);
-int playPlaylist(int fd, int song, int stopOnError);
+enum playlist_result playPlaylist(int song, int stopOnError);
-int playPlaylistById(int fd, int song, int stopOnError);
+enum playlist_result playPlaylistById(int song, int stopOnError);
void nextSongInPlaylist(void);
@@ -83,23 +95,21 @@ void syncPlayerAndPlaylist(void);
void previousSongInPlaylist(void);
-void shufflePlaylist(int fd);
-
-int savePlaylist(int fd, const char *utf8file);
+void shufflePlaylist(void);
-int deletePlaylist(int fd, const char *utf8file);
+enum playlist_result savePlaylist(const char *utf8file);
-int deletePlaylistById(int fd, const char *utf8file);
+enum playlist_result deletePlaylist(const char *utf8file);
void deleteASongFromPlaylist(Song * song);
-int moveSongInPlaylist(int fd, int from, int to);
+enum playlist_result moveSongInPlaylist(int from, int to);
-int moveSongInPlaylistById(int fd, int id, int to);
+enum playlist_result moveSongInPlaylistById(int id, int to);
-int swapSongsInPlaylist(int fd, int song1, int song2);
+enum playlist_result swapSongsInPlaylist(int song1, int song2);
-int swapSongsInPlaylistById(int fd, int id1, int id2);
+enum playlist_result swapSongsInPlaylistById(int id1, int id2);
int loadPlaylist(int fd, const char *utf8file);
@@ -121,9 +131,9 @@ unsigned long getPlaylistVersion(void);
void playPlaylistIfPlayerStopped(void);
-int seekSongInPlaylist(int fd, int song, float seek_time);
+enum playlist_result seekSongInPlaylist(int song, float seek_time);
-int seekSongInPlaylistById(int fd, int id, float seek_time);
+enum playlist_result seekSongInPlaylistById(int id, float seek_time);
void playlistVersionChange(void);