summary refs log tree commit diff
diff options
context:
space:
mode:
authorfranck cuny <franck.cuny@rtgi.fr>2008-12-26 21:24:13 +0100
committerfranck cuny <franck.cuny@rtgi.fr>2008-12-26 21:24:13 +0100
commit2ec9e089f43ea6aa8ed864be0a11fd438e220533 (patch)
tree015d19515bd2b810dc6a65cf49fe3acf858bd9d9
parentpublic data (diff)
downloadlifestream-2ec9e089f43ea6aa8ed864be0a11fd438e220533.tar.gz
lifestream script, template, and configuration file
-rw-r--r--lifestream.pl47
-rw-r--r--lifestream.tt135
-rw-r--r--lifestream.yaml19
3 files changed, 201 insertions, 0 deletions
diff --git a/lifestream.pl b/lifestream.pl
new file mode 100644
index 0000000..891e945
--- /dev/null
+++ b/lifestream.pl
@@ -0,0 +1,47 @@
+#!/usr/bin/perl -w
+use strict;
+use feature 'say';
+
+use XML::Feed;
+use YAML::Syck;
+use URI;
+use Template;
+
+my $feeds = LoadFile( shift );
+
+my $hash_entries;
+foreach ( @$feeds ) {
+    my $feed = XML::Feed->parse( URI->new( $_->{ url } ) );
+    for my $e ( $feed->entries ) {
+        my $date = $e->issued->strftime( '%Y.%m.%d' );
+        push @{ $hash_entries->{ $date } },
+            {
+            source     => $_->{ source },
+            date       => $e->issued->hms,
+            title      => $e->title,
+            link       => $e->link,
+            source_url => $_->{ source_url },
+            };
+    }
+}
+
+my @dates = keys %$hash_entries;
+my @sorted_dates = sort { $a cmp $b } @dates;
+
+my $hash_templates;
+foreach my $date ( reverse @sorted_dates ) {
+    my @actions = sort { $b->{ date } cmp $a->{ date } }
+        @{ $hash_entries->{ $date } };
+    push @{ $hash_templates->{ entries } },
+        {
+        date    => $date,
+        actions => \@actions
+        };
+}
+
+my $template = Template->new;
+$template->process( 'lifestream.tt', $hash_templates, \my $content )
+    or die $!;
+open my $fh, '>:utf8', 'public/index.html';
+print $fh $content;
+close $fh;
diff --git a/lifestream.tt b/lifestream.tt
new file mode 100644
index 0000000..844ace2
--- /dev/null
+++ b/lifestream.tt
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+        <link rel="stylesheet" href="lifestream.css" type="text/css" />
+        <title>lumberjaph.net | lifestream</title>
+        <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
+    </head>
+    <body id="motion" class="user-profile layout-wtt">
+        <div id="container">
+            <div id="container-inner">
+    <div id="header">
+        <div id="flickr_badge_uber_wrapper">
+            <script type="text/javascript"
+                src="http://www.flickr.com/badge_code_v2.gne?count=10&display=latest&size=s&layout=h&source=user&user=27734462%40N00"></script>
+           
+    </div></div>
+                <div id="content">
+                    <div id="content-inner">
+                        <div id="alpha">
+                            <div id="alpha-inner">
+                                <div class="profile-header">
+                                    <div class="userpic"><img src="images/me.jpg" alt="franck" /></div>
+                                    <div class="profile-header-content"><h1 id="page-title">franck cuny</h1></div>
+                                    <a href="http://lumberjaph.net">lumberjpah.net</a>
+                                </div>
+                                <div class="actions">
+                                    [% USE Dumper %]
+                                    [% FOREACH entry IN entries %]
+                                        <h2>actions for [% entry.date %]</h2>
+                                        <ul class="action-listing">
+                                        [% FOREACH action IN entry.actions %]
+                                        <li class="icon-service-[% action.source %]">
+                                        <span class="action-listing-date"> [% action.date %] - I posted to <a href="[% action.source_url %]">[% action.source %]</a></span>
+                                        <br />
+                                                <span class="action-listing-title">
+                                                    <a href="[% action.link %]" target="_blank">[% action.title %]</a>
+                                                </span>
+                                            </li>
+                                        [% END %]
+                                        </ul>
+                                    [% END %]
+
+                        </div>
+
+
+
+                        </div>
+                    </div>
+
+
+                    <div id="beta">
+    <div id="beta-inner">
+
+        
+            <div class="widget-elsewhere widget">
+    <h3>
+
+        find me elsewhere
+
+    </h3>
+    <div class="widget-content">
+        <ul class="action-stream-list">
+
+
+            <li class="service-icon icon-service-delicious">
+                <a href="http://delicious.com/krynsky/" rel="me">Delicious Profile</a>
+    
+            </li>
+
+            <li class="service-icon icon-service-flickr">
+                <a href="http://flickr.com/photos/krynsky/" rel="me">Flickr Profile</a>
+    
+            </li>
+
+
+            <li class="service-icon icon-service-googlereader">
+                <a href="http://www.google.com/reader/shared/01549324099173237561" rel="me">Google Reader Profile</a>
+    
+            </li>
+
+            <li class="service-icon icon-service-lastfm">
+                <a href="http://www.last.fm/user/krynsky/" rel="me">Last.fm Profile</a>
+    
+            </li>
+
+
+            <li class="service-icon icon-service-identica">
+                <a href="http://identi.ca/franck" rel="me">Identica Profile</a>
+    
+            </li>
+
+
+            <li class="service-icon icon-service-myblog">
+                <a href="http://lumberjaph.net/blog/" rel="me">my blog</a>
+    
+            </li>
+
+        </ul>
+
+    </div>
+</div>
+
+        
+
+        
+
+
+
+                </div>
+            </div>
+
+
+            <div id="footer">
+    <div id="footer-inner">
+        <div id="footer-content">
+<div class="widget-about-site widget">
+    <h3 class="widget-header">About</h3>
+    <div class="widget-content">
+        created with perl - creative commons blah
+    </div>
+</div><div class="widget-powered widget">
+</div>
+        </div>
+    </div>
+</div>
+
+
+
+        </div>
+    </div>
+
+                                    
+
+</body></html>
\ No newline at end of file
diff --git a/lifestream.yaml b/lifestream.yaml
new file mode 100644
index 0000000..79944e2
--- /dev/null
+++ b/lifestream.yaml
@@ -0,0 +1,19 @@
+-
+    source: delicious
+    url: http://feeds.delicious.com/v2/rss/franck?count=20
+    source_url: http://delicious.com/franck
+-
+    source: identica
+    url: http://identi.ca/api/statuses/user_timeline/franck.atom
+    source_url: http://identi.ca/franck
+-
+    source: googlereader
+    url: http://www.google.com/reader/public/atom/user%2F17077268849154926648%2Fstate%2Fcom.google%2Fbroadcast
+-
+    source: myblog
+    url: http://lumberjaph.net/blog/index.php/feed/
+    source_url: http://lumberjaph.net/blog/
+-
+    source: lastfm
+    url: http://ws.audioscrobbler.com/1.0/user/franckcuny/recenttracks.rss
+    source_url: http://www.last.fm/user/franckcuny