]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
eit: combine title and subtitle when scraping title with ' % ', fixes #4873
authorJim Hague <jim@sinodun.com>
Wed, 14 Feb 2018 10:15:56 +0000 (10:15 +0000)
committerJaroslav Kysela <perex@perex.cz>
Thu, 22 Feb 2018 15:33:43 +0000 (16:33 +0100)
Currently title and subtitle are combined by joining with a single space.
If the scrape is attempting to just modify the title, that's a problem
because you don't know where the title ends.

So instead join with ' % '. % isn't a regex metachar, so this is
convenient for use in regexes.

Update scraper test engine and UK regexes to match.

data/conf/epggrab/eit/scrape/uk
src/epggrab/module/eit.c
support/eitscrape_test.py

index de3191ff0ca9316070d8a7c3691e7ffa568dee46..346c065d0ccfb2f5cb9f61386d998538aea407cc 100644 (file)
@@ -23,7 +23,7 @@
       "New[.:] "
   ],
   "scrape_title": [
-      "^(.+)[.]{3}( )[.]{3}([^.?!:]+)(?:([?!])|[:.])"
+      "^(.+)[.]{3}( )[.]{3}([^.?!:]+)(?:([?!])|[:.])"
   ],
   "scrape_subtitle": [
     {
@@ -53,7 +53,7 @@
   ],
   "pcre": {
     "scrape_title": [
-      "^(.+)[.]{3}( )[.]{3}(.*?)(?:([?!])|[:]|(?<!Dr|Prof|Rev|Mr|Mrs|Ms|[.][^.])[.]) "
+      "^(.+)[.]{3}( )[.]{3}(.*?)(?:([?!])|[:]|(?<!Dr|Prof|Rev|Mr|Mrs|Ms|[.][^.])[.]) "
     ],
     "scrape_subtitle": [
       {
index 6248031be7788eecb80f37f9ae1b8480fe51aadb..6e23ce5df466370602cdd42dcd137639f40f2402 100644 (file)
@@ -557,7 +557,7 @@ _eit_scrape_text(eit_module_t *eit_mod, eit_event_t *ev)
     char title_summary[2048];
     lang_str_t *ls = lang_str_create();
     RB_FOREACH(se, ev->title, link) {
-      snprintf(title_summary, sizeof(title_summary), "%s %s",
+      snprintf(title_summary, sizeof(title_summary), "%s %% %s",
                se->str, lang_str_get(ev->summary, se->lang));
       if (eit_pattern_apply_list(buffer, sizeof(buffer), title_summary, se->lang, &eit_mod->p_scrape_title)) {
         tvhtrace(LS_TBL_EIT, "  scrape title '%s' from '%s' using %s",
index 1c95d60431c9fe5fa9d7bbbad054f39b8e13e2ab..831a0d6b77f23225569362480dd96fbcad0a11fd 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright (C) 2017 Tvheadend Foundation CIC
+# Copyright (C) 2017, 2018 Tvheadend Foundation CIC
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -170,7 +170,7 @@ class EITScrapeTest(object):
       canonical, _, _ = key.partition(':')
       text = test['summary']
       if canonical == 'new_title':
-        text = test['title'] + ' ' + text
+        text = test['title'] + ' ' + text
       if 'language' in test:
         lang = test['language']
       else: