Read image from metadata, gitignore updates, cleanup cache py files

master
Jurij Podgoršek 2021-09-30 22:14:33 +02:00
parent 665764bc80
commit 13bb18f8a3
7 changed files with 13 additions and 1 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
scratch scratch
**/__pycache__/
.#*

View File

@ -2,6 +2,7 @@
from pprint import pp from pprint import pp
from datetime import datetime from datetime import datetime
from metadata_parser import MetadataParser
class Event: class Event:
status = None status = None
@ -17,12 +18,17 @@ class Event:
def setLocation(self, location): def setLocation(self, location):
self.location = location self.location = location
def setImageFromLink(self, link):
page = MetadataParser(self.link)
self.image = page.get_metadata_link('image')
def __str__(self): def __str__(self):
return str({ return str({
'title': self.title, 'title': self.title,
'time': self.time, 'time': self.time,
'link': self.link, 'link': self.link,
'status': self.status 'status': self.status,
'image': self.image
}) })
def parseRSS(entry): def parseRSS(entry):
@ -39,4 +45,6 @@ def parseRSS(entry):
if 'ical_location' in entry: if 'ical_location' in entry:
ev.setLocation(entry['ical_location']) ev.setLocation(entry['ical_location'])
ev.setImageFromLink(ev.link)
return ev return ev

View File

@ -1,2 +1,4 @@
sgqlc==v14.1 sgqlc==v14.1
feedparser==6.0.8 feedparser==6.0.8
metadata-parser==0.10.5
lxml==4.6.3