Skip to content

Commit

Permalink
clean up nuvexportrc and docs, add --gencutlist, require mythtv .19
Browse files Browse the repository at this point in the history
  • Loading branch information
ex-nerd committed Mar 7, 2006
1 parent 58de180 commit 6614821
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 44 deletions.
3 changes: 3 additions & 0 deletions trunk/export/ffmpeg.pm
Expand Up @@ -123,6 +123,9 @@ package export::ffmpeg;
my $ffmpeg = '';
my $mythtranscode = '';

# Generate a cutlist?
$self->gen_cutlist($episode);

# Set up the fifo dirs?
if (-e "/tmp/fifodir_$$/vidout" || -e "/tmp/fifodir_$$/audout") {
die "Possibly stale mythtranscode fifo's in /tmp/fifodir_$$/.\nPlease remove them before running nuvexport.\n\n";
Expand Down
15 changes: 14 additions & 1 deletion trunk/export/generic.pm
Expand Up @@ -29,7 +29,8 @@ package export::generic;
add_arg('path:s', 'Save path (only used with the noserver option).');
add_arg('filename|name:s', 'Format string for output names.');
add_arg('underscores!', 'Convert spaces to underscores for output filename.');
add_arg('use_cutlist|cutlist!', 'Use the myth cutlist (or not)');
add_arg('use_cutlist|cutlist!', 'Use the myth cutlist (or not).');
add_arg('gencutlist!', 'Generate a cutlist from the commercial flag list (don\'t forget --use_cutlist, too).');

# These aren't used by all modules, but the routine to define them is here, so here they live
add_arg('height|v_res|h=s', 'Output height.');
Expand Down Expand Up @@ -87,6 +88,18 @@ package export::generic;
}
}

# Generate a cutlist
sub gen_cutlist {
my $self = shift;
my $episode = shift;
# Find mythcommflag
my $mythcommflag = find_program('mythcommflag');
# Nothing?
die "Can't find mythcommflag.\n" unless ($mythcommflag);
# Generate the cutlist
system("$NICE $mythcommflag --gencutlist -c $episode->{'channel'} -s $episode->{'start_time_sep'}");
}

# Check for a duplicate filename, and return a full path to the output filename
sub get_outfile {
my $self = shift;
Expand Down
4 changes: 4 additions & 0 deletions trunk/export/mencoder.pm
Expand Up @@ -67,6 +67,10 @@ package export::mencoder;
# Init the commands
my $mencoder = '';
my $mythtranscode = '';

# Generate a cutlist?
$self->gen_cutlist($episode);

# Start the mencoder command
$mencoder = "$NICE mencoder";
# Import aspect ratio
Expand Down
3 changes: 3 additions & 0 deletions trunk/export/transcode.pm
Expand Up @@ -77,6 +77,9 @@ package export::transcode;
my $pad_h;
my $pad_w;

# Generate a cutlist?
$self->gen_cutlist($episode);

# Start the transcode command
$transcode = "$NICE transcode"
# -V is now the default, but need to keep using it because people are still using an older version of transcode
Expand Down
5 changes: 2 additions & 3 deletions trunk/mythtv/recordings.pm
Expand Up @@ -63,9 +63,8 @@ package mythtv::recordings;
# Try a basename file search
my $rows;
$sh = $dbh->prepare('SELECT *, basename FROM recorded');
if ($sh) {
$rows = $sh->execute();
}
die "nuvexport 0.3 requires MythTV 0.19\n" unless ($sh);
$rows = $sh->execute();
if (defined $rows) {
while ($file = $sh->fetchrow_hashref()) {
push @files, $file;
Expand Down
13 changes: 7 additions & 6 deletions trunk/nuv_export/help.pm
@@ -1,9 +1,11 @@
#!/usr/bin/perl -w
#
# $Date$
# $Revision$
# $Author$
# help
#
# help.pm
# @url $URL$
# @date $Date$
# @version $Revision$
# @author $Author$
#

if (arg('mode')) {
Expand All @@ -17,8 +19,7 @@

else {
print "Help section still needs to be updated.\n"
." For now, use `man nuvexport` or visit the nuvexport "
."wiki at\n"
." For now, please read /etc/nuvexportrc or the nuvexport wiki at\n"
." https://svn.forevermore.net/nuvexport/\n\n";
}

Expand Down
46 changes: 20 additions & 26 deletions trunk/nuv_export/ui.pm
Expand Up @@ -58,34 +58,28 @@ package nuv_export::ui;
my $starttime = arg('starttime');
# Filename specified on the command line -- extract the chanid and starttime
if (arg('infile')) {
if (arg('infile') =~ /\basdasd(\d+)_(\d+)(?:_\d+)?\.(nuv|mpg)$/) {
$chanid = $1;
$starttime = $2;
}
else {
# Try to pick out the chanid and starttime from the database
my $sh = $dbh->prepare('SELECT chanid, 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\/*//;
# Look up the file
$rows = $sh->execute($infile);
if (defined $rows) {
($chanid, $starttime) = $sh->fetchrow_array();
if ($starttime) {
# strip non-numbers to get the proper format
$starttime =~ tr/0-9//cd;
}
# Try to pick out the chanid and starttime from the database
my $sh = $dbh->prepare('SELECT chanid, 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\/*//;
# Look up the file
$rows = $sh->execute($infile);
if (defined $rows) {
($chanid, $starttime) = $sh->fetchrow_array();
if ($starttime) {
# strip non-numbers to get the proper format
$starttime =~ tr/0-9//cd;
}
$sh->finish;
}
# Give up
if (!defined $rows || !$chanid || !$starttime) {
die "Input filename does not match the MythTV recording name format\n"
."and no matching file could be found in the MythTV database.\n"
."Please reference only files in your active MythTV video directory.\n";
}
$sh->finish;
}
# Give up
if (!defined $rows || !$chanid || !$starttime) {
die "Input filename does not match the MythTV recording name format\n"
."and no matching file could be found in the MythTV database.\n"
."Please reference only files in your active MythTV video directory.\n";
}
}
# Find the show
Expand Down
2 changes: 1 addition & 1 deletion trunk/nuvexport
Expand Up @@ -5,7 +5,7 @@
# $Author$

# Version
$VERSION = '0.3 0.20060302.svn';
$VERSION = '0.3 0.20060306.svn';

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

Name: nuvexport
Version: 0.3
Release: 0.20060302.svn
Release: 0.20060306.svn
License: GPL
Summary: mythtv nuv video file conversion script
URL: http://forevermore.net/nuvexport/
Expand Down
50 changes: 44 additions & 6 deletions trunk/nuvexportrc
Expand Up @@ -99,14 +99,50 @@

<generic>

#
# Default to export to the current directory
#
path = .

use_cutlist = yes
multipass = yes
#
# Use the cutlist (not to be confused with the commercial flag list) when
# exporting.
#
use_cutlist = yes

#
# Tell mythcommflag to generate a cutlist from the commercial flags before
# exporting. Don't forget to enable use_cutlist above, too.
#
# gencutlist = no

#
# Contrary to popular belief, enabling multipass will not make your recordings
# look better. What it will do, however is guarantee that the bitrate you
# choose will be the average bitrate of your entire encode (meaning that your
# exports will end up being about the same size per-minute), and that you
# will receive the best overall quality for a files of the same size.
#
multipass = yes

#
# Disabling noise reduction can speed up your exports dramatically, but at the
# expense of some quality. You can also access this on the commandline via
# the --denoise (or --nodenoise) flag.
#
noise_reduction = yes

#
# Deinterlace the video so that it looks better on software players.
#
deinterlace = yes
crop = yes

#
# Crop about 2% from the border of the recording before encoding. This is done
# to get rid of part of the broadcast signal that is usually obscured by the
# tv's overscan.
#
crop = yes

#
# You can create settings for each export module type. These are the
Expand All @@ -117,13 +153,15 @@
# fast_denoise (it's actually part of yuvdenoise, which both the ffmpeg
# and transcode exporters call). It can be almost twice as slow as the
# default "fast" normal noise reduction, but it considerably more effective.
# The latest version of yuvdenoise (which is called directly by the ffmpeg
# exporters) does not support this option, so it is ignored in that case.
#
fast_denoise = yes

#
# If nuvexport is having trouble detecting the aspect ratio of your recordings
# (MythTV used to hard-code all software-encoded files as 1:1 regardless of
# the true aspect), set this option to one of the following:
# If nuvexport is having trouble detecting the *input* aspect ratio of your
# recordings (MythTV used to hard-code all software-encoded files as 1:1
# regardless of the true aspect), set this option to one of the following:
#
# force_aspect = [ 1:1 4:3 16:9 2.21:1 ]

Expand Down

0 comments on commit 6614821

Please sign in to comment.