[mythtv-commits] Ticket #3404: Patch to set the recording group of imported recordings via myth.rebuilddatabase.pl

MythTV mythtv at cvs.mythtv.org
Thu May 3 17:55:19 UTC 2007


#3404: Patch to set the recording group of imported recordings via
myth.rebuilddatabase.pl
-----------------------+----------------------------------------------------
 Reporter:  anonymous  |       Owner:  ijr    
     Type:  patch      |      Status:  new    
 Priority:  trivial    |   Milestone:  unknown
Component:  mythtv     |     Version:  unknown
 Severity:  low        |  
-----------------------+----------------------------------------------------
 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) {
 }}}

-- 
Ticket URL: <http://svn.mythtv.org/trac/ticket/3404>
MythTV <http://svn.mythtv.org/trac>
MythTV


More information about the mythtv-commits mailing list