From 6614821bc9bf561b91d6b89cfb6e864a704bdf14 Mon Sep 17 00:00:00 2001 From: Chris Petersen Date: Tue, 7 Mar 2006 05:34:25 +0000 Subject: [PATCH] clean up nuvexportrc and docs, add --gencutlist, require mythtv .19 --- trunk/export/ffmpeg.pm | 3 +++ trunk/export/generic.pm | 15 +++++++++++- trunk/export/mencoder.pm | 4 +++ trunk/export/transcode.pm | 3 +++ trunk/mythtv/recordings.pm | 5 ++-- trunk/nuv_export/help.pm | 13 +++++----- trunk/nuv_export/ui.pm | 46 +++++++++++++++-------------------- trunk/nuvexport | 2 +- trunk/nuvexport.spec | 2 +- trunk/nuvexportrc | 50 +++++++++++++++++++++++++++++++++----- 10 files changed, 99 insertions(+), 44 deletions(-) diff --git a/trunk/export/ffmpeg.pm b/trunk/export/ffmpeg.pm index caf1972..6b7c700 100644 --- a/trunk/export/ffmpeg.pm +++ b/trunk/export/ffmpeg.pm @@ -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"; diff --git a/trunk/export/generic.pm b/trunk/export/generic.pm index 8a5fa2b..4cef1d3 100644 --- a/trunk/export/generic.pm +++ b/trunk/export/generic.pm @@ -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.'); @@ -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; diff --git a/trunk/export/mencoder.pm b/trunk/export/mencoder.pm index 6762867..d1b1e3b 100644 --- a/trunk/export/mencoder.pm +++ b/trunk/export/mencoder.pm @@ -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 diff --git a/trunk/export/transcode.pm b/trunk/export/transcode.pm index c4e808a..e8c131d 100644 --- a/trunk/export/transcode.pm +++ b/trunk/export/transcode.pm @@ -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 diff --git a/trunk/mythtv/recordings.pm b/trunk/mythtv/recordings.pm index f507f70..0094b59 100644 --- a/trunk/mythtv/recordings.pm +++ b/trunk/mythtv/recordings.pm @@ -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; diff --git a/trunk/nuv_export/help.pm b/trunk/nuv_export/help.pm index 6d6c07d..4a7575a 100644 --- a/trunk/nuv_export/help.pm +++ b/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')) { @@ -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"; } diff --git a/trunk/nuv_export/ui.pm b/trunk/nuv_export/ui.pm index a092741..fb96c0b 100644 --- a/trunk/nuv_export/ui.pm +++ b/trunk/nuv_export/ui.pm @@ -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 diff --git a/trunk/nuvexport b/trunk/nuvexport index 8056420..7f30b0c 100755 --- a/trunk/nuvexport +++ b/trunk/nuvexport @@ -5,7 +5,7 @@ # $Author$ # Version - $VERSION = '0.3 0.20060302.svn'; + $VERSION = '0.3 0.20060306.svn'; # Autoflush buffers $|++; diff --git a/trunk/nuvexport.spec b/trunk/nuvexport.spec index 8e29ec0..a378c78 100644 --- a/trunk/nuvexport.spec +++ b/trunk/nuvexport.spec @@ -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/ diff --git a/trunk/nuvexportrc b/trunk/nuvexportrc index eb05104..f762b5f 100644 --- a/trunk/nuvexportrc +++ b/trunk/nuvexportrc @@ -99,14 +99,50 @@ +# +# 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 @@ -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 ]