]> git.etc.gen.nz Git - mythtv-epg-nz.git/commitdiff
Import 0.6.3 of xmltv-proc-nz master
authorAndrew Ruthven <andrew@etc.gen.nz>
Sun, 1 Jan 2023 06:27:26 +0000 (19:27 +1300)
committerAndrew Ruthven <andrew@etc.gen.nz>
Sun, 1 Jan 2023 06:27:26 +0000 (19:27 +1300)
bin/xmltv-proc-nz

index c218782c8c767ba1938e0d7d352b831321b9892e..ed6865ce1136e6bbc488ada9f082e22a40272de0 100644 (file)
@@ -51,6 +51,10 @@ JSW = Stephen Worthington <stephen@jsw.gen.nz>
 0.6.2  JSW
        - Add a file:/// URL to JSON_BASE_URLS to support the use of /etc/mythtv-epg-nz for configuring xmltv-proc-nz, as required for
          Andrew Ruthven's .deb install.
+0.6.3  JSW
+       - Fix Sky Movies procssing, so that it works.
+       - Sky Movies: Move PREMIERE to description.
+       - Sky Movies: Join up split titles where part of the title is in the subtitle.
 """
 #TODO: Find repeats
 #TODO: Regex replacements for categories
@@ -752,13 +756,13 @@ class SkyMoviesChannels(BaseProcessor):
         self.sky_movies_xmltvid_list = None
         for json_base_url in JSON_BASE_URLS:
             try:
-                data = urlopen('%s/sky_movies_xmltvids/+json' % json_base_url).read()
+                data = urlopen('%s/sky-movies-xmltvids/+json' % json_base_url).read()
             except IOError:
                 log.warning('SkyMoviesChannels: Fetching data from %s failed.' % json_base_url)
             else:
                 try:
                     sky_movies_xmltvid_list = json.loads(data)
-                    if self.categories == None:
+                    if self.sky_movies_xmltvid_list == None:
                         self.sky_movies_xmltvid_list = sky_movies_xmltvid_list
                     else:
                         self.sky_movies_xmltvid_list += sky_movies_xmltvid_list
@@ -783,7 +787,26 @@ class SkyMoviesChannels(BaseProcessor):
                 )
             else:
                 #sys.stderr.write('programme=' + ElementTree.tostring(programme, encoding='utf-8') + '\n')
-                programme.find('desc').text = programme.find('sub-title').text + ' ' + programme.find('desc').text
+                title = programme.find('title').text
+                subtitle = programme.find('sub-title').text
+                premiere = False
+                if title != 'Stay tuned...' and title != 'On DUKE today...':
+                    if title[0:9] == 'PREMIERE ':
+                        premiere = True
+                        title = title[9:]
+                    if title[0:10] == 'PREMIERE: ':
+                        premiere = True
+                        title = title[10:]
+                    if title[-3:] == '...':
+                        if subtitle[0:3] == '...':
+                            subtitle = subtitle[3:]
+                        location = subtitle.find('. ')
+                        if location != -1:
+                            title_second_part = subtitle[0:location]
+                            subtitle = subtitle[location+2:]
+                            title = title[0:-3] + ' ' + title_second_part
+                programme.find('title').text = title
+                programme.find('desc').text = ('PREMIERE: ' if premiere else '') + subtitle + ' ' + programme.find('desc').text
                 programme.find('sub-title').text = ''
                 log.info(
                     'SkyMoviesChannels: channel=%s title=%s fixed',