././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1779664611.0167031 mopidy_podcast-4.0.0/0000775000175100017510000000000015204703343013260 5ustar00tkemtkem././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779664537.0 mopidy_podcast-4.0.0/CHANGELOG.rst0000664000175100017510000000522315204703231015277 0ustar00tkemtkem4.0.0 (2026-05-25) =================== - Require Mopidy >= 4.0.0. - Remove deprecated configuration entries. - Update build environment. v3.1.1 (2026-04-10) =================== - Minor documentation improvements. v3.1.0 (2026-04-05) =================== - Add support for Python <= 3.14. - Modernize build environment and packages structure. - Update CI environment. v3.0.1 (2022-04-03) =================== - Officially support Python 3.9 and 3.10. v3.0.0 (2019-12-25) =================== - Depend on final release of Mopidy 3.0.0. v3.0.0a1 (2019-12-06) ===================== - Require Python >= 3.7. - Require Mopidy >= 3.0.0a5. - Require Pykka >= 2.0.1. - Update project setup. v2.0.3 (2018-07-23) =================== - Skip empty ```` tags. v2.0.2 (2018-01-10) =================== - Skip cache for local feeds. - Accept uppercase ``URL`` attributes in OPML feeds. v2.0.1 (2016-08-10) =================== - Add OPML example to docs. - Remove PyPI downloads badge from README. - Correct tests under extreme timezones (thanks to Chris Lamb). v2.0.0 (2016-03-23) =================== - Add support for OPML subscription lists and directories. - Add configuration options for browse and lookup order. - Change URI scheme for podcast episodes to use GUID as fragment identifier. - Drop ``feeds`` directory. - Drop directory API. - Drop search support. - Upgrade dependencies to Mopidy v1.1.1. v1.1.2 (2015-08-27) =================== - Pass ``episodes`` as ``list`` to ``Podcast.copy()``. v1.1.1 (2015-03-25) =================== - Prepare for Mopidy v1.0 exact search API. v1.1.0 (2014-11-22) =================== - Improve ``podcast`` URI scheme. - Report podcasts as albums when browsing. - Update dependencies. - Update unit tests. v1.0.0 (2014-05-24) =================== - Move RSS parsing to ``FeedsDirectory``. - Support for additional podcast/episode properties. - Add ``search_results`` config value. - Add ``uri_schemes`` property to ``PodcastDirectory``. - Add ``uri`` property to ``Podcast`` and ``Episode``. - Support for ````. - Convert ``Podcast.Image`` and ``Episode.Enclosure`` to Mopidy model types. v0.4.0 (2014-04-11) =================== - ``PodcastDirectory`` and models API changes. - Performance and stability improvements. - Configuration cleanup. v0.3.0 (2014-03-14) =================== - Complete rewrite to integrate podcast directory extensions. v0.2.0 (2014-02-07) =================== - Improve handling of iTunes tags. - Improve performance by removing feedparser. - Support searching for podcasts and episodes. v0.1.0 (2014-02-01) =================== - Initial release. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1597080932.0 mopidy_podcast-4.0.0/LICENSE0000644000175100017510000002367613714302544014303 0ustar00tkemtkem Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779663383.0 mopidy_podcast-4.0.0/MANIFEST.in0000664000175100017510000000007415204701027015014 0ustar00tkemtkemprune .github/ exclude .gitignore exclude .readthedocs.yaml ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1779664611.0166905 mopidy_podcast-4.0.0/PKG-INFO0000644000175100017510000000755415204703343014366 0ustar00tkemtkemMetadata-Version: 2.4 Name: Mopidy-Podcast Version: 4.0.0 Summary: Mopidy extension for browsing and playing podcasts Author-email: Thomas Kemmer Maintainer-email: Thomas Kemmer License-Expression: Apache-2.0 Project-URL: Homepage, https://github.com/tkem/mopidy-podcast/ Project-URL: Documentation, https://mopidy-podcast.readthedocs.io/en/stable/ Project-URL: Source, https://github.com/tkem/mopidy-podcast/ Project-URL: Repository, https://github.com/tkem/mopidy-podcast/ Project-URL: Issues, https://github.com/tkem/mopidy-podcast/issues Project-URL: Changelog, https://github.com/tkem/mopidy-podcast/blob/master/CHANGELOG.rst Classifier: Environment :: No Input/Output (Daemon) Classifier: Intended Audience :: End Users/Desktop Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.13 Classifier: Programming Language :: Python :: 3.14 Classifier: Topic :: Multimedia :: Sound/Audio :: Players Requires-Python: >=3.13 Description-Content-Type: text/x-rst License-File: LICENSE Requires-Dist: cachetools>=5.3.3 Requires-Dist: mopidy>=4.0.0 Requires-Dist: pykka>=4.1 Requires-Dist: uritools>=4.0.3 Dynamic: license-file ************** Mopidy-Podcast ************** .. image:: https://img.shields.io/pypi/v/Mopidy-Podcast :target: https://pypi.org/project/Mopidy-Podcast/ :alt: Latest PyPI version .. image:: https://img.shields.io/github/actions/workflow/status/tkem/mopidy-podcast/ci.yml :target: https://github.com/tkem/mopidy-podcast/actions/workflows/ci.yml :alt: CI build status .. image:: https://img.shields.io/readthedocs/mopidy-podcast :target: https://mopidy-podcast.readthedocs.io/ :alt: Documentation build status .. image:: https://img.shields.io/codecov/c/gh/tkem/mopidy-podcast :target: https://codecov.io/gh/tkem/mopidy-podcast :alt: Test coverage .. image:: https://img.shields.io/github/license/tkem/mopidy-podcast :target: https://raw.github.com/tkem/mopidy-podcast/master/LICENSE :alt: License .. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/black :alt: Code style: black Mopidy-Podcast is a Mopidy_ extension for browsing and playing podcasts. This extension lets you browse podcasts distributed as RSS feeds and play individual episodes in a variety of audio formats. Podcasts are mapped to albums, while podcast episodes are shown as tracks in Mopidy, with metadata converted to Mopidy’s native data model where applicable. OPML 2.0 subscription lists and directories are also supported for multi-level browsing. Installation ============ On Debian Linux and Debian-based distributions like Ubuntu or Raspbian, install the ``mopidy-podcast`` package from apt.mopidy.com_:: apt-get install mopidy-podcast Otherwise, install the Python package from PyPI_:: pip install Mopidy-Podcast Project Resources ================= - `Documentation`_ - `Issue tracker`_ - `Source code`_ - `Change log`_ License ======= Copyright (c) 2014-2026 Thomas Kemmer. Licensed under the `Apache License, Version 2.0`_. Credits ======= - Original author: `Thomas Kemmer `__ - Current maintainer: `Thomas Kemmer `__ - `Contributors `_ .. _Mopidy: https://www.mopidy.com/ .. _PyPI: https://pypi.org/project/Mopidy-Podcast/ .. _apt.mopidy.com: https://apt.mopidy.com/ .. _Documentation: https://mopidy-podcast.readthedocs.io/en/latest/ .. _Source code: https://github.com/tkem/mopidy-podcast .. _Issue tracker: https://github.com/tkem/mopidy-podcast/issues .. _Change log: https://github.com/tkem/mopidy-podcast/blob/master/CHANGELOG.rst .. _Apache License, Version 2.0: https://raw.github.com/tkem/mopidy-podcast/master/LICENSE ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779654910.0 mopidy_podcast-4.0.0/README.rst0000664000175100017510000000512515204660376014762 0ustar00tkemtkem************** Mopidy-Podcast ************** .. image:: https://img.shields.io/pypi/v/Mopidy-Podcast :target: https://pypi.org/project/Mopidy-Podcast/ :alt: Latest PyPI version .. image:: https://img.shields.io/github/actions/workflow/status/tkem/mopidy-podcast/ci.yml :target: https://github.com/tkem/mopidy-podcast/actions/workflows/ci.yml :alt: CI build status .. image:: https://img.shields.io/readthedocs/mopidy-podcast :target: https://mopidy-podcast.readthedocs.io/ :alt: Documentation build status .. image:: https://img.shields.io/codecov/c/gh/tkem/mopidy-podcast :target: https://codecov.io/gh/tkem/mopidy-podcast :alt: Test coverage .. image:: https://img.shields.io/github/license/tkem/mopidy-podcast :target: https://raw.github.com/tkem/mopidy-podcast/master/LICENSE :alt: License .. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/black :alt: Code style: black Mopidy-Podcast is a Mopidy_ extension for browsing and playing podcasts. This extension lets you browse podcasts distributed as RSS feeds and play individual episodes in a variety of audio formats. Podcasts are mapped to albums, while podcast episodes are shown as tracks in Mopidy, with metadata converted to Mopidy’s native data model where applicable. OPML 2.0 subscription lists and directories are also supported for multi-level browsing. Installation ============ On Debian Linux and Debian-based distributions like Ubuntu or Raspbian, install the ``mopidy-podcast`` package from apt.mopidy.com_:: apt-get install mopidy-podcast Otherwise, install the Python package from PyPI_:: pip install Mopidy-Podcast Project Resources ================= - `Documentation`_ - `Issue tracker`_ - `Source code`_ - `Change log`_ License ======= Copyright (c) 2014-2026 Thomas Kemmer. Licensed under the `Apache License, Version 2.0`_. Credits ======= - Original author: `Thomas Kemmer `__ - Current maintainer: `Thomas Kemmer `__ - `Contributors `_ .. _Mopidy: https://www.mopidy.com/ .. _PyPI: https://pypi.org/project/Mopidy-Podcast/ .. _apt.mopidy.com: https://apt.mopidy.com/ .. _Documentation: https://mopidy-podcast.readthedocs.io/en/latest/ .. _Source code: https://github.com/tkem/mopidy-podcast .. _Issue tracker: https://github.com/tkem/mopidy-podcast/issues .. _Change log: https://github.com/tkem/mopidy-podcast/blob/master/CHANGELOG.rst .. _Apache License, Version 2.0: https://raw.github.com/tkem/mopidy-podcast/master/LICENSE ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1779664611.0157087 mopidy_podcast-4.0.0/docs/0000775000175100017510000000000015204703343014210 5ustar00tkemtkem././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779663383.0 mopidy_podcast-4.0.0/docs/conf.py0000664000175100017510000000155715204701027015514 0ustar00tkemtkem# Extract the current version from the source. import pathlib import sys src_directory = (pathlib.Path(__file__).parent.parent / "src").resolve() sys.path.insert(0, str(src_directory)) def get_version(package): """Get the version and release from the source code.""" text = (src_directory / "mopidy_podcast/__init__.py").read_text() for line in text.splitlines(): if not line.strip().startswith("__version__"): continue return line.partition("=")[2].strip().strip("\"'") project = "Mopidy-Podcast" copyright = "2014-2026 Thomas Kemmer" release = get_version(project) version = ".".join(release.split(".")[:2]) extensions = [ "sphinx.ext.autodoc", "sphinx.ext.coverage", "sphinx.ext.doctest", "sphinx.ext.intersphinx", "sphinx.ext.todo", ] exclude_patterns = ["_build"] master_doc = "index" html_theme = "classic" ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779654910.0 mopidy_podcast-4.0.0/docs/index.rst0000664000175100017510000001137515204660376016070 0ustar00tkemtkem:tocdepth: 3 ************** Mopidy-Podcast ************** Mopidy-Podcast is a Mopidy_ extension for browsing and playing podcasts. This extension lets you browse podcasts distributed as RSS feeds and play individual episodes in a variety of audio formats. Podcasts are mapped to albums, while podcast episodes are shown as tracks in Mopidy, with metadata converted to Mopidy’s native data model where applicable. OPML 2.0 subscription lists and directories are also supported for multi-level browsing. To use this extension, you first need a way to access podcasts from Mopidy: - If you are already using a podcasting client, chances are that it supports exporting your subscribed feeds as an OPML file. Simply store this file in the location pointed to by :confval:`browse_root` to access your favorite podcasts from Mopidy. - Since OPML is a simple XML format, it is also feasible to create your own, using an XML or text editor of your choice. OPML also supports linking to other OPML files, both locally and on the Web, so this even allows creating your own *meta directory* pointing to podcast collections from the `BBC `_, `gpodder.net `_, and other sources:: - If your client supports entering Mopidy URIs for playback and browsing directly, just prefix the feed URL with ``podcast+`` to make sure it is not treated as an audio stream:: mpc add "podcast+https://www.npr.org/rss/podcast.php?id=510298" - Last but not least, you can install the companion extension `Mopidy-Podcast-iTunes`_, to browse and search podcasts on on `Apple Podcasts`_. ************* Configuration ************* This extension provides a number of configuration values that can be tweaked. However, the :ref:`default configuration ` should contain everything to get you up and running, and will usually require only a few modifications, if any, to match personal preferences. .. _confvals: Configuration Values ==================== .. confval:: enabled Whether this extension should be enabled or not. .. confval:: browse_root A local path or URL pointing to an OPML syndication feed to use as the root for browsing the *Podcasts* directory in Mopidy. Relative paths refer to files in the extension's configuration directory [#footnote1]_. For example, this will point the *Podcasts* directory to a collection of all the BBC Radio and Music feeds:: browse_root = https://www.bbc.co.uk/podcasts.opml The default value is ``Podcasts.opml``, so simply exporting your subscribed feeds from your favorite podcast client under this name and dropping the file in Mopidy-Podcast's configuration directory is usually all you need to do. If set to an empty string, the *Podcasts* directory will be hidden when browsing Mopidy. .. confval:: browse_order Whether to sort podcast episodes by ascending (``asc``) or descending (``desc``) publication date for browsing. .. confval:: lookup_order Whether to sort podcast episodes by ascending (``asc``) or descending (``desc``) publication date for lookup, for example when adding a podcast to Mopidy's tracklist. .. confval:: cache_size The maximum number of podcast feeds that will be cached in memory. .. confval:: cache_ttl The cache's *time to live*, i.e. the number of seconds after which a cached feed expires and needs to be reloaded. .. confval:: timeout The HTTP request timeout when retrieving podcast feeds, in seconds. .. _defconf: Default Configuration ===================== For reference, this is the default configuration shipped with Mopidy-Podcast release |release|: .. literalinclude:: ../src/mopidy_podcast/ext.conf :language: ini .. rubric:: Footnotes .. [#footnote1] When running Mopidy as a regular user, this will usually be ``~/.config/mopidy/podcast``. When running as a system service, this should be ``/etc/mopidy/podcast``. Note that it may be necessary to create these directories manually when installing the Python package from PyPi_, depending on local file permissions. .. _PyPI: https://pypi.org/project/Mopidy-Podcast/ .. _Mopidy: https://www.mopidy.com/ .. _OPML 2.0 specification: http://dev.opml.org/spec2.html .. _Mopidy-Podcast-iTunes: https://github.com/tkem/mopidy-podcast-itunes/ .. _Apple Podcasts: https://podcasts.apple.com/ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779663383.0 mopidy_podcast-4.0.0/pyproject.toml0000664000175100017510000000342315204701027016173 0ustar00tkemtkem[build-system] requires = ["setuptools >= 80", "setuptools-scm >= 8.2"] build-backend = "setuptools.build_meta" [project] name = "Mopidy-Podcast" description = "Mopidy extension for browsing and playing podcasts" authors = [ {name = "Thomas Kemmer", email = "tkemmer@computer.org"} ] maintainers = [ {name = "Thomas Kemmer", email = "tkemmer@computer.org"} ] readme = "README.rst" license = "Apache-2.0" license-files = ["LICENSE"] requires-python = ">= 3.13" classifiers = [ "Environment :: No Input/Output (Daemon)", "Intended Audience :: End Users/Desktop", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", "Topic :: Multimedia :: Sound/Audio :: Players", ] dependencies = [ "cachetools >= 5.3.3", "mopidy >= 4.0.0", "pykka >= 4.1", "uritools >= 4.0.3", ] dynamic = ["version"] [project.entry-points."mopidy.ext"] podcast = "mopidy_podcast:Extension" [project.urls] Homepage = "https://github.com/tkem/mopidy-podcast/" Documentation = "https://mopidy-podcast.readthedocs.io/en/stable/" Source = "https://github.com/tkem/mopidy-podcast/" Repository = "https://github.com/tkem/mopidy-podcast/" Issues = "https://github.com/tkem/mopidy-podcast/issues" Changelog = "https://github.com/tkem/mopidy-podcast/blob/master/CHANGELOG.rst" [tool.setuptools] package-dir = {"" = "src"} [tool.setuptools.package-data] "*" = ["*.conf"] [tool.setuptools.packages.find] where = ["src"] [tool.setuptools.dynamic] version = {attr = "mopidy_podcast.__version__"} [tool.pyright] typeCheckingMode = "standard" #reportFunctionMemberAccess = false #reportOptionalContextManager = false #reportOptionalMemberAccess = false ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1779664611.0168612 mopidy_podcast-4.0.0/setup.cfg0000664000175100017510000000004615204703343015101 0ustar00tkemtkem[egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1779664611.0148916 mopidy_podcast-4.0.0/src/0000775000175100017510000000000015204703343014047 5ustar00tkemtkem././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1779664611.0164845 mopidy_podcast-4.0.0/src/Mopidy_Podcast.egg-info/0000775000175100017510000000000015204703343020457 5ustar00tkemtkem././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779664611.0 mopidy_podcast-4.0.0/src/Mopidy_Podcast.egg-info/PKG-INFO0000644000175100017510000000755415204703343021565 0ustar00tkemtkemMetadata-Version: 2.4 Name: Mopidy-Podcast Version: 4.0.0 Summary: Mopidy extension for browsing and playing podcasts Author-email: Thomas Kemmer Maintainer-email: Thomas Kemmer License-Expression: Apache-2.0 Project-URL: Homepage, https://github.com/tkem/mopidy-podcast/ Project-URL: Documentation, https://mopidy-podcast.readthedocs.io/en/stable/ Project-URL: Source, https://github.com/tkem/mopidy-podcast/ Project-URL: Repository, https://github.com/tkem/mopidy-podcast/ Project-URL: Issues, https://github.com/tkem/mopidy-podcast/issues Project-URL: Changelog, https://github.com/tkem/mopidy-podcast/blob/master/CHANGELOG.rst Classifier: Environment :: No Input/Output (Daemon) Classifier: Intended Audience :: End Users/Desktop Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.13 Classifier: Programming Language :: Python :: 3.14 Classifier: Topic :: Multimedia :: Sound/Audio :: Players Requires-Python: >=3.13 Description-Content-Type: text/x-rst License-File: LICENSE Requires-Dist: cachetools>=5.3.3 Requires-Dist: mopidy>=4.0.0 Requires-Dist: pykka>=4.1 Requires-Dist: uritools>=4.0.3 Dynamic: license-file ************** Mopidy-Podcast ************** .. image:: https://img.shields.io/pypi/v/Mopidy-Podcast :target: https://pypi.org/project/Mopidy-Podcast/ :alt: Latest PyPI version .. image:: https://img.shields.io/github/actions/workflow/status/tkem/mopidy-podcast/ci.yml :target: https://github.com/tkem/mopidy-podcast/actions/workflows/ci.yml :alt: CI build status .. image:: https://img.shields.io/readthedocs/mopidy-podcast :target: https://mopidy-podcast.readthedocs.io/ :alt: Documentation build status .. image:: https://img.shields.io/codecov/c/gh/tkem/mopidy-podcast :target: https://codecov.io/gh/tkem/mopidy-podcast :alt: Test coverage .. image:: https://img.shields.io/github/license/tkem/mopidy-podcast :target: https://raw.github.com/tkem/mopidy-podcast/master/LICENSE :alt: License .. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/black :alt: Code style: black Mopidy-Podcast is a Mopidy_ extension for browsing and playing podcasts. This extension lets you browse podcasts distributed as RSS feeds and play individual episodes in a variety of audio formats. Podcasts are mapped to albums, while podcast episodes are shown as tracks in Mopidy, with metadata converted to Mopidy’s native data model where applicable. OPML 2.0 subscription lists and directories are also supported for multi-level browsing. Installation ============ On Debian Linux and Debian-based distributions like Ubuntu or Raspbian, install the ``mopidy-podcast`` package from apt.mopidy.com_:: apt-get install mopidy-podcast Otherwise, install the Python package from PyPI_:: pip install Mopidy-Podcast Project Resources ================= - `Documentation`_ - `Issue tracker`_ - `Source code`_ - `Change log`_ License ======= Copyright (c) 2014-2026 Thomas Kemmer. Licensed under the `Apache License, Version 2.0`_. Credits ======= - Original author: `Thomas Kemmer `__ - Current maintainer: `Thomas Kemmer `__ - `Contributors `_ .. _Mopidy: https://www.mopidy.com/ .. _PyPI: https://pypi.org/project/Mopidy-Podcast/ .. _apt.mopidy.com: https://apt.mopidy.com/ .. _Documentation: https://mopidy-podcast.readthedocs.io/en/latest/ .. _Source code: https://github.com/tkem/mopidy-podcast .. _Issue tracker: https://github.com/tkem/mopidy-podcast/issues .. _Change log: https://github.com/tkem/mopidy-podcast/blob/master/CHANGELOG.rst .. _Apache License, Version 2.0: https://raw.github.com/tkem/mopidy-podcast/master/LICENSE ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779664611.0 mopidy_podcast-4.0.0/src/Mopidy_Podcast.egg-info/SOURCES.txt0000664000175100017510000000132715204703343022346 0ustar00tkemtkemCHANGELOG.rst LICENSE MANIFEST.in README.rst pyproject.toml tox.ini docs/conf.py docs/index.rst src/Mopidy_Podcast.egg-info/PKG-INFO src/Mopidy_Podcast.egg-info/SOURCES.txt src/Mopidy_Podcast.egg-info/dependency_links.txt src/Mopidy_Podcast.egg-info/entry_points.txt src/Mopidy_Podcast.egg-info/requires.txt src/Mopidy_Podcast.egg-info/top_level.txt src/mopidy_podcast/__init__.py src/mopidy_podcast/backend.py src/mopidy_podcast/ext.conf src/mopidy_podcast/feeds.py src/mopidy_podcast/library.py src/mopidy_podcast/playback.py tests/__init__.py tests/conftest.py tests/directory.xml tests/rssfeed.xml tests/test_extension.py tests/test_feeds.py tests/test_library.py tests/test_opml.py tests/test_playback.py tests/test_rss.py././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779664611.0 mopidy_podcast-4.0.0/src/Mopidy_Podcast.egg-info/dependency_links.txt0000664000175100017510000000000115204703343024525 0ustar00tkemtkem ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779664611.0 mopidy_podcast-4.0.0/src/Mopidy_Podcast.egg-info/entry_points.txt0000664000175100017510000000006015204703343023751 0ustar00tkemtkem[mopidy.ext] podcast = mopidy_podcast:Extension ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779664611.0 mopidy_podcast-4.0.0/src/Mopidy_Podcast.egg-info/requires.txt0000664000175100017510000000007315204703343023057 0ustar00tkemtkemcachetools>=5.3.3 mopidy>=4.0.0 pykka>=4.1 uritools>=4.0.3 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779664611.0 mopidy_podcast-4.0.0/src/Mopidy_Podcast.egg-info/top_level.txt0000664000175100017510000000001715204703343023207 0ustar00tkemtkemmopidy_podcast ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1779664611.016127 mopidy_podcast-4.0.0/src/mopidy_podcast/0000775000175100017510000000000015204703343017065 5ustar00tkemtkem././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779663383.0 mopidy_podcast-4.0.0/src/mopidy_podcast/__init__.py0000664000175100017510000000262315204701027021176 0ustar00tkemtkemimport pathlib from mopidy import config, ext, httpclient __version__ = "4.0.0" class Extension(ext.Extension): dist_name = "Mopidy-Podcast" ext_name = "podcast" version = __version__ def get_default_config(self): return config.read(pathlib.Path(__file__).parent / "ext.conf") def get_config_schema(self): schema = super().get_config_schema() schema["browse_root"] = config.String(optional=True) schema["browse_order"] = config.String(choices=["asc", "desc"]) schema["lookup_order"] = config.String(choices=["asc", "desc"]) schema["cache_size"] = config.Integer(minimum=1) schema["cache_ttl"] = config.Integer(minimum=1) schema["timeout"] = config.Integer(optional=True, minimum=1) return schema def setup(self, registry): from .backend import PodcastBackend registry.add("backend", PodcastBackend) @classmethod def get_url_opener(cls, config): from urllib.request import ProxyHandler, build_opener proxy = httpclient.format_proxy(config["proxy"]) if proxy: handlers = [ProxyHandler({"http": proxy, "https": proxy})] else: handlers = [] opener = build_opener(*handlers) user_agent = f"{cls.dist_name}/{cls.version}" opener.addheaders = [("User-agent", httpclient.format_user_agent(user_agent))] return opener ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779663383.0 mopidy_podcast-4.0.0/src/mopidy_podcast/backend.py0000664000175100017510000000270015204701027021022 0ustar00tkemtkemimport contextlib import logging import cachetools from mopidy import backend import pykka from . import Extension, feeds from .library import PodcastLibraryProvider from .playback import PodcastPlaybackProvider logger = logging.getLogger(__name__) class PodcastFeedCache(cachetools.TTLCache): pykka_traversable = True def __init__(self, config): super().__init__( maxsize=config[Extension.ext_name]["cache_size"], ttl=config[Extension.ext_name]["cache_ttl"], ) self.__opener = Extension.get_url_opener(config) self.__timeout = config[Extension.ext_name]["timeout"] def __missing__(self, uri): ext_name, _, feedurl = uri.partition("+") assert ext_name == Extension.ext_name f = self.__opener.open(feedurl, timeout=self.__timeout) with contextlib.closing(f) as source: feed = feeds.parse(source) # do not cache local URIs so updates are available immediately if not feedurl.startswith("file:"): self[uri] = feed return feed class PodcastBackend(pykka.ThreadingActor, backend.Backend): uri_schemes = ["podcast", "podcast+file", "podcast+http", "podcast+https"] def __init__(self, config, audio): super().__init__() self.feeds = PodcastFeedCache(config) self.library = PodcastLibraryProvider(config, backend=self) self.playback = PodcastPlaybackProvider(audio, backend=self) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779654910.0 mopidy_podcast-4.0.0/src/mopidy_podcast/ext.conf0000664000175100017510000000123115204660376020541 0ustar00tkemtkem[podcast] enabled = true # optional path or URL to an OPML file used as the root for browsing; # relative paths will be resolved according to the extension's # configuration directory browse_root = Podcasts.opml # sort podcast episodes by ascending (asc) or descending (desc) # publication date for browsing browse_order = desc # sort podcast episodes by ascending (asc) or descending (desc) # publication date for lookup, e.g. when adding a podcast to Mopidy's # tracklist lookup_order = asc # maximum number of podcast feeds to cache in memory cache_size = 64 # cache time-to-live in seconds cache_ttl = 86400 # HTTP request timeout in seconds timeout = 10 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779663383.0 mopidy_podcast-4.0.0/src/mopidy_podcast/feeds.py0000664000175100017510000001660515204701027020532 0ustar00tkemtkemimport datetime import email.utils import re from pathlib import Path from mopidy import models import uritools from . import Extension try: import xml.etree.cElementTree as ElementTree except ImportError: import xml.etree.ElementTree as ElementTree def parse(source): if isinstance(source, Path): source = str(source) if isinstance(source, str): url = uritools.uricompose("file", "", source) else: url = source.geturl() root = ElementTree.parse(source).getroot() if root.tag == "rss": return RssFeed(url, root) elif root.tag == "opml": return OpmlFeed(url, root) else: raise TypeError("Not a recognized podcast feed: %s", url) def get_url(source, default=None): """ Get URL from xml.etree.ElementTree.Element. URL is often capitalized in OPML feeds. """ return source.get("url", source.get("URL", default)) class PodcastFeed: def __init__(self, url): self.uri = self.getfeeduri(url) @classmethod def getfeeduri(cls, url): return uritools.uridefrag(Extension.ext_name + "+" + url).uri def getitemuri(self, guid, safe=uritools.SUB_DELIMS + ":@/?"): return self.uri + "#" + uritools.uriencode(guid, safe=safe).decode() def getstreamuri(self, guid): raise NotImplementedError def items(self, newest_first=None): raise NotImplementedError def tracks(self, newest_first=None): return [] def images(self): return [] class RssFeed(PodcastFeed): ITUNES_PREFIX = "{http://www.itunes.com/dtds/podcast-1.0.dtd}" DURATION_RE = re.compile( r""" (?: (?:(?P\d+):)? (?P\d+): )? (?P\d+) """, flags=re.VERBOSE, ) def __init__(self, url, root): super().__init__(url) self.__channel = channel = root.find("channel") items = channel.findall("./item/enclosure[@url]/..") self.__items = list(sorted(items, key=self.__order)) def getstreamuri(self, guid): for item in self.__items: if self.__guid(item) == guid: return get_url(item.find("enclosure")) return None def items(self, newest_first=False): for item in reversed(self.__items) if newest_first else self.__items: yield models.Ref.track( uri=self.getitemuri(self.__guid(item)), name=item.findtext("title"), ) def tracks(self, newest_first=False): album = models.Album( uri=self.uri, name=self.__channel.findtext("title"), artists=self.__artists(self.__channel), num_tracks=len(self.__items), ) genre = self.__genre(self.__channel) items = enumerate(self.__items, start=1) for index, item in reversed(list(items)) if newest_first else items: yield models.Track( uri=self.getitemuri(self.__guid(item)), name=item.findtext("title"), album=album, artists=(self.__artists(item) or album.artists), genre=genre, date=self.__date(item), length=self.__length(item), comment=item.findtext("description"), track_no=index, ) def images(self): image = self.__image(self.__channel) default = [image] if image else None if default: yield self.uri, default for item in self.__items: image = self.__image(item) if image: yield self.getitemuri(self.__guid(item)), [image] elif default: yield self.getitemuri(self.__guid(item)), default else: pass @classmethod def __artists(cls, etree): elem = etree.find(cls.ITUNES_PREFIX + "author") if elem is not None and elem.text: return [models.Artist(name=elem.text)] else: return None @classmethod def __date(cls, etree): text = etree.findtext("pubDate") try: t = email.utils.mktime_tz(email.utils.parsedate_tz(text)) except AttributeError: return None except TypeError: return None else: return datetime.datetime.fromtimestamp(t, datetime.UTC).date().isoformat() @classmethod def __genre(cls, etree): elem = etree.find(cls.ITUNES_PREFIX + "category") if elem is not None: return elem.get("text") else: return None @classmethod def __guid(cls, etree): return etree.findtext("guid") or get_url(etree.find("enclosure")) @classmethod def __image(cls, etree): elem = etree.find(cls.ITUNES_PREFIX + "image") if elem is not None: return models.Image(uri=elem.get("href")) else: return None @classmethod def __length(cls, etree): text = etree.findtext(cls.ITUNES_PREFIX + "duration") try: groups = cls.DURATION_RE.match(text).groupdict("0") except AttributeError: return None except TypeError: return None else: d = datetime.timedelta(**{k: int(v) for k, v in groups.items()}) return int(d.total_seconds() * 1000) @staticmethod def __order(etree): text = etree.findtext("pubDate") try: timestamp = email.utils.mktime_tz(email.utils.parsedate_tz(text)) except AttributeError: return 0 except TypeError: return 0 else: return timestamp class OpmlFeed(PodcastFeed): # not really a "feed" TYPES = { "include": lambda e: models.Ref.directory( name=e.get("text"), uri=PodcastFeed.getfeeduri(get_url(e)) ), "link": lambda e: models.Ref( type=( models.Ref.DIRECTORY if get_url(e).endswith(".opml") else models.Ref.ALBUM ), name=e.get("text"), uri=PodcastFeed.getfeeduri(get_url(e)), ), "rss": lambda e: models.Ref.album( name=e.get("title", e.get("text")), uri=PodcastFeed.getfeeduri(e.get("xmlUrl")), ), } def __init__(self, url, root): super().__init__(url) self.__outlines = root.findall("./body//outline[@type]") def items(self, newest_first=None): for e in self.__outlines: try: ref = self.TYPES[e.get("type").lower()] except KeyError: pass else: yield ref(e) if __name__ == "__main__": # pragma: no cover import argparse import contextlib import json import urllib.request import sys from mopidy.models import ModelJSONEncoder parser = argparse.ArgumentParser() parser.add_argument("url", metavar="URL") parser.add_argument("-i", "--images", action="store_true") parser.add_argument("-t", "--tracks", action="store_true") args = parser.parse_args() with contextlib.closing(urllib.request.urlopen(args.url)) as source: feed = parse(source) if args.tracks: result = list(feed.tracks()) elif args.images: result = dict(feed.images()) else: result = list(feed.items()) json.dump(result, sys.stdout, cls=ModelJSONEncoder, indent=2) sys.stdout.write("\n") ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779654910.0 mopidy_podcast-4.0.0/src/mopidy_podcast/library.py0000664000175100017510000000770415204660376021123 0ustar00tkemtkemimport itertools import locale import logging import os from mopidy import backend, models import uritools from . import Extension logger = logging.getLogger(__name__) def strerror(error): if isinstance(error.strerror, bytes): return error.strerror.decode(locale.getpreferredencoding()) else: return error.strerror def get_config_dir(config): try: return Extension.get_config_dir(config) except OSError as e: logger.warning( "Cannot access %s config directory: %s", Extension.dist_name, strerror(e), ) except Exception as e: logger.warning("Cannot access %s config directory: %s", Extension.dist_name, e) return None class PodcastLibraryProvider(backend.LibraryProvider): def __init__(self, config, backend): super().__init__(backend) self.__config_dir = get_config_dir(config) self.__browse_root = config[Extension.ext_name]["browse_root"] self.__browse_order = config[Extension.ext_name]["browse_order"] self.__lookup_order = config[Extension.ext_name]["lookup_order"] self.__tracks = {} # cache tracks for faster lookup @property def root_directory(self): root = self.__browse_root if not root: return None elif root.startswith(("file:", "http:", "https:")): uri = uritools.uridefrag("podcast+" + root).uri return models.Ref.directory(name="Podcasts", uri=uri) elif os.path.isabs(root): uri = uritools.uricompose("podcast+file", "", root) return models.Ref.directory(name="Podcasts", uri=uri) elif self.__config_dir: path = os.path.join(self.__config_dir, root) uri = uritools.uricompose("podcast+file", "", path) return models.Ref.directory(name="Podcasts", uri=uri) else: logger.error("Cannot retrieve Podcast root directory") return None def browse(self, uri): try: feed = self.backend.feeds[uri] except Exception as e: logger.error("Error retrieving %s: %s", uri, e) # TODO: raise? else: return list(feed.items(self.__browse_order == "desc")) return [] # FIXME: hide errors from clients def get_images(self, uris): def key(uri): return uritools.uridefrag(uri).uri result = {} for feeduri, urls in itertools.groupby(sorted(uris, key=key), key=key): try: images = dict(self.backend.feeds[feeduri].images()) except Exception as e: logger.error("Error retrieving images for %s: %s", feeduri, e) else: result.update((url, images.get(url, [])) for url in urls) return result def lookup(self, uri): # pop from __tracks since cached tracks shouldn't live too long try: track = self.__tracks.pop(uri) except KeyError: logger.debug("Lookup cache miss: %s", uri) else: return [track] try: feed = self.backend.feeds[uritools.uridefrag(uri).uri] except Exception as e: logger.error("Error retrieving %s: %s", uri, e) # TODO: raise? else: return self.__lookup(feed, uri) return [] # FIXME: hide errors from clients def refresh(self, uri=None): if uri: self.backend.feeds.pop(uritools.uridefrag(uri).uri, None) else: self.backend.feeds.clear() self.__tracks.clear() def __lookup(self, feed, uri): if uri == feed.uri: return list(feed.tracks(self.__lookup_order == "desc")) else: self.__tracks = tracks = {t.uri: t for t in feed.tracks()} try: track = tracks.pop(uri) except KeyError: logger.warning("No such track: %s", uri) # TODO: raise? else: return [track] ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779654910.0 mopidy_podcast-4.0.0/src/mopidy_podcast/playback.py0000664000175100017510000000071615204660376021241 0ustar00tkemtkemimport logging from mopidy import backend import uritools logger = logging.getLogger(__name__) class PodcastPlaybackProvider(backend.PlaybackProvider): def translate_uri(self, uri): parts = uritools.uridefrag(uri) try: feed = self.backend.feeds[parts.uri] except Exception as e: logger.error("Error retrieving %s: %s", parts.uri, e) else: return feed.getstreamuri(parts.getfragment()) ././@PaxHeader0000000000000000000000000000003200000000000010210 xustar0026 mtime=1779664611.01645 mopidy_podcast-4.0.0/tests/0000775000175100017510000000000015204703343014422 5ustar00tkemtkem././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1597080933.0 mopidy_podcast-4.0.0/tests/__init__.py0000644000175100017510000000000013714302545016522 0ustar00tkemtkem././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779663383.0 mopidy_podcast-4.0.0/tests/conftest.py0000664000175100017510000000167415204701027016626 0ustar00tkemtkemimport functools import os from pathlib import Path from unittest import mock import mopidy_podcast as ext import pytest @pytest.fixture def testpath() -> Path: return Path(__file__).parent @pytest.fixture def abspath(testpath: Path): return functools.partial(os.path.join, str(testpath)) @pytest.fixture def audio(): return mock.Mock() @pytest.fixture def config(testpath: Path): return { "podcast": { "browse_root": "Podcasts.opml", "browse_order": "desc", "lookup_order": "asc", "cache_size": 64, "cache_ttl": 86400, "timeout": 10, }, "core": {"config_dir": testpath}, "proxy": {}, } @pytest.fixture def backend(config, audio): return ext.backend.PodcastBackend(config, audio) @pytest.fixture def library(backend): return backend.library @pytest.fixture def playback(backend): return backend.playback ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1597080933.0 mopidy_podcast-4.0.0/tests/directory.xml0000644000175100017510000001111713714302545017152 0ustar00tkemtkem mySubscriptions.opml Sat, 18 Jun 2005 12:11:52 GMT Tue, 02 Aug 2005 21:42:48 GMT Dave Winer dave@scripting.com 1 61 304 562 842 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1597080933.0 mopidy_podcast-4.0.0/tests/rssfeed.xml0000644000175100017510000000662413714302545016610 0ustar00tkemtkem All About Everything http://www.example.com/podcasts/everything/index.html en-us ℗ & © 2014 John Doe & Family A show about everything John Doe All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our podcast in the Podcasts app or in the iTunes Store All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our podcast in the Podcasts app or in the iTunes Store John Doe john.doe@example.com Shake Shake Shake Your Spices John Doe A short primer on table spices salt and pepper shakers, comparing and contrasting pour rates, construction materials, and overall aesthetics. Come and join the party!]]> http://example.com/podcasts/archive/aae20140615.m4a Wed, 15 Jun 2014 19:00:00 GMT 7:04 Socket Wrench Shootout Jane Doe Comparing socket wrenches is fun! This week we talk about metric vs. Old English socket wrenches. Which one is better? Do you really need both? Get all of your answers here. http://example.com/podcasts/archive/aae20140608.mp3 Wed, 8 Jun 2014 19:00:00 GMT 4:34 Red,Whine, & Blue Various Red + Blue != Purple This week we talk about surviving in a Red state if you are a Blue person. Or vice versa. http://example.com/podcasts/archive/aae20140601.mp3 Wed, 1 Jun 2014 19:00:00 GMT 3:59 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779654910.0 mopidy_podcast-4.0.0/tests/test_extension.py0000664000175100017510000000421515204660376020061 0ustar00tkemtkemfrom unittest import mock from urllib.request import FileHandler, HTTPHandler, HTTPSHandler from mopidy_podcast import Extension, backend import pytest def test_get_default_config(): config = Extension().get_default_config() assert "[" + Extension.ext_name + "]" in config assert "enabled = true" in config def test_get_config_schema(): schema = Extension().get_config_schema() assert "browse_root" in schema assert "browse_order" in schema assert "lookup_order" in schema assert "cache_size" in schema assert "cache_ttl" in schema assert "timeout" in schema def test_setup(): registry = mock.Mock() Extension().setup(registry) registry.add.assert_called_once_with("backend", backend.PodcastBackend) @pytest.mark.parametrize( "url,handler,method,proxy_config", [ ("file://example.com/feed.xml", FileHandler, "file_open", {}), ("http://example.com/feed.xml", HTTPHandler, "http_open", {}), ( "https://example.com/feed.xml", HTTPSHandler, "https_open", {}, ), ( "http://example.com/feed.xml", HTTPHandler, "http_open", {"scheme": "http", "hostname": "localhost", "port": 9999}, ), ( "http://example.com/feed.xml", HTTPSHandler, "https_open", {"scheme": "https", "hostname": "localhost", "port": 9999}, ), ], ) def test_get_url_opener(url, handler, method, proxy_config): opener = Extension.get_url_opener({"proxy": proxy_config}) with mock.patch.object(handler, method) as mock_open: try: opener.open(url) except Exception: pass assert mock_open.mock_calls (req,), _ = mock_open.call_args if req.header_items(): user_agent = f"{Extension.dist_name}/{Extension.version}" assert user_agent in req.get_header("User-agent") if proxy_config: assert req.type == proxy_config["scheme"] assert req.host == "{hostname}:{port}".format(**proxy_config) assert req.selector == url assert url == req.get_full_url() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779663383.0 mopidy_podcast-4.0.0/tests/test_feeds.py0000664000175100017510000000070015204701027017113 0ustar00tkemtkemfrom pathlib import Path from mopidy_podcast import feeds import pytest import uritools @pytest.mark.parametrize( "filename,expected", [("directory.xml", feeds.OpmlFeed), ("rssfeed.xml", feeds.RssFeed)], ) def test_parse(testpath: Path, filename: str, expected): path = testpath / filename feed = feeds.parse(path) assert isinstance(feed, expected) assert feed.uri == uritools.uricompose("podcast+file", "", str(path)) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779654910.0 mopidy_podcast-4.0.0/tests/test_library.py0000664000175100017510000000526215204660376017514 0ustar00tkemtkemfrom mopidy_podcast import feeds import pytest def test_root_directory(library): assert library.root_directory is not None assert library.root_directory.name == "Podcasts" assert library.root_directory.uri.endswith("Podcasts.opml") @pytest.mark.parametrize("filename", ["directory.xml", "rssfeed.xml"]) def test_browse(config, library, filename, abspath): feed = feeds.parse(abspath(filename)) newest_first = config["podcast"]["browse_order"] == "desc" assert library.browse(feed.uri) == list(feed.items(newest_first)) @pytest.mark.parametrize("uri,expected", [(None, []), ("podcast+file:///", [])]) def test_browse_error(library, uri, expected): if isinstance(expected, type): with pytest.raises(expected): library.browse(uri) else: assert library.browse(uri) == expected @pytest.mark.parametrize("filename", ["rssfeed.xml"]) def test_get_images(library, filename, abspath): feed = feeds.parse(abspath(filename)) for uri, images in feed.images(): assert library.get_images([uri]) == {uri: images} images = {uri: images for uri, images in feed.images()} assert library.get_images(list(images)) == images @pytest.mark.parametrize("uris,expected", [(None, TypeError), ("podcast+file:///", {})]) def test_get_images_error(library, uris, expected): if isinstance(expected, type): with pytest.raises(expected): library.get_images(uris) else: assert library.get_images(uris) == expected @pytest.mark.parametrize("filename", ["rssfeed.xml"]) def test_lookup(config, library, filename, abspath): feed = feeds.parse(abspath(filename)) for track in feed.tracks(): assert library.lookup(track.uri) == [track] newest_first = config["podcast"]["lookup_order"] == "desc" assert library.lookup(feed.uri) == list(feed.tracks(newest_first)) @pytest.mark.parametrize("uri,expected", [(None, []), ("podcast+file:///", [])]) def test_lookup_error(library, uri, expected): if isinstance(expected, type): with pytest.raises(expected): library.lookup(uri) else: assert library.lookup(uri) == expected @pytest.mark.parametrize("filename", ["rssfeed.xml"]) def test_refresh(library, filename, abspath): feed = feeds.parse(abspath(filename)) tracks = library.lookup(feed.uri) assert feed.uri not in library.backend.feeds # local feeds not cached! library.backend.feeds[feed.uri] = feed assert feed.uri in library.backend.feeds library.refresh(tracks[0].uri) assert feed.uri not in library.backend.feeds library.backend.feeds[feed.uri] = feed assert library.backend.feeds library.refresh() assert not library.backend.feeds ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779654910.0 mopidy_podcast-4.0.0/tests/test_opml.py0000664000175100017510000000441115204660376017012 0ustar00tkemtkemfrom mopidy import models from mopidy_podcast import feeds import pytest XML = """ example.opml Tue, 02 Mar 2016 12:01:00 GMT Tue, 02 Mar 2016 12:01:00 GMT """ @pytest.fixture def opml(): from io import StringIO class StringSource(StringIO): def geturl(self): return "http://example.com/example.opml" return StringSource(XML) def test_items(opml): feed = feeds.parse(opml) assert list(feed.items()) == [ models.Ref.album(uri="podcast+http://example.com/podcast1.rss", name="Podcast"), models.Ref.album(uri="podcast+http://example.com/podcast2.xml", name="Podcast"), models.Ref.album(uri="podcast+http://example.com/podcast3", name="Podcast"), models.Ref.directory( uri="podcast+http://example.com/directory1", name="Directory" ), models.Ref.directory( uri="podcast+http://example.com/directory2.opml", name="Directory" ), models.Ref.album(uri="podcast+http://example.com/podcast4.xml", name="Podcast"), models.Ref.album(uri="podcast+http://example.com/podcast5.xml", name="PODCAST"), ] def test_tracks(opml): feed = feeds.parse(opml) assert list(feed.tracks()) == [] def test_images(opml): feed = feeds.parse(opml) assert dict(feed.images()) == {} ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779654910.0 mopidy_podcast-4.0.0/tests/test_playback.py0000664000175100017510000000075515204660376017640 0ustar00tkemtkemfrom mopidy_podcast import feeds import pytest @pytest.mark.parametrize("filename", ["rssfeed.xml"]) def test_translate_uri(playback, filename, abspath): feed = feeds.parse(abspath(filename)) for track in feed.tracks(): assert playback.translate_uri(track.uri) is not None assert playback.translate_uri(feed.uri + "#n/a") is None assert playback.translate_uri(feed.uri) is None def test_translate_empty_uri(playback): assert playback.translate_uri("") is None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779654910.0 mopidy_podcast-4.0.0/tests/test_rss.py0000664000175100017510000001052115204660376016651 0ustar00tkemtkemfrom mopidy import models from mopidy_podcast import feeds import pytest XML = """ All About Everything http://www.example.com/everything/index.html en-us ℗ & © 2014 John Doe & Family John Doe All About Everything is a show about everything. Shake Shake Shake Your Spices episode3 Wed, 15 Jun 2014 19:00:00 GMT 7:04 Socket Wrench Shootout Jane Doe episode2 Wed, 8 Jun 2014 19:00:00 GMT 4:34 Red, Whine, & Blue Various Wed, 1 Jun 2014 19:00:00 GMT 3:59 """ @pytest.fixture def rss(): from io import StringIO class StringSource(StringIO): def geturl(self): return "http://www.example.com/everything.xml" return feeds.parse(StringSource(XML)) @pytest.fixture def album(): return models.Album( uri="podcast+http://www.example.com/everything.xml", name="All About Everything", artists=[models.Artist(name="John Doe")], num_tracks=3, ) @pytest.fixture def tracks(album): return [ models.Track( uri="podcast+http://www.example.com/everything.xml#episode3", name="Shake Shake Shake Your Spices", artists=[models.Artist(name="John Doe")], album=album, genre="Technology", date="2014-06-15", length=424000, track_no=3, ), models.Track( uri="podcast+http://www.example.com/everything.xml#episode2", name="Socket Wrench Shootout", artists=[models.Artist(name="Jane Doe")], album=album, genre="Technology", date="2014-06-08", length=274000, track_no=2, ), models.Track( uri=( "podcast+http://www.example.com/everything.xml" "#http://example.com/everything/Episode1.mp3" ), name="Red, Whine, & Blue", artists=[models.Artist(name="Various")], album=album, genre="Technology", date="2014-06-01", length=239000, track_no=1, ), ] @pytest.fixture def items(tracks): return [models.Ref.track(uri=t.uri, name=t.name) for t in tracks] def test_items(rss, items): assert list(rss.items(newest_first=True)) == items assert list(rss.items(newest_first=False)) == list(reversed(items)) def test_tracks(rss, tracks): assert list(rss.tracks(newest_first=True)) == tracks assert list(rss.tracks(newest_first=False)) == list(reversed(tracks)) def test_images(rss): assert dict(rss.images()) == { "podcast+http://www.example.com/everything.xml": [ models.Image(uri="http://example.com/everything/Podcast.jpg") ], "podcast+http://www.example.com/everything.xml#episode3": [ models.Image(uri="http://example.com/everything/Episode3.jpg") ], "podcast+http://www.example.com/everything.xml#episode2": [ models.Image(uri="http://example.com/everything/Episode2.jpg") ], ( "podcast+http://www.example.com/everything.xml" "#http://example.com/everything/Episode1.mp3" ): [models.Image(uri="http://example.com/everything/Podcast.jpg")], } ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779663383.0 mopidy_podcast-4.0.0/tox.ini0000664000175100017510000000107615204701027014574 0ustar00tkemtkem[tox] envlist = py,docs,ruff,ruff-format [testenv] deps = pytest pytest-cov commands = py.test --basetemp={envtmpdir} --cov=mopidy_podcast --cov-report term-missing {posargs} [testenv:docs] deps = sphinx commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs {envtmpdir}/html [testenv:ruff] deps = ruff commands = ruff check {posargs} skip_install = true [testenv:ruff-format] deps = ruff commands = ruff format --diff -q {posargs} skip_install = true [testenv:pyright] deps = pyright commands = pyright {posargs}