diff --git a/platypush/plugins/http/request/rss.py b/platypush/plugins/http/request/rss.py new file mode 100644 index 000000000..686b0ed25 --- /dev/null +++ b/platypush/plugins/http/request/rss.py @@ -0,0 +1,23 @@ +import feedparser + +from platypush.plugins import action +from platypush.plugins.http.request import HttpRequestPlugin + +class HttpRequestRssPlugin(HttpRequestPlugin): + """ + Plugin to programmatically retrieve and parse an RSS feed URL. + + Requires: + + * **feedparser** (``pip install feedparser``) + """ + + @action + def get(self, url): + response = super().get(url, output='text').output + feed = feedparser.parse(response) + return feed.entries + + +# vim:sw=4:ts=4:et: + diff --git a/platypush/plugins/music/mpd/__init__.py b/platypush/plugins/music/mpd/__init__.py index d07c9f0fa..a895280aa 100644 --- a/platypush/plugins/music/mpd/__init__.py +++ b/platypush/plugins/music/mpd/__init__.py @@ -207,7 +207,7 @@ class MusicMpdPlugin(MusicPlugin): return self._exec('shuffle') @action - def add(self, resource): + def add(self, resource, position=None): """ Add a resource (track, album, artist, folder etc.) to the current playlist @@ -219,14 +219,20 @@ class MusicMpdPlugin(MusicPlugin): for r in resource: r = self._parse_resource(r) try: - self._exec('add', r) + if position is None: + self._exec('add', r) + else: + self._exec('addid', r, position) except Exception as e: self.logger.warning('Could not add {}: {}'.format(r, e)) return self.status().output r = self._parse_resource(resource) - return self._exec('add', r) + + if position is None: + return self._exec('add', r) + return self._exec('addid', r, position) @classmethod def _parse_resource(cls, resource):