#!/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',
    'UnBase64',
));

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

feeds_from_opml(
    {
        mail_folders => 'Gentoo',
    },
    'https://planet.gentoo.org/opml.xml',
    {
        exclude => [
            'http://www.deathwing00.org/wordpress/category/gentoo/feed/',
            'http://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&amp;feed=atom',
            'http://pi-ist-genau-3.de/?cat=441&#038;feed=atom',
            'http://pi-ist-genau-3.de/?cat=441&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',
	    'http://hexxeh.net/?cat=5&feed=rss2',
	    'http://gryniewicz.com/blogs/dang/category/gentoo/feed/',
	    'http://max.kanat.us/tag-syndicate/?user=psykil&tag=gentoo',
	    'http://dev.c1pher.net/index.php/category/gentoo/feed/',
	    'http://idl0r.qasl.de/blog/index.php?tempskin=_rss2',
	    'http://my.opera.com/pacho/xml/rss/blog/gentoo',
	    'http://vh4x0r.wordpress.com/category/planet-gentoo/feed/',
	    'http://hwoarang.silverarrow.org/category/linux/gentoo/feed/',
	    'http://v00d00.net/category/linux/gentoo-linux/feed',
	    'http://linuxcrazy.com/?q=rss.xml',
	    'http://gentoo-pr.org/rss.xml',
	    'https://blog.jolexa.net/category/gentoo/feed/',
	    'http://blog.dastergon.gr/rss.xml',
	    'http://www.domenkozar.com/feed/atom/',
	    'https://www.gentoo.org/news/feed.xml',
	    'http://www.professionalsysadmin.com/matt/atom.xml',
	    'https://www.p8952.info/feed.category.xml',
	    'https://rgm.io/atom/gentoo/',
	    'http://blogs.gentoo.org/tampakrap/category/planets/planet-gentoo/feed/',
	    'http://pi-ist-genau-3.de/category/gentoo/feed/atom/',
	    'http://robbat2.livejournal.com/data/rss?tag=gentoo',
	    'https://blog.flameeyes.eu/tags/gentoo/',
            'https://aballier.wordpress.com/category/gentoo/feed/atom/',
            'https://rich0gentoo.wordpress.com/category/gentoo/feed/',
            'https://lxnay.wordpress.com/category/gentoo/feed/',
            'https://ahenobarbi.wordpress.com/category/planet-gentoo/feed/',
            'http://www.mpagano.com/blog/?feed=rss2',
            'http://blog.stealer.net/category/gentoo/feed/',
            'https://v00d00.net/tag/gentoo/rss/',
        ],
    },
);

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/',
    {
        uri => 'https://bakabt.me/rss.php?uid=714931&key=94346a8e67f313b3cf64bef311eaf551',
        title => 'BakaBT releases',
        dedupe_use_body => 0,
        dedupe_use_date => 0,
    },
);

feeds(
    {
        mail_folders => 'OSS',
    },
    'https://alistapart.com/main/feed/',
    'https://www.oreilly.com/radar/feed/index.xml',
    'https://www.oreilly.com/radar/topics/four-short-links/feed/index.xml',
    'http://feeds.feedburner.com/Oreillygmt',
    'http://emacs-fu.blogspot.com/feeds/posts/default',
);

feeds(
    {
        mail_folders => 'Perl',
    },
    {
        uri => 'file:///var/www/thenautilus/htdocs/metacpan.atom',
        title => 'Recent CPAN uploads - MetaCPAN',
    },
    'http://pugs.blogs.com/pugs/index.rdf',
    'http://blog.plover.com/index.atom',
    'https://shitpost.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',
    {
        uri => 'https://xdg.me/blog/index.xml',
        dedupe_use_body => 0,
    },
    'http://perl6advent.wordpress.com/feed/',
    'http://perladvent.org/2014/atom.xml',
    'http://leonerds-code.blogspot.com/feeds/posts/default',
    'http://pl6anet.org/atom.xml',
    'https://rakudoweekly.blog/feed/',
);

feeds(
    {
        mail_folders => 'Science',
    },
    'http://www.badscience.net/feed/',
    'http://blog.khymos.org/feed/',
    'http://glottorellando.wordpress.com/feed/',
    'http://languagelog.ldc.upenn.edu/nll/?feed=atom',
    {
    	uri => 'http://www.goodmath.org/blog/?feed=rss2',
        dedupe_use_body => 0,
    },
    'http://web.randi.org/1/feed',
    '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/',
    'http://blog.plan28.org/feeds/posts/default',
    'http://chasmosaurs.com/feed/',
);

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

feeds(
    {
        mail_folders => 'Weblogs',
    },
    'http://feeds.feedburner.com/boingboing/iBag',
    'http://www.rousette.org.uk/blog/index.xml',
    {
        uri => 'http://www.haibane.info/feed/',
        dedupe_use_body => 0,
    },
    'http://nobodyharks.blogspot.com/feeds/posts/default',
    'http://spaghettovolante.wordpress.com/feed/',
    'http://exquisitebeast.tumblr.com/rss',
    'https://viaggiandocongiotto.com/feed/',
);

feeds(
    {
        mail_folders => 'Writers',
    },
    {
        uri => 'http://www.antipope.org/charlie/blog-static/atom.xml',
        dedupe_use_date => 0,
    },
    {
        uri => 'http://elizabethbear.livejournal.com/data/rss',
        dedupe_use_body => 0,
    },
    'http://lisagoldresearch.wordpress.com/feed/',
    {
    	uri => 'http://journal.neilgaiman.com/feeds/posts/default',
	dedupe_use_body => 0,
    },
    'http://www.tor.com/feed',
    'http://whatever.scalzi.com/feed/',
    {
        uri => 'http://thecomposites.tumblr.com/rss',
        dedupe_use_body => 0,
    },
    {
    	uri => 'http://www.goodreads.com/author/show/16094.Lois_McMaster_Bujold/blog?format=rss',
	dedupe_use_body => 0,
    },
);

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

