Mopidy-Podcast-iTunes-2.0.0/0000775000175000017500000000000012674567321016763 5ustar tkemmertkemmer00000000000000Mopidy-Podcast-iTunes-2.0.0/setup.cfg0000664000175000017500000000024712674567321020607 0ustar tkemmertkemmer00000000000000[flake8] application-import-names = mopidy_podcast_itunes,tests exclude = .git,.tox [wheel] universal = 1 [egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 Mopidy-Podcast-iTunes-2.0.0/Mopidy_Podcast_iTunes.egg-info/0000775000175000017500000000000012674567321024722 5ustar tkemmertkemmer00000000000000Mopidy-Podcast-iTunes-2.0.0/Mopidy_Podcast_iTunes.egg-info/dependency_links.txt0000644000175000017500000000000112674567321030766 0ustar tkemmertkemmer00000000000000 Mopidy-Podcast-iTunes-2.0.0/Mopidy_Podcast_iTunes.egg-info/entry_points.txt0000644000175000017500000000007712674567321030222 0ustar tkemmertkemmer00000000000000[mopidy.ext] podcast-itunes = mopidy_podcast_itunes:Extension Mopidy-Podcast-iTunes-2.0.0/Mopidy_Podcast_iTunes.egg-info/SOURCES.txt0000644000175000017500000000130712674567321026605 0ustar tkemmertkemmer00000000000000CHANGES.rst LICENSE MANIFEST.in README.rst setup.cfg setup.py tox.ini 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.pyMopidy-Podcast-iTunes-2.0.0/Mopidy_Podcast_iTunes.egg-info/requires.txt0000644000175000017500000000011312674567321027313 0ustar tkemmertkemmer00000000000000setuptools Mopidy >= 1.1 Mopidy-Podcast >= 2.0 Pykka >= 1.1 requests >= 2.0Mopidy-Podcast-iTunes-2.0.0/Mopidy_Podcast_iTunes.egg-info/not-zip-safe0000644000175000017500000000000112660310213027123 0ustar tkemmertkemmer00000000000000 Mopidy-Podcast-iTunes-2.0.0/Mopidy_Podcast_iTunes.egg-info/top_level.txt0000644000175000017500000000002612674567321027450 0ustar tkemmertkemmer00000000000000mopidy_podcast_itunes Mopidy-Podcast-iTunes-2.0.0/Mopidy_Podcast_iTunes.egg-info/PKG-INFO0000644000175000017500000001124312674567321026016 0ustar tkemmertkemmer00000000000000Metadata-Version: 1.1 Name: Mopidy-Podcast-iTunes Version: 2.0.0 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 Description: Mopidy-Podcast-iTunes ======================================================================== Mopidy-Podcast-iTunes is a Mopidy_ extension for searching and browsing podcasts on the `Apple iTunes Store `_. 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 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 ------------------------------------------------------------------------ .. image:: https://img.shields.io/pypi/v/Mopidy-Podcast-iTunes.svg?style=flat :target: https://pypi.python.org/pypi/Mopidy-Podcast-iTunes/ :alt: Latest PyPI version .. image:: https://img.shields.io/pypi/dm/Mopidy-Podcast-iTunes.svg?style=flat :target: https://pypi.python.org/pypi/Mopidy-Podcast-iTunes/ :alt: Number of PyPI downloads .. image:: https://img.shields.io/travis/tkem/mopidy-podcast-itunes/master.svg?style=flat :target: https://travis-ci.org/tkem/mopidy-podcast-itunes :alt: Travis CI build status .. image:: https://img.shields.io/coveralls/tkem/mopidy-podcast-itunes/master.svg?style=flat :target: https://coveralls.io/r/tkem/mopidy-podcast-itunes?branch=master :alt: Test coverage - `Issue Tracker`_ - `Source Code`_ - `Change Log`_ License ------------------------------------------------------------------------ Copyright (c) 2014-2016 Thomas Kemmer. Licensed under the `Apache License, Version 2.0`_. .. _Mopidy: http://www.mopidy.com/ .. _apt.mopidy.com: http://apt.mopidy.com/ .. _PyPI: https://pypi.python.org/pypi/Mopidy-Podcast-iTunes/ .. _Issue Tracker: https://github.com/tkem/mopidy-podcast-itunes/issues/ .. _Source Code: https://github.com/tkem/mopidy-podcast-itunes/ .. _Change Log: https://github.com/tkem/mopidy-podcast-itunes/blob/master/CHANGES.rst .. _Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-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 :: 2 Classifier: Topic :: Multimedia :: Sound/Audio :: Players Mopidy-Podcast-iTunes-2.0.0/README.rst0000664000175000017500000000641412674565111020452 0ustar tkemmertkemmer00000000000000Mopidy-Podcast-iTunes ======================================================================== Mopidy-Podcast-iTunes is a Mopidy_ extension for searching and browsing podcasts on the `Apple iTunes Store `_. 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 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 ------------------------------------------------------------------------ .. image:: https://img.shields.io/pypi/v/Mopidy-Podcast-iTunes.svg?style=flat :target: https://pypi.python.org/pypi/Mopidy-Podcast-iTunes/ :alt: Latest PyPI version .. image:: https://img.shields.io/pypi/dm/Mopidy-Podcast-iTunes.svg?style=flat :target: https://pypi.python.org/pypi/Mopidy-Podcast-iTunes/ :alt: Number of PyPI downloads .. image:: https://img.shields.io/travis/tkem/mopidy-podcast-itunes/master.svg?style=flat :target: https://travis-ci.org/tkem/mopidy-podcast-itunes :alt: Travis CI build status .. image:: https://img.shields.io/coveralls/tkem/mopidy-podcast-itunes/master.svg?style=flat :target: https://coveralls.io/r/tkem/mopidy-podcast-itunes?branch=master :alt: Test coverage - `Issue Tracker`_ - `Source Code`_ - `Change Log`_ License ------------------------------------------------------------------------ Copyright (c) 2014-2016 Thomas Kemmer. Licensed under the `Apache License, Version 2.0`_. .. _Mopidy: http://www.mopidy.com/ .. _apt.mopidy.com: http://apt.mopidy.com/ .. _PyPI: https://pypi.python.org/pypi/Mopidy-Podcast-iTunes/ .. _Issue Tracker: https://github.com/tkem/mopidy-podcast-itunes/issues/ .. _Source Code: https://github.com/tkem/mopidy-podcast-itunes/ .. _Change Log: https://github.com/tkem/mopidy-podcast-itunes/blob/master/CHANGES.rst .. _Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 Mopidy-Podcast-iTunes-2.0.0/tox.ini0000664000175000017500000000070712674565111020275 0ustar tkemmertkemmer00000000000000[tox] envlist = py27, flake8, check-manifest [testenv] sitepackages = true deps = mock pytest pytest-cov pytest-xdist responses commands = py.test --basetemp={envtmpdir} --cov=mopidy_podcast_itunes --cov-report=term-missing {posargs} [testenv:flake8] deps = flake8 flake8-import-order skip_install = true commands = flake8 [testenv:check-manifest] deps = check-manifest skip_install = true commands = check-manifest Mopidy-Podcast-iTunes-2.0.0/MANIFEST.in0000664000175000017500000000024012674565111020510 0ustar tkemmertkemmer00000000000000include CHANGES.rst include LICENSE include MANIFEST.in include README.rst include mopidy_podcast_itunes/ext.conf include tox.ini recursive-include tests *.py Mopidy-Podcast-iTunes-2.0.0/setup.py0000664000175000017500000000265612674565111020501 0ustar tkemmertkemmer00000000000000from __future__ import unicode_literals from setuptools import find_packages, setup def get_version(filename): from re import findall with open(filename) as f: metadata = dict(findall("__([a-z]+)__ = '([^']+)'", f.read())) return metadata['version'] setup( name='Mopidy-Podcast-iTunes', version=get_version('mopidy_podcast_itunes/__init__.py'), url='https://github.com/tkem/mopidy-podcast-itunes', license='Apache License, Version 2.0', author='Thomas Kemmer', author_email='tkemmer@computer.org', description=( 'Mopidy extension for searching and browsing podcasts ' 'on the Apple iTunes Store' ), long_description=open('README.rst').read(), packages=find_packages(exclude=['tests', 'tests.*']), zip_safe=False, include_package_data=True, install_requires=[ 'setuptools', 'Mopidy >= 1.1', 'Mopidy-Podcast >= 2.0', 'Pykka >= 1.1', 'requests >= 2.0' ], entry_points={ 'mopidy.ext': [ 'podcast-itunes = mopidy_podcast_itunes:Extension', ], }, classifiers=[ 'Environment :: No Input/Output (Daemon)', 'Intended Audience :: End Users/Desktop', 'License :: OSI Approved :: Apache Software License', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2', 'Topic :: Multimedia :: Sound/Audio :: Players', ], ) Mopidy-Podcast-iTunes-2.0.0/LICENSE0000644000175000017500000002367612660304050017763 0ustar tkemmertkemmer00000000000000 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 Mopidy-Podcast-iTunes-2.0.0/PKG-INFO0000664000175000017500000001124312674567321020061 0ustar tkemmertkemmer00000000000000Metadata-Version: 1.1 Name: Mopidy-Podcast-iTunes Version: 2.0.0 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 Description: Mopidy-Podcast-iTunes ======================================================================== Mopidy-Podcast-iTunes is a Mopidy_ extension for searching and browsing podcasts on the `Apple iTunes Store `_. 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 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 ------------------------------------------------------------------------ .. image:: https://img.shields.io/pypi/v/Mopidy-Podcast-iTunes.svg?style=flat :target: https://pypi.python.org/pypi/Mopidy-Podcast-iTunes/ :alt: Latest PyPI version .. image:: https://img.shields.io/pypi/dm/Mopidy-Podcast-iTunes.svg?style=flat :target: https://pypi.python.org/pypi/Mopidy-Podcast-iTunes/ :alt: Number of PyPI downloads .. image:: https://img.shields.io/travis/tkem/mopidy-podcast-itunes/master.svg?style=flat :target: https://travis-ci.org/tkem/mopidy-podcast-itunes :alt: Travis CI build status .. image:: https://img.shields.io/coveralls/tkem/mopidy-podcast-itunes/master.svg?style=flat :target: https://coveralls.io/r/tkem/mopidy-podcast-itunes?branch=master :alt: Test coverage - `Issue Tracker`_ - `Source Code`_ - `Change Log`_ License ------------------------------------------------------------------------ Copyright (c) 2014-2016 Thomas Kemmer. Licensed under the `Apache License, Version 2.0`_. .. _Mopidy: http://www.mopidy.com/ .. _apt.mopidy.com: http://apt.mopidy.com/ .. _PyPI: https://pypi.python.org/pypi/Mopidy-Podcast-iTunes/ .. _Issue Tracker: https://github.com/tkem/mopidy-podcast-itunes/issues/ .. _Source Code: https://github.com/tkem/mopidy-podcast-itunes/ .. _Change Log: https://github.com/tkem/mopidy-podcast-itunes/blob/master/CHANGES.rst .. _Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-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 :: 2 Classifier: Topic :: Multimedia :: Sound/Audio :: Players Mopidy-Podcast-iTunes-2.0.0/CHANGES.rst0000664000175000017500000000151412674565111020561 0ustar tkemmertkemmer00000000000000v2.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. Mopidy-Podcast-iTunes-2.0.0/mopidy_podcast_itunes/0000775000175000017500000000000012674567321023370 5ustar tkemmertkemmer00000000000000Mopidy-Podcast-iTunes-2.0.0/mopidy_podcast_itunes/backend.py0000664000175000017500000000075112674565111025327 0ustar tkemmertkemmer00000000000000from __future__ import unicode_literals from 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(iTunesPodcastBackend, self).__init__() self.client = iTunesPodcastClient(config) self.library = iTunesPodcastLibraryProvider(config, self) Mopidy-Podcast-iTunes-2.0.0/mopidy_podcast_itunes/client.py0000664000175000017500000001070212674566763025231 0ustar tkemmertkemmer00000000000000from __future__ import unicode_literals import logging from urlparse 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(object): 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('No %s charts for genreId %s' % (name, 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') Mopidy-Podcast-iTunes-2.0.0/mopidy_podcast_itunes/ext.conf0000664000175000017500000000134312674565111025033 0ustar tkemmertkemmer00000000000000[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 Mopidy-Podcast-iTunes-2.0.0/mopidy_podcast_itunes/translator.py0000664000175000017500000000631212674565111026130 0ustar tkemmertkemmer00000000000000from __future__ import unicode_literals from 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') } def artists(item): if 'artistName' in item: return [models.Artist(name=item['artistName'])] else: return None def directory(type, g, name=None, scheme=Extension.ext_name.replace('-', '+')): 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=[], 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+b':@/?'): uri = uritools.uridefrag('podcast+' + feedurl).uri if guid: return uri + '#' + uritools.uriencode(guid, safe=safe) else: return uri Mopidy-Podcast-iTunes-2.0.0/mopidy_podcast_itunes/library.py0000664000175000017500000000614712674565111025411 0ustar tkemmertkemmer00000000000000from __future__ import unicode_literals import 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(iTunesPodcastLibraryProvider, self).__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 as e: 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, key=lambda g: 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 Mopidy-Podcast-iTunes-2.0.0/mopidy_podcast_itunes/__init__.py0000664000175000017500000000727512674565111025507 0ustar tkemmertkemmer00000000000000from __future__ import unicode_literals import os from mopidy import config, ext, httpclient __version__ = '2.0.0' 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(os.path.join(os.path.dirname(__file__), 'ext.conf')) def get_config_schema(self): schema = super(Extension, self).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 = '%s/%s' % (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 Mopidy-Podcast-iTunes-2.0.0/tests/0000775000175000017500000000000012674567321020125 5ustar tkemmertkemmer00000000000000Mopidy-Podcast-iTunes-2.0.0/tests/conftest.py0000664000175000017500000000130312674565111022314 0ustar tkemmertkemmer00000000000000from __future__ import unicode_literals 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 Mopidy-Podcast-iTunes-2.0.0/tests/test_search.py0000664000175000017500000000277312674565111023007 0ustar tkemmertkemmer00000000000000from __future__ import unicode_literals import 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' ) ) ] ) Mopidy-Podcast-iTunes-2.0.0/tests/test_extension.py0000664000175000017500000000140012674565111023540 0ustar tkemmertkemmer00000000000000from __future__ import unicode_literals 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) Mopidy-Podcast-iTunes-2.0.0/tests/test_translator.py0000664000175000017500000000774212674565111023734 0ustar tkemmertkemmer00000000000000from __future__ import unicode_literals from 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 Mopidy-Podcast-iTunes-2.0.0/tests/test_browse.py0000664000175000017500000000715612674565111023043 0ustar tkemmertkemmer00000000000000from __future__ import unicode_literals import re from urlparse 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') ] Mopidy-Podcast-iTunes-2.0.0/tests/__init__.py0000644000175000017500000000000012660304050022201 0ustar tkemmertkemmer00000000000000