tivo: Fix title and description escaping.

This commit is contained in:
Justin Maggard 2015-04-08 23:38:38 -07:00
parent e165dbf7a9
commit 0845c2193b

View File

@ -123,6 +123,7 @@ tivo_unescape_tag(char *tag)
modifyString(tag, "<", "<", 1); modifyString(tag, "<", "<", 1);
modifyString(tag, ">", ">", 1); modifyString(tag, ">", ">", 1);
modifyString(tag, ">", ">", 1); modifyString(tag, ">", ">", 1);
modifyString(tag, """, """, 1);
return tag; return tag;
} }
@ -185,13 +186,8 @@ callback(void *args, int argc, char **argv, char **azColName)
episode = strstr(title, " - "); episode = strstr(title, " - ");
if( episode ) if( episode )
{ {
strcatf(str, "<Title>%.*s</Title>" strcatf(str, "<EpisodeTitle>%s</EpisodeTitle>", episode+3);
"<EpisodeTitle>%s</EpisodeTitle>", *episode = '\0';
(int)(episode-title), title, episode+3);
}
else
{
strcatf(str, "<Title>%s</Title>", title);
} }
if( date ) if( date )
{ {
@ -202,13 +198,13 @@ callback(void *args, int argc, char **argv, char **azColName)
strcatf(str, "<CaptureDate>0x%X</CaptureDate>", (unsigned int)mktime(&tm)); strcatf(str, "<CaptureDate>0x%X</CaptureDate>", (unsigned int)mktime(&tm));
} }
if( comment ) if( comment )
strcatf(str, "<Description>%s</Description>", comment); strcatf(str, "<Description>%s</Description>", tivo_unescape_tag(comment));
} }
else else
{ {
return 0; return 0;
} }
strcatf(str, "<Title>%s</Title>", tivo_unescape_tag(title)); strcatf(str, "<Title>%s</Title>", title);
if( artist ) { if( artist ) {
strcatf(str, "<ArtistName>%s</ArtistName>", tivo_unescape_tag(artist)); strcatf(str, "<ArtistName>%s</ArtistName>", tivo_unescape_tag(artist));
} }