././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1779665207.5754375 mopidy_podcast_itunes-4.0.0/0000775000175100017510000000000015204704470014651 5ustar00tkemtkem././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779665060.0 mopidy_podcast_itunes-4.0.0/CHANGELOG.rst0000664000175100017510000000372015204704244016673 0ustar00tkemtkem4.0.0 (2026-05-25) =================== - Require Mopidy >= 4.0.0. - Remove deprecated configuration entries. - Update build environment. v3.1.3 (2026-04-16) =================== - Improve error handling. v3.1.2 (2026-04-11) =================== - Update and re-enable browsing tests. - Minor documentation improvements. v3.1.1 (2026-04-10) =================== - Minor documentation improvements. v3.1.0 (2026-04-08) =================== - Add support for Python <= 3.14. - Rename root directory to "Apple Podcasts". - Re-enable podcast charts browsing by switching to currently supported APIs. - Move documentation to ``_. - Update unit tests fur use with current pytest versions. - 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.0 (2016-03-23) =================== - Converted from Mopidy-Podcast directory extension to regular Mopidy backend extension. No longer uses Mopidy-Podcast directory API. - Add workaround for apparent changes in iTunes search API regarding the ``explicit`` parameter. - Add HTTP connection retries configuration. - Upgrade dependencies to Mopidy v1.1 and Mopidy-Podcast v2.0. v1.0.0 (2014-05-24) =================== - Upgrade to Mopidy-Podcast v1.0.0 directory API. - Add support for undocumented search attributes. - Support custom formatting of search/browse results. v0.2.0 (2014-04-11) =================== - Upgrade to Mopidy-Podcast v0.4.0 directory API. - Separate charts directory if subgenres are present. - Support for ``genreTerm`` search attribute. v0.1.0 (2014-03-14) =================== - Initial release. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1597080934.0 mopidy_podcast_itunes-4.0.0/LICENSE0000644000175100017510000002367613714302546015674 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=1779665060.0 mopidy_podcast_itunes-4.0.0/MANIFEST.in0000664000175100017510000000007415204704244016407 0ustar00tkemtkemprune .github/ exclude .gitignore exclude .readthedocs.yaml ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1779665207.5754201 mopidy_podcast_itunes-4.0.0/PKG-INFO0000644000175100017510000000773515204704470015760 0ustar00tkemtkemMetadata-Version: 2.4 Name: Mopidy-Podcast-iTunes Version: 4.0.0 Summary: Mopidy extension for searching and browsing podcasts on Apple Podcasts Home-page: https://github.com/tkem/mopidy-podcast-itunes Author: Thomas Kemmer Author-email: Thomas Kemmer Maintainer-email: Thomas Kemmer License-Expression: Apache-2.0 Project-URL: Homepage, https://github.com/tkem/mopidy-podcast-itunes/ Project-URL: Documentation, https://mopidy-podcast-itunes.readthedocs.io/en/stable/ Project-URL: Source, https://github.com/tkem/mopidy-podcast-itunes/ Project-URL: Repository, https://github.com/tkem/mopidy-podcast-itunes/ Project-URL: Issues, https://github.com/tkem/mopidy-podcast-itunes/issues Project-URL: Changelog, https://github.com/tkem/mopidy-podcast-itunes/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: mopidy>=4.0.0 Requires-Dist: mopidy-podcast>=4.0.0 Requires-Dist: pykka>=4.1 Requires-Dist: requests>=2.32 Dynamic: license-file ********************* Mopidy-Podcast-iTunes ********************* .. image:: https://img.shields.io/pypi/v/Mopidy-Podcast-iTunes :target: https://pypi.org/project/Mopidy-Podcast-iTunes/ :alt: Latest PyPI version .. image:: https://img.shields.io/github/actions/workflow/status/tkem/mopidy-podcast-itunes/ci.yml :target: https://github.com/tkem/mopidy-podcast-itunes/actions/workflows/ci.yml :alt: CI build status .. image:: https://img.shields.io/readthedocs/mopidy-podcast-itunes :target: https://mopidy-podcast-itunes.readthedocs.io/ :alt: Documentation build status .. image:: https://img.shields.io/codecov/c/gh/tkem/mopidy-podcast-itunes :target: https://codecov.io/gh/tkem/mopidy-podcast-itunes :alt: Test coverage .. image:: https://img.shields.io/github/license/tkem/mopidy-podcast-itunes :target: https://raw.github.com/tkem/mopidy-podcast-itunes/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-iTunes is a Mopidy_ extension for searching and browsing podcasts on `Apple Podcasts`_, using the `iTunes Search API`_. Installation ============ On Debian Linux and Debian-based distributions like Ubuntu or Raspbian, install the ``mopidy-podcast-itunes`` package from apt.mopidy.com_:: apt-get install mopidy-podcast-itunes Otherwise, install the Python package from PyPI_:: pip install Mopidy-Podcast-iTunes 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/ .. _Apple Podcasts: https://podcasts.apple.com/ .. _iTunes Search API: https://performance-partners.apple.com/search-api .. _PyPI: https://pypi.org/project/Mopidy-Podcast/ .. _apt.mopidy.com: https://apt.mopidy.com/ .. _Documentation: https://mopidy-podcast-itunes.readthedocs.io/en/latest/ .. _Source code: https://github.com/tkem/mopidy-podcast-itunes .. _Issue tracker: https://github.com/tkem/mopidy-podcast-itunes/issues .. _Change log: https://github.com/tkem/mopidy-podcast-itunes/blob/master/CHANGELOG.rst .. _Apache License, Version 2.0: https://raw.github.com/tkem/mopidy-podcast-itunes/master/LICENSE ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1775845079.0 mopidy_podcast_itunes-4.0.0/README.rst0000664000175100017510000000505715166237327016360 0ustar00tkemtkem********************* Mopidy-Podcast-iTunes ********************* .. image:: https://img.shields.io/pypi/v/Mopidy-Podcast-iTunes :target: https://pypi.org/project/Mopidy-Podcast-iTunes/ :alt: Latest PyPI version .. image:: https://img.shields.io/github/actions/workflow/status/tkem/mopidy-podcast-itunes/ci.yml :target: https://github.com/tkem/mopidy-podcast-itunes/actions/workflows/ci.yml :alt: CI build status .. image:: https://img.shields.io/readthedocs/mopidy-podcast-itunes :target: https://mopidy-podcast-itunes.readthedocs.io/ :alt: Documentation build status .. image:: https://img.shields.io/codecov/c/gh/tkem/mopidy-podcast-itunes :target: https://codecov.io/gh/tkem/mopidy-podcast-itunes :alt: Test coverage .. image:: https://img.shields.io/github/license/tkem/mopidy-podcast-itunes :target: https://raw.github.com/tkem/mopidy-podcast-itunes/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-iTunes is a Mopidy_ extension for searching and browsing podcasts on `Apple Podcasts`_, using the `iTunes Search API`_. Installation ============ On Debian Linux and Debian-based distributions like Ubuntu or Raspbian, install the ``mopidy-podcast-itunes`` package from apt.mopidy.com_:: apt-get install mopidy-podcast-itunes Otherwise, install the Python package from PyPI_:: pip install Mopidy-Podcast-iTunes 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/ .. _Apple Podcasts: https://podcasts.apple.com/ .. _iTunes Search API: https://performance-partners.apple.com/search-api .. _PyPI: https://pypi.org/project/Mopidy-Podcast/ .. _apt.mopidy.com: https://apt.mopidy.com/ .. _Documentation: https://mopidy-podcast-itunes.readthedocs.io/en/latest/ .. _Source code: https://github.com/tkem/mopidy-podcast-itunes .. _Issue tracker: https://github.com/tkem/mopidy-podcast-itunes/issues .. _Change log: https://github.com/tkem/mopidy-podcast-itunes/blob/master/CHANGELOG.rst .. _Apache License, Version 2.0: https://raw.github.com/tkem/mopidy-podcast-itunes/master/LICENSE ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1779665207.5739288 mopidy_podcast_itunes-4.0.0/docs/0000775000175100017510000000000015204704470015601 5ustar00tkemtkem././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779665060.0 mopidy_podcast_itunes-4.0.0/docs/conf.py0000664000175100017510000000157515204704244017107 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_itunes/__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-iTunes" 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=1775940612.0 mopidy_podcast_itunes-4.0.0/docs/index.rst0000664000175100017510000000361515166532004017446 0ustar00tkemtkem:tocdepth: 3 ********************* Mopidy-Podcast-iTunes ********************* Mopidy-Podcast-iTunes is a Mopidy_ extension for searching and browsing podcasts on `Apple Podcasts`_, using the `iTunes Search API`_. .. note:: The iTunes Search API is limited to approximately 20 calls per minute (subject to change). Mopidy-Podcast-iTunes uses in-memory caching extensively, so you should not be affected by this limit with normal, interactive usage. ************* 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:: base_url The iTunes Search API base URL. .. confval:: country The two-letter country code for the store you want to search. .. confval:: explicit Whether you want to include explicit content in your search results. .. confval:: charts_limit The maximum number of podcast charts entries to retrieve when browsing. .. confval:: search_limit The maximum number of search results to retrieve. .. confval:: timeout The HTTP request timeout in seconds when using the Search API. .. confval:: retries The maximum number of HTTP connection retries when using the Search API. .. _defconf: Default Configuration ===================== For reference, this is the default configuration shipped with Mopidy-Podcast-iTunes release |release|: .. literalinclude:: ../src/mopidy_podcast_itunes/ext.conf :language: ini .. _Mopidy: https://www.mopidy.com/ .. _Apple Podcasts: https://podcasts.apple.com/ .. _iTunes Search API: https://performance-partners.apple.com/search-api ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779665060.0 mopidy_podcast_itunes-4.0.0/pyproject.toml0000664000175100017510000000355715204704244017576 0ustar00tkemtkem[build-system] requires = ["setuptools >= 80", "setuptools-scm >= 8.2"] build-backend = "setuptools.build_meta" [project] name = "Mopidy-Podcast-iTunes" description = "Mopidy extension for searching and browsing podcasts on Apple 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 = [ "mopidy >= 4.0.0", "mopidy-podcast >= 4.0.0", "pykka >= 4.1", "requests >= 2.32" ] dynamic = ["version"] [project.entry-points."mopidy.ext"] podcast-itunes = "mopidy_podcast_itunes:Extension" [project.urls] Homepage = "https://github.com/tkem/mopidy-podcast-itunes/" Documentation = "https://mopidy-podcast-itunes.readthedocs.io/en/stable/" Source = "https://github.com/tkem/mopidy-podcast-itunes/" Repository = "https://github.com/tkem/mopidy-podcast-itunes/" Issues = "https://github.com/tkem/mopidy-podcast-itunes/issues" Changelog = "https://github.com/tkem/mopidy-podcast-itunes/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_itunes.__version__"} [tool.pyright] typeCheckingMode = "standard" #reportFunctionMemberAccess = false #reportOptionalContextManager = false #reportOptionalMemberAccess = false ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1779665207.5759907 mopidy_podcast_itunes-4.0.0/setup.cfg0000664000175100017510000000304615204704470016475 0ustar00tkemtkem[metadata] name = Mopidy-Podcast-iTunes version = 3.0.1 url = https://github.com/tkem/mopidy-podcast-itunes author = Thomas Kemmer author_email = tkemmer@computer.org license = Apache License, Version 2.0 license_file = LICENSE description = Mopidy extension for searching and browsing podcasts on the Apple iTunes Store long_description = file: README.rst classifiers = Environment :: No Input/Output (Daemon) Intended Audience :: End Users/Desktop License :: OSI Approved :: Apache Software License Operating System :: OS Independent Programming Language :: Python :: 3 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Topic :: Multimedia :: Sound/Audio :: Players [options] zip_safe = False include_package_data = True packages = find: python_requires = >= 3.7 install_requires = Mopidy >= 3.0.0 Mopidy-Podcast >= 3.0.0 Pykka >= 2.0.1 requests >= 2.0 setuptools [options.extras_require] lint = black check-manifest flake8 flake8-black flake8-bugbear flake8-import-order isort[pyproject] release = twine wheel test = pytest pytest-cov responses dev = %(lint)s %(release)s %(test)s [options.packages.find] exclude = tests tests.* [options.entry_points] mopidy.ext = podcast-itunes = mopidy_podcast_itunes:Extension [flake8] application-import-names = mopidy_podcast, tests max-line-length = 80 exclude = .git, .tox, build select = C, E, F, W B B950 N ignore = E203 E501 W503 [egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1597080933.0 mopidy_podcast_itunes-4.0.0/setup.py0000644000175100017510000000004613714302545016362 0ustar00tkemtkemfrom setuptools import setup setup() ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1779665207.572478 mopidy_podcast_itunes-4.0.0/src/0000775000175100017510000000000015204704470015440 5ustar00tkemtkem././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1779665207.575127 mopidy_podcast_itunes-4.0.0/src/Mopidy_Podcast_iTunes.egg-info/0000775000175100017510000000000015204704470023377 5ustar00tkemtkem././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779665207.0 mopidy_podcast_itunes-4.0.0/src/Mopidy_Podcast_iTunes.egg-info/PKG-INFO0000644000175100017510000000773515204704467024514 0ustar00tkemtkemMetadata-Version: 2.4 Name: Mopidy-Podcast-iTunes Version: 4.0.0 Summary: Mopidy extension for searching and browsing podcasts on Apple Podcasts Home-page: https://github.com/tkem/mopidy-podcast-itunes Author: Thomas Kemmer Author-email: Thomas Kemmer Maintainer-email: Thomas Kemmer License-Expression: Apache-2.0 Project-URL: Homepage, https://github.com/tkem/mopidy-podcast-itunes/ Project-URL: Documentation, https://mopidy-podcast-itunes.readthedocs.io/en/stable/ Project-URL: Source, https://github.com/tkem/mopidy-podcast-itunes/ Project-URL: Repository, https://github.com/tkem/mopidy-podcast-itunes/ Project-URL: Issues, https://github.com/tkem/mopidy-podcast-itunes/issues Project-URL: Changelog, https://github.com/tkem/mopidy-podcast-itunes/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: mopidy>=4.0.0 Requires-Dist: mopidy-podcast>=4.0.0 Requires-Dist: pykka>=4.1 Requires-Dist: requests>=2.32 Dynamic: license-file ********************* Mopidy-Podcast-iTunes ********************* .. image:: https://img.shields.io/pypi/v/Mopidy-Podcast-iTunes :target: https://pypi.org/project/Mopidy-Podcast-iTunes/ :alt: Latest PyPI version .. image:: https://img.shields.io/github/actions/workflow/status/tkem/mopidy-podcast-itunes/ci.yml :target: https://github.com/tkem/mopidy-podcast-itunes/actions/workflows/ci.yml :alt: CI build status .. image:: https://img.shields.io/readthedocs/mopidy-podcast-itunes :target: https://mopidy-podcast-itunes.readthedocs.io/ :alt: Documentation build status .. image:: https://img.shields.io/codecov/c/gh/tkem/mopidy-podcast-itunes :target: https://codecov.io/gh/tkem/mopidy-podcast-itunes :alt: Test coverage .. image:: https://img.shields.io/github/license/tkem/mopidy-podcast-itunes :target: https://raw.github.com/tkem/mopidy-podcast-itunes/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-iTunes is a Mopidy_ extension for searching and browsing podcasts on `Apple Podcasts`_, using the `iTunes Search API`_. Installation ============ On Debian Linux and Debian-based distributions like Ubuntu or Raspbian, install the ``mopidy-podcast-itunes`` package from apt.mopidy.com_:: apt-get install mopidy-podcast-itunes Otherwise, install the Python package from PyPI_:: pip install Mopidy-Podcast-iTunes 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/ .. _Apple Podcasts: https://podcasts.apple.com/ .. _iTunes Search API: https://performance-partners.apple.com/search-api .. _PyPI: https://pypi.org/project/Mopidy-Podcast/ .. _apt.mopidy.com: https://apt.mopidy.com/ .. _Documentation: https://mopidy-podcast-itunes.readthedocs.io/en/latest/ .. _Source code: https://github.com/tkem/mopidy-podcast-itunes .. _Issue tracker: https://github.com/tkem/mopidy-podcast-itunes/issues .. _Change log: https://github.com/tkem/mopidy-podcast-itunes/blob/master/CHANGELOG.rst .. _Apache License, Version 2.0: https://raw.github.com/tkem/mopidy-podcast-itunes/master/LICENSE ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779665207.0 mopidy_podcast_itunes-4.0.0/src/Mopidy_Podcast_iTunes.egg-info/SOURCES.txt0000664000175100017510000000145015204704467025271 0ustar00tkemtkemCHANGELOG.rst LICENSE MANIFEST.in README.rst pyproject.toml setup.cfg setup.py tox.ini docs/conf.py docs/index.rst src/Mopidy_Podcast_iTunes.egg-info/PKG-INFO src/Mopidy_Podcast_iTunes.egg-info/SOURCES.txt src/Mopidy_Podcast_iTunes.egg-info/dependency_links.txt src/Mopidy_Podcast_iTunes.egg-info/entry_points.txt src/Mopidy_Podcast_iTunes.egg-info/not-zip-safe src/Mopidy_Podcast_iTunes.egg-info/requires.txt src/Mopidy_Podcast_iTunes.egg-info/top_level.txt src/mopidy_podcast_itunes/__init__.py src/mopidy_podcast_itunes/backend.py src/mopidy_podcast_itunes/client.py src/mopidy_podcast_itunes/ext.conf src/mopidy_podcast_itunes/library.py src/mopidy_podcast_itunes/translator.py tests/__init__.py tests/conftest.py tests/test_browse.py tests/test_extension.py tests/test_search.py tests/test_translator.py././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779665207.0 mopidy_podcast_itunes-4.0.0/src/Mopidy_Podcast_iTunes.egg-info/dependency_links.txt0000664000175100017510000000000115204704467027453 0ustar00tkemtkem ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779665207.0 mopidy_podcast_itunes-4.0.0/src/Mopidy_Podcast_iTunes.egg-info/entry_points.txt0000664000175100017510000000007615204704467026706 0ustar00tkemtkem[mopidy.ext] podcast-itunes = mopidy_podcast_itunes:Extension ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1775417792.0 mopidy_podcast_itunes-4.0.0/src/Mopidy_Podcast_iTunes.egg-info/not-zip-safe0000664000175100017510000000000115164534700025627 0ustar00tkemtkem ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779665207.0 mopidy_podcast_itunes-4.0.0/src/Mopidy_Podcast_iTunes.egg-info/requires.txt0000664000175100017510000000007615204704467026010 0ustar00tkemtkemmopidy>=4.0.0 mopidy-podcast>=4.0.0 pykka>=4.1 requests>=2.32 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779665207.0 mopidy_podcast_itunes-4.0.0/src/Mopidy_Podcast_iTunes.egg-info/top_level.txt0000664000175100017510000000002615204704467026135 0ustar00tkemtkemmopidy_podcast_itunes ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1779665207.5747259 mopidy_podcast_itunes-4.0.0/src/mopidy_podcast_itunes/0000775000175100017510000000000015204704470022045 5ustar00tkemtkem././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779665060.0 mopidy_podcast_itunes-4.0.0/src/mopidy_podcast_itunes/__init__.py0000664000175100017510000001004215204704244024152 0ustar00tkemtkemimport pathlib from mopidy import config, ext, httpclient __version__ = "4.0.0" COUNTRIES = [ "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW", ] EXPLICIT = ("Yes", "No") # since config.Boolean has no "optional" MAX_LIMIT = 200 # absolute limit specified by iTunes Store API class Extension(ext.Extension): dist_name = "Mopidy-Podcast-iTunes" ext_name = "podcast-itunes" 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.update( base_url=config.String(), country=config.String(choices=COUNTRIES), explicit=config.String(choices=EXPLICIT, optional=True), charts_limit=config.Integer(minimum=1, maximum=MAX_LIMIT, optional=True), search_limit=config.Integer(minimum=1, maximum=MAX_LIMIT, optional=True), timeout=config.Integer(minimum=1, optional=True), retries=config.Integer(minimum=0), ) return schema def setup(self, registry): from .backend import iTunesPodcastBackend registry.add("backend", iTunesPodcastBackend) @classmethod def get_requests_session(cls, config): import requests proxy = httpclient.format_proxy(config["proxy"]) user_agent_string = f"{cls.dist_name}/{cls.version}" user_agent = httpclient.format_user_agent(user_agent_string) session = requests.Session() session.proxies.update({"http": proxy, "https": proxy}) session.headers.update({"user-agent": user_agent}) return session ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779665060.0 mopidy_podcast_itunes-4.0.0/src/mopidy_podcast_itunes/backend.py0000664000175100017510000000064515204704244024012 0ustar00tkemtkemfrom mopidy import backend import pykka from .client import iTunesPodcastClient from .library import iTunesPodcastLibraryProvider class iTunesPodcastBackend(pykka.ThreadingActor, backend.Backend): uri_schemes = ["podcast+itunes"] def __init__(self, config, audio): super().__init__() self.client = iTunesPodcastClient(config) self.library = iTunesPodcastLibraryProvider(config, self) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1776369170.0 mopidy_podcast_itunes-4.0.0/src/mopidy_podcast_itunes/client.py0000664000175100017510000001207715170237022023700 0ustar00tkemtkemimport json import logging from functools import reduce from urllib.error import HTTPError from urllib.parse import urljoin from . import Extension BASE_URL = "https://itunes.apple.com/" GENRES_PATH = "/WebObjects/MZStoreServices.woa/ws/genres" CHARTS_PATH = "/%s/rss/toppodcasts/limit=%d/genre=%s/json" LOOKUP_PATH = "/lookup" SEARCH_PATH = "/search" logger = logging.getLogger(__name__) def genres(result, g): result.update(reduce(genres, g.get("subgenres", {}).values(), {})) result[g["id"]] = g return result def http_adapter(config): import requests return requests.adapters.HTTPAdapter( max_retries=config[Extension.ext_name]["retries"] ) class iTunesPodcastClient: def __init__(self, config): self.__base_url = config[Extension.ext_name]["base_url"] self.__country = config[Extension.ext_name]["country"] self.__timeout = config[Extension.ext_name]["timeout"] self.__session = Extension.get_requests_session(config) self.__session.mount(self.__base_url, http_adapter(config)) self.__genres = {} def charts(self, genre_id, limit=None): # for now, ignore self.__genres[genre_id]["rssUrls"] et al., # since they do not seem to work well without expolicitly # specifying "limit" path = CHARTS_PATH % (self.__country, limit or 20, genre_id) charts = self.__request(urljoin(self.__base_url, path)) # chart entries apparently lack the actual feed URL, so we # have to call "lookup" for all entry IDs entries = charts.get("feed", {}).get("entry", []) ids = [e.get("id", {}).get("attributes", {}).get("im:id") for e in entries] result = self.__request( urljoin(self.__base_url, LOOKUP_PATH), params={"id": ",".join(filter(None, ids))}, ) return result.get("results", []) def genre(self, genre_id): if genre_id not in self.__genres: g = self.__request( urljoin(self.__base_url, GENRES_PATH), params={"id": genre_id, "cc": self.__country}, ) # TODO: ignore values except for subgenres, see comments above self.__genres.update(reduce(genres, g.values(), {})) return self.__genres[genre_id] def refresh(self): # pragma: no cover self.__genres = {} def search( self, term, media=None, entity=None, attribute=None, limit=None, explicit=None, genre_id=None, ): params = { "term": term, "country": self.__country, "media": media, "entity": entity, "attribute": attribute, "limit": limit, "explicit": (explicit.lower() if explicit else None), "genreId": genre_id, # undocumented, and not really working as expected } try: res = self.__request(urljoin(self.__base_url, SEARCH_PATH), params=params) return res.get("results", []) except HTTPError as e: logger.error("Error searching for %s: %s", term, e) return [] def __request(self, url, **kwargs): response = self.__session.get(url, timeout=self.__timeout, **kwargs) response.raise_for_status() logger.debug("Retrieving %s took %s", response.url, response.elapsed) return response.json() if __name__ == "__main__": # pragma: no cover import argparse import logging import sys parser = argparse.ArgumentParser() parser.add_argument("arg", metavar="SEARCH-TERM | GENRE-ID", nargs="?") parser.add_argument("-B", "--base-url", default=BASE_URL) parser.add_argument("-a", "--attribute") parser.add_argument("-c", "--country", default="US") parser.add_argument("-e", "--entity") parser.add_argument("-g", "--genre-id") parser.add_argument("-i", "--indent", type=int) parser.add_argument("-l", "--limit", type=int) parser.add_argument("-m", "--media") parser.add_argument("-r", "--retries", type=int, default=0) parser.add_argument("-t", "--timeout", type=float) parser.add_argument("-v", "--verbose", action="store_true") parser.add_argument("-x", "--explicit") args = parser.parse_args() logging.basicConfig(level=logging.DEBUG if args.verbose else logging.WARN) client = iTunesPodcastClient( { Extension.ext_name: { "base_url": args.base_url, "country": args.country, "timeout": args.timeout, "retries": args.retries, }, "proxy": {}, } ) if not args.arg: result = client.genre(args.genre_id or "26") elif args.arg.isdigit(): result = client.charts(args.arg, args.limit) else: result = client.search( args.arg, args.media, args.entity, args.attribute, args.limit, args.explicit, args.genre_id, ) json.dump(result, sys.stdout, indent=args.indent, sort_keys=True) sys.stdout.write("\n") ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1775597613.0 mopidy_podcast_itunes-4.0.0/src/mopidy_podcast_itunes/ext.conf0000664000175100017510000000115515165274055023525 0ustar00tkemtkem[podcast-itunes] enabled = true # iTunes Search API base URL base_url = https://itunes.apple.com/ # ISO country code for the store to be used country = US # whether search results should include explicit content; possible # values are "Yes", "No", or empty for store defaults explicit = # maximum number of charts entries to retrieve, or empty for store # defaults; maximum is 200 charts_limit = 20 # maximum number of search results to retrieve, or empty for store # defaults; maximum is 200 search_limit = 20 # HTTP request timeout in seconds timeout = 10 # maximum number of HTTP connection retries retries = 3 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1776369170.0 mopidy_podcast_itunes-4.0.0/src/mopidy_podcast_itunes/library.py0000664000175100017510000000620515170237022024062 0ustar00tkemtkemimport collections import logging from mopidy import backend, models from . import Extension, translator ROOT_GENRE_ID = "26" # "Podcasts" logger = logging.getLogger(__name__) class iTunesPodcastLibraryProvider(backend.LibraryProvider): def __init__(self, config, backend): super().__init__(backend) self.__charts_kwargs = { "limit": config[Extension.ext_name]["charts_limit"], } self.__search_kwargs = { "explicit": config[Extension.ext_name]["explicit"], "limit": config[Extension.ext_name]["search_limit"], } @property def root_directory(self): return models.Ref.directory(name="Apple Podcasts", uri="podcast+itunes:") def browse(self, uri): if uri == self.root_directory.uri: type, id = "genre", ROOT_GENRE_ID else: _, type, id = uri.split(":") if type == "charts": return self.__charts(id) elif type == "genre": return self.__genre(id) else: logger.error("Invalid browse URI: %s", uri) def refresh(self, uri=None): self.backend.client.refresh() def search(self, query=None, uris=None, exact=False): # sanitize uris - remove duplicates, root directory uris = frozenset(uris or []).difference([self.root_directory.uri]) try: kwargs = translator.query(query or {}, uris, exact) except NotImplementedError: return None # query not supported except Exception as e: logger.error("%s", e) else: kwargs.update(self.__search_kwargs) results = collections.defaultdict(list) for item in self.backend.client.search(**kwargs): try: model = translator.model(item) except Exception as e: logger.error("Error converting iTunes search result: %s %s", e, item) else: results[type(model)].append(model) return models.SearchResult( albums=results[models.Album], artists=results[models.Artist], tracks=results[models.Track], ) def __charts(self, id): refs = [] for item in self.backend.client.charts(id, **self.__charts_kwargs): try: ref = translator.ref(item) except KeyError as e: logger.debug( "Skipping iTunes charts item with missing key %s: %s", e, item ) except Exception as e: logger.error("Error converting iTunes charts item: %s %s", e, item) else: refs.append(ref) return refs def __genre(self, id): def key(g): return g["name"].lower() g = self.backend.client.genre(id) refs = [translator.directory("charts", g, "Top %s" % g["name"])] for genre in sorted(g.get("subgenres", {}).values(), key=key): if "subgenres" in genre: refs.append(translator.directory("genre", genre)) else: refs.append(translator.directory("charts", genre)) return refs ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1776369170.0 mopidy_podcast_itunes-4.0.0/src/mopidy_podcast_itunes/translator.py0000664000175100017510000000626115170237022024611 0ustar00tkemtkemfrom mopidy import models import uritools from . import Extension _MODELS = { "podcast": lambda item: models.Album( uri=uri(item["feedUrl"]), name=item.get("collectionName", item["trackName"]), artists=artists(item), date=(item.get("releaseDate", "").partition("T")[0] or None), num_tracks=item.get("trackCount"), ), "podcast-episode": lambda item: models.Track( uri=uri(item["feedUrl"], item["episodeGuid"]), name=item["trackName"], album=models.Album(uri=uri(item["feedUrl"]), name=item["collectionName"]), artists=artists(item), date=(item.get("releaseDate", "").partition("T")[0] or None), genre=item.get("primaryGenreName"), length=item.get("trackTimeMillis"), comment=item.get("description"), ), } _REFS = { "podcast": lambda item: models.Ref.album( uri=uri(item["feedUrl"]), name=item.get("collectionName", item["trackName"]), ), "podcast-episode": lambda item: models.Ref.track( uri=uri(item["feedUrl"], item["episodeGuid"]), name=item["trackName"] ), } # FIXME: 'authorTerm' and 'titleTerm' not working properly for podcastEpisode _QUERY = { "track_name": ("podcastEpisode", "titleTerm"), "any": ("podcast,podcastEpisode", None), "album": ("podcast", "titleTerm"), "albumartist": ("podcast", "authorTerm"), "artist": ("podcast,podcastEpisode", "authorTerm"), "genre": ("podcast,podcastEpisode", "genreTerm"), "comment": ("podcastEpisode", "descriptionTerm"), } _SCHEME = Extension.ext_name.replace("-", "+") def artists(item): if "artistName" in item: return frozenset([models.Artist(name=item["artistName"])]) else: return frozenset() def directory(type, g, name=None, scheme=_SCHEME): return models.Ref.directory( uri=":".join((scheme, type, g["id"])), name=(name or g["name"]) ) def model(item): try: translate = _MODELS[item["kind"]] except KeyError: raise TypeError('Unsupported result type "%s"' % item.get("kind")) else: return translate(item) def query(query, uris=tuple(), exact=False): if exact: raise NotImplementedError("Exact queries not supported") try: ((key, values),) = query.items() except ValueError: raise NotImplementedError("Multi-key queries not supported") try: entity, attribute = _QUERY[key] except KeyError: raise NotImplementedError('Search key "%s" not supported' % key) return { "term": " ".join(values), "media": "podcast", "entity": entity, "attribute": attribute, # FIXME: not working as expected... # 'genre_id': ','.join(uri.rpartition(':')[2] for uri in uris) or None } def ref(item): try: translate = _REFS[item["kind"]] except KeyError: raise ValueError('Unsupported result type "%s"' % item.get("kind")) else: return translate(item) def uri(feedurl, guid=None, safe=uritools.SUB_DELIMS + ":@/?"): uri = uritools.uridefrag("podcast+" + feedurl).uri if guid: return uri + "#" + uritools.uriencode(guid, safe=safe).decode() else: return uri ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1779665207.5750682 mopidy_podcast_itunes-4.0.0/tests/0000775000175100017510000000000015204704470016013 5ustar00tkemtkem././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1597080937.0 mopidy_podcast_itunes-4.0.0/tests/__init__.py0000644000175100017510000000000013714302551020106 0ustar00tkemtkem././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1597080937.0 mopidy_podcast_itunes-4.0.0/tests/conftest.py0000644000175100017510000000125313714302551020207 0ustar00tkemtkemfrom unittest import mock import pytest @pytest.fixture def audio(): return mock.Mock() @pytest.fixture def config(): return { "podcast-itunes": { "base_url": "http://itunes.apple.com/", "country": "US", "explicit": None, "charts": "podcasts", "charts_limit": 20, "search_limit": 20, "timeout": 10, "retries": 3, }, "proxy": {}, } @pytest.fixture def backend(config, audio): from mopidy_podcast_itunes import backend return backend.iTunesPodcastBackend(config, audio) @pytest.fixture def library(backend): return backend.library ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1775940612.0 mopidy_podcast_itunes-4.0.0/tests/test_browse.py0000664000175100017510000000663315166532004020734 0ustar00tkemtkemimport re from mopidy.models import Ref import pytest import responses @pytest.fixture def genres(): return { "26": { "name": "Podcasts", "id": "26", "subgenres": { "1000": { "name": "Foo", "id": "1000", }, "1001": { "name": "Bar", "id": "1001", "subgenres": { "1002": { "name": "Baz", "id": "1002", } }, }, }, } } @pytest.fixture def toppodcasts(): return { "feed": { "author": { "name": {"label": "iTunes Store"}, "uri": {"label": "http://www.apple.com/itunes/"}, }, "entry": [ { "id": { "attributes": {"im:id": "1234"}, }, }, { "id": { "attributes": {"im:id": "5678"}, }, }, ], } } @pytest.fixture def lookup(): return { "resultCount": 2, "results": [ { "kind": "podcast", "collectionName": "foo", "collectionId": 1234, "feedUrl": "http://example.com/1234", "trackName": "foo", "trackId": 1234, }, { "kind": "podcast", "collectionName": "bar", "collectionId": 5678, "feedUrl": "http://example.com/5678", "trackName": "bar", "trackId": 5678, }, ], } def test_root_directory(config, library): assert library.root_directory.uri == "podcast+itunes:" @responses.activate def test_browse_root(config, library, genres): responses.add(responses.GET, re.compile(r".*/genres\b.*"), json=genres) assert library.browse("podcast+itunes:") == [ Ref.directory(name="Top Podcasts", uri="podcast+itunes:charts:26"), Ref.directory(name="Bar", uri="podcast+itunes:genre:1001"), Ref.directory(name="Foo", uri="podcast+itunes:charts:1000"), ] @responses.activate def test_browse_charts(config, library, genres, toppodcasts, lookup): responses.add(responses.GET, re.compile(r".*/genres\b.*"), json=genres) responses.add(responses.GET, re.compile(r".*/toppodcasts\b.*"), json=toppodcasts) responses.add(responses.GET, re.compile(r".*/lookup\b.*"), json=lookup) assert library.browse("podcast+itunes:charts:1000") == [ Ref.album(name="foo", uri="podcast+http://example.com/1234"), Ref.album(name="bar", uri="podcast+http://example.com/5678"), ] @responses.activate def test_browse_subgenre(config, library, genres, toppodcasts, lookup): responses.add(responses.GET, re.compile(r".*/genres\b.*"), json=genres) responses.add(responses.GET, re.compile(r".*/toppodcasts\b.*"), json=toppodcasts) responses.add(responses.GET, re.compile(r".*/lookup\b.*"), json=lookup) assert library.browse("podcast+itunes:genre:1001") == [ Ref.directory(name="Top Bar", uri="podcast+itunes:charts:1001"), Ref.directory(name="Baz", uri="podcast+itunes:charts:1002"), ] ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779665060.0 mopidy_podcast_itunes-4.0.0/tests/test_extension.py0000664000175100017510000000130715204704244021440 0ustar00tkemtkemfrom unittest import mock from mopidy_podcast_itunes import Extension, backend 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 "base_url" in schema assert "country" in schema assert "explicit" in schema assert "charts_limit" in schema assert "search_limit" in schema assert "timeout" in schema assert "retries" in schema def test_setup(): registry = mock.Mock() Extension().setup(registry) registry.add.assert_called_with("backend", backend.iTunesPodcastBackend) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1775419047.0 mopidy_podcast_itunes-4.0.0/tests/test_search.py0000664000175100017510000000260015164537247020702 0ustar00tkemtkemimport re from mopidy import models import pytest import responses @pytest.fixture def results(): return { "resultCount": 3, "results": [ { "kind": "podcast", "collectionId": 1234, "collectionName": "Foo", "feedUrl": "http://example.com/feed1234", "trackId": 1234, "trackName": "Foo", }, { "kind": "podcast-episode", "collectionId": 1234, "collectionName": "Foo", "episodeGuid": "5678", "feedUrl": "http://example.com/feed1234", "trackId": 5678, "trackName": "Bar", }, {"kind": "song", "trackName": "Baz"}, ], } @responses.activate def test_search(config, library, results): responses.add(responses.GET, re.compile(r".*/search\b.*"), json=results) assert library.search({"any": ["foo"]}) == models.SearchResult( albums=[models.Album(name="Foo", uri="podcast+http://example.com/feed1234")], tracks=[ models.Track( name="Bar", uri="podcast+http://example.com/feed1234#5678", album=models.Album( name="Foo", uri="podcast+http://example.com/feed1234" ), ) ], ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1775419047.0 mopidy_podcast_itunes-4.0.0/tests/test_translator.py0000664000175100017510000001133515164537247021633 0ustar00tkemtkemfrom mopidy import models from mopidy_podcast_itunes import translator import pytest @pytest.mark.parametrize( "feedurl,guid,expected", [ ( "http://example.com/feed.xml", None, "podcast+http://example.com/feed.xml", ), ( "http://example.com/feed.xml", "1", "podcast+http://example.com/feed.xml#1", ), ], ) def test_uri(feedurl, guid, expected): assert translator.uri(feedurl, guid) == expected @pytest.mark.parametrize( "item,expected", [ ( { "kind": "podcast", "feedUrl": "http://example.com/feed", "collectionName": "bar", "trackName": "foo", }, models.Ref.album(uri="podcast+http://example.com/feed", name="bar"), ), ( { "kind": "podcast-episode", "feedUrl": "http://example.com/feed", "collectionName": "bar", "episodeGuid": "1", "trackName": "foo", }, models.Ref.track(uri="podcast+http://example.com/feed#1", name="foo"), ), ], ) def test_ref(item, expected): assert translator.ref(item) == expected @pytest.mark.parametrize( "item", [ {}, {"kind": "song", "trackName": "foo"}, ], ) def test_ref_value_error(item): with pytest.raises(ValueError): translator.ref(item) @pytest.mark.parametrize( "item", [ {"kind": "podcast", "trackName": "foo"}, {"kind": "podcast-episode", "trackId": 1234, "trackName": "foo"}, ], ) def test_ref_key_error(item): with pytest.raises(KeyError): translator.ref(item) @pytest.mark.parametrize( "item,expected", [ ( { "kind": "podcast", "feedUrl": "http://example.com/feed", "collectionName": "bar", "trackName": "foo", "artistName": "baz", "releaseDate": "1972-09-16T16:55:00Z", }, models.Album( uri="podcast+http://example.com/feed", name="bar", artists=[models.Artist(name="baz")], date="1972-09-16", ), ), ( { "kind": "podcast-episode", "feedUrl": "http://example.com/feed", "collectionName": "bar", "episodeGuid": "1", "trackName": "foo", "artistName": "baz", "primaryGenreName": "Music", "releaseDate": "1972-09-16T16:55:00Z", "trackTimeMillis": 3600, }, models.Track( uri="podcast+http://example.com/feed#1", name="foo", album=models.Album(uri="podcast+http://example.com/feed", name="bar"), artists=[models.Artist(name="baz")], date="1972-09-16", genre="Music", length=3600, ), ), ], ) def test_model(item, expected): assert translator.model(item) == expected @pytest.mark.parametrize( "item", [ {}, {"kind": "song", "trackName": "foo"}, ], ) def test_model_type_error(item): with pytest.raises(TypeError): translator.model(item) @pytest.mark.parametrize( "item", [ {"kind": "podcast", "trackName": "foo"}, {"kind": "podcast-episode", "trackName": "foo", "trackId": 12345678}, { "kind": "podcast-episode", "trackName": "foo", "collectionId": 12345678, }, ], ) def test_model_key_error(item): with pytest.raises(KeyError): translator.model(item) @pytest.mark.parametrize( "query,expected", [ ( {"any": ["foo"]}, { "term": "foo", "media": "podcast", "entity": "podcast,podcastEpisode", "attribute": None, # 'genre_id': None }, ), ( {"album": ["foo", "bar"]}, { "term": "foo bar", "media": "podcast", "entity": "podcast", "attribute": "titleTerm", # 'genre_id': None }, ), ( {"genre": ["Music"]}, { "term": "Music", "media": "podcast", "entity": "podcast,podcastEpisode", "attribute": "genreTerm", # 'genre_id': None }, ), ], ) def test_query(query, expected): assert translator.query(query) == expected ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1779665060.0 mopidy_podcast_itunes-4.0.0/tox.ini0000664000175100017510000000113615204704244016164 0ustar00tkemtkem[tox] envlist = py,docs,ruff,ruff-format [testenv] deps = pytest pytest-cov responses commands = py.test --basetemp={envtmpdir} --cov=mopidy_podcast_itunes --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 pytest commands = pyright {posargs}