when updating, don't cause db reread on adding and then removing empty directories
git-svn-id: https://svn.musicpd.org/mpd/trunk@805 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
4a1fbb45c5
commit
158c23f238
29
TODO
29
TODO
@ -1,40 +1,33 @@
|
||||
1) On exploring a directory:
|
||||
1) detect if any songs were added
|
||||
2) if no songs added remove explored directory
|
||||
3) use this info on exploring directory to adjust whether or not an
|
||||
update happened
|
||||
4) remove the deleteEmptryDirectories() function
|
||||
|
||||
2) resampling audio for compatibility, and better gapless/crossfading
|
||||
1) resampling audio for compatibility, and better gapless/crossfading
|
||||
a) write bit conversion stuff (8->16 and 24->16)
|
||||
b) mono to stereo conversion
|
||||
c) default audio format is (44.1khz, 16-bit, stereo)
|
||||
d) option to set default sampling frequency
|
||||
e) abitility to disable resampling and audio format conversion
|
||||
|
||||
3) when writing combined interface for all decodes to use, be sure to add a
|
||||
2) when writing combined interface for all decodes to use, be sure to add a
|
||||
common function and abstrct dealing with DecoderControl * and put
|
||||
cycleLogFiles in there, so we cycleLogFiles while decoding, not just when
|
||||
decoding has stopped.
|
||||
|
||||
4) reaplygain
|
||||
3) reaplygain
|
||||
|
||||
5) streaming and playing in general
|
||||
1) determine a clever interface to play, so that play doesn't block
|
||||
4) streaming and playing in general
|
||||
a) determine a clever interface to play, so that play doesn't block
|
||||
until the file is opened, but just returns when the command
|
||||
is accepted.
|
||||
2) put errors in error stuff of PlayerControl and report this to
|
||||
b) put errors in error stuff of PlayerControl and report this to
|
||||
status and print to error logs
|
||||
3) this will help streaming from blocking indefinetly or waiting
|
||||
c) this will help streaming from blocking indefinetly or waiting
|
||||
on a response
|
||||
|
||||
6) play streams
|
||||
5) play streams
|
||||
|
||||
7) ACK error codes
|
||||
6) ACK error codes
|
||||
|
||||
8) cleanup main()
|
||||
7) cleanup main()
|
||||
|
||||
9) handle '\n' in filenames
|
||||
8) handle '\n' in filenames
|
||||
|
||||
|
||||
Post-1.0
|
||||
|
@ -103,7 +103,7 @@ void deleteEmptyDirectoriesInDirectory(Directory * directory);
|
||||
|
||||
void removeSongFromDirectory(Directory * directory, char * shortname);
|
||||
|
||||
Directory * addSubDirectoryToDirectory(Directory * directory, char * shortname,
|
||||
int addSubDirectoryToDirectory(Directory * directory, char * shortname,
|
||||
char * name);
|
||||
|
||||
Directory * getDirectoryDetails(char * name, char ** shortname,
|
||||
@ -328,8 +328,8 @@ int updateInDirectory(Directory * directory, char * shortname, char * name) {
|
||||
if(updateDirectory((Directory *)subDir)>0) return 1;
|
||||
}
|
||||
else {
|
||||
addSubDirectoryToDirectory(directory,shortname,name);
|
||||
return 1;
|
||||
return addSubDirectoryToDirectory(directory,shortname,
|
||||
name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -434,8 +434,9 @@ Directory * addDirectoryPathToDB(char * utf8path, char ** shortname) {
|
||||
|
||||
if(!findInList(parentDirectory->subDirectories,*shortname, &directory))
|
||||
{
|
||||
directory = (void *)addSubDirectoryToDirectory(parentDirectory,
|
||||
*shortname,utf8path);
|
||||
directory = newDirectory(utf8path);
|
||||
insertInList(parentDirectory->subDirectories,*shortname,
|
||||
directory);
|
||||
}
|
||||
|
||||
/* if we're adding directory paths, make sure to delete filenames
|
||||
@ -531,9 +532,7 @@ int updatePath(char * utf8path) {
|
||||
*/
|
||||
if(isDir(path) || isMusic(path,NULL)) {
|
||||
parentDirectory = addParentPathToDB(path,&shortname);
|
||||
addToDirectory(parentDirectory,shortname,path);
|
||||
sortDirectory(parentDirectory);
|
||||
ret = 1;
|
||||
if(addToDirectory(parentDirectory,shortname,path)>0) ret = 1;
|
||||
}
|
||||
|
||||
free(path);
|
||||
@ -587,6 +586,11 @@ int updateDirectory(Directory * directory) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* return values:
|
||||
-1 -> error
|
||||
0 -> no error, but nothing found
|
||||
1 -> no error, and stuff found
|
||||
*/
|
||||
int exploreDirectory(Directory * directory) {
|
||||
DIR * dir;
|
||||
char cwd[2];
|
||||
@ -594,6 +598,7 @@ int exploreDirectory(Directory * directory) {
|
||||
char * s;
|
||||
char * utf8;
|
||||
char * dirname = directory->utf8name;
|
||||
int ret = 0;
|
||||
|
||||
cwd[0] = '.';
|
||||
cwd[1] = '\0';
|
||||
@ -619,38 +624,41 @@ int exploreDirectory(Directory * directory) {
|
||||
sprintf(s,"%s/%s",directory->utf8name,utf8);
|
||||
}
|
||||
else s = strdup(utf8);
|
||||
addToDirectory(directory,utf8,s);
|
||||
if(addToDirectory(directory,utf8,s)>0) ret = 1;
|
||||
free(utf8);
|
||||
free(s);
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
Directory * addSubDirectoryToDirectory(Directory * directory, char * shortname,
|
||||
int addSubDirectoryToDirectory(Directory * directory, char * shortname,
|
||||
char * name)
|
||||
{
|
||||
Directory * subDirectory = newDirectory(name);
|
||||
|
||||
insertInList(directory->subDirectories,shortname,subDirectory);
|
||||
exploreDirectory(subDirectory);
|
||||
if(exploreDirectory(subDirectory)<1) {
|
||||
freeDirectory(subDirectory);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return subDirectory;
|
||||
insertInList(directory->subDirectories,shortname,subDirectory);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int addToDirectory(Directory * directory, char * shortname, char * name) {
|
||||
if(isDir(name)) {
|
||||
addSubDirectoryToDirectory(directory,shortname,name);
|
||||
return 0;
|
||||
return addSubDirectoryToDirectory(directory,shortname,name);
|
||||
}
|
||||
else if(isMusic(name,NULL)) {
|
||||
Song * song;
|
||||
song = addSongToList(directory->songs,shortname,name);
|
||||
if(!song) return -1;
|
||||
LOG("added %s\n",name);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
DEBUG("addToDirectory: %s is not a directory or music\n",name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user