27 changes: 2 additions & 25 deletions trunk/export/transcode.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/perl -w
#Last Updated: 2005.02.11 (xris)
#Last Updated: 2005.02.14 (xris)
#
# transcode.pm
#
Expand All @@ -19,10 +19,7 @@ package export::transcode;
use mythtv::recordings;

# Load the following extra parameters from the commandline
$cli_args{'deinterlace:s'} = 1; # Deinterlace video
$cli_args{'denoise|noise_reduction:s'} = 1; # Enable noise reduction
$cli_args{'zoom_filter:s'} = 1; # Which zoom filter to use
$cli_args{'crop'} = 1; # Crop out broadcast overscan
add_arg('zoom_filter:s', 'Which zoom filter to use.');

# This superclass defines several object variables:
#
Expand Down Expand Up @@ -61,26 +58,6 @@ package export::transcode;
die "Unknown zoom_filter: $Args{'zoom_filter'}\n";
}
}
# Defaults?
$Args{'denoise'} = '' if (defined $Args{'denoise'} && $Args{'denoise'} eq '');
$Args{'deinterlace'} = 'smartyuv' if (defined $Args{'deinterlace'} && $Args{'deinterlace'} eq '');
# Noise reduction?
$self->{'denoise'} = query_text('Enable noise reduction (slower, but better results)?',
'yesno',
$self->{'denoise'} ? 'Yes' : 'No');
# Deinterlace video?
$self->{'deinterlace'} = query_text('Enable deinterlacing?',
'yesno',
$self->{'deinterlace'} ? 'Yes' : 'No');
# Crop video to get rid of broadcast padding
if ($Args{'crop'}) {
$self->{'crop'} = 1;
}
else {
$self->{'crop'} = query_text('Crop broadcast overscan (2% border)?',
'yesno',
$self->{'crop'} ? 'Yes' : 'No');
}
}

sub export {
Expand Down
8 changes: 4 additions & 4 deletions trunk/export/transcode/DVD.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/perl -w
#Last Updated: 2005.01.26 (xris)
#Last Updated: 2005.02.14 (xris)
#
# export::transcode::DVD
# Maintained by Gavin Hurlbut <gjhurlbu@gmail.com>
Expand All @@ -15,9 +15,9 @@ package export::transcode::DVD;
use mythtv::recordings;

# Load the following extra parameters from the commandline
$cli_args{'quantisation|q=i'} = 1; # Quantisation
$cli_args{'a_bitrate|a=i'} = 1; # Audio bitrate
$cli_args{'v_bitrate|v=i'} = 1; # Video bitrate
add_arg('quantisation|q=i', 'Quantisation');
add_arg('a_bitrate|a=i', 'Audio bitrate');
add_arg('v_bitrate|v=i', 'Video bitrate');

sub new {
my $class = shift;
Expand Down
8 changes: 4 additions & 4 deletions trunk/export/transcode/SVCD.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/perl -w
#Last Updated: 2005.01.26 (xris)
#Last Updated: 2005.02.14 (xris)
#
# export::transcode::SVCD
# Maintained by Chris Petersen <mythtv@forevermore.net>
Expand All @@ -15,9 +15,9 @@ package export::transcode::SVCD;
use mythtv::recordings;

# Load the following extra parameters from the commandline
$cli_args{'quantisation|q=i'} = 1; # Quantisation
$cli_args{'a_bitrate|a=i'} = 1; # Audio bitrate
$cli_args{'v_bitrate|v=i'} = 1; # Video bitrate
add_arg('quantisation|q=i', 'Quantisation');
add_arg('a_bitrate|a=i', 'Audio bitrate');
add_arg('v_bitrate|v=i', 'Video bitrate');

sub new {
my $class = shift;
Expand Down
10 changes: 5 additions & 5 deletions trunk/export/transcode/XviD.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/perl -w
#Last Updated: 2005.01.26 (xris)
#Last Updated: 2005.02.14 (xris)
#
# export::transcode::XviD
# Maintained by Chris Petersen <mythtv@forevermore.net>
Expand All @@ -15,10 +15,10 @@ package export::transcode::XviD;
use mythtv::recordings;

# Load the following extra parameters from the commandline
$cli_args{'quantisation|q=i'} = 1; # Quantisation
$cli_args{'a_bitrate|a=i'} = 1; # Audio bitrate
$cli_args{'v_bitrate|v=i'} = 1; # Video bitrate
$cli_args{'multipass'} = 1; # Two-pass encoding
add_arg('quantisation|q=i', 'Quantisation');
add_arg('a_bitrate|a=i', 'Audio bitrate');
add_arg('v_bitrate|v=i', 'Video bitrate');
add_arg('multipass!', 'Enably two-pass encoding.');

sub new {
my $class = shift;
Expand Down
16 changes: 10 additions & 6 deletions trunk/nuv_export/shared_utils.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/perl -w
#Last Updated: 2004.12.14 (xris)
#Last Updated: 2005.02.13 (xris)
#
# nuv_export::shared_utils
#
Expand All @@ -15,7 +15,7 @@ package nuv_export::shared_utils;
our @ISA = qw/ Exporter /;

our @EXPORT = qw/ &clear &find_program &shell_escape &wrap &system &mkdir &wipe_tmpfiles
@Exporters %Prog %Args %cli_args $DEBUG
@Exporters %Prog %Args $DEBUG
$num_cpus $is_child
@tmpfiles %children
/;
Expand All @@ -25,7 +25,6 @@ package nuv_export::shared_utils;
our @Exporters; # A list of the various exporters
our %Prog; # Locations of preferred programs for various tasks (mplex, etc) -- DEPRECATED
our %Args; # Edit this to store command line arguments in individual variables
our %cli_args; # Add keys to this this in order to add more command line parse strings
our $is_child = 0; # This is set to 1 after forking to a new process
our @tmpfiles; # Keep track of temporary files, so we can clean them up upon quit
our %children; # Keep track of child pid's so we can kill them off if we quit unexpectedly
Expand Down Expand Up @@ -61,9 +60,14 @@ package nuv_export::shared_utils;
our $terminal = Term::Cap->Tgetent({OSPEED=>$OSPEED});

# Gather info about how many cpu's this machine has
my $cpuinfo = `cat /proc/cpuinfo`;
while ($cpuinfo =~ /^processor\s*:\s*\d+/mg) {
$num_cpus++;
if (-e '/proc/cpuinfo') {
my $cpuinfo = `cat /proc/cpuinfo`;
while ($cpuinfo =~ /^processor\s*:\s*\d+/mg) {
$num_cpus++;
}
}
else {
$num_cpus = 1;
}

# Clear the screen
Expand Down
60 changes: 42 additions & 18 deletions trunk/nuv_export/ui.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,42 +20,53 @@ package nuv_export::ui;
use Exporter;
our @ISA = qw/ Exporter /;

our @EXPORT = qw/ &load_cli_args &load_episodes &load_cli_episodes
&query_savepath &query_exporters &query_text
our @EXPORT = qw/ &add_arg &load_cli_args &arg
&load_episodes &load_cli_episodes
&query_savepath &query_exporters &query_text
$is_cli
/;
}

# Only need to keep track of cli args here
my %cli_args;

# Load the following extra parameters from the commandline
$cli_args{'search-only'} = 1; # Search only, do not do anything with the found recordings
$cli_args{'confirm'} = 1; # Confirm commandline-entered choices
add_arg('search-only', 'Search only, do not do anything with the found recordings');
add_arg('confirm', 'Confirm commandline-entered choices');

$cli_args{'title=s'} = 1; # Used for searching or group-encoding
$cli_args{'subtitle|episode=s'} = 1;
$cli_args{'description=s'} = 1;
$cli_args{'infile|input|i=s'} = 1; # Input filename
$cli_args{'chanid|channel=i'} = 1; # Used to specify a program
$cli_args{'starttime|start_time=i'} = 1;
add_arg('title=s', 'Find programs to convert based on their title.');
add_arg('subtitle|episode=s', 'Find programs to convert based on their subtitle (episode name).');
add_arg('description=s', 'Find programs to convert based on their description.');
add_arg('infile|input|i=s', 'Input filename');
add_arg('chanid|channel=i', 'Find programs to convert based on their chanid');
add_arg('starttime|start_time=i', 'Find programs to convert based on their starttime.');

$cli_args{'require_cutlist'} = 1; # Only show programs that have a cutlist?
add_arg('require_cutlist', 'Only show programs that have a cutlist?');

$cli_args{'mode|function|export=s'} = 1; # CLI for which export mode to use
add_arg('mode|export=s', 'Specify which export mode to use');

$cli_args{'noserver|no-server'} = 1; # Don't talk to the server -- do all encodes here in this execution
add_arg('noserver|no-server', "Don't talk to the server -- do all encodes here in this execution");

$cli_args{'nice=i'} = 1; # Set the value of "nice" for subprocesses
$cli_args{'version'} = 1; # Show the version and exit
add_arg('nice=i', 'Set the value of "nice" for subprocesses');
add_arg('version', 'Show the version and exit');

# Load the commandline options
$cli_args{'help'} = 1;
$cli_args{'debug'} = 1;
add_arg('help', 'Show nuvexport help');
add_arg('debug', 'Enable debug mode');

# Look for certain commandline options to determine if this is cli-mode
our $is_cli = 0;

# Load the commandline arguments
sub load_cli_args {
die "Invalid commandline parameter(s).\n" unless GetOptions(\%Args, keys %cli_args);
# Build an array of the requested commandline arguments
my @args;
foreach my $key (keys %cli_args) {
push @args, $cli_args{$key}[0];
}
# Get the options
GetOptions(\%Args, keys %cli_args)
or die "Invalid commandline parameter(s).\n";
# 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);
Expand All @@ -70,6 +81,19 @@ package nuv_export::ui;
}
}

# Add an argument to check for on the commandline
sub add_arg {
my ($arg, $description) = @_;
my ($name) = $arg =~ /^([^!=:\|]+)/;
$cli_args{$name} = [$arg, $description];
}

# Retrieve the value of a commandline argument
sub arg {
my ($arg, $default) = @_;
return defined($Args{$arg}) ? $Args{$arg} : $default;
}

# Load episodes from the commandline
sub load_cli_episodes {
my @matches;
Expand Down
2 changes: 1 addition & 1 deletion trunk/nuvexport
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Last Updated: 2005.02.12 (xris)

# Version
$VERSION = '0.2 cvs20050212';
$VERSION = '0.2 cvs20050215';

# Autoflush buffers
$|++;
Expand Down
2 changes: 1 addition & 1 deletion trunk/nuvexport.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Name: nuvexport
Version: 0.2
Release: cvs20050212
Release: cvs20050215
License: GPL
Summary: mythtv nuv video file conversion script
URL: http://forevermore.net/nuvexport/
Expand Down