From c28920dfc514bc63ee4502ce110e4fa874c5a007 Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Tue, 21 Aug 2007 20:20:36 +0100 Subject: [PATCH] Support for programme sub-titles. --- playonwii/index.php | 27 +++++++++++++++++++++------ src/gtvg_programmeinfo.py | 1 + src/gtvg_saxhandler.py | 4 ++++ 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/playonwii/index.php b/playonwii/index.php index 2a4337d..9b9cd2a 100644 --- a/playonwii/index.php +++ b/playonwii/index.php @@ -18,6 +18,7 @@ function pretty_date( $date ) function get_info_from_file( $fn ) { $title = ""; + $sub_title = ""; $date = ""; $channel = ""; @@ -39,6 +40,11 @@ function get_info_from_file( $fn ) $title = $v; break; } + case "sub_title": + { + $sub_title = $v; + break; + } case "startTime": { $date = $v; @@ -55,7 +61,7 @@ function get_info_from_file( $fn ) fclose( $handle ); } - return array( $title, $date, $channel ); + return array( $title, $date, $channel, $sub_title ); } function get_info_from_filename( $fn ) @@ -100,14 +106,16 @@ foreach( $sorted_fns as $filename ) if( array_key_exists( $infofn, $filenames ) ) { - list( $title, $date, $channel ) = get_info_from_file( $infofn ); + list( $title, $date, $channel, $sub_title ) = + get_info_from_file( $infofn ); } else { list( $title, $date ) = get_info_from_filename( $filename ); $channel = ""; + $sub_title = ""; } - $titles[$title][] = array( $num, $date, $channel ); + $titles[$title][] = array( $num, $date, $channel, $sub_title ); $num++; } } @@ -157,13 +165,20 @@ print "\n"; ksort( $titles ); foreach( $titles as $title => $arr ) { - list( $num, $date, $channel ) = $arr[0]; + list( $num, $date, $channel, $sub_title ) = $arr[0]; print "
$title(Large)"; foreach( $arr as $lst ) { - list( $num, $date, $channel ) = $lst; - print "" . pretty_date( $date ); + list( $num, $date, $channel, $sub_title ) = $lst; + print "" . pretty_date( $date ); if( $channel ) { diff --git a/src/gtvg_programmeinfo.py b/src/gtvg_programmeinfo.py index 83de595..a31c1b9 100644 --- a/src/gtvg_programmeinfo.py +++ b/src/gtvg_programmeinfo.py @@ -6,6 +6,7 @@ class ProgrammeInfo( gtvg_propertiesfile.PropertiesFile ): def __init__( self ): self.title = None + self.sub_title = None self.description = None self.channel = None self.channel_pretty = None diff --git a/src/gtvg_saxhandler.py b/src/gtvg_saxhandler.py index f02dde1..8c60c52 100644 --- a/src/gtvg_saxhandler.py +++ b/src/gtvg_saxhandler.py @@ -10,6 +10,7 @@ class SaxHandler: self.chars = "" self.callback = callback self.title = None + self.sub_title = None self.desc = "" self.channel = None self.startTime = None @@ -33,12 +34,15 @@ class SaxHandler: self.chars = self.chars.strip() if name == "title": self.title = self.chars + if name == "sub-title": + self.sub_title = self.chars if name == "desc": self.desc = self.chars elif name == "programme" and self.title != None: pi = gtvg_programmeinfo.ProgrammeInfo() pi.title = self.title + pi.sub_title = self.title pi.description = self.desc pi.channel = self.channel pi.startTime = self.startTime -- 2.11.4.GIT