23 changes: 18 additions & 5 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.10.02 (xris)
#Last Updated: 2004.12.14 (xris)
#
# nuv_export::shared_utils
#
Expand All @@ -14,7 +14,7 @@ package nuv_export::shared_utils;
use Exporter;
our @ISA = qw/ Exporter /;

our @EXPORT = qw/ &clear &find_program &num_cpus &shell_escape &wrap &system &wipe_tmpfiles
our @EXPORT = qw/ &clear &find_program &shell_escape &wrap &system &mkdir &wipe_tmpfiles
@Exporters %Prog %Args %cli_args $DEBUG
$num_cpus $is_child
@tmpfiles %children
Expand Down Expand Up @@ -65,7 +65,6 @@ package nuv_export::shared_utils;
while ($cpuinfo =~ /^processor\s*:\s*\d+/mg) {
$num_cpus++;
}
return $num_cpus;

# Clear the screen
sub clear {
Expand Down Expand Up @@ -186,11 +185,23 @@ package nuv_export::shared_utils;
sub system {
my $command = shift;
if ($DEBUG) {
$command =~ s#\ 2>/dev/null##sg;
$command =~ s#\ [12]\s*>\s*/dev/null##sg;
print "\nsystem call:\n$command\n";
}
else {
CORE::system($command);
return CORE::system($command);
}
}

# Overload mkdir() so we can print debug messages
sub mkdir {
my $path = shift;
my $mode = shift;
if ($DEBUG) {
print "\nsystem call:\nmkdir -m ", sprintf("%#o", 493), " $path\n";
}
else {
return CORE::mkdir($path, $mode);
}
}

Expand All @@ -207,5 +218,7 @@ package nuv_export::shared_utils;
@tmpfiles = ();
}

# Return true
return 1;

# vim:ts=4:sw=4:ai:et:si:sts=4
29 changes: 21 additions & 8 deletions trunk/nuvexport
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/perl -w
# Last Updated: 2004.11.22 (xris)
# Last Updated: 2004.12.14 (xris)

# Autoflush buffers
$|++;
Expand All @@ -8,6 +8,11 @@
BEGIN {
$SIG{'INT'} = sub { print "\n"; exit; };
$SIG{'QUIT'} = sub { print "\n"; exit; };
# Annoy people running as root
if ($< < 1) {
print "You are running nuvexport as root -- this is not advised.\n";
<>;
}
}

# Add a couple of include paths so we can load the various export and gui modules
Expand Down Expand Up @@ -43,8 +48,8 @@
use export::DVD;
push @Exporters, export::DVD->new;
# This is disabled until someone shows me how to get transcode to export divx
# use export::DivX;
# push @Exporters, export::DivX->new;
use export::DivX;
push @Exporters, export::DivX->new;
use export::ASF;
push @Exporters, export::ASF->new;
use export::MP3;
Expand Down Expand Up @@ -88,16 +93,24 @@
if ($Args{'noserver'}) {
foreach my $episode (@episodes) {
# Keep track of when we started
print "\nNow encoding: ", $episode->{'show_name'};
print ': ', $episode->{'title'} if ($episode->{'title'});
print "\nEncode started: ".localtime()."\n";
if ($DEBUG) {
print "\n--------------------------------",
"\nTo encode: ", $episode->{'show_name'};
print ': ', $episode->{'title'} if ($episode->{'title'});
print "\nUse the following commands:\n";
}
else {
print "\nNow encoding: ", $episode->{'show_name'};
print ': ', $episode->{'title'} if ($episode->{'title'});
print "\nEncode started: ".localtime()."\n";
}
my $start = time();
# Encode
$exporter->export($episode);
# Remove tmpfiles
wipe_tmpfiles();
# Report how long the encode lasted
print "\nEncode finished: ".localtime()."\n";
print "\nEncode finished: ".localtime()."\n" unless ($DEBUG);
my $seconds = time() - $start;
my $timestr = '';
# How many hours?
Expand All @@ -111,7 +124,7 @@
# Generate a nice
$timestr .= $seconds.'s' if ($seconds > 0 || $timestr eq '');
# Notify the user
print "Encode lasted: $timestr\n";
print "Encode lasted: $timestr\n" unless ($DEBUG);
}
}
# Store in the DB
Expand Down
56 changes: 56 additions & 0 deletions trunk/nuvexport.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#
# RPM spec file for nuvexport
#

Name: nuvexport
Version: 0.2
Release: cvs20041214
License: GPL
Summary: mythtv nuv video file conversion script
URL: http://forevermore.net/nuvexport/
Group: Applications/Multimedia
Source: %{name}-%{version}-%{release}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

# This is a perl script -- no arch needed
BuildArch: noarch

# Standard nuvexport modules:
Requires: transcode >= 0.6.12
Requires: ffmpeg >= 0.4.9
Requires: mjpegtools >= 1.6.2
Requires: divx4linux
Requires: perl-Time-HiRes
# mpeg2cut needs some others:
Requires: avidemux >= 2
Requires: lvemux

%description
nuvexport is a perl script wrapper to several encoders, which is capable of
letting users choose shows from their MythTV database and convert them to one
of several different formats, including SVCD/DVD mpeg and XviD avi.

%prep
%setup

%build

%install
[ %{buildroot} != "/" ] && rm -rf %{buildroot}
%{makeinstall}

%clean
[ %{buildroot} != "/" ] && rm -rf %{buildroot}
rm -f $RPM_BUILD_DIR/file.list.%{name}

%files
%defattr(-, root, root)
%{_bindir}/*
%{_datadir}/nuvexport/
%{_mandir}/man1/*

%doc COPYING

%changelog
* Tue Dec 7 2004 Chris Petersen <rpm@forevermore.net>
- Built first spec