././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1649020365.035797 Mopidy-Podcast-iTunes-3.0.1/0000775000175000017500000000000000000000000014301 5ustar00tkemtkem././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1649020365.0317972 Mopidy-Podcast-iTunes-3.0.1/.github/0000775000175000017500000000000000000000000015641 5ustar00tkemtkem././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1649020365.0317972 Mopidy-Podcast-iTunes-3.0.1/.github/workflows/0000775000175000017500000000000000000000000017676 5ustar00tkemtkem././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1649019876.0 Mopidy-Podcast-iTunes-3.0.1/.github/workflows/ci.yml0000664000175000017500000000330200000000000021012 0ustar00tkemtkemname: CI on: [push, pull_request] jobs: main: strategy: fail-fast: false matrix: include: - name: "Test: Python 3.7" python: "3.7" tox: py37 - name: "Test: Python 3.8" python: "3.8" tox: py38 - name: "Test: Python 3.9" python: "3.9" tox: py39 - name: "Test: Python 3.10" python: "3.10" tox: py310 coverage: true - name: "Lint: check-manifest" python: "3.10" tox: check-manifest - name: "Lint: flake8" python: "3.10" tox: flake8 - name: "Docs" python: "3.10" tox: docs name: ${{ matrix.name }} runs-on: ubuntu-20.04 container: ghcr.io/mopidy/ci:latest steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: python-version: ${{ matrix.python }} - name: Fix home dir permissions to enable pip caching run: chown -R root /github/home - name: Cache pip uses: actions/cache@v2 with: path: ~/.cache/pip key: ${{ runner.os }}-${{ matrix.python }}-${{ matrix.tox }}-pip-${{ hashFiles('setup.cfg') }}-${{ hashFiles('tox.ini') }} restore-keys: | ${{ runner.os }}-${{ matrix.python }}-${{ matrix.tox }}-pip- - run: python -m pip install pygobject tox - run: python -m tox -e ${{ matrix.tox }} if: ${{ ! matrix.coverage }} - run: python -m tox -e ${{ matrix.tox }} -- --cov-report=xml if: ${{ matrix.coverage }} - uses: codecov/codecov-action@v1 if: ${{ matrix.coverage }} ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1649019927.0 Mopidy-Podcast-iTunes-3.0.1/CHANGELOG.rst0000664000175000017500000000222100000000000016317 0ustar00tkemtkemv3.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-3.0.1/LICENSE0000644000175000017500000002367600000000000015322 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=1597080933.0 Mopidy-Podcast-iTunes-3.0.1/MANIFEST.in0000644000175000017500000000033200000000000016033 0ustar00tkemtkeminclude *.py include *.rst include LICENSE include MANIFEST.in include pyproject.toml include tox.ini recursive-include .circleci * recursive-include .github * include mopidy_*/ext.conf recursive-include tests *.py ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1649020365.035797 Mopidy-Podcast-iTunes-3.0.1/Mopidy_Podcast_iTunes.egg-info/0000775000175000017500000000000000000000000022240 5ustar00tkemtkem././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1649020364.0 Mopidy-Podcast-iTunes-3.0.1/Mopidy_Podcast_iTunes.egg-info/PKG-INFO0000664000175000017500000001003100000000000023330 0ustar00tkemtkemMetadata-Version: 2.1 Name: Mopidy-Podcast-iTunes Version: 3.0.1 Summary: Mopidy extension for searching and browsing podcasts on the Apple iTunes Store Home-page: https://github.com/tkem/mopidy-podcast-itunes Author: Thomas Kemmer Author-email: tkemmer@computer.org License: Apache License, Version 2.0 Platform: UNKNOWN Classifier: Environment :: No Input/Output (Daemon) Classifier: Intended Audience :: End Users/Desktop Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Topic :: Multimedia :: Sound/Audio :: Players Requires-Python: >=3.7 Provides-Extra: lint Provides-Extra: release Provides-Extra: test Provides-Extra: dev License-File: LICENSE ********************* 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/workflow/status/tkem/mopidy-podcast-itunes/CI :target: https://github.com/tkem/mopidy-podcast-itunes/actions :alt: CI 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 the `Apple iTunes Store `_. .. _Mopidy: http://www.mopidy.com/ 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 .. _apt.mopidy.com: http://apt.mopidy.com/ .. _PyPI: https://pypi.python.org/pypi/Mopidy-Podcast-iTunes/ Configuration ============= The following configuration values are available: - ``podcast-itunes/enabled``: Whether this extension should be enabled or not. Defaults to ``true``. - ``podcast-itunes/base_url``: The base URL for the iTunes Store. Defaults to ``http://itunes.apple.com/``. - ``podcast-itunes/country``: The ISO country code for the store to be used. Defaults to ``US``. - ``podcast-itunes/explicit``: Whether search results should include explicit content. Can be set to ``Yes``, ``No``, or left empty to use the store's default. - ``podcast-itunes/charts``: One of ``podcasts``, ``audioPodcasts`` or ``videoPodcasts``. Defaults to ``audioPodcasts``. - ``podcast-itunes/charts_limit``: The maximum number of charts entries to retrieve. Defaults to ``20``. - ``podcast-itunes/search_limit``: The maximum number of search results to retrieve. Defaults to ``20``. - ``podcast-itunes/timeout``: The HTTP request timeout in seconds when connecting to the iTunes Store. Defaults to ``10``. - ``podcast-itunes/retries``: The maximum number of HTTP connection retries when connecting to the iTunes Store. Defaults to ``3``. Project Resources ================= - `Source code `_ - `Issue tracker `_ - `Changelog `_ Credits ======= - Original author: `Thomas Kemmer `__ - Current maintainer: `Thomas Kemmer `__ - `Contributors `_ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1649020365.0 Mopidy-Podcast-iTunes-3.0.1/Mopidy_Podcast_iTunes.egg-info/SOURCES.txt0000664000175000017500000000136100000000000024125 0ustar00tkemtkemCHANGELOG.rst LICENSE MANIFEST.in README.rst pyproject.toml setup.cfg setup.py tox.ini .github/workflows/ci.yml Mopidy_Podcast_iTunes.egg-info/PKG-INFO Mopidy_Podcast_iTunes.egg-info/SOURCES.txt Mopidy_Podcast_iTunes.egg-info/dependency_links.txt Mopidy_Podcast_iTunes.egg-info/entry_points.txt Mopidy_Podcast_iTunes.egg-info/not-zip-safe Mopidy_Podcast_iTunes.egg-info/requires.txt Mopidy_Podcast_iTunes.egg-info/top_level.txt mopidy_podcast_itunes/__init__.py mopidy_podcast_itunes/backend.py mopidy_podcast_itunes/client.py mopidy_podcast_itunes/ext.conf mopidy_podcast_itunes/library.py 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=1649020364.0 Mopidy-Podcast-iTunes-3.0.1/Mopidy_Podcast_iTunes.egg-info/dependency_links.txt0000664000175000017500000000000100000000000026306 0ustar00tkemtkem ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1649020364.0 Mopidy-Podcast-iTunes-3.0.1/Mopidy_Podcast_iTunes.egg-info/entry_points.txt0000664000175000017500000000007600000000000025541 0ustar00tkemtkem[mopidy.ext] podcast-itunes = mopidy_podcast_itunes:Extension ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1649018496.0 Mopidy-Podcast-iTunes-3.0.1/Mopidy_Podcast_iTunes.egg-info/not-zip-safe0000664000175000017500000000000100000000000024466 0ustar00tkemtkem ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1649020364.0 Mopidy-Podcast-iTunes-3.0.1/Mopidy_Podcast_iTunes.egg-info/requires.txt0000664000175000017500000000056600000000000024647 0ustar00tkemtkemMopidy>=3.0.0 Mopidy-Podcast>=3.0.0 Pykka>=2.0.1 requests>=2.0 setuptools [dev] black check-manifest flake8 flake8-black flake8-bugbear flake8-import-order isort[pyproject] twine wheel pytest pytest-cov responses [lint] black check-manifest flake8 flake8-black flake8-bugbear flake8-import-order isort[pyproject] [release] twine wheel [test] pytest pytest-cov responses ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1649020364.0 Mopidy-Podcast-iTunes-3.0.1/Mopidy_Podcast_iTunes.egg-info/top_level.txt0000664000175000017500000000002600000000000024770 0ustar00tkemtkemmopidy_podcast_itunes ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1649020365.035797 Mopidy-Podcast-iTunes-3.0.1/PKG-INFO0000664000175000017500000001003100000000000015371 0ustar00tkemtkemMetadata-Version: 2.1 Name: Mopidy-Podcast-iTunes Version: 3.0.1 Summary: Mopidy extension for searching and browsing podcasts on the Apple iTunes Store Home-page: https://github.com/tkem/mopidy-podcast-itunes Author: Thomas Kemmer Author-email: tkemmer@computer.org License: Apache License, Version 2.0 Platform: UNKNOWN Classifier: Environment :: No Input/Output (Daemon) Classifier: Intended Audience :: End Users/Desktop Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Topic :: Multimedia :: Sound/Audio :: Players Requires-Python: >=3.7 Provides-Extra: lint Provides-Extra: release Provides-Extra: test Provides-Extra: dev License-File: LICENSE ********************* 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/workflow/status/tkem/mopidy-podcast-itunes/CI :target: https://github.com/tkem/mopidy-podcast-itunes/actions :alt: CI 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 the `Apple iTunes Store `_. .. _Mopidy: http://www.mopidy.com/ 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 .. _apt.mopidy.com: http://apt.mopidy.com/ .. _PyPI: https://pypi.python.org/pypi/Mopidy-Podcast-iTunes/ Configuration ============= The following configuration values are available: - ``podcast-itunes/enabled``: Whether this extension should be enabled or not. Defaults to ``true``. - ``podcast-itunes/base_url``: The base URL for the iTunes Store. Defaults to ``http://itunes.apple.com/``. - ``podcast-itunes/country``: The ISO country code for the store to be used. Defaults to ``US``. - ``podcast-itunes/explicit``: Whether search results should include explicit content. Can be set to ``Yes``, ``No``, or left empty to use the store's default. - ``podcast-itunes/charts``: One of ``podcasts``, ``audioPodcasts`` or ``videoPodcasts``. Defaults to ``audioPodcasts``. - ``podcast-itunes/charts_limit``: The maximum number of charts entries to retrieve. Defaults to ``20``. - ``podcast-itunes/search_limit``: The maximum number of search results to retrieve. Defaults to ``20``. - ``podcast-itunes/timeout``: The HTTP request timeout in seconds when connecting to the iTunes Store. Defaults to ``10``. - ``podcast-itunes/retries``: The maximum number of HTTP connection retries when connecting to the iTunes Store. Defaults to ``3``. Project Resources ================= - `Source code `_ - `Issue tracker `_ - `Changelog `_ Credits ======= - Original author: `Thomas Kemmer `__ - Current maintainer: `Thomas Kemmer `__ - `Contributors `_ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1649019876.0 Mopidy-Podcast-iTunes-3.0.1/README.rst0000664000175000017500000000611100000000000015767 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/workflow/status/tkem/mopidy-podcast-itunes/CI :target: https://github.com/tkem/mopidy-podcast-itunes/actions :alt: CI 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 the `Apple iTunes Store `_. .. _Mopidy: http://www.mopidy.com/ 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 .. _apt.mopidy.com: http://apt.mopidy.com/ .. _PyPI: https://pypi.python.org/pypi/Mopidy-Podcast-iTunes/ Configuration ============= The following configuration values are available: - ``podcast-itunes/enabled``: Whether this extension should be enabled or not. Defaults to ``true``. - ``podcast-itunes/base_url``: The base URL for the iTunes Store. Defaults to ``http://itunes.apple.com/``. - ``podcast-itunes/country``: The ISO country code for the store to be used. Defaults to ``US``. - ``podcast-itunes/explicit``: Whether search results should include explicit content. Can be set to ``Yes``, ``No``, or left empty to use the store's default. - ``podcast-itunes/charts``: One of ``podcasts``, ``audioPodcasts`` or ``videoPodcasts``. Defaults to ``audioPodcasts``. - ``podcast-itunes/charts_limit``: The maximum number of charts entries to retrieve. Defaults to ``20``. - ``podcast-itunes/search_limit``: The maximum number of search results to retrieve. Defaults to ``20``. - ``podcast-itunes/timeout``: The HTTP request timeout in seconds when connecting to the iTunes Store. Defaults to ``10``. - ``podcast-itunes/retries``: The maximum number of HTTP connection retries when connecting to the iTunes Store. Defaults to ``3``. Project Resources ================= - `Source code `_ - `Issue tracker `_ - `Changelog `_ Credits ======= - Original author: `Thomas Kemmer `__ - Current maintainer: `Thomas Kemmer `__ - `Contributors `_ ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1649020365.035797 Mopidy-Podcast-iTunes-3.0.1/mopidy_podcast_itunes/0000775000175000017500000000000000000000000020706 5ustar00tkemtkem././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1597080937.0 Mopidy-Podcast-iTunes-3.0.1/mopidy_podcast_itunes/__init__.py0000644000175000017500000001110500000000000023013 0ustar00tkemtkemimport pathlib import pkg_resources from mopidy import config, ext, httpclient __version__ = pkg_resources.get_distribution("Mopidy-Podcast").version CHARTS = ["podcasts", "audioPodcasts", "videoPodcasts"] 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=config.String(choices=CHARTS), 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), # no longer used charts_format=config.Deprecated(), episode_format=config.Deprecated(), genre_format=config.Deprecated(), podcast_format=config.Deprecated(), root_genre_id=config.Deprecated(), root_name=config.Deprecated(), ) 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=1597080937.0 Mopidy-Podcast-iTunes-3.0.1/mopidy_podcast_itunes/backend.py0000644000175000017500000000064500000000000022652 0ustar00tkemtkemimport pykka from mopidy import backend 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=1597080937.0 Mopidy-Podcast-iTunes-3.0.1/mopidy_podcast_itunes/client.py0000644000175000017500000001125600000000000022541 0ustar00tkemtkemimport logging from functools import reduce from urllib.parse import urljoin from . import Extension BASE_URL = "http://itunes.apple.com/" GENRES_PATH = "/WebObjects/MZStoreServices.woa/ws/genres" 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, name, limit=None): g = self.genre(genre_id) try: url = g["chartUrls"][name] except KeyError: raise LookupError(f"No {name} charts for genreId {genre_id}") ids = self.__request(url, params={"limit": limit}).get("resultIds", []) result = self.__request( urljoin(self.__base_url, LOOKUP_PATH), params={"id": ",".join(map(str, 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}, ) self.__genres.update(reduce(genres, g.values(), {})) return self.__genres[genre_id] def refresh(self): self.__genres = {} def search( self, term, media=None, entity=None, attribute=None, limit=None, explicit=None, genre_id=None, ): result = self.__request( urljoin(self.__base_url, SEARCH_PATH), params={ "term": term, "country": self.__country, "media": media, "entity": entity, "attribute": attribute, "limit": limit, # apparently only lowercase will work, contrary to iTunes specs "explicit": (explicit.lower() if explicit else None), # undocumented, and apparently not really working as expected "genreId": genre_id, }, ) return result.get("results", []) 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 json import sys parser = argparse.ArgumentParser() parser.add_argument("arg", metavar="TERM | CHARTS", 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 in ("podcasts", "audioPodcasts", "videoPodcasts"): result = client.charts(args.genre_id or "26", 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=1597080937.0 Mopidy-Podcast-iTunes-3.0.1/mopidy_podcast_itunes/ext.conf0000644000175000017500000000134300000000000022354 0ustar00tkemtkem[podcast-itunes] enabled = true # iTunes Store base URL base_url = http://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 = # charts type used for browsing; possible values are "podcasts", # "audioPodcasts", "videoPodcasts" charts = audioPodcasts # 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=1649019876.0 Mopidy-Podcast-iTunes-3.0.1/mopidy_podcast_itunes/library.py0000664000175000017500000000604600000000000022732 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 = { "name": config[Extension.ext_name]["charts"], "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="iTunes Store: 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", e) 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 Exception as e: logger.error("Error converting iTunes charts item: %s", e) 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=1597080937.0 Mopidy-Podcast-iTunes-3.0.1/mopidy_podcast_itunes/translator.py0000644000175000017500000000626400000000000023457 0ustar00tkemtkemimport uritools from mopidy import models 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 [models.Artist(name=item["artistName"])] else: return None 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 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1597080933.0 Mopidy-Podcast-iTunes-3.0.1/pyproject.toml0000644000175000017500000000052600000000000017216 0ustar00tkemtkem[build-system] requires = ["setuptools >= 30.3.0", "wheel"] [tool.black] target-version = ["py37", "py38"] line-length = 80 [tool.isort] multi_line_output = 3 include_trailing_comma = true force_grid_wrap = 0 use_parentheses = true line_length = 88 known_tests = "tests" sections = "FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,TESTS,LOCALFOLDER" ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1649020365.035797 Mopidy-Podcast-iTunes-3.0.1/setup.cfg0000664000175000017500000000304600000000000016125 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-3.0.1/setup.py0000644000175000017500000000004600000000000016011 0ustar00tkemtkemfrom setuptools import setup setup() ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1649020365.035797 Mopidy-Podcast-iTunes-3.0.1/tests/0000775000175000017500000000000000000000000015443 5ustar00tkemtkem././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1597080937.0 Mopidy-Podcast-iTunes-3.0.1/tests/__init__.py0000644000175000017500000000000000000000000017540 0ustar00tkemtkem././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1597080937.0 Mopidy-Podcast-iTunes-3.0.1/tests/conftest.py0000644000175000017500000000125300000000000017641 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=1597080937.0 Mopidy-Podcast-iTunes-3.0.1/tests/test_browse.py0000644000175000017500000000671200000000000020361 0ustar00tkemtkemimport re from urllib.parse import urljoin from mopidy.models import Ref import pytest import responses from mopidy_podcast_itunes import Extension @pytest.fixture def charts_url(config): return urljoin(config[Extension.ext_name]["base_url"], "/charts") @pytest.fixture def genres(charts_url): return { "26": { "name": "Podcasts", "id": "26", "chartUrls": {"podcasts": urljoin(charts_url, "?g=26")}, "subgenres": { "1000": { "name": "Foo", "id": "1000", "chartUrls": {"podcasts": urljoin(charts_url, "?g=1000")}, }, "1001": { "name": "Bar", "id": "1001", "chartUrls": {"podcasts": urljoin(charts_url, "?g=1001")}, "subgenres": { "1002": { "name": "Baz", "id": "1002", "chartUrls": { "podcasts": urljoin(charts_url, "?g=1002") }, } }, }, }, } } @pytest.fixture def charts(): return {"resultIds": [1234, 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, charts, lookup): responses.add(responses.GET, re.compile(r".*/genres\b.*"), json=genres) responses.add(responses.GET, re.compile(r".*/charts\b.*"), json=charts) 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, charts, lookup): responses.add(responses.GET, re.compile(r".*/genres\b.*"), json=genres) responses.add(responses.GET, re.compile(r".*/charts\b.*"), json=charts) 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=1597080937.0 Mopidy-Podcast-iTunes-3.0.1/tests/test_extension.py0000644000175000017500000000134500000000000021071 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" 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=1597080937.0 Mopidy-Podcast-iTunes-3.0.1/tests/test_search.py0000644000175000017500000000262500000000000020324 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=1597080937.0 Mopidy-Podcast-iTunes-3.0.1/tests/test_translator.py0000644000175000017500000001110400000000000021240 0ustar00tkemtkemfrom mopidy import models import pytest from mopidy_podcast_itunes import translator @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"}, {"kind": "podcast", "trackName": "foo"}, {"kind": "podcast-episode", "trackId": 1234, "trackName": "foo"}, ], ) def test_ref_error(item): # TODO: raise ValueError for all of these with pytest.raises(Exception): 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"}, {"kind": "podcast", "trackName": "foo"}, {"kind": "podcast-episode", "trackName": "foo", "trackId": 12345678}, { "kind": "podcast-episode", "trackName": "foo", "collectionId": 12345678, }, ], ) def test_model_error(item): # TODO: raise ValueError for all of these with pytest.raises(Exception): 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=1649019876.0 Mopidy-Podcast-iTunes-3.0.1/tox.ini0000664000175000017500000000065600000000000015623 0ustar00tkemtkem[tox] envlist = py37, py38, py39, py310, check-manifest, docs, flake8 [testenv] sitepackages = true deps = .[test] commands = python -m pytest \ --basetemp={envtmpdir} \ --cov=mopidy_podcast_itunes --cov-report=term-missing \ {posargs} [testenv:check-manifest] deps = .[lint] commands = python -m check_manifest [testenv:flake8] deps = .[lint] commands = python -m flake8 --show-source --statistics