]> gitweb.pimeys.fr Git - today.git/blobdiff - today_server.py
La futurs annivs affichés le sont sur un espace temporel connexe
[today.git] / today_server.py
index ef73747f94dfa130555931a51c0ddd45a240b364..ec60fe4ee9da16af02ca44b5266cc654507257d0 100755 (executable)
@@ -17,8 +17,6 @@ import sys
 import urllib
 import json
 os.chdir('/home/vincent/scripts/today/')
-sys.path.append("/home/vincent/scripts/dtc/")
-import dtc
 
 #: Config serveur
 import serverconfig
@@ -26,32 +24,6 @@ import serverconfig
 #: Récupération de toutes les nouveautés
 import gather
 
-def last_dtc():
-    """Vérifie si il y a des quotes DTC non lues"""
-    return dtc.last_inserted()
-
-def last_xkcd():
-    p = urllib.urlopen("http://xkcd.com")
-    t = p.read()
-    current_id = int(re.findall("Permanent link to this comic: http://xkcd.com/(.*?)/", t)[0])
-    return current_id
-
-def last_xantah():
-    p = urllib.urlopen("http://www.adoprixtoxis.com/lite/download/xantah_downloads.php")
-    t = p.read()
-    ids = re.findall("""<div class="top">Xantah (.*?)</div>""", t)
-    ids = [int(i) for i in ids]
-    return max(ids)
-
-def last_jl8():
-    rss = urllib.urlopen("http://limbero.org/jl8/rss/")
-    t = rss.read()
-    x = etree.fromstring(t)
-    links = x.xpath("//link")
-    maxnum = links[1].text.split("/")[-1]
-    maxnum = int(maxnum)
-    return maxnum
-
 def get_file():
     """Récupère la liste des derniers ids de chaque truc, stockée dans le fichier."""
     f = open(serverconfig.store_published_file)
@@ -65,23 +37,6 @@ def update_file(news):
     json.dump(news, f)
     f.close()
 
-FETCHS = {
-          "xkcd" : last_xkcd,
-          "dtc" : last_dtc,
-          "xantah" : last_xantah,
-          "dc" : last_jl8,
-         }
-
-def fetch_all():
-    """Va chercher sur les différents sites les nouveaux trucs."""
-    news = {}
-    for (k, f) in FETCHS.iteritems():
-        try:
-            news[k] = f()
-        except Exception as e:
-            raise
-    news.update(gather.gather())
-    return news
 
 def sync():
     """Reçoit une requête de synchronisation."""
@@ -104,7 +59,7 @@ def sync():
 if __name__ == "__main__":
     DEBUG = ("--debug" in sys.argv) or ("--verbose" in sys.argv) or serverconfig.DEBUG
     if sys.argv[1] == "check":
-        news = fetch_all()
+        news = gather.gather()
         if "--init" in sys.argv:
             olds = news
         else: