aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2012-04-22 10:22:44 +0200
committercedricbonhomme <devnull@localhost>2012-04-22 10:22:44 +0200
commit34fccc4dbee64f34a77cd75b878f3d6a8ae90d57 (patch)
treea6cbeb5de0db639d88758487f680fbe6afee7e0a
parentSHA1 is replaced by urlsafe_b64encode for id of articles. (diff)
downloadnewspipe-34fccc4dbee64f34a77cd75b878f3d6a8ae90d57.tar.gz
newspipe-34fccc4dbee64f34a77cd75b878f3d6a8ae90d57.tar.bz2
newspipe-34fccc4dbee64f34a77cd75b878f3d6a8ae90d57.zip
Added comments.
-rwxr-xr-xsource/feedgetter.py8
-rw-r--r--source/sqlite2mongo.py3
-rwxr-xr-xsource/utils.py17
3 files changed, 13 insertions, 15 deletions
diff --git a/source/feedgetter.py b/source/feedgetter.py
index 351d099d..14ef2edf 100755
--- a/source/feedgetter.py
+++ b/source/feedgetter.py
@@ -2,7 +2,7 @@
#-*- coding: utf-8 -*-
# pyAggr3g470r - A Web based news aggregator.
-# Copyright (C) 2010 Cédric Bonhomme - http://cedricbonhomme.org/
+# Copyright (C) 2010-2012 Cédric Bonhomme - http://cedricbonhomme.org/
#
# For more information : http://bitbucket.org/cedricbonhomme/pyaggr3g470r/
#
@@ -20,8 +20,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>
__author__ = "Cedric Bonhomme"
-__version__ = "$Revision: 1.0 $"
+__version__ = "$Revision: 1.1 $"
__date__ = "$Date: 2010/09/02 $"
+__revision__ = "$Date: 2012/04/22 $"
__copyright__ = "Copyright (c) Cedric Bonhomme"
__license__ = "GPLv3"
@@ -155,8 +156,7 @@ class FeedGetter(object):
#).start()
-
if __name__ == "__main__":
# Point of entry in execution mode
feed_getter = FeedGetter()
- feed_getter.retrieve_feed()
+ feed_getter.retrieve_feed() \ No newline at end of file
diff --git a/source/sqlite2mongo.py b/source/sqlite2mongo.py
index 6a68d00b..c4bb4e17 100644
--- a/source/sqlite2mongo.py
+++ b/source/sqlite2mongo.py
@@ -2,15 +2,14 @@
# -*- coding: utf-8 -*-
import sqlite3
-import mongodb
+import mongodb
import utils
from datetime import datetime
SQLITE_BASE = "./var/feed.db"
-
def sqlite2mongo():
"""
Load feeds and articles in a dictionary.
diff --git a/source/utils.py b/source/utils.py
index 78c909f5..d6365073 100755
--- a/source/utils.py
+++ b/source/utils.py
@@ -35,7 +35,6 @@ __license__ = "GPLv3"
#
import re
-import hashlib
import sqlite3
import operator
import urlparse
@@ -58,9 +57,6 @@ from collections import OrderedDict
from StringIO import StringIO
-import threading
-LOCKER = threading.Lock()
-
import os
import ConfigParser
# load the configuration
@@ -94,16 +90,19 @@ url_finders = [ \
re.compile("'\\<((mailto:)|)[-A-Za-z0-9\\.]+@[-A-Za-z0-9\\.]+"), \
]
-
from base64 import urlsafe_b64encode, urlsafe_b64decode
-
-
def uri_b64encode(s):
- return urlsafe_b64encode(s).strip('=')
+ """
+ Encode an URI in base 64 and remove the final '='.
+ """
+ return urlsafe_b64encode(s).strip('=')
def uri_b64decode(s):
- return urlsafe_b64decode(s + '=' * (4 - len(s) % 4))
+ """
+ Decode a base 64 encoded URI.
+ """
+ return urlsafe_b64decode(s + '=' * (4 - len(s) % 4))
def detect_url_errors(list_of_urls):
"""
bgstack15