Skip to content

Commit a8db678

Browse files
committed
make "crop" an option, instead of forcing it
filename illegal-char fixes perform tmpfile-wipe after each encode, instead of just at END, to keep un-muxed files from piling up.
1 parent 2d004bf commit a8db678

File tree

9 files changed

+44
-24
lines changed

9 files changed

+44
-24
lines changed

trunk/export/DVCD.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ package export::DVCD;
2626
# Transcode-related settings
2727
'denoise' => 1,
2828
'deinterlace' => 1,
29+
'crop' => 1,
2930
};
3031
bless($self, $class);
3132

trunk/export/DVD.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ package export::DVD;
2929
# Transcode-related settings
3030
'denoise' => 1,
3131
'deinterlace' => 1,
32+
'crop' => 1,
3233
# DVD-specific settings
3334
'quantisation' => 5, # 4 through 6 is probably right...
3435
'a_bitrate' => 384,

trunk/export/SVCD.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ package export::SVCD;
2929
# Transcode-related settings
3030
'denoise' => 1,
3131
'deinterlace' => 1,
32+
'crop' => 1,
3233
# SVCD-specific settings
3334
'quantisation' => 5, # 4 through 6 is probably right...
3435
'a_bitrate' => 192,

trunk/export/VCD.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ package export::VCD;
2626
# Transcode-related settings
2727
'denoise' => 1,
2828
'deinterlace' => 1,
29+
'crop' => 1,
2930
};
3031
bless($self, $class);
3132

trunk/export/XviD.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ package export::XviD;
3232
# Transcode-related settings
3333
'denoise' => 1,
3434
'deinterlace' => 1,
35+
'crop' => 1,
3536
# VBR-specific settings
3637
'vbr' => 1, # This enables vbr, and the multipass/quantisation options
3738
'multipass' => 0, # You get multipass or quantisation, multipass will override

trunk/export/transcode.pm

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ package export::transcode;
2323
$cli_args{'denoise|noise_reduction:s'} = 1; # Enable noise reduction
2424
$cli_args{'deinterlace:s'} = 1; # Transcode-related settings
2525
$cli_args{'zoom_filter:s'} = 1; # Which zoom filter to use
26+
$cli_args{'crop'} = 1; # Crop out broadcast overscan
2627

2728
# This superclass defines several object variables:
2829
#
@@ -71,9 +72,14 @@ package export::transcode;
7172
'yesno',
7273
$self->{'deinterlace'} ? 'Yes' : 'No');
7374
# Crop video to get rid of broadcast padding
74-
# $self->{'crop'} = query_text('Crop ',
75-
# 'yesno',
76-
# $self->{'crop'} ? 'Yes' : 'No');
75+
if ($Args{'crop'}) {
76+
$self->{'crop'} = 1;
77+
}
78+
else {
79+
$self->{'crop'} = query_text('Crop broadcast overscan (2% border)?',
80+
'yesno',
81+
$self->{'crop'} ? 'Yes' : 'No');
82+
}
7783
}
7884

7985
sub export {
@@ -117,7 +123,7 @@ package export::transcode;
117123
;
118124
}
119125
# Crop?
120-
if (1 || $self->{'crop'}) {
126+
if ($self->{'crop'}) {
121127
my $w = sprintf('%.0f', .02 * $episode->{'finfo'}{'width'});
122128
my $h = sprintf('%.0f', .02 * $episode->{'finfo'}{'height'});
123129
$transcode .= " -j $h,$w,$h,$w" if ($h || $w);

trunk/mythtv/recordings.pm

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,17 @@ package mythtv::recordings;
9191
$description = 'No Description' unless ($description =~ /\S/);
9292
# Build a clean filename
9393
my $outfile = 'Untitled';
94-
if ($show ne 'Untitled' and $episode ne 'Untitled') {
95-
$outfile = "$show - $episode";
96-
}
97-
elsif($show ne 'Untitled') {
98-
$outfile = $show;
99-
}
100-
elsif($episode ne 'Untitled') {
101-
$outfile = $episode;
102-
}
103-
$outfile =~ s/(?:[:\?&\/]+\s*?)+\s?/-/sg;
94+
if ($show ne 'Untitled' and $episode ne 'Untitled') {
95+
$outfile = "$show - $episode";
96+
}
97+
elsif($show ne 'Untitled') {
98+
$outfile = $show;
99+
}
100+
elsif($episode ne 'Untitled') {
101+
$outfile = $episode;
102+
}
103+
$outfile =~ s/(?:[\/\\\:\*\?\<\>\|\-]+\s*?)+\s?/-/sg;
104+
$outfile =~ tr/"/'/s;
104105
#$description =~ s/(?:''|``)/"/sg;
105106
push @{$Shows{$show}}, {'filename' => "$video_dir/$file",
106107
'channel' => $channel,

trunk/nuv_export/shared_utils.pm

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/perl -w
2-
#Last Updated: 2004.09.24 (xris)
2+
#Last Updated: 2004.09.28 (xris)
33
#
44
# nuv_export::shared_utils
55
#
@@ -14,7 +14,7 @@ package nuv_export::shared_utils;
1414
use Exporter;
1515
our @ISA = qw/ Exporter /;
1616

17-
our @EXPORT = qw/ &clear &find_program &num_cpus &shell_escape &wrap &system
17+
our @EXPORT = qw/ &clear &find_program &num_cpus &shell_escape &wrap &system &wipe_tmpfiles
1818
@Exporters %Prog %Args %cli_args $DEBUG
1919
$is_child
2020
@tmpfiles %children
@@ -37,14 +37,7 @@ package nuv_export::shared_utils;
3737
END {
3838
if (!$is_child) {
3939
# Clean up temp files/directories
40-
foreach my $file (@tmpfiles) {
41-
if (-d $file) {
42-
rmdir $file;
43-
}
44-
elsif (-e $file) {
45-
unlink $file;
46-
}
47-
}
40+
wipe_tmpfiles();
4841
# Make sure any child processes also go away
4942
if (%children) {
5043
foreach my $child (keys %children) {
@@ -202,5 +195,18 @@ package nuv_export::shared_utils;
202195
}
203196
}
204197

198+
# Remove tmpfiles
199+
sub wipe_tmpfiles {
200+
foreach my $file (@tmpfiles) {
201+
if (-d $file) {
202+
rmdir $file;
203+
}
204+
elsif (-e $file) {
205+
unlink $file;
206+
}
207+
}
208+
@tmpfiles = ();
209+
}
210+
205211

206212
# vim:ts=4:sw=4:ai:et:si:sts=4

trunk/nuvexport

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@
9191
my $start = time();
9292
# Encode
9393
$exporter->export($episode);
94+
# Remove tmpfiles
95+
wipe_tmpfiles();
9496
# Report how long the encode lasted
9597
print "\nEncode finished: ".localtime()."\n";
9698
my $seconds = time() - $start;

0 commit comments

Comments
 (0)