Add support for db naming

This commit is contained in:
Ron Pedde 2003-11-17 16:38:03 +00:00
parent d93504dd5a
commit 4b6af9ccdd
4 changed files with 12 additions and 9 deletions

View File

@ -73,6 +73,7 @@ CONFIGELEMENT config_elements[] = {
{ 1,1,0,CONFIG_TYPE_INT,"port",(void*)&config.port,config_emit_int },
{ 1,1,0,CONFIG_TYPE_STRING,"admin_pw",(void*)&config.adminpassword,config_emit_string },
{ 1,1,0,CONFIG_TYPE_STRING,"mp3_dir",(void*)&config.mp3dir,config_emit_string },
{ 1,1,0,CONFIG_TYPE_STRING,"servername",(void*)&config.servername,config_emit_string },
{ 0,0,0,CONFIG_TYPE_SPECIAL,"release",(void*)VERSION,config_emit_literal },
{ 0,0,0,CONFIG_TYPE_SPECIAL,"package",(void*)PACKAGE,config_emit_literal },
{ 0,0,0,CONFIG_TYPE_SPECIAL,"include",(void*)NULL,config_emit_include },
@ -187,6 +188,7 @@ int config_read(char *file) {
while((pce->config_element != -1)) {
if(pce->required && pce->config_element && !pce->changed) {
fprintf(stderr,"Required config entry '%s' not specified\n",pce->name);
errno=EINVAL;
err=-1;
}
if((pce->config_element) && (pce->changed)) {

View File

@ -346,7 +346,7 @@ DAAP_BLOCK *daap_response_update(int clientver) {
*
* handle the daap block for the /databases/containers URI
*/
DAAP_BLOCK *daap_response_playlists(void) {
DAAP_BLOCK *daap_response_playlists(char *name) {
DAAP_BLOCK *root;
DAAP_BLOCK *mlcl;
DAAP_BLOCK *mlit;
@ -366,7 +366,7 @@ DAAP_BLOCK *daap_response_playlists(void) {
if(mlit) {
g = g && daap_add_int(mlit,"miid",0x1);
g = g && daap_add_long(mlit,"mper",0,2);
g = g && daap_add_string(mlit,"minm","mt-daapd");
g = g && daap_add_string(mlit,"minm",name);
g = g && daap_add_int(mlit,"mimc",db_get_song_count());
}
}
@ -389,7 +389,7 @@ DAAP_BLOCK *daap_response_playlists(void) {
* handle the daap block for the /databases URI
*/
DAAP_BLOCK *daap_response_dbinfo(void) {
DAAP_BLOCK *daap_response_dbinfo(char *name) {
DAAP_BLOCK *root;
DAAP_BLOCK *mlcl;
DAAP_BLOCK *mlit;
@ -409,7 +409,7 @@ DAAP_BLOCK *daap_response_dbinfo(void) {
if(mlit) {
g = g && daap_add_int(mlit,"miid",0x20);
g = g && daap_add_long(mlit,"mper",0,1);
g = g && daap_add_string(mlit,"minm","mt-daapd");
g = g && daap_add_string(mlit,"minm",name);
g = g && daap_add_int(mlit,"mimc",db_get_song_count()); /* songs */
g = g && daap_add_int(mlit,"mctc",0x1); /* playlists */
}
@ -432,7 +432,7 @@ DAAP_BLOCK *daap_response_dbinfo(void) {
*
* handle the daap block for the /server-info URI
*/
DAAP_BLOCK *daap_response_server_info(void) {
DAAP_BLOCK *daap_response_server_info(char *name) {
DAAP_BLOCK *root;
int g=1;
@ -444,7 +444,7 @@ DAAP_BLOCK *daap_response_server_info(void) {
g = (int)daap_add_int(root,"mstt",200); /* result */
g = g && daap_add_int(root,"mpro",2 << 16); /* dmap proto ? */
g = g && daap_add_int(root,"apro",2 << 16); /* daap protocol */
g = g && daap_add_string(root,"minm","mt-daapd"); /* server name */
g = g && daap_add_string(root,"minm",name); /* server name */
g = g && daap_add_char(root,"mslr",0); /* logon required */
g = g && daap_add_int(root,"mstm",1800); /* timeout - iTunes=1800 */
g = g && daap_add_char(root,"msal",0); /* autologout */

View File

@ -23,13 +23,13 @@
#include "daap-proto.h"
DAAP_BLOCK *daap_response_server_info(void);
DAAP_BLOCK *daap_response_server_info(char *name);
DAAP_BLOCK *daap_response_content_codes(void);
DAAP_BLOCK *daap_response_login(void);
DAAP_BLOCK *daap_response_update(int clientver);
DAAP_BLOCK *daap_response_songlist(void);
DAAP_BLOCK *daap_response_playlists(void);
DAAP_BLOCK *daap_response_dbinfo(void);
DAAP_BLOCK *daap_response_playlists(char *name);
DAAP_BLOCK *daap_response_dbinfo(char *name);
DAAP_BLOCK *daap_response_playlist_items(int playlist);
#endif /* _DAAP_H_ */

View File

@ -36,6 +36,7 @@ typedef struct tag_config {
char *adminpassword;
char *readpassword;
char *mp3dir;
char *servername;
SONGENTRY songlist;
} CONFIG;