#!/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;