From e60d1f75ecfd62156c5a7a71a051d312b7d9c9c8 Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Mon, 1 May 2006 08:06:19 +0000 Subject: [PATCH] invert the sense of the -s switch, default skipping intial scan --- src/Makefile.am | 1 + src/db-generic.c | 4 ++-- src/db-generic.h | 2 +- src/db-sql.c | 10 ++++++---- src/db-sql.h | 2 +- src/main.c | 8 ++++---- src/plugin.c | 14 +++++++++++++- src/plugins/Makefile.am | 7 +++++++ 8 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 src/plugins/Makefile.am diff --git a/src/Makefile.am b/src/Makefile.am index 90b6580f..4e87f915 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,6 @@ # $Id$ # +SUBDIRS=plugins sbin_PROGRAMS = mt-daapd bin_PROGRAMS = wavstreamer mtd-update diff --git a/src/db-generic.c b/src/db-generic.c index d3aafad1..456a07c8 100644 --- a/src/db-generic.c +++ b/src/db-generic.c @@ -49,7 +49,7 @@ typedef struct tag_db_functions { char *name; int(*dbs_open)(char **, char *); - int(*dbs_init)(int); + int(*dbs_init)(int*); int(*dbs_deinit)(void); int(*dbs_add)(char **, MP3FILE*, int*); int(*dbs_add_playlist)(char **, char *, int, char *,char *, int, int *); @@ -524,7 +524,7 @@ int db_open(char **pe, char *type, char *parameters) { * * \param reload whether or not to do a full reload of the database */ -int db_init(int reload) { +int db_init(int *reload) { return db_current->dbs_init(reload); } diff --git a/src/db-generic.h b/src/db-generic.h index b8370de9..122e6114 100644 --- a/src/db-generic.h +++ b/src/db-generic.h @@ -147,7 +147,7 @@ typedef struct tag_daap_items { extern DAAP_ITEMS taglist[]; extern int db_open(char **pe, char *type, char *parameters); -extern int db_init(int reload); +extern int db_init(int *reload); extern int db_deinit(void); extern int db_revision(void); diff --git a/src/db-sql.c b/src/db-sql.c index b2ca12ba..a4bffccb 100644 --- a/src/db-sql.c +++ b/src/db-sql.c @@ -304,14 +304,14 @@ int db_sql_open(char **pe, char *parameters) { * initialize the sqlite database, reloading if requested * * @param reload whether or not to do a full reload on the db + * on return, reload is set to 1 if the db MUST be rescanned * @returns DB_E_SUCCESS on success, error code otherwise */ -int db_sql_init(int reload) { +int db_sql_init(int *reload) { int items; int rescan = 0; int err; - err=db_sql_get_count(NULL,&items, countSongs); if(err != DB_E_SUCCESS) items = 0; @@ -321,18 +321,20 @@ int db_sql_init(int reload) { "term='rescan'") == DB_E_SUCCESS) { if(rescan) - reload=1; + *reload=1; } - if(reload || (!items)) { + if(*reload || (!items)) { DPRINTF(E_LOG,L_DB,"Full reload...\n"); db_sql_event_fn(DB_SQL_EVENT_FULLRELOAD); db_sql_reload=1; + *reload=1; } else { db_sql_event_fn(DB_SQL_EVENT_STARTUP); db_sql_reload=0; + *reload=0; } return DB_E_SUCCESS; diff --git a/src/db-sql.h b/src/db-sql.h index 1905014c..604a0c18 100644 --- a/src/db-sql.h +++ b/src/db-sql.h @@ -32,7 +32,7 @@ extern int db_sql_open_sqlite3(char **pe, char *parameters); #endif extern int db_sql_open(char **pe, char *parameters); -extern int db_sql_init(int reload); +extern int db_sql_init(int *reload); extern int db_sql_deinit(void); extern int db_sql_escape(char *buffer, int *size, char *fmt, ...); extern int db_sql_add(char **pe, MP3FILE *pmp3, int *id); diff --git a/src/main.c b/src/main.c index 757cf5d2..4c9c4d8b 100644 --- a/src/main.c +++ b/src/main.c @@ -206,7 +206,7 @@ int main(int argc, char *argv[]) { int rescan_counter=0; int old_song_count, song_count; int force_non_root=0; - int skip_initial=0; + int skip_initial=1; int convert_conf=0; char *logfile,*db_type,*db_parms,*web_root,*runas; char **mp3_dir_array; @@ -259,7 +259,7 @@ int main(int argc, char *argv[]) { break; case 's': - skip_initial=1; + skip_initial=0; break; case 'y': @@ -386,12 +386,12 @@ int main(int argc, char *argv[]) { /* Initialize the database before starting */ DPRINTF(E_LOG,L_MAIN|L_DB,"Initializing database\n"); - if(db_init(reload)) { + if(db_init(&reload)) { DPRINTF(E_FATAL,L_MAIN|L_DB,"Error in db_init: %s\n",strerror(errno)); } if(conf_get_array("general","mp3_dir",&mp3_dir_array)) { - if(!skip_initial) { + if((!skip_initial) || (reload)) { DPRINTF(E_LOG,L_MAIN|L_SCAN,"Starting mp3 scan\n"); if(scan_init(mp3_dir_array)) { diff --git a/src/plugin.c b/src/plugin.c index 4aceeb5e..8a9abaa4 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -328,6 +328,8 @@ int plugin_rend_register(char *name, int port, char *iface) { PLUGIN_ENTRY *ppi; PLUGIN_REND_INFO *pri; char *txt; + char *new_name; + _plugin_readlock(); ppi = _plugin_list.next; @@ -342,7 +344,17 @@ int plugin_rend_register(char *name, int port, char *iface) { txt = ""; DPRINTF(E_DBG,L_PLUG,"Registering %s\n",pri->type); - rend_register(name,pri->type,port,iface,txt); + + new_name=(char*)malloc(strlen(name) + 3 + + strlen(ppi->versionstring)); + if(conf_get_int("plugins","mangle_rendezvous",1)) { + sprintf(new_name,"%s (%s)",name,ppi->versionstring); + } else { + sprintf(new_name,"%s",name); + } + rend_register(new_name,pri->type,port,iface,txt); + free(new_name); + pri++; } } diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am new file mode 100644 index 00000000..8f7afb69 --- /dev/null +++ b/src/plugins/Makefile.am @@ -0,0 +1,7 @@ +# $Id: $ +# +rspdir = ${pkgdatadir}/plugins + +lib_LTLIBRARIES=rsp.la +rsp_la_LDFLAGS=-module -avoid-version +rsp_la_SOURCES = compat.c rsp.c xml-rpc.c