On Apr 2, 2005 2:56 AM, Chris Petersen <[EMAIL PROTECTED]> wrote:
> > I just saw a post from Chris Peterson saying he's been doing work on
> > nuvexport lately.  I've made a few changes myself to allow nuvexport
> > to be run from the job queue as a user job.
> 
> Cool, want to send a patch?

Sure, it's attached. :)  This patch adds a --quiet flag which should
suppress printing of normal output, but still allow errors to be
printed.  I didn't make any changes in ui.pm so --quiet should still
work correctly in interactive mode (i.e. you should see prompts for
confirmation/entering of values, but no output after that except for
errors), although I'm not sure why you'd want to use it for that mode.
 I tested cli-only mode for xvid, divx and dvd output using ffmpeg and
transcode and all seemed to be well.  I am currently running a job
from the myth job queue using my patched version and will let you know
how that run turns out although I expect it to run with no problems.

This patch also includes some changes to export/ffmpeg/DVD.pm to check
the $is_cli flag and not prompt the user for confirmation of values if
$is_cli is set.

Brad
diff -ru nuvexport-0.2/export/ffmpeg/ASF.pm nuvexport-0.2.patched/export/ffmpeg/ASF.pm
--- nuvexport-0.2/export/ffmpeg/ASF.pm	2005-03-16 01:46:35.000000000 -0500
+++ nuvexport-0.2.patched/export/ffmpeg/ASF.pm	2005-04-02 14:48:29.000000000 -0500
@@ -125,7 +125,7 @@
             my $path_bak = $self->{'path'};
             $self->{'path'} = '/dev/null';
         # First pass
-            print "First pass...\n";
+            print "First pass...\n" unless $QUIET;
             $self->{'ffmpeg_xtra'} = ' -vcodec msmpeg4'
                                    . ' -b ' . $self->{'v_bitrate'}
                                    . ' -minrate 32 -maxrate '.(2*$self->{'v_bitrate'}).' -bt 32'
@@ -137,7 +137,7 @@
         # Restore the path
             $self->{'path'} = $path_bak;
         # Second pass
-            print "Final pass...\n";
+            print "Final pass...\n" unless $QUIET;
             $self->{'ffmpeg_xtra'} = ' -vcodec msmpeg4'
                                    . ' -b ' . $self->{'v_bitrate'}
                                    . ' -minrate 32 -maxrate '.(2*$self->{'v_bitrate'}).' -bt 32'
diff -ru nuvexport-0.2/export/ffmpeg/DivX.pm nuvexport-0.2.patched/export/ffmpeg/DivX.pm
--- nuvexport-0.2/export/ffmpeg/DivX.pm	2005-03-16 11:40:49.000000000 -0500
+++ nuvexport-0.2.patched/export/ffmpeg/DivX.pm	2005-04-02 14:48:18.000000000 -0500
@@ -127,7 +127,7 @@
             my $path_bak = $self->{'path'};
             $self->{'path'} = '/dev/null';
         # First pass
-            print "First pass...\n";
+            print "First pass...\n" unless $QUIET;
             $self->{'ffmpeg_xtra'} = ' -vcodec mpeg4'
                                    . ' -b ' . $self->{'v_bitrate'}
                                    . ' -minrate 32 -maxrate '.(2*$self->{'v_bitrate'}).' -bt 32'
@@ -140,7 +140,7 @@
         # Restore the path
             $self->{'path'} = $path_bak;
         # Second pass
-            print "Final pass...\n";
+            print "Final pass...\n" unless $QUIET;
             $self->{'ffmpeg_xtra'} = ' -vcodec mpeg4'
                                    . ' -b ' . $self->{'v_bitrate'}
                                    . ' -minrate 32 -maxrate '.(2*$self->{'v_bitrate'}).' -bt 32'
diff -ru nuvexport-0.2/export/ffmpeg/DVD.pm nuvexport-0.2.patched/export/ffmpeg/DVD.pm
--- nuvexport-0.2/export/ffmpeg/DVD.pm	2005-03-08 02:36:48.000000000 -0500
+++ nuvexport-0.2.patched/export/ffmpeg/DVD.pm	2005-04-02 14:07:15.000000000 -0500
@@ -70,15 +70,23 @@
         my $self = shift;
     # Load the parent module's settings
         $self->SUPER::gather_settings();
+
     # Audio Bitrate
         while (1) {
-            my $a_bitrate = query_text('Audio bitrate?',
-                                       'int',
-                                       $self->val('a_bitrate'));
+            my $a_bitrate;
+            if ($is_cli) {
+                $a_bitrate = $self->val('a_bitrate');
+            } else {
+                $a_bitrate = query_text('Audio bitrate?',
+                                           'int',
+                                           $self->val('a_bitrate'));
+            }
             if ($a_bitrate < 64) {
+                die "Too low; please choose a bitrate between 64 and 384." if $is_cli;
                 print "Too low; please choose a bitrate between 64 and 384.\n";
             }
             elsif ($a_bitrate > 384) {
+                die "Too high; please choose a bitrate between 64 and 384." if $is_cli;
                 print "Too high; please choose a bitrate between 64 and 384.\n";
             }
             else {
@@ -93,13 +101,20 @@
                  $self->{'v_bitrate'} = $max_v_bitrate;
             }
             while (1) {
-                my $v_bitrate = query_text('Maximum video bitrate for VBR?',
-                                           'int',
-                                           $self->val('v_bitrate'));
+                my $v_bitrate;
+                if ($is_cli) {
+                    $v_bitrate = $self->val('v_bitrate');
+                } else {
+                    $v_bitrate = query_text('Maximum video bitrate for VBR?',
+                                               'int',
+                                               $self->val('v_bitrate'));
+                }
                 if ($v_bitrate < 1000) {
+                    die "Too low; please choose a bitrate between 1000 and $max_v_bitrate." if $is_cli;
                     print "Too low; please choose a bitrate between 1000 and $max_v_bitrate.\n";
                 }
                 elsif ($v_bitrate > $max_v_bitrate) {
+                    die "Too high; please choose a bitrate between 1000 and $max_v_bitrate." if $is_cli;
                     print "Too high; please choose a bitrate between 1000 and $max_v_bitrate.\n";
                 }
                 else {
@@ -110,13 +125,20 @@
         }
     # Ask the user what vbr quality (quantisation) he/she wants - 1..31
         while (1) {
-            my $quantisation = query_text('VBR quality/quantisation (1-31)?',
-                                          'float',
-                                          $self->val('quantisation'));
+            my $quantisation;
+            if ($is_cli) {
+                $quantisation = $self->val('quantisation');
+            } else {
+                $quantisation = query_text('VBR quality/quantisation (1-31)?',
+                                              'float',
+                                              $self->val('quantisation'));
+            }
             if ($quantisation < 1) {
+                die "Too low; please choose a number between 1 and 31." if $is_cli;
                 print "Too low; please choose a number between 1 and 31.\n";
             }
             elsif ($quantisation > 31) {
+                die "Too high; please choose a number between 1 and 31" if $is_cli;
                 print "Too high; please choose a number between 1 and 31\n";
             }
             else {
diff -ru nuvexport-0.2/export/ffmpeg/XviD.pm nuvexport-0.2.patched/export/ffmpeg/XviD.pm
--- nuvexport-0.2/export/ffmpeg/XviD.pm	2005-03-12 02:37:53.000000000 -0500
+++ nuvexport-0.2.patched/export/ffmpeg/XviD.pm	2005-04-02 14:48:07.000000000 -0500
@@ -136,7 +136,7 @@
             my $path_bak = $self->{'path'};
             $self->{'path'} = '/dev/null';
         # First pass
-            print "First pass...\n";
+            print "First pass...\n" unless $QUIET;
             $self->{'ffmpeg_xtra'} = ' -vcodec xvid'
                                    . ' -b ' . $self->{'v_bitrate'}
                                    . ' -minrate 32 -maxrate '.(2*$self->{'v_bitrate'}).' -bt 32'
@@ -148,7 +148,7 @@
         # Restore the path
             $self->{'path'} = $path_bak;
         # Second pass
-            print "Final pass...\n";
+            print "Final pass...\n" unless $QUIET;
             $self->{'ffmpeg_xtra'} = ' -vcodec xvid'
                                    . ' -b ' . $self->{'v_bitrate'}
                                    . ' -minrate 32 -maxrate '.(2*$self->{'v_bitrate'}).' -bt 32'
diff -ru nuvexport-0.2/export/ffmpeg.pm nuvexport-0.2.patched/export/ffmpeg.pm
--- nuvexport-0.2/export/ffmpeg.pm	2005-04-02 05:11:36.000000000 -0500
+++ nuvexport-0.2.patched/export/ffmpeg.pm	2005-04-02 14:50:31.000000000 -0500
@@ -177,7 +177,7 @@
         push @tmpfiles, "/tmp/fifodir_$$", "/tmp/fifodir_$$/audout", "/tmp/fifodir_$$/vidout";
 
     # Execute ffmpeg
-        print "Starting ffmpeg.\n" unless ($DEBUG);
+        print "Starting ffmpeg.\n" unless ($DEBUG || $QUIET);
         ($ffmpeg_pid, $ffmpeg_h) = fork_command("$ffmpeg 2>&1");
         $children{$ffmpeg_pid} = 'ffmpeg' if ($ffmpeg_pid);
 
@@ -203,7 +203,7 @@
             else {
                 $pct = "0.00";
             }
-            printf "\rprocessed:  $frames of $total_frames frames ($pct\%%), %6.2f fps ", $fps;
+            printf "\rprocessed:  $frames of $total_frames frames ($pct\%%), %6.2f fps ", $fps unless $QUIET;
 
         # Read from the ffmpeg handle
             while (has_data($ffmpeg_h) and $l = <$ffmpeg_h>) {
@@ -254,7 +254,7 @@
         # The pid?
             $pid = waitpid(-1, &WNOHANG);
             if ($children{$pid}) {
-                print "\n$children{$pid} finished.\n" unless ($DEBUG);
+                print "\n$children{$pid} finished.\n" unless ($DEBUG || $QUIET);
                 $last_death  = $children{$pid};
                 $death_timer = time();
                 delete $children{$pid};
diff -ru nuvexport-0.2/export/generic.pm nuvexport-0.2.patched/export/generic.pm
--- nuvexport-0.2/export/generic.pm	2005-03-31 23:37:24.000000000 -0500
+++ nuvexport-0.2.patched/export/generic.pm	2005-04-02 14:49:49.000000000 -0500
@@ -40,6 +40,7 @@
     sub load_defaults {
         my $self = shift;
     # These defaults apply to all modules
+        $self->{'defaults'}{'path'}            = '.';
         $self->{'defaults'}{'use_cutlist'}     = 1;
         $self->{'defaults'}{'noise_reduction'} = 1;
         $self->{'defaults'}{'deinterlace'}     = 1;
@@ -49,26 +50,34 @@
 # Gather settings from the user
     sub gather_settings {
         my $self = shift;
+        if ($is_cli) {
+            $self->{'path'} = $self->val('path');
+            $self->{'use_cutlist'} = $self->val('use_cutlist');
+            $self->{'noise_reduction'} = $self->val('noise_reduction');
+            $self->{'deinterlace'} = $self->val('deinterlace');
+            $self->{'crop'} = $self->val('crop');
+        } else {
     # Load the save path, if requested
-        $self->{'path'} = query_savepath($self->val('path'));
+            $self->{'path'} = query_savepath($self->val('path'));
     # Ask the user if he/she wants to use the cutlist
-        $self->{'use_cutlist'} = query_text('Enable Myth cutlist?',
-                                            'yesno',
-                                            $self->val('use_cutlist'));
+            $self->{'use_cutlist'} = query_text('Enable Myth cutlist?',
+                                                'yesno',
+                                                $self->val('use_cutlist'));
     # Video settings
-        if (!$self->{'audioonly'}) {
+            if (!$self->{'audioonly'}) {
         # Noise reduction?
-            $self->{'noise_reduction'} = query_text('Enable noise reduction (slower, but better results)?',
-                                                    'yesno',
-                                                    $self->val('noise_reduction'));
+                $self->{'noise_reduction'} = query_text('Enable noise reduction (slower, but better results)?',
+                                                        'yesno',
+                                                        $self->val('noise_reduction'));
         # Deinterlace video?
-            $self->{'deinterlace'} = query_text('Enable deinterlacing?',
-                                                'yesno',
-                                                $self->val('deinterlace'));
+                $self->{'deinterlace'} = query_text('Enable deinterlacing?',
+                                                    'yesno',
+                                                    $self->val('deinterlace'));
         # Crop video to get rid of broadcast padding
-            $self->{'crop'} = query_text('Crop broadcast overscan (2% border)?',
-                                         'yesno',
-                                         $self->val('crop'));
+                $self->{'crop'} = query_text('Crop broadcast overscan (2% border)?',
+                                             'yesno',
+                                             $self->val('crop'));
+            }
         }
     }
 
@@ -217,7 +226,7 @@
                 }
             # We have a line to print?
                 if ($data && length $data > 0) {
-                    print $write $data;
+                    print $write $data unless $QUIET;
                 }
             # Sleep for 1/20 second so we don't go too fast and annoy the cpu,
             # but still read fast enough that transcode won't slow down, either.
@@ -226,7 +235,7 @@
             close COM;
         # Print the return status of the child
             my $status = $? >> 8;
-            print $write "!!! process $$ complete:  $status !!!\n";
+            print $write "!!! process $$ complete:  $status !!!\n" unless $QUIET;
         # Close the write handle
             close $write;
         # Exit using something that won't set off the END block
@@ -254,7 +263,7 @@
         if (!$DEBUG) {
             while (++$overload < 30 && !(-e "$fifodir/audout" && -e "$fifodir/vidout" )) {
                 sleep 1;
-                print "Waiting for mythtranscode to set up the fifos.\n";
+                print "Waiting for mythtranscode to set up the fifos.\n" unless $QUIET;
             }
             unless (-e "$fifodir/audout" && -e "$fifodir/vidout") {
                 die "Waited too long for mythtranscode to create its fifos.  Please try again.\n\n";
diff -ru nuvexport-0.2/export/mencoder/XviD.pm nuvexport-0.2.patched/export/mencoder/XviD.pm
--- nuvexport-0.2/export/mencoder/XviD.pm	2005-03-03 02:17:25.000000000 -0500
+++ nuvexport-0.2.patched/export/mencoder/XviD.pm	2005-04-02 14:49:29.000000000 -0500
@@ -135,7 +135,7 @@
             my $path_bak = $self->{'path'};
             $self->{'path'} = '/dev/null';
         # First pass
-            print "First pass...\n";
+            print "First pass...\n" unless $QUIET;
             $self->{'mencoder_xtra'} = "  $params"
                                        ." -passlogfile /tmp/xvid.$$.log"
                                        ." -nosound"
@@ -144,7 +144,7 @@
         # Restore the path
             $self->{'path'} = $path_bak;
         # Second pass
-            print "Final pass...\n";
+            print "Final pass...\n" unless $QUIET;
             $self->{'mencoder_xtra'} = " $params"
                                        ." -oac mp3lame -lameopts vbr=3:br=$self->{'a_bitrate'}"
                                        ." -passlogfile /tmp/xvid.$$.log"
diff -ru nuvexport-0.2/export/mencoder.pm nuvexport-0.2.patched/export/mencoder.pm
--- nuvexport-0.2/export/mencoder.pm	2005-03-03 02:18:52.000000000 -0500
+++ nuvexport-0.2.patched/export/mencoder.pm	2005-04-02 14:49:13.000000000 -0500
@@ -157,7 +157,7 @@
     #Fix -vop options before we execute mencoder
         $mencoder = build_vop_line($mencoder);
     # Execute mencoder
-        print "Starting mencoder.\n" unless ($DEBUG);
+        print "Starting mencoder.\n" unless ($DEBUG || $QUIET);
         ($mencoder_pid, $mencoder_h) = fork_command("$mencoder 2>&1");
         $children{$mencoder_pid} = 'mencoder' if ($mencoder_pid);
     # Get ready to count the frames that have been processed
@@ -180,7 +180,7 @@
             else {
                 $pct = "0.00";
             }
-            print "\rprocessed:  $frames of $total_frames frames ($pct\%), $fps fps ";
+            print "\rprocessed:  $frames of $total_frames frames ($pct\%), $fps fps " unless $QUIET;
         # Read from the mencoder handle
             while (has_data($mencoder_h) and $l = <$mencoder_h>) {
                 if ($l =~ /^Pos:.*?(\d+)f.*?\(.*?(\d+)fps/) {
@@ -219,7 +219,7 @@
         # The pid?
             $pid = waitpid(-1, &WNOHANG);
             if ($children{$pid}) {
-                print "\n$children{$pid} finished.\n" unless ($DEBUG);
+                print "\n$children{$pid} finished.\n" unless ($DEBUG || $QUIET);
                 $last_death  = $children{$pid};
                 $death_timer = time();
                 delete $children{$pid};
diff -ru nuvexport-0.2/export/transcode/DVD.pm nuvexport-0.2.patched/export/transcode/DVD.pm
--- nuvexport-0.2/export/transcode/DVD.pm	2005-03-08 02:36:39.000000000 -0500
+++ nuvexport-0.2.patched/export/transcode/DVD.pm	2005-04-02 14:07:35.000000000 -0500
@@ -65,17 +65,25 @@
 # Gather settings from the user
     sub gather_settings {
         my $self = shift;
+
     # Load the parent module's settings
         $self->SUPER::gather_settings();
     # Audio Bitrate
         while (1) {
-            my $a_bitrate = query_text('Audio bitrate?',
-                                       'int',
-                                       $self->val('a_bitrate'));
+            my $a_bitrate;
+            if ($is_cli) {
+                $a_bitrate = $self->val('a_bitrate');
+            } else {
+                $a_bitrate = query_text('Audio bitrate?',
+                                           'int',
+                                           $self->val('a_bitrate'));
+            }
             if ($a_bitrate < 64) {
+                die "Too low; please choose a bitrate between 64 and 384." if $is_cli;
                 print "Too low; please choose a bitrate between 64 and 384.\n";
             }
             elsif ($a_bitrate > 384) {
+                die "Too high; please choose a bitrate between 64 and 384." if $is_cli;
                 print "Too high; please choose a bitrate between 64 and 384.\n";
             }
             else {
@@ -90,13 +98,20 @@
                  $self->{'v_bitrate'} = $max_v_bitrate;
             }
             while (1) {
-                my $v_bitrate = query_text('Maximum video bitrate for VBR?',
-                                           'int',
-                                           $self->val('v_bitrate'));
+                my $v_bitrate;
+                if ($is_cli) {
+                    $v_bitrate = $self->val('v_bitrate');
+                } else {
+                    $v_bitrate = query_text('Maximum video bitrate for VBR?',
+                                               'int',
+                                               $self->val('v_bitrate'));
+                }
                 if ($v_bitrate < 1000) {
+                    die "Too low; please choose a bitrate between 1000 and $max_v_bitrate." if $is_cli;
                     print "Too low; please choose a bitrate between 1000 and $max_v_bitrate.\n";
                 }
                 elsif ($v_bitrate > $max_v_bitrate) {
+                    die "Too high; please choose a bitrate between 1000 and $max_v_bitrate." if $is_cli;
                     print "Too high; please choose a bitrate between 1000 and $max_v_bitrate.\n";
                 }
                 else {
@@ -107,13 +122,20 @@
         }
     # Ask the user what vbr quality (quantisation) he/she wants - 1..31
         while (1) {
-            my $quantisation = query_text('VBR quality/quantisation (1-31)?',
-                                          'float',
-                                          $self->val('quantisation'));
+            my $quantisation;
+            if ($is_cli) {
+                $quantisation = $self->val('quantisation');
+            } else {
+                $quantisation = query_text('VBR quality/quantisation (1-31)?',
+                                              'float',
+                                              $self->val('quantisation'));
+            }
             if ($quantisation < 1) {
+                die "Too low; please choose a number between 1 and 31." if $is_cli;
                 print "Too low; please choose a number between 1 and 31.\n";
             }
             elsif ($quantisation > 31) {
+                die "Too high; please choose a number between 1 and 31" if $is_cli;
                 print "Too high; please choose a number between 1 and 31\n";
             }
             else {
diff -ru nuvexport-0.2/export/transcode/XviD.pm nuvexport-0.2.patched/export/transcode/XviD.pm
--- nuvexport-0.2/export/transcode/XviD.pm	2005-03-08 02:25:05.000000000 -0500
+++ nuvexport-0.2.patched/export/transcode/XviD.pm	2005-04-02 14:48:41.000000000 -0500
@@ -138,7 +138,7 @@
             my $path_bak = $self->{'path'};
             $self->{'path'} = '/dev/null';
         # First pass
-            print "First pass...\n";
+            print "First pass...\n" unless $QUIET;
             $self->{'transcode_xtra'} = " -y xvid,null $params"
                                        ." -R 1,/tmp/xvid.$$.log"
                                        ." -w $self->{'v_bitrate'} ";
@@ -146,7 +146,7 @@
         # Restore the path
             $self->{'path'} = $path_bak;
         # Second pass
-            print "Final pass...\n";
+            print "Final pass...\n" unless $QUIET;
             $self->{'transcode_xtra'} = " -y xvid $params"
                                        ." -R 2,/tmp/xvid.$$.log"
                                        ." -w $self->{'v_bitrate'} ";
diff -ru nuvexport-0.2/export/transcode.pm nuvexport-0.2.patched/export/transcode.pm
--- nuvexport-0.2/export/transcode.pm	2005-03-03 02:18:57.000000000 -0500
+++ nuvexport-0.2.patched/export/transcode.pm	2005-04-02 14:50:13.000000000 -0500
@@ -176,7 +176,7 @@
             push @tmpfiles, "/tmp/fifodir_$$", "/tmp/fifodir_$$/audout", "/tmp/fifodir_$$/vidout";
         }
     # Execute transcode
-        print "Starting transcode.\n" unless ($DEBUG);
+        print "Starting transcode.\n" unless ($DEBUG || $QUIET);
         ($trans_pid, $trans_h) = fork_command("$transcode 2>&1");
         $children{$trans_pid} = 'transcode' if ($trans_pid);
     # Get ready to count the frames that have been processed
@@ -199,7 +199,7 @@
             else {
                 $pct = "0.00";
             }
-            print "\rprocessed:  $frames of $total_frames frames ($pct\%), $fps fps ";
+            print "\rprocessed:  $frames of $total_frames frames ($pct\%), $fps fps " unless $QUIET;
         # Read from the transcode handle
             while (has_data($trans_h) and $l = <$trans_h>) {
                 if ($l =~ /encoding\s+frames\s+\[(\d+)-(\d+)\],\s*([\d\.]+)\s*fps,\s+EMT:\s*([\d:]+),/) {
@@ -238,7 +238,7 @@
         # The pid?
             $pid = waitpid(-1, &WNOHANG);
             if ($children{$pid}) {
-                print "\n$children{$pid} finished.\n" unless ($DEBUG);
+                print "\n$children{$pid} finished.\n" unless ($DEBUG || $QUIET);
                 $last_death  = $children{$pid};
                 $death_timer = time();
                 delete $children{$pid};
diff -ru nuvexport-0.2/mythtv/recordings.pm nuvexport-0.2.patched/mythtv/recordings.pm
--- nuvexport-0.2/mythtv/recordings.pm	2005-02-17 02:40:15.000000000 -0500
+++ nuvexport-0.2.patched/mythtv/recordings.pm	2005-04-02 14:47:51.000000000 -0500
@@ -39,8 +39,10 @@
 #
     sub load_recordings {
     # Let the user know what's going on
-        clear();
-        print "Loading MythTV recording info.\n";
+        if (!$QUIET) {
+            clear();
+            print "Loading MythTV recording info.\n";
+        }
 
     # Query variables we'll use below
         my ($sh, $sh2, $sh3, $q, $q2, $q3);
@@ -75,7 +77,7 @@
             next if ($file =~ /^ringbuf/);
             $count++;
         # Print a progress dot
-            print "\r", sprintf('%.0f', 100 * ($count / @Files)), '% ';
+            print "\r", sprintf('%.0f', 100 * ($count / @Files)), '% ' unless $QUIET;
         # Pull out the various parts that make up the filename
             my ($channel,
                 $syear, $smonth, $sday, $shour, $sminute, $ssecond,
@@ -126,7 +128,7 @@
                                    };
         }
         $sh->finish();
-        print "\n";
+        print "\n" unless $QUIET;
 
     # We now have a hash of show names, containing an array of episodes
     # We should probably do some sorting by timestamp (and also count how many shows there are)
diff -ru nuvexport-0.2/nuvexport nuvexport-0.2.patched/nuvexport
--- nuvexport-0.2/nuvexport	2005-04-02 05:12:19.000000000 -0500
+++ nuvexport-0.2.patched/nuvexport	2005-04-02 14:51:03.000000000 -0500
@@ -131,7 +131,7 @@
                 print ':  ', $episode->{'title'} if ($episode->{'title'});
                 print "\nUse the following commands:\n";
             }
-            else {
+            elsif (!$QUIET) {
                 print "\nNow encoding:  ", $episode->{'show_name'};
                 print ':  ', $episode->{'title'} if ($episode->{'title'});
                 print "\nEncode started:  ".localtime()."\n";
@@ -142,7 +142,7 @@
         # Remove tmpfiles
             wipe_tmpfiles();
         # Report how long the encode lasted
-            print "\nEncode finished:  ".localtime()."\n" unless ($DEBUG);
+            print "\nEncode finished:  ".localtime()."\n" unless ($DEBUG || $QUIET);
             my $seconds = time() - $start;
             my $timestr = '';
         # How many hours?
@@ -156,7 +156,7 @@
         # Generate a nice
             $timestr .= $seconds.'s' if ($seconds > 0 || $timestr eq '');
         # Notify the user
-            print "Encode lasted: $timestr\n" unless ($DEBUG);
+            print "Encode lasted: $timestr\n" unless ($DEBUG || $QUIET);
         }
     }
 # Store in the DB
diff -ru nuvexport-0.2/nuv_export/cli.pm nuvexport-0.2.patched/nuv_export/cli.pm
--- nuvexport-0.2/nuv_export/cli.pm	2005-04-02 03:05:11.000000000 -0500
+++ nuvexport-0.2.patched/nuv_export/cli.pm	2005-04-02 14:46:53.000000000 -0500
@@ -21,7 +21,7 @@
         our @EXPORT = qw/ &add_arg      &load_cli_args
                           &arg          &rc_arg
                           $export_prog  $is_cli
-                          $DEBUG
+                          $DEBUG        $QUIET
                         /;
     }
 
@@ -130,6 +130,7 @@
 # Load the commandline options
     add_arg('help',  'Show nuvexport help');
     add_arg('debug', 'Enable debug mode');
+    add_arg('quiet', 'Enable quiet mode (only print errors)');
 
 # Load the commandline arguments
     sub load_cli_args {
@@ -143,6 +144,12 @@
     # Get the options
         GetOptions(\%args, @args)
             or die "Invalid commandline parameter(s).\n";
+    # Set the value of $QUIET
+        if ($args{'quiet'}) {
+            $QUIET = 1;
+        } else {
+            $QUIET = 0;
+        }
     # Make sure nice is defined
         if (defined($args{'nice'})) {
             die "--nice must be between -20 (highest priority) and 19 (lowest)\n" if (int($args{'nice'}) != $args{'nice'} || $args{'nice'} > 19 || $args{'nice'} < -20);
diff -ru nuvexport-0.2/nuv_export/shared_utils.pm nuvexport-0.2.patched/nuv_export/shared_utils.pm
--- nuvexport-0.2/nuv_export/shared_utils.pm	2005-03-08 02:33:12.000000000 -0500
+++ nuvexport-0.2.patched/nuv_export/shared_utils.pm	2005-04-02 14:42:49.000000000 -0500
@@ -22,6 +22,7 @@
                           $DEBUG        $NICE
                           $num_cpus     $is_child
                           @tmpfiles     %children
+                          $QUIET
                         /;
     }
 
@@ -37,6 +38,7 @@
 # These are defined here to avoid some nasty use-loops with nuv_export::ui
     our $DEBUG;
     our $NICE;
+    our $QUIET;
 
 # Remove any temporary files, and make sure child processes are cleaned up.
     END {
_______________________________________________
mythtv-users mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

Reply via email to