From 26b2f4f3ce39b94a32a60e4aa99e8b2aeb07cb20 Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Sun, 4 Mar 2012 08:37:07 +0100 Subject: Removed useless code concerning SQLite and the update method (inotify) on the old database. --- feedgetter.py | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) (limited to 'feedgetter.py') diff --git a/feedgetter.py b/feedgetter.py index 74b7b3a0..b9d61c69 100755 --- a/feedgetter.py +++ b/feedgetter.py @@ -27,7 +27,6 @@ __license__ = "GPLv3" import os.path import traceback -import sqlite3 import threading import feedparser import hashlib @@ -52,15 +51,9 @@ class FeedGetter(object): """ Initializes the base and variables. """ - # Create the base if not exists. - utils.create_base() - # MongoDB connections self.articles = mongodb.Articles() - # mutex to protect the SQLite base - self.locker = threading.Lock() - def retrieve_feed(self): """ Parse the file 'feeds.lst' and launch a thread for each RSS feed. @@ -89,25 +82,12 @@ class FeedGetter(object): """Request the URL Executed in a thread. - SQLite objects created in a thread can only be used in that same thread ! """ - # Protect this part of code. - self.locker.acquire() - - self.conn = sqlite3.connect(utils.sqlite_base, isolation_level = None) - self.c = self.conn.cursor() - if utils.detect_url_errors([the_good_url]) == []: # if ressource is available add the articles in the base. - self.add_into_sqlite(the_good_url) - - self.conn.commit() - self.c.close() - - # Release this part of code. - self.locker.release() + self.add_into_database(the_good_url) - def add_into_sqlite(self, feed_link): + def add_into_database(self, feed_link): """ Add the articles of the feed 'a_feed' in the SQLite base. """ -- cgit