aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsource/utils.py30
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
bgstack15