Ticket #873: mythrename-verbose.diff

File mythrename-verbose.diff, 1.9 KB (added by tom@…, 18 years ago)
  • mythrename.pl

     
    4545               'separator=s'                  => \$separator,
    4646               'replacement=s'                => \$replacement,
    4747               'usage|help|h'                 => \$usage,
    48                'underscores'                  => \$underscores
     48               'underscores'                  => \$underscores,
     49               'verbose'                  => \$verbose
    4950              );
    5051
    5152# Print usage
     
    124125
    125126    default:  No underscores
    126127
     128--verbose
     129
     130    Print debug info.
     131
     132    default: No info printed to console
     133
    127134--help
    128135
    129136    Show this help text.
     
    215222    # Double-check the destination
    216223        $dest ||= "$video_dir/show_names";
    217224    # Alert the user
    218         print "Link destination directory:  $dest\n";
     225        if ($verbose) {
     226            print "Link destination directory:  $dest\n";
     227        }
    219228    # Create nonexistent paths
    220229        unless (-e $dest) {
    221230            mkpath($dest, 0, 0755) or die "Failed to create $dest:  $!\n";
     
    355364        # Create the link
    356365            symlink "$video_dir/".$info{'basename'}, "$dest/$name"
    357366                or die "Can't create symlink $dest/$name:  $!\n";
    358             print "$dest/$name\n";
     367            if ($verbose) {
     368                print "$dest/$name\n";
     369            }
    359370        }
    360371    # Rename the file
    361372        else {
     
    378389                    $rows = $sh2->execute($info{'basename'}, $info{'chanid'}, $info{'starttime'});
    379390                    die "Couldn't restore original basename in database for ".$info{'basename'}.":  ($q2)\n" unless ($rows == 1);
    380391                }
    381                 print $info{'basename'}."\t-> $name\n";
     392                if ($verbose) {
     393                    print $info{'basename'}."\t-> $name\n";
     394                }
    382395            }
    383396        }
    384397    }