bin/xmltv2html.rb in xmltv2html-0.7.0 vs bin/xmltv2html.rb in xmltv2html-0.7.1

- old
+ new

@@ -2,11 +2,11 @@ # With Ruby 1.8.3, yaml gives a lot of warnings... :-(( Fixed with 1.8.4 #!/usr/bin/env ruby # # xmltv2html.rb - A Ruby script to transform the XMLTV output into HTML. # -# Version : 0.7.0 +# Version : 0.7.1 # Author : Kurt V. Hindenburg <public@kurt.hindenburg.name> # # Copyright (C) 2003, 2004, 2005 Kurt V. Hindenburg # # This program is free software; you can redistribute it and/or modify @@ -73,12 +73,12 @@ require 'singleton' require 'time' require 'set' require 'ostruct' -XMLTV2HTML_VERSION="0.7.0" -XMLTV2HTML_DATE="Feb 13, 2006" +XMLTV2HTML_VERSION="0.7.1" +XMLTV2HTML_DATE="Feb 20, 2006" class Time class << self ### Time.<method> @@ -133,10 +133,11 @@ :channels_interval => 4, :time_format_12 => true, :use_favorites => false, :output_favorites => false, :favorites_list => [], + :favorites_sort_by_date => true, :css_filename => 'xmltv2html.css', :categories => {}, :output_date_in_time => false, :date_format => '%a %d', :use_programme_popup => true, @@ -254,11 +255,11 @@ end class Programme attr_reader :title, :subtitle, :span, :times, :desc, :rating, :category - attr_reader :previouslyShown, :spanSlots, :startSlot + attr_reader :previouslyShown, :spanSlots, :startSlot, :channelid attr_accessor :startTimeStr, :stopTimeStr attr_accessor :startTime, :stopTime, :popupIndex def initialize(title, subtitle, channel, start, stop, desc, rating, cats, rerun) @title = title @@ -383,11 +384,10 @@ end class Channel attr_reader(:name, :id, :fullname) attr_accessor(:programmes) -# attr_reader(:programmes) attr_accessor(:totalSpan) def initialize(id, fn) @id = id @fullname = fn @@ -1242,22 +1242,32 @@ end print '</td>'; nl end def output_favorites_list(fav_list) - fav_list = fav_list.sort! { |a, b| a.title<=>b.title } - - + if @@options[:favorites_sort_by_date] + fav_list = fav_list.sort! { |a, b| a.startTime<=>b.startTime } + else + fav_list = fav_list.sort! { |a, b| a.title<=>b.title } + end + print '<br><br>'; nl print '<table width="100%" border="3" cellpadding="3">'; nl - print '<tr><td colspan="3" align="center">Favorites</td></tr>'; nl - print '<tr><td width="50%" align="center" nowrap>Title</td>'; - print '<td width="25%" align="center">Start</td>'; - print '<td width="25%" align="center">Stop</td>'; + print '<tr><td colspan="4" align="center">Favorites</td></tr>'; nl + print '<tr><td width="15%" align="center" nowrap>Channel</td>'; + print '<td width="45%" align="center" nowrap>Title</td>'; + print '<td width="20%" align="center">Start</td>'; + print '<td width="20%" align="center">Stop</td>'; print '</tr>'; nl + channels = Channels.instance + fav_list.each { |p| print '<tr>'; nl + + print '<td class="channel">'; nl + print channels[p.channelid].fullname + print '</td>'; nl outputProgramme(p, p.popupIndex, 1) print '<td align="center">'; nl print p.startTime.strftime("%a %b %d %I:%M %p")