summaryrefslogtreecommitdiff
path: root/process.pl
diff options
context:
space:
mode:
authorOthmar Gsenger <otti@wirdorange.org>2011-03-31 19:05:23 +0000
committerOthmar Gsenger <otti@wirdorange.org>2011-03-31 19:05:23 +0000
commitd26fa8c1e0886c813de5364ee6570c860c6ce12c (patch)
tree418120693100150b0443d3d880f945aaa45a0d22 /process.pl
parentadded support for browsing by category (diff)
hopfully repaired this after backup loss
Diffstat (limited to 'process.pl')
-rwxr-xr-xprocess.pl27
1 files changed, 27 insertions, 0 deletions
diff --git a/process.pl b/process.pl
new file mode 100755
index 0000000..33a6279
--- /dev/null
+++ b/process.pl
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+use strict;
+use Cwd 'abs_path';
+use File::Basename;
+use local::db;
+use config;
+my $process_path = dirname(abs_path($config::config{process})) or die "Couldn\'t determine process_path";
+#print "$process_path\n";
+
+$ENV{NZBPP_DIRECTORY} or die "missing argument download id";
+my $dl_id = basename($ENV{NZBPP_DIRECTORY}) or die "missing argument download id";
+my $dl = local::db::download->retrieve($dl_id) or die 'cannont find download';
+$dl->processing(1);
+$dl->update;
+chdir($process_path);
+my $return = system($config::config{process});
+$return = $return >> 8 if $return;
+$dl->completed(1);
+
+my $du = "du -sm ".$config::config{files_dir}.'/'.$dl->category->name.'/'.$dl_id;
+my $du_resp = `$du`;
+my ($size) = $du_resp =~ /^(\d+)/;
+#warn $size;
+$dl->size($size);
+$dl->update;
+
+exit $return;