Æüµ­/2020-12-27

ºÇ½ª¹¹¿·»þ´Ö¡§2020ǯ12·î27Æü 10»þ48ʬ24ÉÃ

2021ǯ¤ÎJRA½Å¾Þ¥«¥ì¥ó¥À¡¼¤ÎºîÀ®

¡¡

calendar.png

¡¡JRA¤ÏÎãǯGoogle¥«¥ì¥ó¥À¡¼¤Ê¤É¤ËÅÐÏ¿¤Ç¤­¤ë³«ºÅÆüÄø¤ä½Å¾ÞÆüÄø¤ò¤Þ¤È¤á¤¿ics¥Õ¥¡¥¤¥ë¤òÄ󶡤·¤Æ¤¤¤ë¡Ê¤³¤Á¤é¤Î¥Ú¡¼¥¸»²¾È¡Ë¡£
¡¡¤·¤«¤·¡¢2020/12/27¸½ºß¡¢2021ǯ¤Î³«ºÅÆüÄø¤Îics¥Õ¥¡¥¤¥ë¤Ï¤¹¤Ç¤ËÄ󶡤µ¤ì¤Æ¤¤¤ë¤¬¡¢½Å¾ÞÆüÄø¤ÎÊý¤Ï¤Þ¤ÀÄ󶡤µ¤ì¤Æ¤¤¤Ê¤¤¡£¤³¤ì¤Ï¡¢°ìÉô¤Î½Å¾Þ¤Î³ÊÉÕ¤±¤¬¤Þ¤À³ÎÄꤷ¤Æ¤¤¤Ê¤¤¤¿¤á¤À¤È»×¤ï¤ì¤ë¡£Àè¤Î¥Ú¡¼¥¸¤Ë¤Ï¡¢

Ãíµ­¡§	½Å¾Þ¥¹¥±¥¸¥å¡¼¥ë¥Õ¥¡¥¤¥ë¤Ï2021ǯ1·îÃæ½Ü¤Ë¥¢¥Ã¥×ͽÄê¤Ç¤¹¡£

¤È¤¢¤ë¤¿¤á¡¢¤â¤¦Æó¡¢»°½µ´ÖÂԤƤФ¤¤¤¤Î¤À¤¬¡¢»ä¤È¤·¤Æ¤Ï¡¢Ç¯ÌÀ¤±¤Ë¤Ï¶âÇդγ«ºÅÆüÄø¤ò¤É¤¦¤·¤Æ¤âGoogle¥«¥ì¥ó¥À¡¼¤Ëɽ¼¨¤·¤Æ¤ª¤­¤¿¤¤¡ª
¡¡¤½¤³¤Ç¡¢¤¹¤Ç¤ËJRA¤«¤éÄ󶡤µ¤ì¤Æ¤¤¤ë³ÊÉÕ¤±Ì¤³ÎÄê¤Î¾ðÊó¤ò´Þ¤à2021ǯ¤Î½Å¾Þ¥ì¡¼¥¹°ìÍ÷¤Î¥Ú¡¼¥¸¤Î¥Ç¡¼¥¿¤ò¸µ¤Ë¡¢¾¡¼ê¤Ëics¥Õ¥¡¥¤¥ë¤òºîÀ®¤·¤Æ¡¢Google¥«¥ì¥ó¥À¡¼¤ËÅÐÏ¿¤·¤Æ¤ß¤¿¡£
¡¡°Ê²¼¤Î¥¹¥¯¥ê¥×¥È(makevcal.pl)¤ò¼Â¹Ô¤·¡¢

./makevcal.pl > grace.ics

¡¡ºîÀ®¤µ¤ì¤¿ics¥Õ¥¡¥¤¥ë¤òGoogle¥«¥ì¥ó¥À¡¼¤Ë¥¤¥ó¥Ý¡¼¥È¤¹¤ë¤À¤±¡£

#!/usr/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
use HTML::TableExtract;
use Time::Piece;
use Time::Seconds;
use utf8;
binmode(STDOUT, ":utf8");

my $url = 'https://www.jra.go.jp/datafile/seiseki/replay/2021/jyusyo.html';
my $ua = LWP::UserAgent->new();
$ua->agent('Mozilla/4.0 (compatible; MSIE 6.0\'; Windows NT 5.0;)');
my $res = $ua->get($url);
my $html = $res->decoded_content;

my $te = HTML::TableExtract->new();
$te->parse($html);
my ($ts) = $te->first_table_found();

print("BEGIN:VCALENDAR\n");
print("VERSIONS:2.0\n");
print("X-WR-CALNAME:JRAGRADERACE2021\n");
print("X-WR-TIMEZONE:Asia/Tokyo\n");

#[0] \ "1·î5Æü²ÐÍË",
#[1] \ "G­·Ã滳¶âÇÕ",
#[2] \ "Ã滳",
#[3] \ "4ºÐ°Ê¾å",
#[4] \ "¼Ç2,000¥á¡¼¥È¥ë",

for my $row ($ts->rows) {
    my $date = $row->[0];
    my $desc = $row->[1];
    my $location = $row->[2];
    my $age = $row->[3];
    my $course = $row->[4];

    next if ($date eq "·îÆü");

    $date =~ m/(\d+)·î(\d+)Æü/;
    my $mon = $1;
    my $day = $2;
    $date = sprintf("2021%02d%02d", $mon, $day);
    my $d = Time::Piece->strptime($date, '%Y%m%d');

    print("BEGIN:VEVENT\n");
    printf("DTSTART;VALUE=DATE:%s\n", $d->strftime("%Y%m%d"));
    $d += ONE_DAY;
    printf("DTEND;VALUE=DATE:%s\n", $d->strftime("%Y%m%d"));
    
    $desc =~ m/(G(­µ|­¶|­·)|½Å¾Þ)(.*)/;
    my $grade = $1;
    my $name = $3;
    $grade =~ s/­µ/I/;
    $grade =~ s/­¶/II/;
    $grade =~ s/­·/III/;

    printf("SUMMARY:%s(%s)\n", $name, $grade);
    printf("LOCATION:%s¶¥ÇϾì\n", $location);
    printf("DESCRIPTION:%s %s\n", $age, $course);
    print("END:VEVENT\n");
}

print("END:VCALENDAR\n");

¡¡Ãí°ÕÅÀ¤È¤·¤Æ¤Ï¡¢¾å½Ò¤ÎÄ̤ꡢ2020/12/27»þÅÀ¤Ç¤Ï¡¢³ÊÉÕ¤±Ì¤³ÎÄê¤Î½Å¾Þ¤¬¤¢¤ë¤³¤È¡£2021ǯ¤Î½Å¾Þ¥ì¡¼¥¹°ìÍ÷¤Î¥Ú¡¼¥¸¤Ë¤Ï¡¢°Ê²¼¤Î¤è¤¦¤ÊÃí°Õ½ñ¤­¤¬Åº¤¨¤é¤ì¤Æ¤¤¤ë¡£

Ãíµ­¡§	°ªS¤ÏG­·³ÊÉÕ¿½ÀÁÃæ
Ãíµ­¡§	Å쥹¥ÝÇÕ2ºÐS¤ÏG­¶³ÊÉÕ¿½ÀÁÃæ

¡¡Â¿Ê¬¡¢¿½ÀÁÄ̤ê¤Î³ÊÉÕ¤±¤Ë¤Ê¤ë¤ó¤À¤í¤¦¤¬¡¢²áµî¤Ë¤Ï¿½ÀÁ¤¬Ä̤é¤Ê¤«¤Ã¤¿¤³¤È¤â¤¢¤ë¤é¤·¤¯¡¢ÌýÃǤǤ­¤Ê¤¤¡£
¡¡¾åµ­¤Î½Å¾Þ¤Î³ÊÉÕ¤±¤¬³ÎÄꤷ¤¿¤é¡¢¿·¤¿¤Ëics¥Õ¥¡¥¤¥ë¤òºî¤êľ¤¹¤«¡¢JRA¤¬Ä󶡤¹¤ëics¥Õ¥¡¥¤¥ë¤ò¥²¥Ã¥È¤¹¤ë¤«¤·¤Æ¡¢Google¥«¥ì¥ó¥À¡¼¤Ë¥¤¥ó¥Ý¡¼¥È¤·Ä¾¤¹¤«¡¢Google¥«¥ì¥ó¥À¡¼¾å¤Ç¡¢2021/05/29¡ÊÅڡˤΰªS¡Ê¡Ö½Å¾Þ¡×¤ò¡ÖGIII¡×¤Ø¡©¡Ë¤È¡¢2021/11/20¡ÊÅڡˤÎÅ쥹¥ÝÇÕ2ºÐS¡Ê¡ÖGIII¡×¤ò¡ÖGII¡×¤Ø¡©¡Ë¤Î¾ðÊó¤ò¼ê¤Ç½¤Àµ¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡¤¤¤ä¡¢¤½¤ì¤Ê¤éÆó¡¢»°½µ´ÖÂԤƤ衢¤Ã¤ÆÏäǤ¹¤¬¡£