diff options
author | LS80 <github@lee-smith.me.uk> | 2016-09-30 23:11:43 +0100 |
---|---|---|
committer | LS80 <github@lee-smith.me.uk> | 2016-09-30 23:17:29 +0100 |
commit | 7bbe3df26a75a71ac34c3865012b5e4ab1227e3b (patch) | |
tree | d3ce56df34a4428364533e4bb214a140fc937dd7 /plugin.video.spurs-tv/resources | |
parent | 1bba39f44b9e6412bd2e00b323810c7f94cfc846 (diff) |
[plugin.video.spurs-tv] 2.12.0
Diffstat (limited to 'plugin.video.spurs-tv/resources')
-rw-r--r-- | plugin.video.spurs-tv/resources/lib/utils.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/plugin.video.spurs-tv/resources/lib/utils.py b/plugin.video.spurs-tv/resources/lib/utils.py index a24df58..a2bcfc6 100644 --- a/plugin.video.spurs-tv/resources/lib/utils.py +++ b/plugin.video.spurs-tv/resources/lib/utils.py @@ -1,10 +1,9 @@ import _strptime import time -from datetime import date +from datetime import datetime, date def date_from_str(date_str, date_format): - return date(*(time.strptime(date_str, date_format)[0:3])) - -def add_item_info(item, title, item_date): - item['info'] = {'title': title, - 'date': item_date.strftime("%d.%m.%Y")} + try: + return datetime.strptime(date_str, date_format).date() + except TypeError: + return date(*(time.strptime(date_str, date_format)[0:3])) |