Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
remove trailing spaces from title and subtitle
  • Loading branch information
mario-tux authored and perexg committed Sep 17, 2014
1 parent e5137f8 commit 45bb1c8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/epggrab/module/opentv.c
Expand Up @@ -20,6 +20,7 @@
#include <assert.h>
#include <unistd.h>
#include <regex.h>
#include <ctype.h>
#include "tvheadend.h"
#include "channels.h"
#include "huffman.h"
Expand Down Expand Up @@ -349,6 +350,12 @@ opentv_parse_event_section
if ((ee = epg_broadcast_get_episode(ebc, 1, &save))) {
tvhdebug("opentv", " find episode %p", ee);
if (ev.title) {
int size;

size = strlen(ev.title);
while (size > 0 && isspace(ev.title[size - 1]))
ev.title[--size] = '\0';

tvhdebug("opentv", " title %s", ev.title);
save |= epg_episode_set_title(ee, ev.title, lang, src);
}
Expand Down Expand Up @@ -389,6 +396,8 @@ opentv_parse_event_section
for (i = 0; i < ARRAY_SIZE(_opentv_subtitle_patterns); i++) {
if (!regexec(_opentv_subtitle_pregs+i, ev.summary, 2, match, 0) && match[1].rm_so != -1) {
size = MIN(match[1].rm_eo - match[1].rm_so, sizeof(buf) - 1);
while (size > 0 && isspace(ev.summary[match[1].rm_so + size - 1]))
size--;
memcpy(buf, ev.summary + match[1].rm_so, size);
buf[size] = '\0';
tvhdebug("opentv", " extract from summary subtitle %s", buf);
Expand Down

0 comments on commit 45bb1c8

Please sign in to comment.