aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-07 13:39:31 +0200
committerEric Wong <normalperson@yhbt.net>2008-09-09 01:03:33 -0700
commit6dcd7fea0e3cfc8f51097f11c0c84793584e8f0b (patch)
treecea563abd8d942ff658459ea0bab0a9af8182e67 /src/playlist.h
parente29a971c9619a6e988dceb5335645f7ae10a527e (diff)
downloadmpd-6dcd7fea0e3cfc8f51097f11c0c84793584e8f0b.tar.gz
mpd-6dcd7fea0e3cfc8f51097f11c0c84793584e8f0b.tar.xz
mpd-6dcd7fea0e3cfc8f51097f11c0c84793584e8f0b.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 '')
-rw-r--r--src/playlist.h48
1 files changed, 29 insertions, 19 deletions
diff --git a/src/playlist.h b/src/playlist.h
index 3afe33da0..11ec63e9e 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
+};
+
extern int playlist_saveAbsolutePaths;
extern int playlist_max_length;
@@ -40,21 +52,21 @@ 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);
Song *playlist_queued_song(void);
@@ -64,9 +76,9 @@ int playlist_playing(void);
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);
@@ -74,23 +86,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);
@@ -110,9 +120,9 @@ int getPlaylistLength(void);
unsigned long getPlaylistVersion(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);