add playlist parse option, as well as initializing smart playlists

This commit is contained in:
Ron Pedde 2003-12-05 05:59:19 +00:00
parent 9744ab3830
commit 2fde2c1250
1 changed files with 21 additions and 5 deletions

View File

@ -44,8 +44,7 @@
#include "mp3-scanner.h"
#include "rend.h"
#include "webserver.h"
// 3689
#include "playlist.h"
/*
@ -271,6 +270,7 @@ void usage(char *program) {
#endif
printf(" -m Use mDNS\n");
printf(" -c <file> Use configfile specified");
printf(" -p Parse playlist file\n");
printf("\n\n");
}
@ -282,13 +282,14 @@ int main(int argc, char *argv[]) {
ENUMHANDLE handle;
MP3FILE *pmp3;
int status;
int parseonly=0;
config.use_mdns=0;
#ifdef DEBUG
char *optval="d:c:m";
char *optval="d:c:mp";
#else
char *optval="c:m";
char *optval="c:mp";
#endif /* DEBUG */
printf("mt-daapd: version $Revision$\n");
@ -310,6 +311,10 @@ int main(int argc, char *argv[]) {
config.use_mdns=1;
break;
case 'p':
parseonly=1;
break;
default:
usage(argv[0]);
exit(EXIT_FAILURE);
@ -333,7 +338,7 @@ int main(int argc, char *argv[]) {
}
}
if(config.use_mdns) {
if((config.use_mdns) && (!parseonly)) {
fprintf(stderr,"Starting rendezvous daemon\n");
rend_init(&config.rend_pid,config.servername, config.port);
}
@ -346,6 +351,17 @@ int main(int argc, char *argv[]) {
exit(EXIT_FAILURE);
}
if(config.playlist)
pl_load(config.playlist);
if(parseonly) {
if(!pl_error) {
printf("Parsed successfully.\n");
pl_dump();
}
exit(EXIT_SUCCESS);
}
printf("Scanning MP3s\n");
if(scan_init(config.mp3dir)) {