diff options
author | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-01-20 21:48:46 +0100 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-01-20 21:48:46 +0100 |
commit | 45c0f51c2be5cadc4d3f1130f536b423702493fa (patch) | |
tree | ebcf9661342a52a81d7455cbf492dd34147677e5 | |
parent | You can now fetch only one feed. (diff) | |
download | newspipe-45c0f51c2be5cadc4d3f1130f536b423702493fa.tar.gz newspipe-45c0f51c2be5cadc4d3f1130f536b423702493fa.tar.bz2 newspipe-45c0f51c2be5cadc4d3f1130f536b423702493fa.zip |
Removed uselles function compare() and string_to_datetime.
-rwxr-xr-x | source/utils.py | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/source/utils.py b/source/utils.py index c27e577c..a452bd72 100755 --- a/source/utils.py +++ b/source/utils.py @@ -20,9 +20,9 @@ # along with this program. If not, see <http://www.gnu.org/licenses/> __author__ = "Cedric Bonhomme" -__version__ = "$Revision: 1.3 $" +__version__ = "$Revision: 1.4 $" __date__ = "$Date: 2010/12/07 $" -__revision__ = "$Date: 2012/11/8 $" +__revision__ = "$Date: 2013/01/20 $" __copyright__ = "Copyright (c) Cedric Bonhomme" __license__ = "GPLv3" @@ -38,7 +38,6 @@ import os import re import glob import operator -import urllib.parse import calendar import unicodedata import html.entities @@ -51,7 +50,6 @@ import urllib.request, urllib.error, urllib.parse import http.server from bs4 import BeautifulSoup -from datetime import datetime from collections import Counter import conf @@ -178,28 +176,6 @@ def send_mail(mfrom, mto, feed_title, article_title, description): s.sendmail(mfrom, mto, msg.as_string()) s.quit() -def string_to_datetime(stringtime): - """ - Convert a string to datetime. - """ - date, time = stringtime.split(' ') - year, month, day = date.split('-') - hour, minute, second = time.split(':') - return datetime(year=int(year), month=int(month), day=int(day), \ - hour=int(hour), minute=int(minute), second=int(second)) - -def compare(stringtime1, stringtime2): - """ - Compare two dates in the format 'yyyy-mm-dd hh:mm:ss'. - """ - datetime1 = string_to_datetime(stringtime1) - datetime2 = string_to_datetime(stringtime2) - if datetime1 < datetime2: - return -1 - elif datetime1 > datetime2: - return 1 - return 0 - def add_feed(feed_url): """ Add the URL feed_url in the file feed.lst. @@ -257,4 +233,4 @@ def search_feed(url): if url not in feed_link['href']: return urllib.parse.urljoin(url, feed_link['href']) return feed_link['href'] - return None + return None
\ No newline at end of file |