[Bast-commits] r8825 - ironman
idn at dev.catalyst.perl.org
idn at dev.catalyst.perl.org
Sat Feb 27 00:30:33 GMT 2010
Author: idn
Date: 2010-02-27 00:30:33 +0000 (Sat, 27 Feb 2010)
New Revision: 8825
Added:
ironman/perlanet-collector.pl
Log:
First cut commit of the perlanet-collector script for IronMan. This is some shitty code that needs refactoring, but it works
Added: ironman/perlanet-collector.pl
===================================================================
--- ironman/perlanet-collector.pl (rev 0)
+++ ironman/perlanet-collector.pl 2010-02-27 00:30:33 UTC (rev 8825)
@@ -0,0 +1,88 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Perlanet::IronMan;
+use XML::Feed;
+use IronMan::Schema;
+use Data::Dumper;
+
+# Perlanet configuration settings
+my $cfg = {};
+$cfg->{title} = "all.things.per.ly";
+$cfg->{description} = "all.things.per.ly IronMan agregation";
+$cfg->{url} = "http://ironboy.enlightenedperl.org/";
+$cfg->{self_link} = "http://ironboy.enlightenedperl.org/";
+$cfg->{agent} = "Perlanet";
+$cfg->{author}->{name} = "Perlanet";
+$cfg->{feed}->{format} = "RSS";
+$cfg->{entries} = 5;
+
+# Database
+$cfg->{db}{dsn} = "dbi:SQLite:/var/www/ironboy.enlightenedperl.org/ironman/subscriptions.db";
+
+# Get me a Perlanet::IronMan thingy using our config from above
+my $p = Perlanet::IronMan->new( cfg => $cfg );
+
+# Should be calling run here
+#$p->run;
+#exit;
+
+# I'm taking run apart here
+$p->update_opml;
+
+# Get the list of feeds from the database
+print("Fetching feeds object\n");
+my $feeds_obj = $p->feeds;
+
+# Sample data:
+# bless( {
+# 'website' => 'http://jjnapiorkowski.vox.com/library/posts/page/1/',
+# 'entries' => [],
+# 'url' => 'http://jjnapiorkowski.vox.com/library/posts/atom.xml',
+# 'title' => 'John Napiorkowski',
+# 'id' => 'D78C979A-6678-11DE-98DD-DC36AA5A0737',
+# 'author' => ''
+# }, 'Perlanet::Feed' )
+
+#print(Dumper($feeds_obj));
+#exit;
+
+#print("Fetching the feed data\n");
+#my @feeds_data = $p->fetch_feeds( @{ $feeds_obj } );
+
+foreach my $feed ( @{ $feeds_obj } ) {
+ #print("Fetching posts from feed '" . $feed->url . "'\n");
+ my @feed_posts = $p->fetch_feeds( $feed );
+
+ #print(Dumper(@feed_posts));
+ #exit;
+
+ #print("Filtering posts to remove duplicates\n");
+ # Filter feed_posts for previously seen posts
+ @feed_posts = $p->select_entries(@feed_posts);
+
+ #print(Dumper(@feed_posts));
+ #exit;
+
+ #print("Building a post object\n");
+ my $post = $p->build_feed(@feed_posts);
+ $p->render($feed, $post);
+
+}
+
+
+#print(Dumper(@feeds_data));
+#exit;
+
+# Get the entries from the feeds data
+#print("Building the entries array\n");
+#my @entries = $p->select_entries( @feeds_data );
+
+#print(Dumper(@entries));
+#exit;
+
+#my $feed = $p->build_feed(@entries);
+#$p->render($feed)
+
Property changes on: ironman/perlanet-collector.pl
___________________________________________________________________
Added: svn:executable
+ *
More information about the Bast-commits
mailing list