diff options
| author | Dennis Fink | 2020-12-08 00:44:30 +0100 |
|---|---|---|
| committer | Dennis Fink | 2020-12-08 00:44:30 +0100 |
| commit | d922fcbe586ab069eb93b6e3b2221beebcd74b48 (patch) | |
| tree | 7dd6902c497ea60bf022d3f67a3171dedd28ae0b | |
| parent | 84e57107394d33047bc2ab14ddba1d7fb2884f99 (diff) | |
| download | patternutils-d922fcbe586ab069eb93b6e3b2221beebcd74b48.tar.gz patternutils-d922fcbe586ab069eb93b6e3b2221beebcd74b48.zip | |
Add more entries in prss
Diffstat (limited to '')
| -rw-r--r-- | patternutils/commands/prss.py | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/patternutils/commands/prss.py b/patternutils/commands/prss.py index 95e6a3c..d23f67f 100644 --- a/patternutils/commands/prss.py +++ b/patternutils/commands/prss.py @@ -51,16 +51,19 @@ def prss( "feed_description": parsed_feed.feed.description, } - files = [f.name for f in walk(directory)] + direntries = [] + filenames = [] + + for f in walk(directory): + direntries.append(f) + filenames.append(f.name) matches = [] for entry in parsed_feed.entries: href = entry.enclosures[0]["href"] - splitted_href = href.split("/") - file_to_search = splitted_href[-1] try: @@ -69,14 +72,22 @@ def prss( click.secho(f"{file_to_search} not found!", fg="red", err=True) else: filename = files[file_index] + direntry = direntries[file_index] entry_values = { - "title": entry.title, - "link": entry.link, - "description": entry.description, - "id": entry.id, - "enclosure_href": entry.enclosures[0]["href"], + "title": entry.get("title", None), + "link": entry.get("link", None), + "description": entry.get("description", None), + "id": entry.get("id", None), + "enclosure_href": href, + "published": entry.get("published", None), + "subtitle": entry.get("subtitle", None), + "summary": entry.get("summary", None), + "author": entry.get("author", None), "_name": filename, - "_abspath": os.path.abspath(filename), + "_path": direntry.path, + "_abspath": os.path.abspath(direntry.path), + "_realpath": os.path.realpath(direntry.path), + "_relpath": os.path.relpath(direntry.path), } entry_values.update(default_values) matches.append(entry_values) |
