Merge branch 'master' into 29-generic-entities-support

This commit is contained in:
Fabio Manganiello 2022-12-17 00:51:51 +01:00
commit 9ddebb920f
Signed by: blacklight
GPG key ID: D90FBA7F76362774
7 changed files with 60 additions and 29 deletions

View file

@ -4,13 +4,15 @@ All notable changes to this project will be documented in this file.
Given the high speed of development in the first phase, changes are being Given the high speed of development in the first phase, changes are being
reported only starting from v0.20.2. reported only starting from v0.20.2.
## [Unreleased] ## [0.24.3] - 2022-12-17
### Added ### Added
- Added `[-v|--verbose]` command-line option to override the default logging - Added `[-v|--verbose]` command-line option to override the default logging
configuration and enable debug logging. configuration and enable debug logging.
- Added `--version` command-line option to print the current version and exit. - Added `--version` command-line option to print the current version and exit.
- [[#236](https://git.platypush.tech/platypush/platypush/issues/236)] Added
support for `author` and `tags` attributes on feed entries.
## [0.24.2] - 2022-12-10 ## [0.24.2] - 2022-12-10

View file

@ -25,7 +25,7 @@ from .message.response import Response
from .utils import set_thread_name, get_enabled_plugins from .utils import set_thread_name, get_enabled_plugins
__author__ = 'Fabio Manganiello <info@fabiomanganiello.com>' __author__ = 'Fabio Manganiello <info@fabiomanganiello.com>'
__version__ = '0.24.2' __version__ = '0.24.3'
log = logging.getLogger('platypush') log = logging.getLogger('platypush')

View file

@ -1,5 +1,5 @@
from datetime import datetime from datetime import datetime
from typing import Optional from typing import Iterable, Optional
from platypush.message.event import Event from platypush.message.event import Event
@ -10,11 +10,30 @@ class NewFeedEntryEvent(Event):
""" """
def __init__( def __init__(
self, *, feed_url: str, url: str, title: Optional[str] = None, id: Optional[str] = None, self,
feed_title: Optional[str] = None, published: Optional[datetime] = None, summary: Optional[str] = None, *,
content: Optional[str] = None, **kwargs feed_url: str,
url: str,
title: Optional[str] = None,
id: Optional[str] = None,
feed_title: Optional[str] = None,
published: Optional[datetime] = None,
summary: Optional[str] = None,
content: Optional[str] = None,
author: Optional[str] = None,
tags: Optional[Iterable[str]] = None,
**kwargs
): ):
super().__init__( super().__init__(
feed_url=feed_url, url=url, title=title, id=id, feed_title=feed_title, feed_url=feed_url,
published=published, summary=summary, content=content, **kwargs url=url,
title=title,
id=id,
feed_title=feed_title,
published=published,
summary=summary,
content=content,
author=author,
tags=tags or [],
**kwargs
) )

View file

@ -129,6 +129,12 @@ class RssPlugin(RunnablePlugin):
'title': entry.title, 'title': entry.title,
'summary': getattr(entry, 'summary', None), 'summary': getattr(entry, 'summary', None),
'content': self._parse_content(entry), 'content': self._parse_content(entry),
'author': getattr(entry, 'author', None),
'tags': [
tag['term']
for tag in getattr(entry, 'tags', [])
if tag.get('term')
],
} }
for entry in feed.entries for entry in feed.entries
if getattr(entry, 'published_parsed', None) if getattr(entry, 'published_parsed', None)

View file

@ -5,36 +5,40 @@ from platypush.schemas import DateTime
class RssFeedEntrySchema(Schema): class RssFeedEntrySchema(Schema):
feed_title = fields.String(metadata=dict(description='Feed title')) feed_title = fields.String(metadata={'description': 'Feed title'})
feed_url = fields.URL( feed_url = fields.URL(
required=True, required=True,
metadata=dict( metadata={
description='URL of the feed', 'description': 'URL of the feed',
example='https://some-website/rss', 'example': 'https://some-website/rss',
) },
) )
id = fields.String( id = fields.String(
required=True, required=True,
metadata=dict( metadata={
description='Feed entry ID', 'description': 'Feed entry ID',
example='1234', 'example': '1234',
) },
) )
url = fields.URL( url = fields.URL(
required=True, required=True,
metadata=dict( metadata={
description='URL of the feed entry', 'description': 'URL of the feed entry',
example='https://some-website/articles/1234', 'example': 'https://some-website/articles/1234',
) },
) )
published = DateTime( published = DateTime(
required=True, required=True, metadata={'description': 'Entry published time'}
metadata=dict(description='Entry published time')
) )
title = fields.String(metadata=dict(description='Feed entry title')) title = fields.String(metadata={'description': 'Feed entry title'})
summary = fields.String(metadata=dict(description='Feed entry summary')) summary = fields.String(metadata={'description': 'Feed entry summary'})
content = fields.String(metadata=dict(description='Feed entry content')) content = fields.String(metadata={'description': 'Feed entry content'})
author = fields.String(metadata={'description': 'Feed entry author'})
tags = fields.List(
fields.String(),
metadata={'description': 'Feed entry tags'},
)

View file

@ -1,10 +1,10 @@
[bumpversion] [bumpversion]
current_version = 0.24.2 current_version = 0.24.3
commit = True commit = True
tag = True tag = True
[metadata] [metadata]
description-file = README.md description_file = README.md
[flake8] [flake8]
max-line-length = 120 max-line-length = 120

View file

@ -28,7 +28,7 @@ backend = pkg_files('platypush/backend')
setup( setup(
name="platypush", name="platypush",
version="0.24.2", version="0.24.3",
author="Fabio Manganiello", author="Fabio Manganiello",
author_email="info@fabiomanganiello.com", author_email="info@fabiomanganiello.com",
description="Platypush service", description="Platypush service",