|
Lines 513-519
Link Here
|
| 513 |
while(1 == tMoreDataNeeded) |
513 |
while(1 == tMoreDataNeeded) |
| 514 |
{ |
514 |
{ |
| 515 |
tError = readDataFromClient(pSock, &(tConn.recv)); |
515 |
tError = readDataFromClient(pSock, &(tConn.recv)); |
| 516 |
if(!tError && strlen(tConn.recv.data) > 0) |
516 |
//if(!tError && strlen(tConn.recv.data) > 0) |
|
|
517 |
if(!tError && tConn.recv.current > 0) |
| 517 |
{ |
518 |
{ |
| 518 |
xprintf("Finished Reading some data from client\n"); |
519 |
xprintf("Finished Reading some data from client\n"); |
| 519 |
// parse client request |
520 |
// parse client request |
|
Lines 632-638
Link Here
|
| 632 |
} |
633 |
} |
| 633 |
|
634 |
|
| 634 |
tSize = (int) (tShortest - tFound); |
635 |
tSize = (int) (tShortest - tFound); |
| 635 |
xprintf("Found %.*s length: %d\n", tSize, tFound, tSize); |
636 |
xprintf("Found %s length: %d\n",tFound, tSize); |
| 636 |
if(pReturnSize != NULL) |
637 |
if(pReturnSize != NULL) |
| 637 |
{ |
638 |
{ |
| 638 |
*pReturnSize = tSize; |
639 |
*pReturnSize = tSize; |
|
Lines 744-750
Link Here
|
| 744 |
if(tContent != NULL) |
745 |
if(tContent != NULL) |
| 745 |
{ |
746 |
{ |
| 746 |
int tContentSize = atoi(tContent); |
747 |
int tContentSize = atoi(tContent); |
| 747 |
if(pConn->recv.marker == 0 || strlen(pConn->recv.data+pConn->recv.marker) != tContentSize) |
748 |
if(pConn->recv.marker == 0 || pConn->recv.current-pConn->recv.marker != tContentSize) |
| 748 |
{ |
749 |
{ |
| 749 |
if(isLogEnabledFor(HEADER_LOG_LEVEL)) |
750 |
if(isLogEnabledFor(HEADER_LOG_LEVEL)) |
| 750 |
{ |
751 |
{ |
|
Lines 752-758
Link Here
|
| 752 |
if(pConn->recv.marker != 0) |
753 |
if(pConn->recv.marker != 0) |
| 753 |
{ |
754 |
{ |
| 754 |
xprintf("ContentPtr has %d, but needs %d\n", |
755 |
xprintf("ContentPtr has %d, but needs %d\n", |
| 755 |
strlen(pConn->recv.data+pConn->recv.marker), tContentSize); |
756 |
(pConn->recv.current-pConn->recv.marker), tContentSize); |
| 756 |
} |
757 |
} |
| 757 |
} |
758 |
} |
| 758 |
// check if value in tContent > 2nd read from client. |
759 |
// check if value in tContent > 2nd read from client. |
|
Lines 989-1003
Link Here
|
| 989 |
{ |
990 |
{ |
| 990 |
propogateCSeq(pConn); |
991 |
propogateCSeq(pConn); |
| 991 |
int tSize = 0; |
992 |
int tSize = 0; |
|
|
993 |
char *buffer = NULL; |
| 994 |
char *contentType = getFromHeader(pConn->recv.data, "Content-Type", &tSize); |
| 995 |
char *tContent = getFromHeader(pConn->recv.data, "Content-Length", NULL); |
| 996 |
int iContentSize = 0; |
| 997 |
int isJpg = 0; |
| 998 |
|
| 999 |
if(tContent != NULL) |
| 1000 |
{ |
| 1001 |
iContentSize = atoi(tContent); |
| 1002 |
} |
| 1003 |
|
| 1004 |
if( tSize > 1 && |
| 1005 |
(strncmp(contentType, "application/x-dmap-tagged", tSize) == 0) || |
| 1006 |
(strncmp(contentType, "image/jpeg", tSize) == 0) ) |
| 1007 |
{ |
| 1008 |
if( (pConn->recv.current - pConn->recv.marker) == iContentSize && pConn->recv.marker != 0) |
| 1009 |
{ |
| 1010 |
if(strncmp(contentType, "image/jpeg", tSize) == 0) |
| 1011 |
{ |
| 1012 |
isJpg = 1; |
| 1013 |
} |
| 1014 |
buffer = (char *)malloc(iContentSize * sizeof(char)); |
| 1015 |
memcpy(buffer, pConn->recv.data + pConn->recv.marker, iContentSize); |
| 1016 |
} |
| 1017 |
else |
| 1018 |
{ |
| 1019 |
iContentSize = 0; |
| 1020 |
} |
| 1021 |
} |
| 1022 |
else |
| 1023 |
{ |
| 1024 |
iContentSize = 0; |
| 1025 |
} |
| 992 |
char *tVol = getFromHeader(pConn->recv.data, "volume", &tSize); |
1026 |
char *tVol = getFromHeader(pConn->recv.data, "volume", &tSize); |
| 993 |
xprintf("About to write [vol: %.*s] data to hairtunes\n", tSize, tVol); |
1027 |
if( tVol) |
|
|
1028 |
{ |
| 1029 |
xprintf("About to write [vol: %.*s] data to hairtunes\n", tSize, tVol); |
| 1030 |
} |
| 994 |
// TBD VOLUME |
1031 |
// TBD VOLUME |
| 995 |
#ifndef XBMC |
1032 |
#ifndef XBMC |
| 996 |
write(pConn->hairtunes->in[1], "vol: ", 5); |
1033 |
write(pConn->hairtunes->in[1], "vol: ", 5); |
| 997 |
write(pConn->hairtunes->in[1], tVol, tSize); |
1034 |
write(pConn->hairtunes->in[1], tVol, tSize); |
| 998 |
write(pConn->hairtunes->in[1], "\n", 1); |
1035 |
write(pConn->hairtunes->in[1], "\n", 1); |
| 999 |
#else |
1036 |
#else |
| 1000 |
hairtunes_setvolume(atof(tVol)); |
1037 |
if(tVol) |
|
|
1038 |
{ |
| 1039 |
hairtunes_setvolume(atof(tVol)); |
| 1040 |
} |
| 1041 |
|
| 1042 |
if(iContentSize) |
| 1043 |
{ |
| 1044 |
if(isJpg) |
| 1045 |
{ |
| 1046 |
hairtunes_set_metadata_coverart(buffer, iContentSize); |
| 1047 |
} |
| 1048 |
else |
| 1049 |
{ |
| 1050 |
hairtunes_set_metadata(buffer, iContentSize); |
| 1051 |
} |
| 1052 |
free(buffer); |
| 1053 |
} |
| 1001 |
#endif |
1054 |
#endif |
| 1002 |
xprintf("Finished writing data write data to hairtunes\n"); |
1055 |
xprintf("Finished writing data write data to hairtunes\n"); |
| 1003 |
} |
1056 |
} |