2 Commits

Author SHA1 Message Date
cb5a1bfbbe Mege NF_0004 2026-04-27 12:47:13 -04:00
98c37f2204 Add try except in Video.fromString for invalid date 2026-04-22 12:43:53 -04:00
2 changed files with 9 additions and 3 deletions

View File

@@ -513,10 +513,10 @@ def parseDuration(strDuration):
# newsFeed=NewsFeed('/home/pi/Projects/Python/NewsFeed/')
# newsFeed=NewsFeed('/home/pi/.kodi/addons/plugin.video.fox.news/resources/lib/videodb.txt')
# newsFeed=NewsFeed(PATH_VIDEO_DATABASE, myLog())
# newsFeed=NewsFeed('/home/pi/Projects/Python/NewsFeed/', myLog())
# newsFeed=NewsFeed('C:/Python/NewsFeed/Archive', myLog())
# videos=newsFeed.getItemsInFeed(FOX_NEWS_URL)
# for video in videos:
# if(video.description.startswith("Martha")):
# print(f"Description={video.description}")
# print(f"Url={video.url}")
# print(f"getTimestamp={video.getTimestamp().toStringMonthDay()}")
@@ -524,6 +524,7 @@ def parseDuration(strDuration):
# print(f"getFeedTime={video.getFeedTime()}")
# print(f"daysOld={(datetime.now()-video.getFeedTime()).days}")
# print(' ')
# print(f"Got {len(videos)} videos")
# pull the time out of the description and subtract it from the time we scanned the feed.
# the result will be the time of the article..use this to sort on.

View File

@@ -68,7 +68,12 @@ class Video:
description=splits[0].strip()
url=splits[1].strip()
icon=splits[2].strip()
timestamp=DateTime(splits[3].strip())
datePart = splits[3].strip()
timestamp = DateTime()
try :
timestamp=DateTime(datePart)
except Exception as exception:
print(f"Encountered invalid date '{datePart}'")
return(Video(description,url,icon,timestamp))
@staticmethod