summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-02-12 11:20:37 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-02-12 11:20:37 +0800
commit5a04bc91540459e854225d7f98f3f7eec080f9b5 (patch)
tree1e88b8e07b4ab33cd0d980a7f8ae3792473c6a08 /util
parent73ff68a955e2dff588c7ae42b98d82c88d6974cd (diff)
downloadpttbbs-5a04bc91540459e854225d7f98f3f7eec080f9b5.tar
pttbbs-5a04bc91540459e854225d7f98f3f7eec080f9b5.tar.gz
pttbbs-5a04bc91540459e854225d7f98f3f7eec080f9b5.tar.bz2
pttbbs-5a04bc91540459e854225d7f98f3f7eec080f9b5.tar.lz
pttbbs-5a04bc91540459e854225d7f98f3f7eec080f9b5.tar.xz
pttbbs-5a04bc91540459e854225d7f98f3f7eec080f9b5.tar.zst
pttbbs-5a04bc91540459e854225d7f98f3f7eec080f9b5.zip
weather predict tomorrow
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1528 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util')
-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