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

View File

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