2004-02-24 00:41:20 +01:00
|
|
|
/* the Music Player Daemon (MPD)
|
2007-04-05 05:22:33 +02:00
|
|
|
* Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
|
2004-02-24 00:41:20 +01:00
|
|
|
* This project's homepage is: http://www.musicpd.org
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PLAYLIST_H
|
|
|
|
#define PLAYLIST_H
|
|
|
|
|
2008-08-28 20:01:08 +02:00
|
|
|
#include "locate.h"
|
2004-02-24 00:41:20 +01:00
|
|
|
|
|
|
|
#define PLAYLIST_FILE_SUFFIX "m3u"
|
2007-05-16 14:02:10 +02:00
|
|
|
#define PLAYLIST_COMMENT '#'
|
|
|
|
|
2008-09-07 13:39:31 +02:00
|
|
|
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
|
|
|
|
};
|
|
|
|
|
2007-05-16 14:02:10 +02:00
|
|
|
typedef struct _Playlist {
|
|
|
|
Song **songs;
|
|
|
|
/* holds version a song was modified on */
|
|
|
|
mpd_uint32 *songMod;
|
|
|
|
int *order;
|
|
|
|
int *positionToId;
|
|
|
|
int *idToPosition;
|
|
|
|
int length;
|
|
|
|
int current;
|
|
|
|
int queued;
|
|
|
|
int repeat;
|
|
|
|
int random;
|
|
|
|
mpd_uint32 version;
|
|
|
|
} Playlist;
|
|
|
|
|
|
|
|
extern int playlist_saveAbsolutePaths;
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-01-26 21:20:59 +01:00
|
|
|
extern int playlist_max_length;
|
|
|
|
|
2006-08-20 02:50:44 +02:00
|
|
|
void initPlaylist(void);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2006-08-20 02:50:44 +02:00
|
|
|
void finishPlaylist(void);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2006-07-31 01:32:47 +02:00
|
|
|
void readPlaylistState(FILE *);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2006-07-31 01:32:47 +02:00
|
|
|
void savePlaylistState(FILE *);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-08-26 08:27:16 +02:00
|
|
|
void clearPlaylist(void);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-09-07 13:44:12 +02:00
|
|
|
int clearStoredPlaylist(const char *utf8file);
|
2006-11-20 16:37:58 +01:00
|
|
|
|
2008-09-07 13:39:31 +02:00
|
|
|
enum playlist_result addToPlaylist(const char *file, int *added_id);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-09-07 13:44:12 +02:00
|
|
|
int addToStoredPlaylist(const char *file, const char *utf8file);
|
2006-11-20 16:37:58 +01:00
|
|
|
|
2008-09-07 13:39:31 +02:00
|
|
|
enum playlist_result addSongToPlaylist(Song * song, int *added_id);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-09-07 13:39:19 +02:00
|
|
|
void showPlaylist(int fd);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-09-07 13:39:31 +02:00
|
|
|
enum playlist_result deleteFromPlaylist(int song);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-09-07 13:39:31 +02:00
|
|
|
enum playlist_result deleteFromPlaylistById(int song);
|
2004-06-09 04:50:44 +02:00
|
|
|
|
2008-09-07 13:39:31 +02:00
|
|
|
enum playlist_result playlistInfo(int fd, int song);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-09-07 13:39:31 +02:00
|
|
|
enum playlist_result playlistId(int fd, int song);
|
2004-06-09 04:50:44 +02:00
|
|
|
|
2008-08-26 08:27:16 +02:00
|
|
|
void stopPlaylist(void);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-09-07 13:39:31 +02:00
|
|
|
enum playlist_result playPlaylist(int song, int stopOnError);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-09-07 13:39:31 +02:00
|
|
|
enum playlist_result playPlaylistById(int song, int stopOnError);
|
2004-06-09 04:50:44 +02:00
|
|
|
|
2008-08-26 08:27:16 +02:00
|
|
|
void nextSongInPlaylist(void);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2006-08-20 02:50:44 +02:00
|
|
|
void syncPlayerAndPlaylist(void);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-08-26 08:27:16 +02:00
|
|
|
void previousSongInPlaylist(void);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-09-07 13:39:31 +02:00
|
|
|
void shufflePlaylist(void);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-09-07 13:39:31 +02:00
|
|
|
enum playlist_result savePlaylist(const char *utf8file);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-09-07 13:39:31 +02:00
|
|
|
enum playlist_result deletePlaylist(const char *utf8file);
|
2004-06-09 04:50:44 +02:00
|
|
|
|
2004-02-24 00:41:20 +01:00
|
|
|
void deleteASongFromPlaylist(Song * song);
|
|
|
|
|
2008-09-07 13:39:31 +02:00
|
|
|
enum playlist_result moveSongInPlaylist(int from, int to);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-09-07 13:39:31 +02:00
|
|
|
enum playlist_result moveSongInPlaylistById(int id, int to);
|
2004-06-09 04:50:44 +02:00
|
|
|
|
2008-09-07 13:39:31 +02:00
|
|
|
enum playlist_result swapSongsInPlaylist(int song1, int song2);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-09-07 13:39:31 +02:00
|
|
|
enum playlist_result swapSongsInPlaylistById(int id1, int id2);
|
2004-06-09 04:50:44 +02:00
|
|
|
|
2008-09-07 13:44:12 +02:00
|
|
|
enum playlist_result loadPlaylist(int fd, const char *utf8file);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2006-08-20 02:50:44 +02:00
|
|
|
int getPlaylistRepeatStatus(void);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-09-07 13:38:59 +02:00
|
|
|
void setPlaylistRepeatStatus(int status);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2006-08-20 02:50:44 +02:00
|
|
|
int getPlaylistRandomStatus(void);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-09-07 13:38:59 +02:00
|
|
|
void setPlaylistRandomStatus(int status);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2006-08-20 02:50:44 +02:00
|
|
|
int getPlaylistCurrentSong(void);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2004-06-09 04:50:44 +02:00
|
|
|
int getPlaylistSongId(int song);
|
|
|
|
|
2006-08-20 02:50:44 +02:00
|
|
|
int getPlaylistLength(void);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2006-08-20 02:50:44 +02:00
|
|
|
unsigned long getPlaylistVersion(void);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2006-08-20 02:50:44 +02:00
|
|
|
void playPlaylistIfPlayerStopped(void);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-09-07 13:39:31 +02:00
|
|
|
enum playlist_result seekSongInPlaylist(int song, float seek_time);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-09-07 13:39:31 +02:00
|
|
|
enum playlist_result seekSongInPlaylistById(int id, float seek_time);
|
2004-06-09 04:50:44 +02:00
|
|
|
|
2006-08-20 02:50:44 +02:00
|
|
|
void playlistVersionChange(void);
|
2004-06-05 03:14:37 +02:00
|
|
|
|
2006-07-30 05:43:38 +02:00
|
|
|
int playlistChanges(int fd, mpd_uint32 version);
|
2004-03-10 11:00:47 +01:00
|
|
|
|
2006-07-30 05:43:38 +02:00
|
|
|
int playlistChangesPosId(int fd, mpd_uint32 version);
|
2006-04-23 13:10:41 +02:00
|
|
|
|
2008-09-06 15:28:31 +02:00
|
|
|
int PlaylistInfo(int fd, const char *utf8file, int detail);
|
2006-03-26 15:46:05 +02:00
|
|
|
|
2007-02-24 03:00:03 +01:00
|
|
|
void searchForSongsInPlaylist(int fd, int numItems, LocateTagItem * items);
|
|
|
|
|
|
|
|
void findSongsInPlaylist(int fd, int numItems, LocateTagItem * items);
|
|
|
|
|
2008-09-07 13:37:04 +02:00
|
|
|
int is_valid_playlist_name(const char *utf8path);
|
|
|
|
|
2004-02-24 00:41:20 +01:00
|
|
|
#endif
|