Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Jan 9, 2014
0 parents commit 30f61ab
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
40 changes: 40 additions & 0 deletions filmical
@@ -0,0 +1,40 @@
#!/usr/bin/perl

use strict;
use warnings;
use 5.010;

use Data::ICal;
use Data::ICal::Entry::Event;
use DateTime::Format::Strptime;
use Digest::MD5 qw[md5_hex];

open my $film_fh, '<', 'films.txt' or die $!;

my $dt_p = DateTime::Format::Strptime->new(
pattern => '%Y-%m-%d'
);
my $ical = Data::ICal->new;
$ical->add_properties(
version => '2.0',
prodid => q[Dave's Film iCal Generator],
);

while (<$film_fh>) {
chomp;
my ($rel_date, $title) = split /\s+/, $_, 2;
my $entry = Data::ICal::Entry::Event->new;
my $date = $dt_p->parse_datetime($rel_date);
my $start = $date->strftime('%Y%m%d');
my $end = $date->add(days => 1)->strftime('%Y%m%d');
my $uid = "$date-" . md5_hex($title) . '@dave.org.uk';
$entry->add_properties(
summary => $title,
uid => $uid,
dtstart => [ $start, { VALUE => 'DATE' } ],
dtend => [ $end, { VALUE => 'DATE' } ],
);
$ical->add_entry($entry);
}

print $ical->as_string;
45 changes: 45 additions & 0 deletions films.txt
@@ -0,0 +1,45 @@
2014-01-01 American Hustle
2014-01-03 Age of Uprising
2014-01-03 Last Vegas
2014-01-03 The Missing Picture
2014-01-10 12 Years a Slave
2014-01-10 After Tiller
2014-01-10 Delivery Man
2014-01-10 Kiss the Water
2014-01-10 The Railway Man
2014-01-17 The Wolf of Wall Street
2014-01-24 August: Osage County
2014-01-24 Dark Days
2014-01-24 Grudge Match
2014-01-24 Inside Llewyn Davies
2014-01-24 Teenage
2014-01-31 Journal de France
2014-01-31 The Armstrong Lie
2014-02-07 Robocop
2014-02-14 The Monuments Men
2014-02-21 A New York Winter's Tale
2014-03-07 300: Rise of an Empire
2014-03-07 A Long Way Down
2014-03-07 Nymphomaniac
2014-03-07 The Grand Budapest Hotel
2014-03-28 Captain America: The Winter Soldier
2014-03-28 Muppets Most Wanted
2014-04-04 Before I Go to Sleep
2014-04-04 Divergent
2014-04-18 The Amazing Spider-Man 2
2014-05-16 Godzilla
2014-05-22 X-Men: Days of Future Past
2014-05-30 Maleficent
2014-06-06 A Million Ways to Die in the West
2014-07-04 How to Train Your Dragon 2
2014-07-17 Dawn of the Planet of the Apes
2014-07-25 Jupiter Ascending
2014-08-01 Guardians of the Galaxy
2014-08-29 Sin City: A Dame to Kill For
2014-10-03 Gone Girl
2014-10-17 The Judge
2014-10-24 Fury
2014-11-07 Interstellar
2014-11-21 The Hunger Games: Mockingjay - Part 1
2014-12-12 Exodus
2014-12-19 The Hobbit: There and Back Again

0 comments on commit 30f61ab

Please sign in to comment.