aboutsummaryrefslogtreecommitdiffstats
path: root/src/directory.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-03-10 09:55:54 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-03-10 09:55:54 +0000
commit68dc3517a63ae26bdd34d2ebcb9c48d5fe099714 (patch)
tree029287856e36e3920d9021a7d1ce17699bcb5cc0 /src/directory.c
parente5e45242e03811a42d8bb98cc5ff5024a21a261a (diff)
downloadmpd-68dc3517a63ae26bdd34d2ebcb9c48d5fe099714.tar.gz
mpd-68dc3517a63ae26bdd34d2ebcb9c48d5fe099714.tar.xz
mpd-68dc3517a63ae26bdd34d2ebcb9c48d5fe099714.zip
move adding and removeing from tables from directory.c to song.c
git-svn-id: https://svn.musicpd.org/mpd/trunk@239 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/directory.c')
-rw-r--r--src/directory.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/directory.c b/src/directory.c
index a5ef89451..016ce376d 100644
--- a/src/directory.c
+++ b/src/directory.c
@@ -20,13 +20,12 @@
#include "ls.h"
#include "command.h"
-#include "tables.h"
#include "utils.h"
#include "path.h"
#include "log.h"
-#include "playlist.h"
#include "conf.h"
#include "stats.h"
+#include "playlist.h"
#include <string.h>
#include <sys/types.h>
@@ -98,8 +97,6 @@ Directory * newDirectory(Directory * parentDirectory, char * dirname, time_t mti
void freeDirectory(Directory * directory) {
freeDirectoryList(directory->subDirectories);
- removeSongsFromTables(directory->songs);
- deleteSongsFromPlaylist(directory->songs);
freeSongList(directory->songs);
if(directory->utf8name) free(directory->utf8name);
free(directory);
@@ -118,8 +115,6 @@ void removeSongFromDirectory(Directory * directory, char * shortname) {
if(findInList(directory->songs,shortname,&song)) {
LOG("removing: %s\n",((Song *)song)->utf8file);
- removeASongFromTables((Song *)song);
- deleteASongFromPlaylist((Song *)song);
deleteFromList(directory->songs,shortname);
}
}
@@ -153,7 +148,9 @@ int updateInDirectory(Directory * directory, char * shortname, char * name) {
}
else if(mtime!=((Song *)song)->mtime) {
LOG("updating %s\n",name);
- updateSongInfo((Song *)song);
+ if(updateSongInfo((Song *)song)<0) {
+ removeSongFromDirectory(directory,shortname);
+ }
}
}
else if(isDir(name,&mtime)) {
@@ -331,7 +328,6 @@ int addToDirectory(Directory * directory, char * shortname, char * name) {
song = addSongToList(directory->songs,shortname,name);
if(!song) return -1;
LOG("added %s\n",name);
- addSongToTables(song);
return 0;
}