#! /usr/local/bin/python
#-*- coding: utf-8 -*-
# pyAggr3g470r - A Web based news aggregator.
# Copyright (C) 2010 Cédric Bonhomme - http://cedric.bonhomme.free.fr/
#
# For more information : http://bitbucket.org/cedricbonhomme/pyaggr3g470r/
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
__author__ = "Cedric Bonhomme"
__version__ = "$Revision: 2.2 $"
__date__ = "$Date: 2010/11/03 $"
__copyright__ = "Copyright (c) 2010 Cedric Bonhomme"
__license__ = "GPLv3"
import os
import re
import time
import sqlite3
import cherrypy
import calendar
import threading
from collections import Counter
import utils
import feedgetter
import PyQRNative
bindhost = "0.0.0.0"
cherrypy.config.update({ 'server.socket_port': 12556, 'server.socket_host': bindhost})
# static files
path = {'/css/style.css': {'tools.staticfile.on': True, \
'tools.staticfile.filename':utils.path+'/css/style.css'}, \
'/css/img/feed-icon-28x28.png': {'tools.staticfile.on': True, \
'tools.staticfile.filename':utils.path+'/css/img/feed-icon-28x28.png'}, \
'/css/img/tuxrss.png': {'tools.staticfile.on': True, \
'tools.staticfile.filename':utils.path+'/css/img/tuxrss.png'}, \
'/css/img/delicious.png': {'tools.staticfile.on': True, \
'tools.staticfile.filename':utils.path+'/css/img/delicious.png'}, \
'/css/img/digg.png': {'tools.staticfile.on': True, \
'tools.staticfile.filename':utils.path+'/css/img/digg.png'}, \
'/css/img/reddit.png': {'tools.staticfile.on': True, \
'tools.staticfile.filename':utils.path+'/css/img/reddit.png'}, \
'/css/img/scoopeo.png': {'tools.staticfile.on': True, \
'tools.staticfile.filename':utils.path+'/css/img/scoopeo.png'}, \
'/css/img/blogmarks.png': {'tools.staticfile.on': True, \
'tools.staticfile.filename':utils.path+'/css/img/blogmarks.png'}, \
'/css/img/buzz.png': {'tools.staticfile.on': True, \
'tools.staticfile.filename':utils.path+'/css/img/buzz.png'}, \
'/css/img/identica.png': {'tools.staticfile.on': True, \
'tools.staticfile.filename':utils.path+'/css/img/identica.png'}, \
'/css/img/heart.png': {'tools.staticfile.on': True, \
'tools.staticfile.filename':utils.path+'/css/img/heart.png'}, \
'/css/img/heart_open.png': {'tools.staticfile.on': True, \
'tools.staticfile.filename':utils.path+'/css/img/heart_open.png'}, \
'/css/img/email-unread.png': {'tools.staticfile.on': True, \
'tools.staticfile.filename':utils.path+'/css/img/email-unread.png'}, \
'/css/img/email-follow.png': {'tools.staticfile.on': True, \
'tools.staticfile.filename':utils.path+'/css/img/email-follow.png'}, \
'/css/img/cross.png': {'tools.staticfile.on': True, \
'tools.staticfile.filename':utils.path+'/css/img/cross.png'}, \
'/var/qrcode': {'tools.staticdir.on': True,
'tools.staticdir.dir': os.path.join(utils.path, './var/qrcode')}}
def htmlheader(nb_unread_articles=""):
"""
Return the header of the HTML page with the number of unread articles
in the 'title' HTML tag..
"""
return '\n' + \
'