summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--util/weather.perl35
-rw-r--r--util/weather.sh3
2 files changed, 20 insertions, 18 deletions
diff --git a/util/weather.perl b/util/weather.perl
index 5edc147a..690c84fa 100644
--- a/util/weather.perl
+++ b/util/weather.perl
@@ -10,28 +10,29 @@
use lib '/home/bbs/bin';
use LocalVars;
-open(BBSPOST, "| bin/webgrep>etc/weather.tmp");
-# 日期
-open(DATE, "date +'%a %b %d %T %Y' |");
-$date = <DATE>;
-chop $date;
-close DATE;
+weather_report('etc/weather.today', 'ftp://ftpsv.cwb.gov.tw/pub/forecast/W002.txt');
+weather_report('etc/weather.tomorrow', 'ftp://ftpsv.cwb.gov.tw/pub/forecast/W003.txt');
+
+sub weather_report
+{
+ my ($file, $link) = @_;
+ open(BBSPOST, "| $file");
# Header
# 內容
#open(WEATHER, "$LYNX -assume_charset=big5 -assume_local_charset=big5 -dump http://www.cwb.gov.tw/V3.0/weather/text/W03.htm |");
-open(WEATHER, "$LYNX -assume_charset=big5 -assume_local_charset=big5 -dump -nolist ftp://ftpsv.cwb.gov.tw/pub/forecast/W002.txt|");
+ open(WEATHER, "$LYNX -assume_charset=big5 -assume_local_charset=big5 -dump -nolist $link|");
-while (<WEATHER>) {
- print BBSPOST if ($_ ne "\n");
-}
-close WEATHER;
+ while (<WEATHER>) {
+ print BBSPOST if ($_ ne "\n");
+ }
+ close WEATHER;
# 簽名檔
-print BBSPOST "\n--\n";
-print BBSPOST "我是beagle所有可愛的小餅乾...跨海為Ptt服務\n";
-print BBSPOST "--\n";
-print BBSPOST "☆ [Origin: ◎果醬小站◎] [From: [藍莓鬆餅屋] ] ";
-
-close BBSPOST;
+ print BBSPOST "\n--\n";
+ print BBSPOST "我是beagle所有可愛的小餅乾...跨海為Ptt服務\n";
+ print BBSPOST "--\n";
+ print BBSPOST "☆ [Origin: ◎果醬小站◎] [From: [藍莓鬆餅屋] ] ";
+ close BBSPOST;
+}
diff --git a/util/weather.sh b/util/weather.sh
index 315b0ec3..58a1bdbf 100644
--- a/util/weather.sh
+++ b/util/weather.sh
@@ -2,4 +2,5 @@
# $Id: weather.sh,v 1.1 2002/03/07 15:13:46 in2 Exp $
#
bin/weather.perl
-bin/post Record 全省各地天氣預報 [氣象小姐] etc/weather.tmp
+bin/post Record 全省今日各地天氣預報 [氣象小姐] etc/weather.today
+bin/post Record 全省明日各地天氣預報 [氣象小姐] etc/weather.tomorrow