xmltv/filter tv_to_latex, 1.17, 1.18 tv_to_text, 1.5, 1.6

Geoff <[email protected]>
Newsgroups gmane.comp.tv.xmltv.cvs
Message-ID <[email protected]>
Update of /cvsroot/xmltv/xmltv/filter
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7244

Modified Files:
	tv_to_latex tv_to_text 
Log Message:
add description to output when optional argument "--with-desc"  (FR #41)

Index: tv_to_latex
===================================================================
RCS file: /cvsroot/xmltv/xmltv/filter/tv_to_latex,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** tv_to_latex	29 Jun 2003 15:53:51 -0000	1.17
--- tv_to_latex	5 May 2014 16:02:53 -0000	1.18
***************
*** 9,13 ****
  =head1 SYNOPSIS
  
! tv_to_latex [--help] [--output FILE] [FILE...]
  
  =head1 DESCRIPTION
--- 9,13 ----
  =head1 SYNOPSIS
  
! tv_to_latex [--help] [--with-desc] [--output FILE] [FILE...]
  
  =head1 DESCRIPTION
***************
*** 16,19 ****
--- 16,21 ----
  The programme titles, subtitles, times and channels are shown.
  
+ B<--with-desc> include programme description in output
+ 
  B<--output FILE> write to FILE rather than standard output
  
***************
*** 78,82 ****
  use XMLTV::Usage <<END
  $0: convert listings to LaTeX source for printing
! usage: $0 [--help] [--output FILE] [FILE...]
  END
  ;
--- 80,84 ----
  use XMLTV::Usage <<END
  $0: convert listings to LaTeX source for printing
! usage: $0 [--help] [--with-desc] [--output FILE] [FILE...]
  END
  ;
***************
*** 84,89 ****
  sub quote( $ );
  
! my ($opt_help, $opt_output);
! GetOptions('help' => \$opt_help, 'output=s' => \$opt_output) or usage(0);
  usage(1) if $opt_help;
  @ARGV = ('-') if not @ARGV;
--- 86,91 ----
  sub quote( $ );
  
! my ($opt_help, $opt_output, $opt_withdesc);
! GetOptions('help' => \$opt_help, 'output=s' => \$opt_output, 'with-desc' => \$opt_withdesc) or usage(0);
  usage(1) if $opt_help;
  @ARGV = ('-') if not @ARGV;
***************
*** 92,96 ****
        or die "cannot write to $opt_output: $!";
  }
! 
  
  ########
--- 94,98 ----
        or die "cannot write to $opt_output: $!";
  }
! $opt_withdesc = 0 if !defined $opt_withdesc;
  
  ########
***************
*** 100,103 ****
--- 102,106 ----
  # Width of programme title
  my $WIDTH = '0.7\textwidth';
+ $WIDTH = '0.35\textwidth' if $opt_withdesc;		# adjust column width if outputting description
  
  # Number of programmes in each table (should fit onto a page)
***************
*** 155,159 ****
      }
  
!     print '\begin{tabular}{r@{--}lp{', $WIDTH, '}r} ', "\n"
        if not $table_size++;
      print $tex;
--- 158,162 ----
      }
  
!     print '\begin{tabular}{r@{--}lp{', $WIDTH, '}r', ($opt_withdesc ? "p{$WIDTH}" : ''), '} ', "\n"
        if not $table_size++;
      print $tex;
***************
*** 169,173 ****
      }
      else {
! 	my ($start, $stop, $title, $sub_title, $channel)
  	  = map { defined() ? quote($to_latin1->($_)) : undef } @$_;
  	die if not defined $start;
--- 172,176 ----
      }
      else {
! 	my ($start, $stop, $title, $sub_title, $channel, $desc)
  	  = map { defined() ? quote($to_latin1->($_)) : undef } @$_;
  	die if not defined $start;
***************
*** 182,186 ****
  	$stop = '' if not defined $stop;
  	$title .= " // $sub_title" if defined $sub_title;
! 	my $row = <<END
  \\smallskip
  $start & $stop &
--- 185,203 ----
  	$stop = '' if not defined $stop;
  	$title .= " // $sub_title" if defined $sub_title;
! 	$desc = '' if not defined $desc;
! 	my $row;
! 	if ($opt_withdesc) {
! 		$row = <<END
! \\smallskip
! $start & $stop &
! { \\small \\raggedright
! $title
! } & $channel &
! { \\small \\raggedright 
! $desc 
! } \\\\
! END
! 	} else {
! 		$row = <<END
  \\smallskip
  $start & $stop &
***************
*** 189,193 ****
  } & $channel \\\\
  END
! ;
          print_row($row);
      }
--- 206,210 ----
  } & $channel \\\\
  END
! 	}
          print_row($row);
      }

Index: tv_to_text
===================================================================
RCS file: /cvsroot/xmltv/xmltv/filter/tv_to_text,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** tv_to_text	21 Feb 2012 19:37:20 -0000	1.5
--- tv_to_text	5 May 2014 16:02:54 -0000	1.6
***************
*** 9,13 ****
  =head1 SYNOPSIS
  
! tv_to_text [--help] [--output FILE] [FILE...]
  
  =head1 DESCRIPTION
--- 9,13 ----
  =head1 SYNOPSIS
  
! tv_to_text [--help] [--with-desc] [--output FILE] [FILE...]
  
  =head1 DESCRIPTION
***************
*** 16,19 ****
--- 16,21 ----
  subtitles, times and channels are shown.
  
+ B<--with-desc> include programme description in output
+ 
  B<--output FILE> write to FILE rather than standard output
  
***************
*** 54,63 ****
  use XMLTV::Usage <<END
  $0: convert listings to plain text
! usage: $0 [--help] [--output FILE] [FILE...]
  END
  ;
  
! my ($opt_help, $opt_output);
! GetOptions('help' => \$opt_help, 'output=s' => \$opt_output) or usage(0);
  usage(1) if $opt_help;
  @ARGV = ('-') if not @ARGV;
--- 56,65 ----
  use XMLTV::Usage <<END
  $0: convert listings to plain text
! usage: $0 [--help] [--with-desc] [--output FILE] [FILE...]
  END
  ;
  
! my ($opt_help, $opt_output, $opt_withdesc);
! GetOptions('help' => \$opt_help, 'output=s' => \$opt_output, 'with-desc' => \$opt_withdesc) or usage(0);
  usage(1) if $opt_help;
  @ARGV = ('-') if not @ARGV;
***************
*** 66,69 ****
--- 68,72 ----
        or die "cannot write to $opt_output: $!";
  }
+ $opt_withdesc = 0 if !defined $opt_withdesc;
  
  # FIXME maybe memoize some stuff here
***************
*** 77,84 ****
  	next;
      }
!     my ($start, $stop, $title, $sub_title, $channel) = @$_;
      $stop = '' if not defined $stop;
      $title .= " // $sub_title" if defined $sub_title;
!     print "$start--$stop\t$title\t$channel\n";
      $wrote_prog = 1;
  }
--- 80,87 ----
  	next;
      }
!     my ($start, $stop, $title, $sub_title, $channel, $desc) = @$_;
      $stop = '' if not defined $stop;
      $title .= " // $sub_title" if defined $sub_title;
!     print "$start--$stop\t$title\t$channel\t". ( $opt_withdesc && defined $desc ? $desc : '' ) . "\n";
      $wrote_prog = 1;
  }


------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
&#149; 3 signs your SCM is hindering your productivity
&#149; Requirements for releasing software faster
&#149; Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.