Opened 14 years ago

Closed 13 years ago

#3404 closed patch (fixed)

Patch to set the recording group of imported recordings via myth.rebuilddatabase.pl

Reported by: anonymous Owned by: cpinkham
Priority: trivial Milestone: unknown
Component: mythtv Version: unknown
Severity: low Keywords: recording group myth.rebuilddatabase.pl contrib rebuild database
Cc: Ticket locked: no

Description

Attached is a minor update to the contributed tool "myth.rebuilddatabase.pl". The patch simply adds an additional question to allow for defining the recording group that the video should be imported in to.

The unified diff is as follows:

--- myth.rebuilddatabase.pl.old     2006-05-27 02:33:13.000000000 -0400
+++ myth.rebuilddatabase.pl.new     2007-05-03 11:55:11.000000000 -0400
@@ -188,7 +188,7 @@
 my $dbh = DBI->connect("dbi:mysql:database=$database:host=$dbhost",
                "$user","$pass") or die "Cannot connect to database ($!)\n";
 
-my ($starttime, $endtime, $title, $subtitle, $channel, $description);
+my ($starttime, $endtime, $title, $subtitle, $channel, $description, $recgroup);
 my ($syear, $smonth, $sday, $shour, $sminute, $ssecond, $eyear, $emonth, $eday,
                $ehour, $eminute, $esecond);
 
@@ -213,7 +213,7 @@
 $dir =~ s/\/$//;
 
 if ($show_existing) {
-       $q = "select title, subtitle, starttime, endtime, chanid from recorded order by starttime";
+       $q = "select title, subtitle, starttime, endtime, chanid, recgroup from recorded order by starttime";
        $sth = $dbh->prepare($q);
        $sth->execute or die "Could not execute ($q)\n";
 
@@ -225,6 +225,7 @@
                $starttime = $row[2];
                $endtime = $row[3];
                $channel = $row[4];
+               $recgroup = $row[5];
 
 ## get the pieces of the time
                if ($starttime =~ m/$db_date_regx/) {
@@ -243,6 +244,7 @@
                print "End time:   $emonth/$eday/$eyear - $ehour:$eminute:$esecond\n";
                print "Title:      $title\n";
                print "Subtitle:   $subtitle\n\n";
+               print "Group:      $recgroup\n\n";
        }
 }
 
@@ -357,6 +359,7 @@
         $newsubtitle = GetAnswer("... subtitle", $newsubtitle);
         $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;
@@ -377,14 +380,14 @@
         $mythfile = sprintf("%s_%s.%s", $channel, $time1, $ext);
     }
 
-    my $sql = "insert into recorded (chanid, starttime, endtime, title, subtitle, description, hostname, basename, progstart, progend) values ((?), (?), (?), (?), (?), (?), (?), (?), (?), (?))";
+    my $sql = "insert into recorded (chanid, starttime, endtime, title, subtitle, description, hostname, basename, progstart, progend, recgroup) values ((?), (?), (?), (?), (?), (?), (?), (?), (?), (?), (?))";
 
     if ($test_mode) {
 
         $sql =~ s/\(\?\)/"%s"/g;
         my $statement = sprintf($sql, $channel, $starttime, $endtime, $newtitle,
                                 $newsubtitle, $newdescription, $host, $mythfile,
-                                $starttime, $endtime);
+                                $starttime, $endtime, $recgroup);
         print("Test mode: insert would have been been:\n");
         print($statement, ";\n");
 
@@ -393,7 +396,7 @@
         $sth = $dbh->prepare($sql);
         $sth->execute($channel, $starttime, $endtime, $newtitle,
                       $newsubtitle, $newdescription, $host, $mythfile,
-                      $starttime, $endtime)
+                      $starttime, $endtime, $recgroup)
             or die "Could not execute ($sql)\n";
 
         if ($mythfile ne $showBase) {

Attachments (1)

myth.rebuilddatabase.pl (14.0 KB) - added by anonymous 14 years ago.

Download all attachments as: .zip

Change History (3)

Changed 14 years ago by anonymous

Attachment: myth.rebuilddatabase.pl added

comment:1 Changed 13 years ago by cpinkham

Owner: changed from Isaac Richards to cpinkham

comment:2 Changed 13 years ago by cpinkham

Resolution: fixed
Status: newclosed

(In [15395]) Allow setting the Recording Group on imported recordings when using myth.rebuilddatabase.pl.

Closes #3404 using patch attached to ticket.

Note: See TracTickets for help on using tickets.