aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-05-13 18:46:38 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-05-13 18:46:38 +0000
commit965e6edcf18948ea6971040495e2121a326aa11b (patch)
tree07d401bd1726b84d73ccba099b677067a05730d4 /src/playlist.c
parent8c484eeccfaafd2d5eaf7cd77842581004957a8a (diff)
downloadmpd-965e6edcf18948ea6971040495e2121a326aa11b.tar.gz
mpd-965e6edcf18948ea6971040495e2121a326aa11b.tar.xz
mpd-965e6edcf18948ea6971040495e2121a326aa11b.zip
redimentary addition of url's to playlist
git-svn-id: https://svn.musicpd.org/mpd/trunk@1000 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/playlist.c')
-rw-r--r--src/playlist.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 1bc5147bb..a705b3160 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -149,7 +149,12 @@ int clearPlaylist(FILE * fp) {
if(stopPlaylist(fp)<0) return -1;
- for(i=0;i<playlist.length;i++) playlist.songs[i] = NULL;
+ for(i=0;i<playlist.length;i++) {
+ if(playlist.songs[i]->type == SONG_TYPE_URL) {
+ free(playlist.songs[i]);
+ }
+ playlist.songs[i] = NULL;
+ }
playlist.length = 0;
incrPlaylistVersion();
@@ -449,13 +454,18 @@ void clearPlayerQueue() {
}
}
-int addToPlaylist(FILE * fp, char * file) {
+int addToPlaylist(FILE * fp, char * url) {
Song * song;
- DEBUG("add to playlist: %s\n",file);
+ DEBUG("add to playlist: %s\n",url);
- if(!(song = getSong(file))) {
- myfprintf(fp,"%s \"%s\" is not in the music db\n",COMMAND_RESPOND_ERROR,file);
+ if((song = getSongFromDB(url))) {
+ }
+ else if(isRemoteUrl(url) && (song = newSong(url,SONG_TYPE_URL))) {
+ }
+ else {
+ myfprintf(fp,"%s \"%s\" is not in the music db\n",
+ COMMAND_RESPOND_ERROR,url);
return -1;
}
@@ -588,6 +598,9 @@ int deleteFromPlaylist(FILE * fp, int song) {
if(playlist.order[i]>song) playlist.order[i]--;
}
/* now take care of other misc stuff */
+ if(playlist.songs[playlist.length-1]->type == SONG_TYPE_URL) {
+ freeJustSong(playlist.songs[playlist.length-1]);
+ }
playlist.songs[playlist.length-1] = NULL;
playlist.length--;
@@ -1127,7 +1140,9 @@ int loadPlaylist(FILE * fp, char * utf8file) {
temp = fsCharsetToUtf8(s);
if(!temp) continue;
temp = strdup(temp);
- if(s[0]==PLAYLIST_COMMENT && !getSong(temp)) {
+ if(s[0]==PLAYLIST_COMMENT && !getSongFromDB(temp)
+ && !isRemoteUrl(temp))
+ {
free(temp);
continue;
}