Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#3201 closed defect (fixed)

Nuvexport error when running with arguments from cli

Reported by: anonymous Owned by: xris
Priority: minor Milestone: 0.21
Component: perl / nuvexport Version: head
Severity: medium Keywords: nuvexport
Cc: Ticket locked: no

Description

When running nuvexport with --infile argument from cli I am getting this error: "Can't call method "prepare" on an undefined value at /usr/local/share/nuvexport/nuv_export/ui.pm line 63" Perl bindings need a protocol bump too. (32!=33).

Change History (6)

comment:1 Changed 13 years ago by xris

Resolution: fixed
Status: newclosed

(In [13030]) Replace all db calls with the proper MythTV object parameter/methods. This closes #3201

comment:2 Changed 12 years ago by anonymous

Resolution: fixed
Status: closedreopened

I still have the problem. I am invoking nuvexport with --infile /path/to/recordings/recording.extension following patch works:

Index: ui.pm
===================================================================
--- ui.pm       (revision 13775)
+++ ui.pm       (working copy)
@@ -11,6 +11,7 @@
 package nuv_export::ui;
 
     use File::Path;
+    use File::Basename;
     use English;
 
 # Load the myth and nuv utilities, and make sure we're connected to the database
@@ -60,11 +61,11 @@
         # Filename specified on the command line -- extract the chanid and starttime
             if (arg('infile')) {
             # Try to pick out the chanid and starttime from the database
-                my $sh = $Myth->{'dbh'}->prepare('SELECT chanid, UNIX_TIMESTAMP(starttime) FROM recorded WHERE basename=?');
+                my $sh = $Main::Myth->{'dbh'}->prepare('SELECT chanid, UNIX_TIMESTAMP(starttime) FROM recorded WHERE basename=?');
                 if ($sh) {
                 # Stip off the video directory so the basename will actually match
                     my $infile = arg('infile');
-                    $infile =~ s/^$video_dir\/*//;
+                    $infile = basename($infile);
                 # Look up the file
                     $rows = $sh->execute($infile);
                     if (defined $rows) {
@@ -86,7 +87,7 @@
             # Make sure the requested show exists
                 foreach my $show (sort keys %Shows) {
                     foreach my $episode (@{$Shows{$show}}) {
-                        next unless ($chanid == $episode->{'channel'} && $starttime == $episode->{'starttime'});
+                        next unless ($chanid == $episode->{'chanid'} && $starttime == $episode->{'starttime'});
                         load_finfo($episode);
                         push @matches, $episode;
                         last;

comment:3 Changed 12 years ago by xris

Resolution: fixed
Status: reopenedclosed

(In [14634]) Apply slightly-modified version of the patch to fix the infile parameter for nuvexport. should close #3201

comment:4 Changed 12 years ago by xris

(In [14635]) re #3201, code cleanup

comment:5 Changed 12 years ago by xris

(In [14636]) re #3201, I hate namespaces sometimes

comment:6 Changed 12 years ago by xris

(In [14637]) re #3201, fix the starttime vs recstartts naming issue, too

Note: See TracTickets for help on using tickets.