fix typo in add_long, made mper tag not work

This commit is contained in:
Ron Pedde 2004-09-14 04:03:57 +00:00
parent e43caee157
commit 23fa058c64
4 changed files with 26 additions and 14 deletions

View File

@ -133,10 +133,10 @@ DAAP_BLOCK *daap_add_long(DAAP_BLOCK *parent, char *tag, int v1, int v2) {
ivalue[2]=(v1 >> 8) & 0xFF;
ivalue[3]=v1 & 0xFF;
ivalue[4]=(v1 >> 24) & 0xFF;
ivalue[5]=(v1 >> 16) & 0xFF;
ivalue[6]=(v1 >> 8) & 0xFF;
ivalue[7]=v1 & 0xFF;
ivalue[4]=(v2 >> 24) & 0xFF;
ivalue[5]=(v2 >> 16) & 0xFF;
ivalue[6]=(v2 >> 8) & 0xFF;
ivalue[7]=v2 & 0xFF;
return daap_add_formatted(parent,tag,8,ivalue);
}

View File

@ -481,7 +481,7 @@ DAAP_BLOCK *daap_response_songlist(char* metaStr, char* query) {
return NULL;
}
DPRINTF(ERR_DEBUG,"Successfully enumerated database\n");
DPRINTF(ERR_DEBUG,"Successfully enumerated database - %d items\n",songs);
daap_set_int(root, "mtco", songs);
daap_set_int(root, "mrco", songs);
@ -553,7 +553,10 @@ DAAP_BLOCK* daap_add_song_entry(DAAP_BLOCK* mlcl, MP3FILE* song, MetaField_t met
if(wantsMeta(meta, metaItemId))
g = g && daap_add_int(mlit,"miid",song->id); /* id */
if(wantsMeta(meta, metaPersistentId))
g = g && daap_add_long(mlit,"mper",0,song->id);
/* these quite go hand in hand */
if(wantsMeta(meta, metaSongFormat))
g = g && daap_add_string(mlit,"asfm",song->type); /* song format */
@ -673,7 +676,7 @@ DAAP_BLOCK *daap_response_playlists(char *name) {
mlit=daap_add_empty(mlcl,"mlit");
if(mlit) {
g = g && daap_add_int(mlit,"miid",0x1);
g = g && daap_add_long(mlit,"mper",0,2);
g = g && daap_add_long(mlit,"mper",0,1);
g = g && daap_add_string(mlit,"minm",name);
g = g && daap_add_int(mlit,"mimc",db_get_song_count());
}
@ -759,6 +762,9 @@ DAAP_BLOCK *daap_response_dbinfo(char *name) {
return NULL;
}
DPRINTF(ERR_DEBUG,"Sent db info... %d songs, %d playlists\n",db_get_song_count(),
db_get_playlist_count());
return root;
}
@ -819,10 +825,12 @@ DAAP_BLOCK *daap_response_server_info(char *name, char *client_version) {
#ifdef OPT_QUERY
g = g && daap_add_char(root,"msqy",0); /* queries */
#endif
#if 0
g = g && daap_add_char(root,"msal",0); /* autologout */
g = g && daap_add_char(root,"msup",0); /* update */
#if 0
g = g && daap_add_char(root,"mspi",0); /* persistant ids */
g = g && daap_add_char(root,"msal",0); /* autologout */
g = g && daap_add_char(root,"msrs",0); /* resolve? req. persist id */
#endif
g = g && daap_add_int(root,"msdc",1); /* database count */
@ -912,7 +920,7 @@ DAAP_BLOCK *daap_response_playlist_items(unsigned int playlist, char* metaStr, c
mlit=daap_add_song_entry(mlcl, current, meta);
if(0 != mlit) {
if(wantsMeta(meta, metaContainerItemId))
g = g && daap_add_int(mlit,"mcti",playlist);
g = g && daap_add_int(mlit,"mcti",current->id);
} else g=0;
}
}
@ -928,7 +936,7 @@ DAAP_BLOCK *daap_response_playlist_items(unsigned int playlist, char* metaStr, c
DPRINTF(ERR_DEBUG,"Adding itemid %d\n",itemid);
mlit=daap_add_song_entry(mlcl,current,meta);
if(0 != mlit) {
if(wantsMeta(meta, metaContainerItemId))
if(wantsMeta(meta, metaContainerItemId)) // current->id?
g = g && daap_add_int(mlit,"mcti",playlist);
} else g = 0;
#ifdef OPT_QUERY
@ -955,6 +963,8 @@ DAAP_BLOCK *daap_response_playlist_items(unsigned int playlist, char* metaStr, c
return NULL;
}
DPRINTF(ERR_DEBUG,"Sucessfully enumerated %d items\n",songs);
daap_set_int(root, "mtco", songs);
daap_set_int(root, "mrco", songs);

View File

@ -713,13 +713,11 @@ int main(int argc, char *argv[]) {
if(config.reload) {
config.reload=0;
/* Need to get traces of an update, obviously... this ain't it.
DPRINTF(ERR_LOG,"Reloading configuration\n");
if(scan_init(config.mp3dir)) {
DPRINTF(ERR_LOG,"Error rescanning... exiting\n");
config.stop=1;
}
*/
}
sleep(2);
}

View File

@ -974,7 +974,11 @@ int scan_get_mp3fileinfo(char *file, MP3FILE *pmp3) {
pmp3->file_size=file_size;
if(fread(buffer,1,sizeof(buffer),infile) != sizeof(buffer)) {
DPRINTF(ERR_LOG,"Short file: %s\n",infile);
if(ferror(infile)) {
DPRINTF(ERR_LOG,"Error reading: %s\n",strerror(errno));
} else {
DPRINTF(ERR_LOG,"Short file: %s\n",infile);
}
return -1;
}