#!/usr/bin/perl -w
# Copyright: GPL
# Written by Egon Willighagen (egon.w@linuxfocus.org)
#
use strict;
use vars qw($opt_h);

use Getopt::Std;
use XML::RSS;
use LinuxFocus::SDB;

my $ver="version 0.3";

my $lfdir = $ENV{'LFDIR'};
my $homedir = "$lfdir/Nederlands";
my $issuemark = "Titelpagina";

my $rss = new XML::RSS();
my $date = `date +"%Y-%m-%d, %H:%M"`;
$date =~ s/(\n|\r)//g;

# this is dirty, but do not know how to let date *speak* Dutch
#$date =~ s/January/Januari/;
#$date =~ s/February/Februari/;
#$date =~ s/March/Maart/; 
#$date =~ s/May/Mei/; 
#$date =~ s/June/Juni/; 
#$date =~ s/July/Juli/; 
#$date =~ s/August/Augustus/; 
#$date =~ s/October/Oktober/; 

$rss->channel(title       => 'LinuxFocus - NL',
              link        => 'http://www.linuxfocus.org/Nederlands/',
              description => 'Nederlandstalige ezine over Linux',
              pubDate     => $date, 
              language    => 'nl');

my $db = LinuxFocus::SDB->new();
$db->load("$homedir/data/lfdb.nl.xml");
$db->load("$homedir/data/lfdb.en.xml");
$db->setLang("nl");

    foreach my $id ($db->getArticleIDs(sort => "desc",
                                       limit => "10",
                                       translated => "yes",
                                       to => "nl",
                                       published => "yes")) {
        $db->selectArticle($id);
        $rss->add_item(
            title       => "LinuxFocus, nieuw vertaald: " . 
                           $db->getArticleTitle("nl"),
            link        => "http://www.linuxfocus.org/" .
                           $db->getArticleRL("nl"),
            description => $db->getArticleAbstract("nl"));           
    }

$rss->save("../../lfnews_channel.rdf");

exit(0);





