#!/usr/local/bin/perl package ottava; #use strict; # ottava.pl - id:word-salad # 2009/03/31 closed. # 以下のように投げて出来た引数を適当に貼ると吉。 # $ottava = require 'ottava.pl'; # 時刻取得 $ENV{'TZ'} = 'JST-9'; my($sec,$min,$hour,$mday,$mon,$year,$wday,$d,$d) = localtime(time); my $on_air_time = sprintf("%02d%02d", $hour, $min); # 今回は時間のみ取得します。 my $on_air_wday = $wday; # 曜日は別腹。 my $ottava_caffe = ''; my $ottava_special = ''; # 平日タイムテーブル if ($on_air_wday =~ m/^[1-5]/i) { if ($on_air_time >= '0500' && $on_air_time < '0700') { $ottava_caffe = 'OTTAVA alba'; } if ($on_air_time >= '0700' && $on_air_time < '0930') { $ottava_caffe = 'OTTAVA fresco'; } if ($on_air_time >= '0930' && $on_air_time < '1000') { $ottava_caffe = 'Caffe celeste'; } if ($on_air_time >= '1000' && $on_air_time < '1330') { $ottava_caffe = 'OTTAVA animato'; } if ($on_air_time >= '1330' && $on_air_time < '1400') { $ottava_caffe = 'Caffe rosso'; } if ($on_air_time >= '1400' && $on_air_time < '1730') { $ottava_caffe = 'OTTAVA moderato'; } if ($on_air_time >= '1730' && $on_air_time < '1800') { $ottava_caffe = 'Caffe bruno'; } if ($on_air_time >= '1800' && $on_air_time < '2130') { $ottava_caffe = 'OTTAVA amoroso'; } if ($on_air_time >= '2130' && $on_air_time < '2200') { $ottava_caffe = 'Caffe bleu'; } if ($on_air_time >= '2200' || $on_air_time < '0100') { $ottava_caffe = 'OTTAVA con brio'; } if ($on_air_time >= '0100' && $on_air_time < '0500') { $ottava_caffe = 'OTTAVA stella'; } # 週末タイムテーブル } else { if ($on_air_time >= '2300' || $on_air_time < '0500') { $ottava_caffe = 'OTTAVA stella'; } if ($on_air_time < '0100' && $on_air_wday eq '6') { $ottava_caffe = 'OTTAVA con brio'; } if ($on_air_time >= '0500' && $on_air_time < '0800') { $ottava_caffe = 'OTTAVA alba'; } if ($on_air_time >= '0800' && $on_air_time < '1030') { $ottava_caffe = 'OTTAVA sereno'; } if ($on_air_time >= '1030' && $on_air_time < '1100') { $ottava_caffe = 'Caffe bianco'; } if ($on_air_time >= '1100' && $on_air_time < '1430') { $ottava_caffe = 'OTTAVA vivace'; } if ($on_air_time >= '1430' && $on_air_time < '1500') { $ottava_caffe = 'Caffe verde'; } if ($on_air_time >= '1500' && $on_air_time < '1830') { $ottava_caffe = 'OTTAVA grazia'; } if ($on_air_time >= '1830' && $on_air_time < '1900') { $ottava_caffe = 'Caffe azzurro'; } if ($on_air_time >= '1900' && $on_air_time < '2300') { $ottava_caffe = 'OTTAVA soave'; } } # Extra. # OTTAVA amoroso (Mon - Fry) 24:00 - 27:30 / InterFM [76.1MHz] # OTTAVA con brio (Mon - Fry)27:30 - 28:00 / TBS Radio [954kHz] if ($on_air_wday =~ m/^[2-6]/i && $on_air_time >= '0000' && $on_air_time < '0400') { if ($on_air_time >= '0000' && $on_air_time < '0330') { $ottava_special.= "\n
NOW ON AIR : OTTAVA amoroso / InterFM [76.1MHz]"; } if ($on_air_time >= '0300' && $on_air_time < '0400') { $ottava_special.= "\n
NOW ON AIR : OTTAVA con brio / TBS Radio [954kHz]"; } } # 出来た物を $now_on_air として格納。 my $now_on_air = ""; $now_on_air = "
"; $now_on_air.= "NOW ON AIR : $ottava_caffe / Contemporary Classical Music Radio Station OTTAVA by TBS"; if ($ottava_special) { $now_on_air.= $ottava_special; } $now_on_air.= ""; return $now_on_air; 1; # おっしまい。