summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rwxr-xr-xrhimport-fe14
-rwxr-xr-xrhimport-zffe105
3 files changed, 115 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 556c2a1..69110dc 100644
--- a/Makefile
+++ b/Makefile
@@ -52,6 +52,7 @@ install-bin:
$(INSTALL) -m 755 $(EXECUTABLE)-ra $(DESTDIR)$(BINDIR)
$(INSTALL) -m 755 $(EXECUTABLE)-sm $(DESTDIR)$(BINDIR)
$(INSTALL) -m 755 $(EXECUTABLE)-zf $(DESTDIR)$(BINDIR)
+ $(INSTALL) -m 755 $(EXECUTABLE)-zffe $(DESTDIR)$(BINDIR)
$(INSTALL) -m 755 $(EXECUTABLE)-zfw $(DESTDIR)$(BINDIR)
$(INSTALL) -m 755 $(EXECUTABLE)-create-id $(DESTDIR)$(BINDIR)
@sed s#/usr/local/share/rhimport/#$(SHAREDIR)/$(EXECUTABLE)/#g -i $(DESTDIR)$(BINDIR)/$(EXECUTABLE)
@@ -64,6 +65,7 @@ install-bin:
@sed s#/usr/local/share/rhimport/#$(SHAREDIR)/$(EXECUTABLE)/#g -i $(DESTDIR)$(BINDIR)/$(EXECUTABLE)-ra
@sed s#/usr/local/share/rhimport/#$(SHAREDIR)/$(EXECUTABLE)/#g -i $(DESTDIR)$(BINDIR)/$(EXECUTABLE)-sm
@sed s#/usr/local/share/rhimport/#$(SHAREDIR)/$(EXECUTABLE)/#g -i $(DESTDIR)$(BINDIR)/$(EXECUTABLE)-zf
+ @sed s#/usr/local/share/rhimport/#$(SHAREDIR)/$(EXECUTABLE)/#g -i $(DESTDIR)$(BINDIR)/$(EXECUTABLE)-zffe
@sed s#/usr/local/share/rhimport/#$(SHAREDIR)/$(EXECUTABLE)/#g -i $(DESTDIR)$(BINDIR)/$(EXECUTABLE)-zfw
install-share:
@@ -87,6 +89,7 @@ remove-bin:
rm -f $(DESTDIR)$(BINDIR)/$(EXECUTABLE)-ra
rm -f $(DESTDIR)$(BINDIR)/$(EXECUTABLE)-sm
rm -f $(DESTDIR)$(BINDIR)/$(EXECUTABLE)-zf
+ rm -f $(DESTDIR)$(BINDIR)/$(EXECUTABLE)-zffe
rm -f $(DESTDIR)$(BINDIR)/$(EXECUTABLE)-zfw
rm -f $(DESTDIR)$(BINDIR)/$(EXECUTABLE)-create-id
diff --git a/rhimport-fe b/rhimport-fe
index bf62e2c..64d1aa5 100755
--- a/rhimport-fe
+++ b/rhimport-fe
@@ -46,7 +46,7 @@ my $STAT_FILE = $ENV{'HOME'} . "/rhimport-fe.stat";
my $NOTE_FILE = $ENV{'HOME'} . "/rhimport-fe.last_note";
my $NEW_FILE = $ENV{'HOME'} . "/rhimport-fe.is_new";
my $RSS_URL = "http://freie-radios.net/portal/podcast.php?serie=208&rss";
-my $PV_ID = '359';
+#my $PV_ID = '359';
binmode(STDIN, ":utf8");
binmode(STDOUT, ":utf8");
@@ -133,12 +133,12 @@ for my $entry ($feed->entries) {
print "summary:\n" . $sum_title . "\n\n" . $sum_text . "\n";
- if($#ARGV >= 0 && $ARGV[0] eq 'nopv') {
- print "not adding note to PV\n";
- } else {
- rhimport::pv_add_note($sum_title, $sum_text, $PV_ID, sprintf("%04d-%02d-%02d", $import_day[0], $import_day[1], $import_day[2]), "1");
- }
- print "\n";
+ # if($#ARGV >= 0 && $ARGV[0] eq 'nopv') {
+ # print "not adding note to PV\n";
+ # } else {
+ # rhimport::pv_add_note($sum_title, $sum_text, $PV_ID, sprintf("%04d-%02d-%02d", $import_day[0], $import_day[1], $import_day[2]), "1");
+ # }
+ # print "\n";
unlink($NOTE_FILE);
open(my $fhs, '>', $NOTE_FILE);
diff --git a/rhimport-zffe b/rhimport-zffe
new file mode 100755
index 0000000..b5ebad1
--- /dev/null
+++ b/rhimport-zffe
@@ -0,0 +1,105 @@
+#!/usr/bin/perl -w
+#
+#
+# rhimport
+#
+# Copyright (C) 2009 Christian Pointner <equinox@helsinki.at>
+#
+# This file is part of rhimport.
+#
+# rhimport is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# any later version.
+#
+# rhimport is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rhimport. If not, see <http://www.gnu.org/licenses/>.
+#
+
+use strict;
+use Switch;
+use Date::Calc;
+use Time::localtime;
+use IO::Handle;
+use IPC::Open3;
+
+use lib '/usr/local/share/rhimport/';
+use rhimport;
+
+my $STAT_FILE = $ENV{'HOME'} . "/rhimport-zffe.stat";
+my $ZF_NOTE_FILE = $ENV{'HOME'} . "/rhimport-zf.last_note";
+my $ZF_NEW_FILE = $ENV{'HOME'} . "/rhimport-zf.is_new";
+my $FE_NOTE_FILE = $ENV{'HOME'} . "/rhimport-fe.last_note";
+my $FE_NEW_FILE = $ENV{'HOME'} . "/rhimport-fe.is_new";
+my $PV_ID = '359';
+
+binmode(STDIN, ":utf8");
+binmode(STDOUT, ":utf8");
+binmode(STDERR, ":utf8");
+
+if($#ARGV >= 0 && $ARGV[0] eq 'last') {
+ print "!!!This is the last attempt, there won't be a retry on error!!!\n"
+}
+
+my @import_day = Date::Calc::Today();
+my $import_date = sprintf("%04d-%02d-%02d", @import_day);
+my $current_date = `cat $STAT_FILE`;
+if($current_date eq $import_date) {
+ print "Already created note of today\n";
+ $dbh->disconnect();
+ exit 0;
+}
+
+unless(-e $ZF_NEW_FILE) {
+ print "zip-fm not yet imported - ";
+ if($#ARGV >= 0 && $ARGV[0] eq 'last') {
+ print "giving up, rebroadcasting last show";
+ } else {
+ print "will retry later\n";
+ exit 0,
+ }
+}
+
+unless(-e $FE_NEW_FILE) {
+ print "focus europa not yet imported - ";
+ if($#ARGV >= 0 && $ARGV[0] eq 'last') {
+ print "giving up, rebroadcasting last show";
+ } else {
+ print "will retry later\n";
+ exit 0,
+ }
+}
+
+sub get_note {
+ my ($file) = @_;
+ my @lines = read_file($file, binmode => ':utf8', err_mode => 'quiet');
+ return "" unless ($lines[0]);
+
+ chomp($lines[0]);
+ $lines[0] = "<p><strong>$lines[0]</strong></p>\n";
+ return join('',@lines);
+};
+
+my $sum_title = "focus europa, zip-fm (WH)";
+my $sum_text = get_note($FE_NOTE_FILE) . "<br/>\n";
+$sum_text = $sum_text . get_note($ZF_NOTE_FILE) . "<br/>\n";
+$sum_text = $sum_text . "<br/><br/>\n";
+
+print "\nsummary:\n" . $sum_title . "\n\n" . $sum_text . "\n";
+rhimport::pv_add_note($sum_title, $sum_text, $PV_ID, sprintf("%04d-%02d-%02d", @import_day), "1");
+print "\n";
+
+unlink($STAT_FILE);
+open(my $fhs, '>', $STAT_FILE);
+print $fhs $import_date;
+close($fhs);
+
+unlink($ZF_NEW_FILE);
+unlink($FE_NEW_FILE);
+
+exit 0;