summaryrefslogtreecommitdiff
path: root/rhimport-rs
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2012-01-20 04:13:30 (GMT)
committerChristian Pointner <equinox@helsinki.at>2012-01-20 04:13:30 (GMT)
commit47b5d302853110c8be4e58b4d994f0436ec1502e (patch)
tree0e8094cbbfb5a7976a8465aff766892878b3783d /rhimport-rs
parentdff0b4b6d3c440317b87d22b19c2e7bf0c464a41 (diff)
cleanups
Diffstat (limited to 'rhimport-rs')
-rwxr-xr-xrhimport-rs30
1 files changed, 13 insertions, 17 deletions
diff --git a/rhimport-rs b/rhimport-rs
index 2b3c319..26c8f4a 100755
--- a/rhimport-rs
+++ b/rhimport-rs
@@ -43,7 +43,7 @@ my $DB = "rivendell";
my $STAT_FILE = $ENV{'HOME'} . "/rhimport-wl.stat";
my $RSS_URL = "http://cba.fro.at/seriesrss/197";
my @PV_SCRIPT = ('/usr/bin/ssh', 'root@intranet', 'addnote', '75');
-my @PV_SCRIPT_REP = ('/usr/bin/ssh', 'root@intranet', 'addnote', '75');
+my @PV_SCRIPT_REB = ('/usr/bin/ssh', 'root@intranet', 'addnote', '75');
binmode(STDIN, ":utf8");
binmode(STDOUT, ":utf8");
@@ -63,25 +63,25 @@ if(scalar(@allowed_dbs) != 2) {
}
my $idx = 0;
-my $idx_rep = 1;
+my $idx_reb = 1;
if(($allowed_dbs[1]->{'TO_CART'} % 100) == 0) {
$idx = 1;
- $idx_rep = 0;
+ $idx_reb = 0;
}
my $dropbox = $allowed_dbs[$idx]->{'PATH'};
my $to_cart = $allowed_dbs[$idx]->{'TO_CART'};
-my $dropbox_rep = $allowed_dbs[$idx_rep]->{'PATH'};
-my $to_cart_rep = $allowed_dbs[$idx_rep]->{'TO_CART'};
+my $dropbox_reb = $allowed_dbs[$idx_reb]->{'PATH'};
+my $to_cart_reb = $allowed_dbs[$idx_reb]->{'TO_CART'};
my @today = Date::Calc::Standard_to_Business(Date::Calc::Today());
$today[2] = 2;
my @broadcast_day = Date::Calc::Business_to_Standard(@today);
$today[2] = 6;
my @import_date = Date::Calc::Business_to_Standard(@today);
-my @import_date_rep = Date::Calc::Add_Delta_Days($import_date[0], $import_date[1], $import_date[2], 10);
+my @import_date_reb = Date::Calc::Add_Delta_Days($import_date[0], $import_date[1], $import_date[2], 10);
print "day of original broadcast: " . Date::Calc::Date_to_Text(@broadcast_day) . "\n";
print "day of Radio Helsinki broadcast: " . Date::Calc::Date_to_Text(@import_date) . "\n";
-print "day of Radio Helsinki repitition: " . Date::Calc::Date_to_Text(@import_date_rep) . "\n";
+print "day of Radio Helsinki rebroadcast: " . Date::Calc::Date_to_Text(@import_date_reb) . "\n";
my $bd = sprintf("%04d-%02d-%02d", $broadcast_day[0], $broadcast_day[1], $broadcast_day[2]);
my $bdfile = sprintf("Rast%04d%02d%02dcba.mp3", $broadcast_day[0], $broadcast_day[1], $broadcast_day[2]);
@@ -112,9 +112,8 @@ for my $entry ($feed->entries) {
$file = $ff->fetch( to => '/tmp' ) or die $ff->error;
print "ok\n";
-
print "summary:\n" . $sum_title . "\n\n" . $sum_text . "\n";
-
+
push(@PV_SCRIPT, sprintf("%04d-%02d-%02d", $import_date[0], $import_date[1], $import_date[2]));
my ($reader, $writer, $error ) = ( new IO::Handle, new IO::Handle, new IO::Handle );
$writer->autoflush(1);
@@ -137,12 +136,11 @@ for my $entry ($feed->entries) {
}
print "\n";
-
- push(@PV_SCRIPT, sprintf("%04d-%02d-%02d", $import_date_rep[0], $import_date_rep[1], $import_date_rep[2]));
+ push(@PV_SCRIPT, sprintf("%04d-%02d-%02d", $import_date_reb[0], $import_date_reb[1], $import_date_reb[2]));
($reader, $writer, $error ) = ( new IO::Handle, new IO::Handle, new IO::Handle );
$writer->autoflush(1);
local $SIG{CHLD} = 'DEFAULT';
- my $pid = open3($writer, $reader, $error, @PV_SCRIPT);
+ $pid = open3($writer, $reader, $error, @PV_SCRIPT);
binmode($reader, ":utf8");
binmode($writer, ":utf8");
binmode($error, ":utf8");
@@ -169,9 +167,7 @@ if($file eq "" || !(-e "$file")) {
}
print "will import $file to dropbox $dropbox (cart=$to_cart)\n";
-print "will import $file to repitition dropbox $dropbox_rep (cart=$to_cart_rep)\n\n";
-
-exit 0;
+print "will import $file to rebroadcast dropbox $dropbox_reb (cart=$to_cart_reb)\n\n";
my $error_cb = sub {
my ($text) = @_;
@@ -187,9 +183,9 @@ my $log = rhimport::clear_carts($dbh, $group, $to_cart);
my $import_log;
($ret, $import_log) = rhimport::import_single($file, $dropbox, $user, 0, $error_cb);
$log .= $import_log;
-$import_log = rhimport::clear_carts($dbh, $group, $to_cart_rep);
+$import_log = rhimport::clear_carts($dbh, $group, $to_cart_reb);
$log .= $import_log;
-($ret, $import_log) = rhimport::import_single($file, $dropbox_rep, $user, 0, $error_cb);
+($ret, $import_log) = rhimport::import_single($file, $dropbox_reb, $user, 0, $error_cb);
$log .= $import_log;
$dbh->disconnect();