ok, addParentPathToDB now works!
also, recursive directory checking for updating on a particular song path now work git-svn-id: https://svn.musicpd.org/mpd/trunk@1624 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
@@ -449,14 +449,29 @@ Directory * addDirectoryPathToDB(char * utf8path, char ** shortname) {
|
|||||||
if(strlen(parent)==0) parentDirectory = (void *)mp3rootDirectory;
|
if(strlen(parent)==0) parentDirectory = (void *)mp3rootDirectory;
|
||||||
else parentDirectory = addDirectoryPathToDB(parent,shortname);
|
else parentDirectory = addDirectoryPathToDB(parent,shortname);
|
||||||
|
|
||||||
|
if(!parentDirectory) {
|
||||||
|
free(parent);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
*shortname = utf8path+strlen(parent);
|
*shortname = utf8path+strlen(parent);
|
||||||
while(*(*shortname) && *(*shortname)=='/') (*shortname)++;
|
while(*(*shortname) && *(*shortname)=='/') (*shortname)++;
|
||||||
|
|
||||||
if(!findInList(parentDirectory->subDirectories,*shortname, &directory))
|
if(!findInList(parentDirectory->subDirectories,*shortname, &directory))
|
||||||
{
|
{
|
||||||
directory = newDirectory(utf8path, parentDirectory);
|
struct stat st;
|
||||||
insertInList(parentDirectory->subDirectories,*shortname,
|
if(myStat(utf8path, &st) < 0 ||
|
||||||
directory);
|
inodeFoundInParent(parentDirectory,
|
||||||
|
st.st_ino, st.st_dev))
|
||||||
|
{
|
||||||
|
free(parent);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
directory = newDirectory(utf8path, parentDirectory);
|
||||||
|
insertInList(parentDirectory->subDirectories,*shortname,
|
||||||
|
directory);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we're adding directory paths, make sure to delete filenames
|
/* if we're adding directory paths, make sure to delete filenames
|
||||||
@@ -465,7 +480,7 @@ Directory * addDirectoryPathToDB(char * utf8path, char ** shortname) {
|
|||||||
|
|
||||||
free(parent);
|
free(parent);
|
||||||
|
|
||||||
return (Directory *)parentDirectory;
|
return (Directory *)directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
Directory * addParentPathToDB(char * utf8path, char ** shortname) {
|
Directory * addParentPathToDB(char * utf8path, char ** shortname) {
|
||||||
@@ -477,6 +492,11 @@ Directory * addParentPathToDB(char * utf8path, char ** shortname) {
|
|||||||
if(strlen(parent)==0) parentDirectory = (void *)mp3rootDirectory;
|
if(strlen(parent)==0) parentDirectory = (void *)mp3rootDirectory;
|
||||||
else parentDirectory = addDirectoryPathToDB(parent,shortname);
|
else parentDirectory = addDirectoryPathToDB(parent,shortname);
|
||||||
|
|
||||||
|
if(!parentDirectory) {
|
||||||
|
free(parent);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
*shortname = utf8path+strlen(parent);
|
*shortname = utf8path+strlen(parent);
|
||||||
while(*(*shortname) && *(*shortname)=='/') (*shortname)++;
|
while(*(*shortname) && *(*shortname)=='/') (*shortname)++;
|
||||||
|
|
||||||
@@ -562,15 +582,17 @@ int updatePath(char * utf8path) {
|
|||||||
*/
|
*/
|
||||||
if(isDir(path) || isMusic(path,NULL)) {
|
if(isDir(path) || isMusic(path,NULL)) {
|
||||||
parentDirectory = addParentPathToDB(path,&shortname);
|
parentDirectory = addParentPathToDB(path,&shortname);
|
||||||
if(!parentDirectory->stat && statDirectory(parentDirectory) < 0)
|
if(!parentDirectory || (
|
||||||
|
!parentDirectory->stat &&
|
||||||
|
statDirectory(parentDirectory) < 0))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else if(inodeFoundInParent(parentDirectory->parent,
|
else if(0 == inodeFoundInParent(parentDirectory->parent,
|
||||||
parentDirectory->stat->inode,
|
parentDirectory->stat->inode,
|
||||||
parentDirectory->stat->device))
|
parentDirectory->stat->device) &&
|
||||||
|
addToDirectory(parentDirectory, shortname, path)
|
||||||
|
>0)
|
||||||
{
|
{
|
||||||
}
|
|
||||||
else if(addToDirectory(parentDirectory,shortname,path)>0) {
|
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user