add --only-update-db command line option
git-svn-id: https://svn.musicpd.org/mpd/trunk@728 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
43c2576934
commit
00c25b772e
8
TODO
8
TODO
@ -17,12 +17,10 @@
|
|||||||
vice versa, this way you can do list album artists or list artist albums, this
|
vice versa, this way you can do list album artists or list artist albums, this
|
||||||
will make life easier when we add genre and other metadata
|
will make life easier when we add genre and other metadata
|
||||||
|
|
||||||
3) thourougly rewrite and check signal blocking and unblocking
|
3) have children close all logging stuff, and redirect stdout and stderr to
|
||||||
|
|
||||||
4) add a --update-only, like --only-create-db, only just for updating
|
|
||||||
|
|
||||||
5) have children close all logging stuff, and redirect stdout and stderr to
|
|
||||||
/dev/null, and set error bits in the shared log for the parent process
|
/dev/null, and set error bits in the shared log for the parent process
|
||||||
to check when it receives a SIGUSR1, and print logs and then reset values of
|
to check when it receives a SIGUSR1, and print logs and then reset values of
|
||||||
error bits. (don't redirect children's stdout and stderr to /dev/null if mpd is
|
error bits. (don't redirect children's stdout and stderr to /dev/null if mpd is
|
||||||
run with --no-daemon)
|
run with --no-daemon)
|
||||||
|
|
||||||
|
4) cleanup main()
|
||||||
|
15
src/main.c
15
src/main.c
@ -59,6 +59,7 @@ typedef struct _Options {
|
|||||||
int daemon;
|
int daemon;
|
||||||
int createDB;
|
int createDB;
|
||||||
int onlyCreateDB;
|
int onlyCreateDB;
|
||||||
|
int onlyUpdateDB;
|
||||||
} Options;
|
} Options;
|
||||||
|
|
||||||
void usage(char * argv[]) {
|
void usage(char * argv[]) {
|
||||||
@ -74,6 +75,7 @@ void usage(char * argv[]) {
|
|||||||
ERROR(" --no-daemon don't detach from console\n");
|
ERROR(" --no-daemon don't detach from console\n");
|
||||||
ERROR(" --create-db force (re)creation database\n");
|
ERROR(" --create-db force (re)creation database\n");
|
||||||
ERROR(" --only-create-db create database and exit\n");
|
ERROR(" --only-create-db create database and exit\n");
|
||||||
|
ERROR(" --only-update-db create database and exit\n");
|
||||||
ERROR(" --no-create-db don't create database\n");
|
ERROR(" --no-create-db don't create database\n");
|
||||||
ERROR(" --verbose verbose logging\n");
|
ERROR(" --verbose verbose logging\n");
|
||||||
ERROR(" --version prints version information\n");
|
ERROR(" --version prints version information\n");
|
||||||
@ -94,6 +96,7 @@ void parseOptions(int argc, char ** argv, Options * options) {
|
|||||||
options->daemon = 1;
|
options->daemon = 1;
|
||||||
options->createDB = 0;
|
options->createDB = 0;
|
||||||
options->onlyCreateDB = 0;
|
options->onlyCreateDB = 0;
|
||||||
|
options->onlyUpdateDB = 0;
|
||||||
options->dbFile = NULL;
|
options->dbFile = NULL;
|
||||||
|
|
||||||
if(argc>1) {
|
if(argc>1) {
|
||||||
@ -116,6 +119,10 @@ void parseOptions(int argc, char ** argv, Options * options) {
|
|||||||
options->onlyCreateDB = 1;
|
options->onlyCreateDB = 1;
|
||||||
argcLeft--;
|
argcLeft--;
|
||||||
}
|
}
|
||||||
|
else if(strcmp(argv[i],"--only-update-db")==0) {
|
||||||
|
options->onlyUpdateDB = 1;
|
||||||
|
argcLeft--;
|
||||||
|
}
|
||||||
else if(strcmp(argv[i],"--no-create-db")==0) {
|
else if(strcmp(argv[i],"--no-create-db")==0) {
|
||||||
options->createDB = -1;
|
options->createDB = -1;
|
||||||
argcLeft--;
|
argcLeft--;
|
||||||
@ -217,7 +224,9 @@ int main(int argc, char * argv[]) {
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!options.onlyCreateDB && (listenSocket = establish(port))<0) {
|
if(!options.onlyCreateDB && !options.onlyUpdateDB &&
|
||||||
|
(listenSocket = establish(port))<0)
|
||||||
|
{
|
||||||
ERROR("error binding port\n");
|
ERROR("error binding port\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
@ -361,6 +370,10 @@ int main(int argc, char * argv[]) {
|
|||||||
}
|
}
|
||||||
if(options.onlyCreateDB) exit(EXIT_SUCCESS);
|
if(options.onlyCreateDB) exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
if(options.onlyUpdateDB) {
|
||||||
|
if(updateMp3Directory(stderr)<0) exit(EXIT_FAILURE);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
initCommands();
|
initCommands();
|
||||||
initAudioDriver();
|
initAudioDriver();
|
||||||
|
Loading…
Reference in New Issue
Block a user