[mythtv-users] Video insertion to match schedule database
Brian J. Murrell
brian at interlinx.bc.ca
Fri Feb 12 03:43:51 UTC 2010
On Thu, 2010-02-11 at 11:30 -0700, Pete Ashdown wrote:
>
> I want to pull MPEG files from another device and insert them into the
> MythTV database & storage with channel and recorded time, so it will
> properly correspond to the downloaded SchedulesDirect schedule, as if
> the inserted video had been recorded by mythtv-backend itself. I'd also
> like to have them commskipped. Is this possible and if so, how?
Yes. It's called myth.rebuilddatabase.pl, or rather a slightly modified
version of such.
I run that script, giving it the file to add to the database and it asks
the show name and then presents me with a list of all of the episodes
currently in the myth database (subtitle, channel, air date,
description), past and present. As long as I have not waited too long
to insert it, the recent episodes are still there and I can just choose
one.
If none of the listed episodes are the one I am inserting, I can opt to
insert the details (air date/time, channel, sub-title, description)
myself.
As I said, I have hacked it up a bit to provide that extra
functionality. Here's my patch against what's
in /usr/share/doc/mythtv-backend/contrib/recovery/myth.rebuilddatabase.pl in mythbunutu's 0.22 release:
--- /usr/share/doc/mythtv-backend/contrib/recovery/myth.rebuilddatabase.pl 2009-10-14 19:01:22.000000000 -0400
+++ /home/mythtv/bin/myth.rebuilddatabase.pl.new 2010-01-21 09:20:12.000000000 -0500
@@ -372,21 +372,48 @@
} else {
- $channel = GetAnswer("Enter channel", $channel);
- $newtitle = GetAnswer("... title", $newtitle);
- $newsubtitle = GetAnswer("... subtitle", $newsubtitle);
- $newdescription = GetAnswer("Description", $newdescription);
- $starttime = GetAnswer("... start time (YYYY-MM-DD HH:MM:SS)", $starttime);
+ $newtitle = GetAnswer("Enter title", $newtitle);
+ my $guess = "select chanid, title, subtitle, description, starttime, endtime from program where title=(?)";
+ $sth = $dbh->prepare($guess);
+ $sth->execute($newtitle)
+ or die "Could not execute ($guess)\n";
+
$recgroup = GetAnswer("... Recording Group", "Default");
- }
- if ($endtime) {
- $duration = (str2time($endtime) - str2time($starttime)) / 60;
- } else {
- $duration = "60";
+ my $num = 0;
+ my @rows;
+ while (my @row = $sth->fetchrow_array()){
+ push(@rows, \@row);
+ printf "%3d. channel: %2s title: %-20s subtitle: %-20s\n start time: %s end time: %s\n description: %s\n",
+ $num + 1, substr($row[0], -2, 2), $row[1], $row[2], $row[4], $row[5], $row[3];
+ $num++;
+ }
+ $num++;
+ printf("999. None of the above\n", );
+ my $row = GetAnswer("Which item", "1");
+
+ if ($row == 999) {
+ $newsubtitle = GetAnswer("... subtitle", $newsubtitle);
+ $channel = GetAnswer("... channel", $channel);
+ $newdescription = GetAnswer("Description", $newdescription);
+ $starttime = GetAnswer("... start time (YYYY-MM-DD HH:MM:SS)", $starttime);
+ $recgroup = GetAnswer("... Recording Group", "Default");
+
+ if ($endtime) {
+ $duration = (str2time($endtime) - str2time($starttime)) / 60;
+ } else {
+ $duration = "60";
+ }
+ $duration = GetAnswer("... duration (in minutes)", $duration);
+ $endtime = time_format("yyyy-mm{on}-dd hh:mm{in}:ss", str2time($starttime) + $duration * 60);
+ } else {
+ $newsubtitle = $rows[$row - 1][2];
+ $channel = $rows[$row - 1][0];
+ $newdescription = $rows[$row - 1][3];
+ $starttime = $rows[$row - 1][4];
+ $endtime = $rows[$row - 1][5];
+ }
}
- $duration = GetAnswer("... duration (in minutes)", $duration);
- $endtime = time_format("yyyy-mm{on}-dd hh:mm{in}:ss", str2time($starttime) + $duration * 60);
if ($norename) {
$mythfile = $showBase;
Cheers,
b.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20100211/f2718965/attachment.pgp>
More information about the mythtv-users
mailing list