On Fri, 17 Oct 2003, Edward Wildgoose wrote:
>what does: "Audio-described" mean?
I think it means an extra audio track which describes what's happening
for blind people. At least this is what I have assumed in the new
version of the
DTD: <http://cvs.sourceforge.net/viewcvs.py/xmltv/xmltv/todo/xmltv-0.6.dtd>.
>Also, question: The deaf sign word seems to have changed (to
>"Deaf-signed") and the old code was ignoring it anyway. However,
>rather than loose it completely could I *deliberately* add it to the
>description?
Okay, but we should do the same for other things too, see below.
>Is this something that has a proper way of being handled in either
>this DTD or the new one?
Yes, the new one handles it.
>The current changes look like this. Can you give it a cursory
>glance and advise whether this is acceptable
[including the patch inline - this is usually better than attaching,
at least for small patches]
> my $channelId = $new_prog->{_chanID};
> my $programmeId = $new_prog->{_progID};
> if ($GET_CATEGORIES) {
>- my $cat_ID = $prog_to_cat{"$channelId$programmeId"};
>- my $cat = $categories{$cat_ID};
>- if (defined $cat) {
>- push @{$new_prog->{category}}, [ lc $cat ];
>- }
>- else {
>- warn "unknown category id $cat\n";
>+ if (exists($prog_to_cat{"$channelId$programmeId"})) {
>+ my $cat_ID = $prog_to_cat{"$channelId$programmeId"};
>+ my $cat = $categories{$cat_ID};
>+ if (defined $cat) {
>+ push @{$new_prog->{category}}, [ $cat ];
>+ }
>+ else {
>+ warn "unknown category id $cat\n";
>+ }
> }
> }
> }
This must be to avoid an undefined value warning, and to warn before
any category information is lost. OK. But I think you should
suppress duplicate warnings;
my $warned_unknown_category;
...
warn "unknown category $cat\n"
unless $warned_unknown_category{$cat}++;
Does one ever see this warning while using the grabber?
> if ($GET_CATEGORIES) {
> my $cat_ID = $prog_to_cat{"$channelId$programmeId"};
>- my $cat = $categories{$cat_ID};
>- push @{$p{category}}, [ lc $cat ];
>+ if ($cat_ID and exists($categories{$cat_ID})) {
>+ my $cat = $categories{$cat_ID};
>+ push @{$p{category}}, [ $cat ];
>+ }
> }
OK - but here should also be a warning if not found. (Maybe
redundant, but it's simplest just to add it.)
>- elsif (s/^Deaf Signed,?\s*//) {
>- warn "discarding deaf-signed information\n"
>- unless $warned_discarding_deaf_signed++;
>+ elsif (s/^(Deaf-signed),?\s*//) {
>+ # Nowhere else to put this and its useful info, so add to
>description
>+ $p{desc}->[0]->[0] .= " ($1)";
> }
Make it recognize both the old and new wordings.
Appending the information to the end of the description is a good idea
(have you checked that there is always at least one description?) but
I think if you do it, it should be for other things too and not just
deaf-signed. Also there should still be a warning, displayed once
per download, because the warnings are there to remind me to fix the
DTD :-P.
Maybe you could make some kind of callback $unknown_info and then say
$unknown_info->($_);
This would print the warning and append to the first description.
>- warn "cannot find results in $data" if not @results;
>+ warn "cannot find results in data: $url" if not @results;
A good idea but should be done more generally; any warnings while
processing a page should include the URL. This can be done by
changing $SIG{__WARN__}; grep the existing code for that and you'll
see some examples.
I know that I am holding your changes to a higher standard than the
existing code, but I hope you'll be able to make the changes suggested
(or come up with a better way).
>P.S. Has anyone tried approaching radio times and asking if they
>would make the data available as XML?
I'm sure they wouldn't.
--
Ed Avis <ed@xxxxxxxxxxx>
-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo
The Event For Linux Datacenter Solutions & Strategies in The Enterprise
Linux in the Boardroom; in the Front Office; & in the Server Room
http://www.enterpriselinuxforum.com
|