playlist.h 3.39 KB
Newer Older
Warren Dukes's avatar
Warren Dukes committed
1
/* the Music Player Daemon (MPD)
2
 * Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
Warren Dukes's avatar
Warren Dukes committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
 * 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

22 23
#include "../config.h"

24
#include "dbUtils.h"
Warren Dukes's avatar
Warren Dukes committed
25 26 27 28 29 30

#include <stdio.h>
#include <sys/param.h>
#include <time.h>

#define PLAYLIST_FILE_SUFFIX 	"m3u"
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
#define PLAYLIST_COMMENT	'#'

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;
Warren Dukes's avatar
Warren Dukes committed
49

50
void initPlaylist(void);
Warren Dukes's avatar
Warren Dukes committed
51

52
void finishPlaylist(void);
Warren Dukes's avatar
Warren Dukes committed
53

54
void readPlaylistState(FILE *);
Warren Dukes's avatar
Warren Dukes committed
55

56
void savePlaylistState(FILE *);
Warren Dukes's avatar
Warren Dukes committed
57

58
int clearPlaylist(int fd);
Warren Dukes's avatar
Warren Dukes committed
59

60 61
int clearStoredPlaylist(int fd, char *utf8file);

62
int addToPlaylist(int fd, char *file, int printId);
Warren Dukes's avatar
Warren Dukes committed
63

64 65
int addToStoredPlaylist(int fd, char *file, char *utf8file);

66
int addSongToPlaylist(int fd, Song * song, int printId);
Warren Dukes's avatar
Warren Dukes committed
67

68
int showPlaylist(int fd);
Warren Dukes's avatar
Warren Dukes committed
69

70
int deleteFromPlaylist(int fd, int song);
Warren Dukes's avatar
Warren Dukes committed
71

72
int deleteFromPlaylistById(int fd, int song);
73

74
int playlistInfo(int fd, int song);
Warren Dukes's avatar
Warren Dukes committed
75

76
int playlistId(int fd, int song);
77

78
int stopPlaylist(int fd);
Warren Dukes's avatar
Warren Dukes committed
79

80
int playPlaylist(int fd, int song, int stopOnError);
Warren Dukes's avatar
Warren Dukes committed
81

82
int playPlaylistById(int fd, int song, int stopOnError);
83

84
int nextSongInPlaylist(int fd);
Warren Dukes's avatar
Warren Dukes committed
85

86
void syncPlayerAndPlaylist(void);
Warren Dukes's avatar
Warren Dukes committed
87

88
int previousSongInPlaylist(int fd);
Warren Dukes's avatar
Warren Dukes committed
89

90
int shufflePlaylist(int fd);
Warren Dukes's avatar
Warren Dukes committed
91

92
int savePlaylist(int fd, char *utf8file);
Warren Dukes's avatar
Warren Dukes committed
93

94
int deletePlaylist(int fd, char *utf8file);
Warren Dukes's avatar
Warren Dukes committed
95

96
int deletePlaylistById(int fd, char *utf8file);
97

Warren Dukes's avatar
Warren Dukes committed
98 99
void deleteASongFromPlaylist(Song * song);

100
int moveSongInPlaylist(int fd, int from, int to);
Warren Dukes's avatar
Warren Dukes committed
101

102
int moveSongInPlaylistById(int fd, int id, int to);
103

104
int swapSongsInPlaylist(int fd, int song1, int song2);
Warren Dukes's avatar
Warren Dukes committed
105

106
int swapSongsInPlaylistById(int fd, int id1, int id2);
107

108
int loadPlaylist(int fd, char *utf8file);
Warren Dukes's avatar
Warren Dukes committed
109

110
int getPlaylistRepeatStatus(void);
Warren Dukes's avatar
Warren Dukes committed
111

112
int setPlaylistRepeatStatus(int fd, int status);
Warren Dukes's avatar
Warren Dukes committed
113

114
int getPlaylistRandomStatus(void);
Warren Dukes's avatar
Warren Dukes committed
115

116
int setPlaylistRandomStatus(int fd, int status);
Warren Dukes's avatar
Warren Dukes committed
117

118
int getPlaylistCurrentSong(void);
Warren Dukes's avatar
Warren Dukes committed
119

120 121
int getPlaylistSongId(int song);

122
int getPlaylistLength(void);
Warren Dukes's avatar
Warren Dukes committed
123

124
unsigned long getPlaylistVersion(void);
Warren Dukes's avatar
Warren Dukes committed
125

126
void playPlaylistIfPlayerStopped(void);
Warren Dukes's avatar
Warren Dukes committed
127

128
int seekSongInPlaylist(int fd, int song, float time);
Warren Dukes's avatar
Warren Dukes committed
129

130
int seekSongInPlaylistById(int fd, int id, float time);
131

132
void playlistVersionChange(void);
133

134
int playlistChanges(int fd, mpd_uint32 version);
135

136
int playlistChangesPosId(int fd, mpd_uint32 version);
137

138
int PlaylistInfo(int fd, char *utf8file, int detail);
139

140 141 142 143
void searchForSongsInPlaylist(int fd, int numItems, LocateTagItem * items);

void findSongsInPlaylist(int fd, int numItems, LocateTagItem * items);

Warren Dukes's avatar
Warren Dukes committed
144
#endif