diff --git a/upnpsoap.c b/upnpsoap.c index a41e6a6..f8ccb9d 100644 --- a/upnpsoap.c +++ b/upnpsoap.c @@ -99,8 +99,9 @@ * 800-899 TBD Action-specific errors for non-standard actions. * Defined by UPnP vendor. */ +#define SoapError(x,y,z) _SoapError(x,y,z,__func__) static void -SoapError(struct upnphttp * h, int errCode, const char * errDesc) +_SoapError(struct upnphttp * h, int errCode, const char * errDesc, const char *func) { static const char resp[] = "filter & FILTER_BOOKMARK_MASK) ) { /* Get bookmark */ int sec = sql_get_int_field(db, "SELECT SEC from BOOKMARKS where ID = '%s'", detailID); - if( sec > 0 && (passed_args->filter & FILTER_UPNP_LASTPLAYBACKPOSITION) ) { + if( sec > 0 ) { /* This format is wrong according to the UPnP/AV spec. It should be in duration format, ** so HH:MM:SS. But Kodi seems to be the only user of this tag, and it only works with a ** raw seconds value. ** If Kodi gets fixed, we can use duration_str(sec * 1000) here */ - ret = strcatf(str, "<upnp:lastPlaybackPosition>%d</upnp:lastPlaybackPosition>", - sec); + if( passed_args->filter & FILTER_UPNP_LASTPLAYBACKPOSITION ) + ret = strcatf(str, "<upnp:lastPlaybackPosition>%d</upnp:lastPlaybackPosition>", + sec); + if( passed_args->filter & FILTER_SEC_DCM_INFO ) + ret = strcatf(str, "<sec:dcmInfo>CREATIONDATE=0,FOLDER=%s,BM=%d</sec:dcmInfo>", + title, sec); } - if( passed_args->filter & FILTER_SEC_DCM_INFO ) - ret = strcatf(str, "<sec:dcmInfo>CREATIONDATE=0,FOLDER=%s,BM=%d</sec:dcmInfo>", - title, sec); if( passed_args->filter & FILTER_UPNP_PLAYBACKCOUNT ) { ret = strcatf(str, "<upnp:playbackCount>%d</upnp:playbackCount>", sql_get_int_field(db, "SELECT WATCH_COUNT from BOOKMARKS where ID = '%s'", detailID));