0

Samurizeを使用してWindowsデスクトップにマージして配置したいGoogleカレンダーがいくつかあります。SamurizeのPageScraperプラグインを使用してみましたが、問題がないようです。

Samurizeにスクリプトを実行させ、その出力をデスクトップに配置することはできますが、これを行うための最良のツールが何であるかはわかりません。

私が持っているすべてのURLは次の形式です。

http://www.google.com/calendar/feeds/example%40gmail.com/private-REMOVED/basic?futureevents=true&orderby=starttime&sortorder=ascending&singleevents=true

したがって、curlを使用してそれらをフェッチすることはできますが、フィルターをかける必要があります。

私は次のようなものが欲しいです:

2009 12 02  Event from calendar 1's description 
2009 12 03  Event from calendar 2's description 
2009 12 04  Event from calendar 1's description 
2009 12 05  Event from calendar 3's description 
2009 12 06  Event from calendar 1's description 

ただし、カレンダーフィードの日付は次のようにフォーマットされます。

<title type='html'>Event from calendar 1's description</title><summary type='html'>When: Fri 5 Dec 2008&lt;br&gt;

では、日付と説明を除外して、日付を変換するにはどうすればよいですか?

(私はcygwinをインストールしているので、perlまたはsed / awkを使用するものは、それらに精通しているので、将来それらを変更することに自信があるので完璧ですが、提案を受け入れます。)

4

3 に答える 3

1

John W のスクリプトに基づいて、これが私が使用しているものです

#!c:\cygwin\bin\perl.exe -w
use strict;
use LWP::Simple qw(get);

my %calendars = ( "Sam Hasler", "http://www.google.com/calendar/feeds/blah/blah/basic"
                , "Family    ", "http://www.google.com/calendar/feeds/blah/blah/basic"
                , "Work      ", "http://www.google.com/calendar/feeds/blah/blah/basic"
                );

my $params = "?futureevents=true&orderby=starttime&sortorder=ascending&singleevents=true";

my %months = ( "Jan", "01", "Feb", "02", "Mar", "03", "Apr", "04"
             , "May", "05", "Jun", "06", "Jul", "07", "Aug", "08"
             , "Sep", "09", "Oct", "10", "Nov", "11", "Dec", "12");

my $calendar_name;
my $calendar_url;
my @lines;

while (($calendar_name, $calendar_url) = each(%calendars)){
    my $calendar_data = get "$calendar_url$params";
    @lines = split(/\n/, $calendar_data);

    foreach (@lines) {
        if (/<title type='html'>([\d\D]*)<\/title><summary type='html'>When: (\S+) (\S+) (\S+) (\S+)&lt;br&gt;/)
        {
            my $day = "$3";
            if ($3 < 10 ) {
                $day = "0$3";
            }

            print "$5 $months{$4} $day\t$calendar_name\t$1\n";
        }
    }

}

出力をパイプしsortて日付順に取得するだけです。

更新:スクリプトをプラグインに変換し、Samurize の Web サイト: Merge Google Calendar feedsに送信しました。

于 2008-12-03T00:24:03.653 に答える
1

2 つのアイデア。

Yahoo Pipes を使用できます (この記事を参照してください)。

または、Yahoo がデータを更新するのを待ちたくない場合は、 ICALファイルをマージするための開発中の Python スクリプトを次に示します。

于 2009-04-23T14:07:25.990 に答える
1

私はperlを学んでいるので、あまり笑わないでください.

#!C:\Perl\bin -w
use strict;

my %months = ("Jan", "01", "Feb", "02", "Mar", "03", ... etc. etc. ... "Dec", "12");

$_ = "<title type='html'>Event from calendar 1's description</title><summary type='html'>When: Fri 5 Dec 2008<br>";

if (/<title type='html'>([\d\D]*)<\/title><summary type='html'>When: (\S+) (\S+) (\S+) (\S+)<br>/)
{
    print "$5 $months{$4} $3 $1\n";
}
于 2008-12-02T22:47:38.980 に答える