diff -Naurb vdr-1.5.8.org/epg.c vdr-1.5.8/epg.c --- vdr-1.5.8.org/epg.c 2009-01-10 13:15:54.309620873 -0500 +++ vdr-1.5.8/epg.c 2009-01-10 13:25:37.612995505 -0500 @@ -18,6 +18,16 @@ #define RUNNINGSTATUSTIMEOUT 30 // seconds before the running status is considered unknown +static char* const critiques[8] = +{ + "", "*", "*½", "**", "**½", "***", "***½", "****" +}; + +static char* const ratings[8] = +{ + "NR/AO", "G", "PG", "PG-13", "R", "NR/AO", "", "NC-17" +}; + // --- tComponent ------------------------------------------------------------ cString tComponent::ToString(void) @@ -556,6 +566,39 @@ strcat(description, " (5.1)"); } + // Add event event rating and critique to the description. + + if (description != NULL) + { + char detailRating[strlen(description) + 22]; // Maximal string: "NR/AO [V,L,N,SC] ****" 21 chars + description + detailRating[0] = '\0'; + strcat(detailRating, ratings[(rating>>10) & 0x07]); + if (ratings[(rating>>10) & 0x07] != "") strcat(detailRating, " "); + if (rating & 0x35F) // Replace with 0x3FF when we know what bits 9 and 11 represent + { + strcat(detailRating, "["); + + if (rating & (0x0200 | 0x0010)) // Bit 7 or 12: Violence (counting from MSB) + strcat(detailRating, "V,"); + if (rating & (0x0008 | 0x0002)) // Bit 13 or 15: Language + strcat(detailRating, "L,"); + if (rating & (0x0040 | 0x0004)) // Bit 10 or 14: Nudity + strcat(detailRating, "N,"); + if (rating & (0x0100 | 0x0001)) // Bit 8 or 16: Sexual Content + strcat(detailRating, "SC,"); + if (rating & (0x0080 | 0x0020)) // Bit 9 or 11: Unknown + strcat(detailRating, "?,"); + char* s = strrchr(detailRating, ','); + if (s) s[0] = ']'; + if (s[0] = ']') strcat(detailRating, " "); + } + strcat(detailRating, critiques[rating>>13]); + if (critiques[rating>>13] != "") strcat(detailRating, " "); + description = (char *)realloc(description, strlen(description) + strlen(detailRating) + 1); + strcat(detailRating, description); + strcpy(description, detailRating); + // printf("rating=%s\n", description);*/ + } // Some channels apparently try to do some formatting in the texts, // which is a bad idea because they have no way of knowing the width // of the window that will actually display the text.