In message <[EMAIL PROTECTED]>
Graeme Wilford <[EMAIL PROTECTED]> wrote:
> On 11/01/06, Tom Hughes <[EMAIL PROTECTED]> wrote:
>
>> I've patched tv_grab_uk_rt to remove the episode number from the
>> subtitle and output them as proper episode numbers in the XML instead
>> which resolves these problems (though there are others with the
>> Radio Times data).
>>
>> I did submit the patch to the xmltv guys a while back but haven't
>> heard anything about it.
>
> Any chance you could post the patch somewhere or mail me a copy? The
> latest version of xmltv I've tried (0.5.40) doesn't seem to contain
> your patch and I was thinking about hacking the script myself or doing
> a post-import database fixup.
Oh I know it isn't in yet. I sent the patch to the xmltv mailing
list but they don't seem to have done anything with it.
The patch is attached, along with a perl script that I used to cleanup
my existing database entries after I had applied the patch. You'll
need to fill in the host/user/password at the top of that script if
you want to use it.
Tom
--
Tom Hughes ([EMAIL PROTECTED])
http://www.compton.nu/
--- tv_grab_uk_rt.orig 2005-09-09 09:21:07.000000000 +0100
+++ tv_grab_uk_rt 2005-09-09 09:21:12.000000000 +0100
@@ -365,6 +365,19 @@
}
my %p = (channel => $ch, title => [ [ $title ] ]);
+ if (defined $sub_title &&
+ ($sub_title =~ /^(\d+)\/(\d+)$/ ||
+ $sub_title =~ /^(\d+)\/(\d+)\s+-\s+/))
+ {
+ my $episode = $1 - 1;
+ my $episodes = $2;
+
+ $p{'episode-num'} = [ [ " . ${episode}/${episodes} . ", "xmltv_ns" ] ];
+
+ $sub_title =~ s/^(\d+)\/(\d+)(?:\s+-\s+)?//;
+
+ undef $sub_title if $sub_title =~ /^\s*$/;
+ }
for ($sub_title) { $p{'sub-title'} = [ [ $_ ] ] if defined }
for ($year) { $p{date} = $_ if defined }
for ($director) { $p{credits}{director} = [ $_ ] if defined }
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
my $host = "";
my $user = "";
my $password = "";
my $dbh = DBI->connect("dbi:mysql:database=mythconverg;host=${host}", $user,
$password) || die $DBI::errstr;
$dbh->{AutoCommit} = 0;
for my $table (qw(program recorded oldrecorded))
{
my $select = $dbh->prepare(qq{
SELECT chanid, starttime, title, subtitle
FROM $table
WHERE subtitle RLIKE '^[0-9]+/[0-9]+[[:>:]]'
}) || die $dbh->errstr;
my $updatesubtitle = $dbh->prepare(qq{
UPDATE $table
SET subtitle = ?
WHERE chanid = ? AND starttime = ?
}) || die $dbh->errstr;
my $updateepisode = $dbh->prepare(qq{
UPDATE $table
SET syndicatedepisodenumber = ?
WHERE chanid = ? AND starttime = ?
}) || die $dbh->errstr;
$select->execute() || die $select->errstr;
while (my $row = $select->fetchrow_hashref())
{
my $chanid = $row->{chanid};
my $starttime = $row->{starttime};
my $title = $row->{title};
my $subtitle = $row->{subtitle};
my $episode;
if ($subtitle =~ m|^(\d+)/(\d+)\s+-\s+|)
{
$episode = "E$1";
$subtitle =~ s|^(\d+)/(\d+)\s+-\s+||;
}
elsif ($subtitle =~ m|^(\d+)/(\d+)$|)
{
$episode = "E$1";
$subtitle = "";
}
else
{
print "!!!! $table : $title : $subtitle\n";
}
if (defined($episode))
{
$updatesubtitle->execute($subtitle, $chanid, $starttime);
if ($table eq "program")
{
$updateepisode->execute($episode, $chanid, $starttime);
}
}
}
}
$dbh->commit() || die $dbh->errstr;
$dbh->{AutoCommit} = 1;
$dbh->disconnect();
exit 0;
_______________________________________________
mythtv-users mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users