directory: remove "Mp3" references

MPD has supported more audio formats than just MP3
for over five years...
This commit is contained in:
Eric Wong 2008-09-29 13:17:42 +02:00 committed by Max Kellermann
parent 9819890f1d
commit a0364d38d3
3 changed files with 22 additions and 22 deletions

View File

@ -53,7 +53,7 @@ enum update_progress {
UPDATE_PROGRESS_DONE = 2 UPDATE_PROGRESS_DONE = 2
} progress; } progress;
static Directory *mp3rootDirectory; static Directory *music_root;
static time_t directory_dbModTime; static time_t directory_dbModTime;
@ -138,7 +138,7 @@ static void * update_task(void *arg)
} }
freeList(path_list); freeList(path_list);
} else { } else {
ret = updateDirectory(mp3rootDirectory); ret = updateDirectory(music_root);
} }
if (ret == UPDATE_RETURN_UPDATED && writeDirectoryDB() < 0) if (ret == UPDATE_RETURN_UPDATED && writeDirectoryDB() < 0)
@ -315,7 +315,7 @@ static Directory *addDirectoryPathToDB(const char *utf8path)
parent = parent_path(path_max_tmp, utf8path); parent = parent_path(path_max_tmp, utf8path);
if (strlen(parent) == 0) if (strlen(parent) == 0)
parentDirectory = (void *)mp3rootDirectory; parentDirectory = music_root;
else else
parentDirectory = addDirectoryPathToDB(parent); parentDirectory = addDirectoryPathToDB(parent);
@ -351,7 +351,7 @@ static Directory *addParentPathToDB(const char *utf8path)
parent = parent_path(path_max_tmp, utf8path); parent = parent_path(path_max_tmp, utf8path);
if (strlen(parent) == 0) if (strlen(parent) == 0)
parentDirectory = (void *)mp3rootDirectory; parentDirectory = music_root;
else else
parentDirectory = addDirectoryPathToDB(parent); parentDirectory = addDirectoryPathToDB(parent);
@ -386,7 +386,7 @@ static enum update_return updatePath(const char *utf8path)
return ret; return ret;
} }
/* we don't want to delete the root directory */ /* we don't want to delete the root directory */
else if (directory == mp3rootDirectory) { else if (directory == music_root) {
free(path); free(path);
return UPDATE_RETURN_NOUPDATE; return UPDATE_RETURN_NOUPDATE;
} }
@ -618,9 +618,9 @@ addToDirectory(Directory * directory, const char *name)
return UPDATE_RETURN_ERROR; return UPDATE_RETURN_ERROR;
} }
void closeMp3Directory(void) void directory_finish(void)
{ {
freeDirectory(mp3rootDirectory); freeDirectory(music_root);
} }
int isRootDirectory(const char *name) int isRootDirectory(const char *name)
@ -663,7 +663,7 @@ static Directory *getSubDirectory(Directory * directory, const char *name)
static Directory *getDirectory(const char *name) static Directory *getDirectory(const char *name)
{ {
return getSubDirectory(mp3rootDirectory, name); return getSubDirectory(music_root, name);
} }
static int printDirectoryList(struct client *client, struct dirvec *dv) static int printDirectoryList(struct client *client, struct dirvec *dv)
@ -844,11 +844,11 @@ int writeDirectoryDB(void)
struct stat st; struct stat st;
DEBUG("removing empty directories from DB\n"); DEBUG("removing empty directories from DB\n");
deleteEmptyDirectoriesInDirectory(mp3rootDirectory); deleteEmptyDirectoriesInDirectory(music_root);
DEBUG("sorting DB\n"); DEBUG("sorting DB\n");
sortDirectory(mp3rootDirectory); sortDirectory(music_root);
DEBUG("writing DB\n"); DEBUG("writing DB\n");
@ -865,7 +865,7 @@ int writeDirectoryDB(void)
fprintf(fp, "%s%s\n", DIRECTORY_FS_CHARSET, getFsCharset()); fprintf(fp, "%s%s\n", DIRECTORY_FS_CHARSET, getFsCharset());
fprintf(fp, "%s\n", DIRECTORY_INFO_END); fprintf(fp, "%s\n", DIRECTORY_INFO_END);
writeDirectoryInfo(fp, mp3rootDirectory); writeDirectoryInfo(fp, music_root);
while (fclose(fp) && errno == EINTR); while (fclose(fp) && errno == EINTR);
@ -881,8 +881,8 @@ int readDirectoryDB(void)
char *dbFile = getDbFile(); char *dbFile = getDbFile();
struct stat st; struct stat st;
if (!mp3rootDirectory) if (!music_root)
mp3rootDirectory = newDirectory(NULL, NULL); music_root = newDirectory(NULL, NULL);
while (!(fp = fopen(dbFile, "r")) && errno == EINTR) ; while (!(fp = fopen(dbFile, "r")) && errno == EINTR) ;
if (fp == NULL) { if (fp == NULL) {
ERROR("unable to open db file \"%s\": %s\n", ERROR("unable to open db file \"%s\": %s\n",
@ -943,7 +943,7 @@ int readDirectoryDB(void)
DEBUG("reading DB\n"); DEBUG("reading DB\n");
readDirectoryInfo(fp, mp3rootDirectory); readDirectoryInfo(fp, music_root);
while (fclose(fp) && errno == EINTR) ; while (fclose(fp) && errno == EINTR) ;
stats.numberOfSongs = countSongsIn(NULL); stats.numberOfSongs = countSongsIn(NULL);
@ -1007,10 +1007,10 @@ int traverseAllIn(const char *name,
data); data);
} }
void initMp3Directory(void) void directory_init(void)
{ {
mp3rootDirectory = newDirectory(NULL, NULL); music_root = newDirectory(NULL, NULL);
exploreDirectory(mp3rootDirectory); exploreDirectory(music_root);
stats.numberOfSongs = countSongsIn(NULL); stats.numberOfSongs = countSongsIn(NULL);
stats.dbPlayTime = sumSongTimesIn(NULL); stats.dbPlayTime = sumSongTimesIn(NULL);
} }

View File

@ -49,9 +49,9 @@ int isUpdatingDB(void);
*/ */
int updateInit(List * pathList); int updateInit(List * pathList);
void initMp3Directory(void); void directory_init(void);
void closeMp3Directory(void); void directory_finish(void);
int isRootDirectory(const char *name); int isRootDirectory(const char *name);

View File

@ -280,7 +280,7 @@ static void openDB(Options * options, char *argv0)
flushWarningLog(); flushWarningLog();
if (checkDirectoryDB() < 0) if (checkDirectoryDB() < 0)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
initMp3Directory(); directory_init();
if (writeDirectoryDB() < 0) if (writeDirectoryDB() < 0)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
if (options->createDB) if (options->createDB)
@ -455,8 +455,8 @@ int main(int argc, char *argv[])
finishPlaylist(); finishPlaylist();
start = clock(); start = clock();
closeMp3Directory(); directory_finish();
DEBUG("closeMp3Directory took %f seconds\n", DEBUG("directory_finish took %f seconds\n",
((float)(clock()-start))/CLOCKS_PER_SEC); ((float)(clock()-start))/CLOCKS_PER_SEC);
deinit_main_notify(); deinit_main_notify();