#!/usr/bin/env perl
use strict;
use warnings;
use 5.012;
use Feed;
use Feed::Utils;
use Log::Log4perl;

Log::Log4perl::init(\<<'LOG');
log4perl.rootLogger = WARN, Screen
log4perl.appender.Screen = Log::Log4perl::Appender::Screen
log4perl.appender.Screen.stderr = 1
log4perl.appender.Screen.layout = PatternLayout
log4perl.appender.Screen.layout.ConversionPattern = [%d{ISO8601}] %p{1} %X{opml} %X{uri} (%c) %m{chomp}%n
LOG

set_feed_class(Feed->with_traits(
    'MailDir',
    'FixDateTime',
    'DeDupe',
    'AuthorName',
));

set_feed_args(
    dupe_dsn => 'dbi:SQLite:dbname=dedup.db',
    maildir_base => 'maildir',
);

feeds_from_opml(
    {
        mail_folders => 'Gentoo',
    },
    'http://planet.gentoo.org/opml.xml',
    {
        exclude => [
            'http://www.deathwing00.org/wordpress/category/gentoo/feed/',
            'http://home.coming.dk/index.php?tempskin=_rss2',
            'http://blog.vandium.net/category/gentoo-org/feed/',
            'http://blog.i-no.de//rss.xml',
            'http://blog.i-no.de/rss.xml',
            'https://barelysufficient.org/category/gentoo/feed/',
            'http://rrr.thetruth.de/category/planetgentoo/feed/',
            'http://pi-ist-genau-3.de/?cat=441&#038;feed=atom',
            'http://blog.oldworld.fr/index.php?feed/tag/gentoo/atom',
            'http://blog.cafarelli.fr:82/feed/category/Gentoo/rss2',
            'http://www.hboeck.de/feeds/categories/11-Gentoo.rss',
        ],
    },
);

feeds(
    {
        mail_folders => 'Gentoo',
    },
    'http://pi-ist-genau-3.de/?cat=441&feed=atom',
);

feeds_from_opml(
    {
        mail_folders => 'Perl',
    },
    'http://planet.perl.org/opml.xml',
    {
        exclude => [
            'http://blog.urth.org/programming/atom.xml',
            'http://blogs.perl.org/users/john_mcnamara/',
            'http://www.dev411.com/blog/xml/atom/category/feed.xml',
            'http://chainsawblues.vox.com/library/posts/page/1/atom.xml',
            'http://pjf.id.au/blog/index.rss?tag=perl',
            'http://log.perl.org/index.rdf',
        ],
    },
);

feeds_from_opml(
    {
        mail_folders => 'Perl',
    },
    'http://planetsix.perl.org/opml.xml',
);

#feeds_from_opml(
#    {
#        mail_folders => 'Perl',
#    },
#    'http://ironman.enlightenedperl.org/opml',
#);

feeds(
    {
        mail_folders => 'Fun',
    },
    'http://feeds2.feedburner.com/rsspect/fJur',
    'http://feeds2.feedburner.com/sydneypadua/yBZX',
    {
        uri => 'http://oglaf.com/feeds/rss/',
        title=>'Oglaf',
    },
    'http://www.bureau42.com/bureau42.rss',
    'http://syndication.thedailywtf.com/TheDailyWtf',
    'http://thisisindexed.com/feed/',
    'http://notalwaysright.com/feed/atom',
    'http://www.overheardeverywhere.com/index.xml',
    'http://www.overheardinnewyork.com/index.xml',
    'http://www.overheardintheoffice.com/index.xml',
    {
        uri => 'http://bakabt.me/rss.php?uid=714931&pass=94346a8e67f313b3cf64bef311eaf551',
        title => 'BakaBT releases',
        dedupe_use_body => 0,
        dedupe_use_date => 0,
    },
);

feeds(
    {
        mail_folders => 'OSS',
    },
    'http://www.alistapart.com/rss.xml',
    'http://feeds.feedburner.com/geek2geek',
    'http://www.groklaw.net/backend/GrokLaw.rdf',
    'http://feeds.feedburner.com/oreilly/radar/atom',
    'http://feeds.feedburner.com/Oreillygmt',
    'http://emacs-fu.blogspot.com/feeds/posts/default',
);

feeds(
    {
        mail_folders => 'Perl',
    },
    'http://www.simon-cozens.org/blogs/simon/feed',
    'http://search.cpan.org/uploads.rdf',
    'http://pugs.blogs.com/pugs/index.rdf',
    'http://blog.plover.com/index.atom',
    'http://blogs.perl.org/atom.xml',
    'http://YAPHB.blogspot.com/atom.xml',
    'http://pugs.blogs.com/audrey/atom.xml',
    'http://blog.fsck.com/atom.xml',
    'http://blog.urth.org/feed/',
    'http://log.perl.org/feeds/posts/default',
);

feeds(
    {
        mail_folders => 'Science',
    },
    {
        uri => 'http://www.slate.com/blogs/bad_astronomy.fulltext.all.10.rss',
        title => 'Bad Astronomy',
    },
    'http://www.badscience.net/?feed=rss2',
    'http://blog.khymos.org/feed/',
    'http://glottorellando.wordpress.com/feed/',
    'http://languagelog.ldc.upenn.edu/nll/?feed=atom',
    {
    	uri => 'http://scientopia.org/blogs/goodmath/feed/',
        dedupe_use_body => 0,
    },
    'http://www.randi.org/site/index.php?format=feed&type=atom',
    'http://cattaneo-lescienze.blogautore.espresso.repubblica.it/feed/atom/',
    'http://feeds.feedburner.com/makezineonline',
    'http://ovadia-lescienze.blogautore.espresso.repubblica.it/feed/atom/',
    'http://rudimatematici-lescienze.blogautore.espresso.repubblica.it/feed/atom/',
    'http://www.schneier.com/blog/index.rdf',
    'http://bressanini-lescienze.blogautore.espresso.repubblica.it/feed/atom/',
    'http://feeds.feedburner.com/cavolettobruxelles',
    'http://scienceofmagic.wordpress.com/feed/',
);

feeds(
    {
        mail_folders => 'Stuff',
    },
    'https://freedom-to-tinker.com/feed/atom/',
    'http://feeds.gawker.com/gizmodo/full',
    'http://hackaday.com/feed/',
    'http://watchismo.blogspot.com/feeds/posts/default',
);

feeds(
    {
        mail_folders => 'Weblogs',
    },
    'http://www.beppegrillo.it/atom.xml',
    'http://feeds.feedburner.com/boingboing/iBag',
    'http://feeds.feedburner.com/butshesagirl',
    'http://dilbertblog.typepad.com/the_dilbert_blog/index.rdf',
    'http://dilbert.com/blog/entry.feed/',
    'http://duecents.blogspot.com/feeds/posts/default',
    'http://www.anzeledda.it/wp/feed/',
    {
        uri => 'http://www.haibane.info/feed/',
        dedupe_use_body => 0,
    },
    'http://feeds.gawker.com/io9/full',
    'http://nobodyharks.blogspot.com/feeds/posts/default',
    'http://spaghettovolante.wordpress.com/feed/',
    'http://ziriruzine.blogspot.com/feeds/posts/default',
    'http://www.insolita.ilcannocchiale.it/blogs/feeds/blogatom.aspx?blogid=25491',
    'http://feeds.feedburner.com/malvestite',
    'http://exquisitebeast.tumblr.com/rss',
);

feeds(
    {
        mail_folders => 'Writers',
    },
    'http://scienceinmyfiction.com/feed/',
    {
        uri => 'http://www.antipope.org/charlie/blog-static/atom.xml',
        dedupe_use_date => 0,
    },
    {
        uri => 'http://elizabethbear.livejournal.com/data/atom',
        dedupe_use_body => 0,
    },
    'http://lisagoldresearch.wordpress.com/feed/',
    'http://feeds.feedburner.com/LoisMcmasterBujolds',
    {
    	uri => 'http://journal.neilgaiman.com/feeds/posts/default',
	dedupe_use_body => 0,
    },
    'http://www.tor.com/index.php?option=com_content&view=all&format=feed&type=rss&content=frontpage',
    'http://www.thewaythefutureblogs.com/feed/',
    'http://whatever.scalzi.com/feed/',
    'http://www.webcomicsnation.com/rss.php?type=creator&creator=1318',
    'http://thecomposites.tumblr.com/rss',
);

feeds(
    {
        mail_folders => '3dPrinter',
    },
    {
        uri => 'http://hydraraptor.blogspot.com/feeds/posts/default',
        dedupe_use_body => 0,
    },
    'http://blog.makerbot.com/feed/',
    'http://blog.thingiverse.com/feed/atom/',
);

