Mopidy-TuneIn-0.4.1/0000775000175000017500000000000012730101757014054 5ustar nicknick00000000000000Mopidy-TuneIn-0.4.1/tox.ini0000664000175000017500000000047012711237274015373 0ustar nicknick00000000000000[tox] envlist = py27, flake8 [testenv] sitepackages = true deps = coverage mock nose commands = nosetests -v --with-xunit --xunit-file=xunit-{envname}.xml --with-coverage --cover-package=mopidy_tunein [testenv:flake8] deps = flake8 flake8-import-order skip_install = true commands = flake8 Mopidy-TuneIn-0.4.1/.coveragerc0000664000175000017500000000011512711237274016175 0ustar nicknick00000000000000[report] omit = */pyshared/* */python?.?/* */site-packages/nose/*Mopidy-TuneIn-0.4.1/.travis.yml0000664000175000017500000000054512711237274016174 0ustar nicknick00000000000000sudo: false language: python python: - "2.7_with_system_site_packages" addons: apt: sources: - mopidy-stable packages: - mopidy env: - TOX_ENV=py27 - TOX_ENV=flake8 install: - "pip install tox" script: - "tox -e $TOX_ENV" after_success: - "if [ $TOX_ENV == 'py27' ]; then pip install --pre coveralls; coveralls; fi" Mopidy-TuneIn-0.4.1/MANIFEST.in0000664000175000017500000000025412711237274015616 0ustar nicknick00000000000000include .coveragerc include .travis.yml include LICENSE include MANIFEST.in include README.rst include mopidy_tunein/ext.conf include tox.ini recursive-include tests *.py Mopidy-TuneIn-0.4.1/LICENSE0000664000175000017500000002613512711237274015073 0ustar nicknick00000000000000 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 APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.Mopidy-TuneIn-0.4.1/README.rst0000664000175000017500000001056212730101732015540 0ustar nicknick00000000000000**************************** Mopidy-TuneIn **************************** .. image:: https://img.shields.io/pypi/v/Mopidy-TuneIn.svg?style=flat :target: https://pypi.python.org/pypi/Mopidy-TuneIn/ :alt: Latest PyPI version .. image:: https://img.shields.io/pypi/dm/Mopidy-TuneIn.svg?style=flat :target: https://pypi.python.org/pypi/Mopidy-TuneIn/ :alt: Number of PyPI downloads .. image:: https://img.shields.io/travis/kingosticks/mopidy-tunein/develop.svg?style=flat :target: https://travis-ci.org/kingosticks/mopidy-tunein :alt: Travis CI build status .. image:: https://img.shields.io/coveralls/kingosticks/mopidy-tunein/develop.svg?style=flat :target: https://coveralls.io/r/kingosticks/mopidy-tunein?branch=master :alt: Test coverage `Mopidy `_ extension for playing music from `TuneIn `_. Listen to the world’s radio with 70,000 stations of music, sports and news streaming from every continent. Acknowledgement and thanks to Marius Wyss for his original version of this extension and Brian Hornsby's `XBMC plugin `_ that was based on. This product uses TuneIn but is not endorsed, certified or otherwise approved in any way by TuneIn. TuneIn is the registered trade mark of TuneIn Inc. Installation ============ Install by running:: pip install Mopidy-TuneIn .. Or, if available, install the Debian/Ubuntu package from `apt.mopidy.com .. `_. Some radio streams may require additional audio plugins. These can be found in the gstreamer plugin packages for your system. For versions of Mopidy prior to v2.0.0, these might include: * `gstreamer0.10-plugins-ugly` * `gstreamer0.10-plugins-bad` * `gstreamer0.10-ffmpeg` For Mopidy v2.0.0 and above, use the gstreamer1.0-plugins-* packages instead. Known issues ============ The following functionality is not yet implemented: * Playback of podcasts/shows. * User login and access to saved stations. Configuration ============= Before starting Mopidy, you must add configuration for Mopidy-TuneIn to your Mopidy configuration file:: [tunein] timeout = 5000 Project resources ================= - `Source code `_ - `Issue tracker `_ - `Download development snapshot `_ Changelog ========= v0.4.1 (2016-06-14) ------------------- - Port timeout fix for Mopidy's internal stream unwrapping code from mopidy/mopidy#1522 (Fixes: #31) v0.4.0 (2016-02-16) ------------------- - Borrow Mopidy's internal stream unwrapping to avoid incompatibilities with Mopidy v2.0.0 (PR: #28) - Improved handling of malformed pls playlists. v0.3.0 (2016-02-06) ------------------- - Requires Mopidy v1.1 - Respect user's Mopidy proxy configuration and set user-agent. - Utilise Mopidy's nested playlist handling (Fixes: #23 PR: #22) v0.2.2 (2015-04-24) ------------------- - Fix infinite loop when adding some stations, again (my bad). v0.2.1 (2015-04-24) ------------------- - Fix infinite loop when adding some stations. (PR: #17) v0.2 (2015-03-26) ------------------- - Fix utf-8 encoding for searches. (PR: #15) - Fixed inaccessible stream URIs identified as recursive playlist and not using the remaining stream URIs. - Update to work with new playback API in Mopidy 1.0. - Update to work with new backend search API in Mopidy 1.0. - Requires Mopidy v1.0. v0.1.3 (2014-01-22) ------------------- - Don't submit a search (and receive an error) when the query is empty. - Improved nested playlist support. - Support for 'protocol rollover' style ASX playlists. - ASF HTTP streams in ASX playlists are converted to MMS steams. - Ignore nested subtypes in content-type header field to fix #5. - Added support for a station's logo. - Include currently playing info. - Unplayable streams now correctly recognised by Mopidy and playback fails rather than continuing to play the previous track. v0.1.2 (2014-04-13) ------------------- - Improved stream selection for stations using PLS format playlists. - Added suggested additional gstreamer plugin packages. v0.1.1 (2014-02-24) ------------------- - Fixed package description typo and capitalisation inconsistency in name! v0.1.0 (2014-02-23) ------------------- - Initial release. Mopidy-TuneIn-0.4.1/mopidy_tunein/0000775000175000017500000000000012730101757016737 5ustar nicknick00000000000000Mopidy-TuneIn-0.4.1/mopidy_tunein/translator.py0000664000175000017500000000620312711237274021506 0ustar nicknick00000000000000from __future__ import unicode_literals import logging import re import urllib from mopidy.models import Album, Artist, Ref, Track logger = logging.getLogger(__name__) TUNEIN_API_ENCODING = 'utf-8' TUNEIN_ID_PROGRAM = 'program' TUNEIN_ID_STATION = 'station' TUNEIN_ID_GROUP = 'group' TUNEIN_ID_TOPIC = 'topic' TUNEIN_ID_CATEGORY = 'category' TUNEIN_ID_REGION = 'region' TUNEIN_ID_PODCAST = 'podcast_category' TUNEIN_ID_AFFILIATE = 'affiliate' TUNEIN_ID_STREAM = 'stream' TUNEIN_ID_UNKNOWN = 'unknown' def unparse_uri(variant, identifier): return b'tunein:%s:%s' % (variant, identifier) def parse_uri(uri): result = re.findall(r'^tunein:([a-z]+)(?::(\w+))?$', uri) if result: return result[0] return None, None def station_to_ref(station): if station['type'] != 'audio': logger.debug('Expecting station but got %s' % station['type']) guide_id = station.get('guide_id', '??') uri = unparse_uri('station', guide_id) name = station.get('text', station['URL']) # TODO: Should the name include 'now playing' for all stations? if get_id_type(guide_id) == TUNEIN_ID_TOPIC: name = name + ' [%s]' % station.get('subtext', '??') return Ref.track(uri=uri, name=name) def station_to_track(station): ref = station_to_ref(station) return Track(uri=ref.uri, name=station.get('subtext', ref.name), album=Album(name=ref.name, uri=ref.uri, images=[station.get('image')]), artists=[Artist(name=ref.name, uri=ref.uri)]) def show_to_ref(show): if show['item'] != 'show': logger.debug('Expecting show but got %s' % show['item']) uri = unparse_uri('episodes', show.get('guide_id', '??')) name = show.get('text', show['URL']) return Ref.directory(uri=uri, name=name) def category_to_ref(category): uri = unparse_uri('category', category['key']) return Ref.directory(uri=uri, name=category['text']) def section_to_ref(section, identifier=''): if section.get('type', 'link') == 'audio': return station_to_ref(section) guide_id = section.get('guide_id', '??') if get_id_type(guide_id) == TUNEIN_ID_REGION or identifier == 'local': uri = unparse_uri('location', guide_id) else: uri = unparse_uri('section', guide_id) return Ref.directory(uri=uri, name=section['text']) def get_id_type(guide_id): return {'p': TUNEIN_ID_PROGRAM, 's': TUNEIN_ID_STATION, 'g': TUNEIN_ID_GROUP, 't': TUNEIN_ID_TOPIC, 'c': TUNEIN_ID_CATEGORY, 'r': TUNEIN_ID_REGION, 'f': TUNEIN_ID_PODCAST, 'a': TUNEIN_ID_AFFILIATE, 'e': TUNEIN_ID_STREAM}.get(guide_id[0], TUNEIN_ID_UNKNOWN) def mopidy_to_tunein_query(mopidy_query): tunein_query = [] for (field, values) in mopidy_query.iteritems(): if not hasattr(values, '__iter__'): values = [values] for value in values: if field == 'any': tunein_query.append(value) query = ' '.join(tunein_query).encode(TUNEIN_API_ENCODING) return urllib.pathname2url(query) Mopidy-TuneIn-0.4.1/mopidy_tunein/actor.py0000664000175000017500000002054312730101732020416 0ustar nicknick00000000000000from __future__ import unicode_literals import logging import time from mopidy import backend, exceptions, httpclient from mopidy.audio import scan # TODO: Something else, using internal APIs is not cool. from mopidy.internal import http, playlists from mopidy.models import Ref, SearchResult import pykka import requests import mopidy_tunein from mopidy_tunein import translator, tunein logger = logging.getLogger(__name__) def get_requests_session(proxy_config, user_agent): proxy = httpclient.format_proxy(proxy_config) full_user_agent = httpclient.format_user_agent(user_agent) session = requests.Session() session.proxies.update({'http': proxy, 'https': proxy}) session.headers.update({'user-agent': full_user_agent}) return session class TuneInBackend(pykka.ThreadingActor, backend.Backend): uri_schemes = ['tunein'] def __init__(self, config, audio): super(TuneInBackend, self).__init__() self._session = get_requests_session( proxy_config=config['proxy'], user_agent='%s/%s' % ( mopidy_tunein.Extension.dist_name, mopidy_tunein.__version__)) self._timeout = config['tunein']['timeout'] self._scanner = scan.Scanner( timeout=config['tunein']['timeout'], proxy_config=config['proxy']) self.tunein = tunein.TuneIn(config['tunein']['timeout'], self._session) self.library = TuneInLibrary(self) self.playback = TuneInPlayback(audio=audio, backend=self) class TuneInLibrary(backend.LibraryProvider): root_directory = Ref.directory(uri='tunein:root', name='TuneIn') def __init__(self, backend): super(TuneInLibrary, self).__init__(backend) def browse(self, uri): result = [] variant, identifier = translator.parse_uri(uri) logger.debug('Browsing %s' % uri) if variant == 'root': for category in self.backend.tunein.categories(): result.append(translator.category_to_ref(category)) elif variant == "category" and identifier: for section in self.backend.tunein.categories(identifier): result.append(translator.section_to_ref(section, identifier)) elif variant == "location" and identifier: for location in self.backend.tunein.locations(identifier): result.append(translator.section_to_ref(location, 'local')) for station in self.backend.tunein.stations(identifier): result.append(translator.station_to_ref(station)) elif variant == "section" and identifier: if (self.backend.tunein.related(identifier)): result.append(Ref.directory( uri='tunein:related:%s' % identifier, name='Related')) if (self.backend.tunein.shows(identifier)): result.append(Ref.directory( uri='tunein:shows:%s' % identifier, name='Shows')) for station in self.backend.tunein.featured(identifier): result.append(translator.section_to_ref(station)) for station in self.backend.tunein.local(identifier): result.append(translator.station_to_ref(station)) for station in self.backend.tunein.stations(identifier): result.append(translator.station_to_ref(station)) elif variant == "related" and identifier: for section in self.backend.tunein.related(identifier): result.append(translator.section_to_ref(section)) elif variant == "shows" and identifier: for show in self.backend.tunein.shows(identifier): result.append(translator.show_to_ref(show)) elif variant == "episodes" and identifier: for episode in self.backend.tunein.episodes(identifier): result.append(translator.station_to_ref(episode)) else: logger.debug('Unknown URI: %s', uri) return result def refresh(self, uri=None): self.backend.tunein.reload() def lookup(self, uri): variant, identifier = translator.parse_uri(uri) if variant != 'station': return [] station = self.backend.tunein.station(identifier) if not station: return [] track = translator.station_to_track(station) return [track] def search(self, query=None, uris=None, exact=False): if query is None or not query: return tunein_query = translator.mopidy_to_tunein_query(query) tracks = [] for station in self.backend.tunein.search(tunein_query): track = translator.station_to_track(station) tracks.append(track) return SearchResult(uri='tunein:search', tracks=tracks) class TuneInPlayback(backend.PlaybackProvider): def translate_uri(self, uri): variant, identifier = translator.parse_uri(uri) station = self.backend.tunein.station(identifier) if not station: return None stream_uris = self.backend.tunein.tune(station) while stream_uris: uri = stream_uris.pop(0) logger.debug('Looking up URI: %s.' % uri) new_uri = self.unwrap_stream(uri) if new_uri: return new_uri else: logger.debug('Mopidy translate_uri failed.') new_uris = self.backend.tunein.parse_stream_url(uri) if new_uris == [uri]: logger.debug( 'Last attempt, play stream anyway: %s.' % uri) return uri stream_uris.extend(new_uris) logger.debug('TuneIn lookup failed.') return None def unwrap_stream(self, uri): unwrapped_uri, _ = _unwrap_stream( uri, timeout=self.backend._timeout, scanner=self.backend._scanner, requests_session=self.backend._session) return unwrapped_uri # Shamelessly taken from mopidy.stream.actor def _unwrap_stream(uri, timeout, scanner, requests_session): """ Get a stream URI from a playlist URI, ``uri``. Unwraps nested playlists until something that's not a playlist is found or the ``timeout`` is reached. """ original_uri = uri seen_uris = set() deadline = time.time() + timeout while time.time() < deadline: if uri in seen_uris: logger.info( 'Unwrapping stream from URI (%s) failed: ' 'playlist referenced itself', uri) return None, None else: seen_uris.add(uri) logger.debug('Unwrapping stream from URI: %s', uri) try: scan_timeout = deadline - time.time() if scan_timeout < 0: logger.info( 'Unwrapping stream from URI (%s) failed: ' 'timed out in %sms', uri, timeout) return None, None scan_result = scanner.scan(uri, timeout=scan_timeout) except exceptions.ScannerError as exc: logger.debug('GStreamer failed scanning URI (%s): %s', uri, exc) scan_result = None if scan_result is not None: if scan_result.playable or ( not scan_result.mime.startswith('text/') and not scan_result.mime.startswith('application/') ): logger.debug( 'Unwrapped potential %s stream: %s', scan_result.mime, uri) return uri, scan_result download_timeout = deadline - time.time() if download_timeout < 0: logger.info( 'Unwrapping stream from URI (%s) failed: timed out in %sms', uri, timeout) return None, None content = http.download( requests_session, uri, timeout=download_timeout / 1000) if content is None: logger.info( 'Unwrapping stream from URI (%s) failed: ' 'error downloading URI %s', original_uri, uri) return None, None uris = playlists.parse(content) if not uris: logger.debug( 'Failed parsing URI (%s) as playlist; found potential stream.', uri) return uri, None # TODO Test streams and return first that seems to be playable logger.debug( 'Parsed playlist (%s) and found new URI: %s', uri, uris[0]) uri = uris[0] Mopidy-TuneIn-0.4.1/mopidy_tunein/ext.conf0000664000175000017500000000004712711237274020412 0ustar nicknick00000000000000[tunein] enabled = true timeout = 5000 Mopidy-TuneIn-0.4.1/mopidy_tunein/__init__.py0000664000175000017500000000122212730101732021036 0ustar nicknick00000000000000from __future__ import unicode_literals import os from mopidy import config, ext __version__ = '0.4.1' class Extension(ext.Extension): dist_name = 'Mopidy-TuneIn' ext_name = 'tunein' version = __version__ def get_default_config(self): conf_file = os.path.join(os.path.dirname(__file__), 'ext.conf') return config.read(conf_file) def get_config_schema(self): schema = super(Extension, self).get_config_schema() schema['timeout'] = config.Integer(minimum=0) return schema def setup(self, registry): from .actor import TuneInBackend registry.add('backend', TuneInBackend) Mopidy-TuneIn-0.4.1/mopidy_tunein/tunein.py0000664000175000017500000003123112711237274020616 0ustar nicknick00000000000000from __future__ import unicode_literals import ConfigParser as configparser import logging import re import time import urlparse from collections import OrderedDict from contextlib import closing import requests try: import cStringIO as StringIO except ImportError: import StringIO as StringIO try: import xml.etree.cElementTree as elementtree except ImportError: import xml.etree.ElementTree as elementtree logger = logging.getLogger(__name__) class PlaylistError(Exception): pass class cache(object): # TODO: merge this to util library (copied from mopidy-spotify) def __init__(self, ctl=0, ttl=3600): self.cache = {} self.ctl = ctl self.ttl = ttl self._call_count = 0 def __call__(self, func): def _memoized(*args): now = time.time() try: value, last_update = self.cache[args] age = now - last_update if (self._call_count > self.ctl or age > self.ttl): self._call_count = 0 raise AttributeError if self.ctl: self._call_count += 1 return value except (KeyError, AttributeError): value = func(*args) if value: self.cache[args] = (value, now) return value except TypeError: return func(*args) def clear(): self.cache.clear() _memoized.clear = clear return _memoized def parse_m3u(data): # Copied from mopidy.audio.playlists # Mopidy version expects a header but it's not always present for line in data.readlines(): if not line.startswith('#') and line.strip(): yield line.strip() def parse_pls(data): # Copied from mopidy.audio.playlists try: cp = configparser.RawConfigParser() cp.readfp(data) except configparser.Error: return for section in cp.sections(): if section.lower() != 'playlist': continue for i in xrange(cp.getint(section, 'numberofentries')): try: # TODO: Remove this horrible hack to avoid adverts if cp.has_option(section, 'length%d' % (i+1)): if cp.get(section, 'length%d' % (i+1)) == '-1': yield cp.get(section, 'file%d' % (i+1)) else: yield cp.get(section, 'file%d' % (i+1)) except configparser.NoOptionError: return def fix_asf_uri(uri): return re.sub(r'http://(.+\?mswmext=\.asf)', r'mms://\1', uri, re.I) def parse_old_asx(data): try: cp = configparser.RawConfigParser() cp.readfp(data) except configparser.Error: return for section in cp.sections(): if section.lower() != 'reference': continue for option in cp.options(section): if option.lower().startswith('ref'): uri = cp.get(section, option).lower() yield fix_asf_uri(uri) def parse_new_asx(data): # Copied from mopidy.audio.playlists try: for event, element in elementtree.iterparse(data): element.tag = element.tag.lower() # normalize except elementtree.ParseError: return for ref in element.findall('entry/ref[@href]'): yield fix_asf_uri(ref.get('href', '').strip()) for entry in element.findall('entry[@href]'): yield fix_asf_uri(entry.get('href', '').strip()) def parse_asx(data): if 'asx' in data.getvalue()[0:50].lower(): return parse_new_asx(data) else: return parse_old_asx(data) # This is all broken: mopidy/mopidy#225 # from gi.repository import TotemPlParser # def totem_plparser(uri): # results = [] # def entry_parsed(parser, uri, metadata): # results.append(uri) # parser = TotemPlParser.Parser.new() # someid = parser.connect('entry-parsed', entry_parsed) # res = parser.parse(uri, False) # parser.disconnect(someid) # if res != TotemPlParser.ParserResult.SUCCESS: # logger.debug('Failed to parse playlist') # return results def find_playlist_parser(extension, content_type): extension_map = {'.asx': parse_asx, '.wax': parse_asx, '.m3u': parse_m3u, '.pls': parse_pls} content_type_map = {'video/x-ms-asf': parse_asx, 'application/x-mpegurl': parse_m3u, 'audio/x-scpls': parse_pls} parser = extension_map.get(extension, None) if not parser and content_type: # Annoying case where the url gave us no hints so try and work it out # from the header's content-type instead. # This might turn out to be server-specific... parser = content_type_map.get(content_type.lower(), None) return parser class TuneIn(object): """Wrapper for the TuneIn API.""" def __init__(self, timeout, session=None): self._base_uri = 'http://opml.radiotime.com/%s' self._session = session or requests.Session() self._timeout = timeout / 1000.0 self._stations = {} def reload(self): self._stations.clear() self._tunein.clear() self._get_playlist.clear() def _flatten(self, data): results = [] for item in data: if 'children' in item: results.extend(item['children']) else: results.append(item) return results def _filter_results(self, data, section_name=None, map_func=None): results = [] def grab_item(item): if 'guide_id' not in item: return if map_func: station = map_func(item) elif item.get('type', 'link') == 'link': results.append(item) return else: station = item self._stations[station['guide_id']] = station results.append(station) for item in data: if section_name is not None: section_key = item.get('key', '').lower() if section_key.startswith(section_name.lower()): for child in item['children']: grab_item(child) else: grab_item(item) return results def categories(self, category=''): if category == 'location': args = '&id=r0' # Annoying special case elif category == 'language': args = '&c=lang' return [] # TuneIn's API is a mess here, cba else: args = '&c=' + category # Take a copy so we don't modify the cached data results = list(self._tunein('Browse.ashx', args)) if category in ('podcast', 'local'): # Flatten the results! results = self._filter_results(self._flatten(results)) elif category == '': trending = {'text': 'Trending', 'key': 'trending', 'type': 'link', 'URL': self._base_uri % 'Browse.ashx?c=trending'} # Filter out the language root category for now results = [x for x in results if x['key'] != 'language'] results.append(trending) else: results = self._filter_results(results) return results def locations(self, location): args = '&id=' + location results = self._tunein('Browse.ashx', args) # TODO: Support filters here return [x for x in results if x.get('type', '') == 'link'] def _browse(self, section_name, guide_id): args = '&id=' + guide_id results = self._tunein('Browse.ashx', args) return self._filter_results(results, section_name) def featured(self, guide_id): return self._browse('Featured', guide_id) def local(self, guide_id): return self._browse('Local', guide_id) def stations(self, guide_id): return self._browse('Station', guide_id) def related(self, guide_id): return self._browse('Related', guide_id) def shows(self, guide_id): return self._browse('Show', guide_id) def episodes(self, guide_id): args = '&c=pbrowse&id=' + guide_id results = self._tunein('Tune.ashx', args) return self._filter_results(results, 'Topic') def _map_listing(self, listing): # We've already checked 'guide_id' exists url_args = 'Tune.ashx?id=%s' % listing['guide_id'] return {'text': listing.get('name', '???'), 'guide_id': listing['guide_id'], 'type': 'audio', 'image': listing.get('logo', ''), 'subtext': listing.get('slogan', ''), 'URL': self._base_uri % url_args} def _station_info(self, station_id): logger.debug('Fetching info for station %s' % station_id) args = '&c=composite&detail=listing&id=' + station_id results = self._tunein('Describe.ashx', args) listings = self._filter_results(results, 'Listing', self._map_listing) if listings: return listings[0] def parse_stream_url(self, url): logger.debug('Extracting URIs from %s', url) extension = urlparse.urlparse(url).path[-4:] if extension in ['.mp3', '.wma']: return [url] # Catch these easy ones results = [] playlist, content_type = self._get_playlist(url) if playlist: parser = find_playlist_parser(extension, content_type) if parser: playlist_data = StringIO.StringIO(playlist) try: results = [u for u in parser(playlist_data) if u and u != url] except Exception as e: logger.error('TuneIn playlist parsing failed %s' % e) if not results: logger.debug('Parsing failure, ' 'malformed playlist: %s' % playlist) elif content_type: results = [url] logger.debug('Got %s', results) return list(OrderedDict.fromkeys(results)) def tune(self, station): logger.debug('Tuning station id %s' % station['guide_id']) args = '&id=' + station['guide_id'] stream_uris = [] for stream in self._tunein('Tune.ashx', args): if 'url' in stream: stream_uris.append(stream['url']) if not stream_uris: logger.error('Failed to tune station id %s' % station['guide_id']) return list(OrderedDict.fromkeys(stream_uris)) def station(self, station_id): if station_id in self._stations: station = self._stations[station_id] else: station = self._station_info(station_id) self._stations['station_id'] = station return station def search(self, query): # "Search.ashx?query=" + query + filterVal if not query: logger.debug('Empty search query') return [] logger.debug('Searching TuneIn for "%s"' % query) args = '&query=' + query search_results = self._tunein('Search.ashx', args) results = [] for item in self._flatten(search_results): if item.get('type', '') == 'audio': # Only return stations self._stations[item['guide_id']] = item results.append(item) return results @cache() def _tunein(self, variant, args): uri = (self._base_uri % variant) + '?render=json' + args logger.debug('TuneIn request: %s', uri) try: with closing(self._session.get(uri, timeout=self._timeout)) as r: r.raise_for_status() return r.json()['body'] except Exception as e: logger.info('TuneIn API request for %s failed: %s' % (variant, e)) return {} @cache() def _get_playlist(self, uri): data, content_type = None, None try: # Defer downloading the body until know it's not a stream with closing(self._session.get(uri, timeout=self._timeout, stream=True)) as r: r.raise_for_status() content_type = r.headers.get('content-type', 'audio/mpeg') logger.debug('%s has content-type: %s' % (uri, content_type)) if content_type != 'audio/mpeg': data = r.content.decode('utf-8', errors='ignore') except Exception as e: logger.info('TuneIn playlist request for %s failed: %s' % (uri, e)) return (data, content_type) Mopidy-TuneIn-0.4.1/setup.cfg0000664000175000017500000000023712730101757015677 0ustar nicknick00000000000000[flake8] application-import-names = mopidy_tunein,tests exclude = .git,.tox [wheel] universal = 1 [egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 Mopidy-TuneIn-0.4.1/setup.py0000664000175000017500000000261212711237274015572 0ustar nicknick00000000000000from __future__ import unicode_literals import re from setuptools import find_packages, setup def get_version(filename): content = open(filename).read() metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", content)) return metadata['version'] setup( name='Mopidy-TuneIn', version=get_version('mopidy_tunein/__init__.py'), url='https://github.com/kingosticks/mopidy-tunein', license='Apache License, Version 2.0', author='Nick Steel', author_email='kingosticks@gmail.com', description='Mopidy extension for playing music from TuneIn.', 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', 'Pykka >= 1.1', 'requests >= 2.0.0', ], test_suite='nose.collector', tests_require=[ 'nose', 'mock >= 1.0', ], entry_points={ 'mopidy.ext': [ 'tunein = mopidy_tunein: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-TuneIn-0.4.1/Mopidy_TuneIn.egg-info/0000775000175000017500000000000012730101757020271 5ustar nicknick00000000000000Mopidy-TuneIn-0.4.1/Mopidy_TuneIn.egg-info/dependency_links.txt0000664000175000017500000000000112730101757024337 0ustar nicknick00000000000000 Mopidy-TuneIn-0.4.1/Mopidy_TuneIn.egg-info/not-zip-safe0000664000175000017500000000000112711237304022514 0ustar nicknick00000000000000 Mopidy-TuneIn-0.4.1/Mopidy_TuneIn.egg-info/SOURCES.txt0000664000175000017500000000102312730101757022151 0ustar nicknick00000000000000.coveragerc .travis.yml LICENSE MANIFEST.in README.rst setup.cfg setup.py tox.ini Mopidy_TuneIn.egg-info/PKG-INFO Mopidy_TuneIn.egg-info/SOURCES.txt Mopidy_TuneIn.egg-info/dependency_links.txt Mopidy_TuneIn.egg-info/entry_points.txt Mopidy_TuneIn.egg-info/not-zip-safe Mopidy_TuneIn.egg-info/requires.txt Mopidy_TuneIn.egg-info/top_level.txt mopidy_tunein/__init__.py mopidy_tunein/actor.py mopidy_tunein/ext.conf mopidy_tunein/translator.py mopidy_tunein/tunein.py tests/__init__.py tests/test_extension.py tests/test_playlists.pyMopidy-TuneIn-0.4.1/Mopidy_TuneIn.egg-info/PKG-INFO0000664000175000017500000001407712730101757021377 0ustar nicknick00000000000000Metadata-Version: 1.1 Name: Mopidy-TuneIn Version: 0.4.1 Summary: Mopidy extension for playing music from TuneIn. Home-page: https://github.com/kingosticks/mopidy-tunein Author: Nick Steel Author-email: kingosticks@gmail.com License: Apache License, Version 2.0 Description: **************************** Mopidy-TuneIn **************************** .. image:: https://img.shields.io/pypi/v/Mopidy-TuneIn.svg?style=flat :target: https://pypi.python.org/pypi/Mopidy-TuneIn/ :alt: Latest PyPI version .. image:: https://img.shields.io/pypi/dm/Mopidy-TuneIn.svg?style=flat :target: https://pypi.python.org/pypi/Mopidy-TuneIn/ :alt: Number of PyPI downloads .. image:: https://img.shields.io/travis/kingosticks/mopidy-tunein/develop.svg?style=flat :target: https://travis-ci.org/kingosticks/mopidy-tunein :alt: Travis CI build status .. image:: https://img.shields.io/coveralls/kingosticks/mopidy-tunein/develop.svg?style=flat :target: https://coveralls.io/r/kingosticks/mopidy-tunein?branch=master :alt: Test coverage `Mopidy `_ extension for playing music from `TuneIn `_. Listen to the world’s radio with 70,000 stations of music, sports and news streaming from every continent. Acknowledgement and thanks to Marius Wyss for his original version of this extension and Brian Hornsby's `XBMC plugin `_ that was based on. This product uses TuneIn but is not endorsed, certified or otherwise approved in any way by TuneIn. TuneIn is the registered trade mark of TuneIn Inc. Installation ============ Install by running:: pip install Mopidy-TuneIn .. Or, if available, install the Debian/Ubuntu package from `apt.mopidy.com .. `_. Some radio streams may require additional audio plugins. These can be found in the gstreamer plugin packages for your system. For versions of Mopidy prior to v2.0.0, these might include: * `gstreamer0.10-plugins-ugly` * `gstreamer0.10-plugins-bad` * `gstreamer0.10-ffmpeg` For Mopidy v2.0.0 and above, use the gstreamer1.0-plugins-* packages instead. Known issues ============ The following functionality is not yet implemented: * Playback of podcasts/shows. * User login and access to saved stations. Configuration ============= Before starting Mopidy, you must add configuration for Mopidy-TuneIn to your Mopidy configuration file:: [tunein] timeout = 5000 Project resources ================= - `Source code `_ - `Issue tracker `_ - `Download development snapshot `_ Changelog ========= v0.4.1 (2016-06-14) ------------------- - Port timeout fix for Mopidy's internal stream unwrapping code from mopidy/mopidy#1522 (Fixes: #31) v0.4.0 (2016-02-16) ------------------- - Borrow Mopidy's internal stream unwrapping to avoid incompatibilities with Mopidy v2.0.0 (PR: #28) - Improved handling of malformed pls playlists. v0.3.0 (2016-02-06) ------------------- - Requires Mopidy v1.1 - Respect user's Mopidy proxy configuration and set user-agent. - Utilise Mopidy's nested playlist handling (Fixes: #23 PR: #22) v0.2.2 (2015-04-24) ------------------- - Fix infinite loop when adding some stations, again (my bad). v0.2.1 (2015-04-24) ------------------- - Fix infinite loop when adding some stations. (PR: #17) v0.2 (2015-03-26) ------------------- - Fix utf-8 encoding for searches. (PR: #15) - Fixed inaccessible stream URIs identified as recursive playlist and not using the remaining stream URIs. - Update to work with new playback API in Mopidy 1.0. - Update to work with new backend search API in Mopidy 1.0. - Requires Mopidy v1.0. v0.1.3 (2014-01-22) ------------------- - Don't submit a search (and receive an error) when the query is empty. - Improved nested playlist support. - Support for 'protocol rollover' style ASX playlists. - ASF HTTP streams in ASX playlists are converted to MMS steams. - Ignore nested subtypes in content-type header field to fix #5. - Added support for a station's logo. - Include currently playing info. - Unplayable streams now correctly recognised by Mopidy and playback fails rather than continuing to play the previous track. v0.1.2 (2014-04-13) ------------------- - Improved stream selection for stations using PLS format playlists. - Added suggested additional gstreamer plugin packages. v0.1.1 (2014-02-24) ------------------- - Fixed package description typo and capitalisation inconsistency in name! v0.1.0 (2014-02-23) ------------------- - Initial release. 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-TuneIn-0.4.1/Mopidy_TuneIn.egg-info/entry_points.txt0000664000175000017500000000005712730101757023571 0ustar nicknick00000000000000[mopidy.ext] tunein = mopidy_tunein:Extension Mopidy-TuneIn-0.4.1/Mopidy_TuneIn.egg-info/top_level.txt0000664000175000017500000000001612730101757023020 0ustar nicknick00000000000000mopidy_tunein Mopidy-TuneIn-0.4.1/Mopidy_TuneIn.egg-info/requires.txt0000664000175000017500000000007012730101757022666 0ustar nicknick00000000000000setuptools Mopidy >= 1.1 Pykka >= 1.1 requests >= 2.0.0 Mopidy-TuneIn-0.4.1/PKG-INFO0000664000175000017500000001407712730101757015162 0ustar nicknick00000000000000Metadata-Version: 1.1 Name: Mopidy-TuneIn Version: 0.4.1 Summary: Mopidy extension for playing music from TuneIn. Home-page: https://github.com/kingosticks/mopidy-tunein Author: Nick Steel Author-email: kingosticks@gmail.com License: Apache License, Version 2.0 Description: **************************** Mopidy-TuneIn **************************** .. image:: https://img.shields.io/pypi/v/Mopidy-TuneIn.svg?style=flat :target: https://pypi.python.org/pypi/Mopidy-TuneIn/ :alt: Latest PyPI version .. image:: https://img.shields.io/pypi/dm/Mopidy-TuneIn.svg?style=flat :target: https://pypi.python.org/pypi/Mopidy-TuneIn/ :alt: Number of PyPI downloads .. image:: https://img.shields.io/travis/kingosticks/mopidy-tunein/develop.svg?style=flat :target: https://travis-ci.org/kingosticks/mopidy-tunein :alt: Travis CI build status .. image:: https://img.shields.io/coveralls/kingosticks/mopidy-tunein/develop.svg?style=flat :target: https://coveralls.io/r/kingosticks/mopidy-tunein?branch=master :alt: Test coverage `Mopidy `_ extension for playing music from `TuneIn `_. Listen to the world’s radio with 70,000 stations of music, sports and news streaming from every continent. Acknowledgement and thanks to Marius Wyss for his original version of this extension and Brian Hornsby's `XBMC plugin `_ that was based on. This product uses TuneIn but is not endorsed, certified or otherwise approved in any way by TuneIn. TuneIn is the registered trade mark of TuneIn Inc. Installation ============ Install by running:: pip install Mopidy-TuneIn .. Or, if available, install the Debian/Ubuntu package from `apt.mopidy.com .. `_. Some radio streams may require additional audio plugins. These can be found in the gstreamer plugin packages for your system. For versions of Mopidy prior to v2.0.0, these might include: * `gstreamer0.10-plugins-ugly` * `gstreamer0.10-plugins-bad` * `gstreamer0.10-ffmpeg` For Mopidy v2.0.0 and above, use the gstreamer1.0-plugins-* packages instead. Known issues ============ The following functionality is not yet implemented: * Playback of podcasts/shows. * User login and access to saved stations. Configuration ============= Before starting Mopidy, you must add configuration for Mopidy-TuneIn to your Mopidy configuration file:: [tunein] timeout = 5000 Project resources ================= - `Source code `_ - `Issue tracker `_ - `Download development snapshot `_ Changelog ========= v0.4.1 (2016-06-14) ------------------- - Port timeout fix for Mopidy's internal stream unwrapping code from mopidy/mopidy#1522 (Fixes: #31) v0.4.0 (2016-02-16) ------------------- - Borrow Mopidy's internal stream unwrapping to avoid incompatibilities with Mopidy v2.0.0 (PR: #28) - Improved handling of malformed pls playlists. v0.3.0 (2016-02-06) ------------------- - Requires Mopidy v1.1 - Respect user's Mopidy proxy configuration and set user-agent. - Utilise Mopidy's nested playlist handling (Fixes: #23 PR: #22) v0.2.2 (2015-04-24) ------------------- - Fix infinite loop when adding some stations, again (my bad). v0.2.1 (2015-04-24) ------------------- - Fix infinite loop when adding some stations. (PR: #17) v0.2 (2015-03-26) ------------------- - Fix utf-8 encoding for searches. (PR: #15) - Fixed inaccessible stream URIs identified as recursive playlist and not using the remaining stream URIs. - Update to work with new playback API in Mopidy 1.0. - Update to work with new backend search API in Mopidy 1.0. - Requires Mopidy v1.0. v0.1.3 (2014-01-22) ------------------- - Don't submit a search (and receive an error) when the query is empty. - Improved nested playlist support. - Support for 'protocol rollover' style ASX playlists. - ASF HTTP streams in ASX playlists are converted to MMS steams. - Ignore nested subtypes in content-type header field to fix #5. - Added support for a station's logo. - Include currently playing info. - Unplayable streams now correctly recognised by Mopidy and playback fails rather than continuing to play the previous track. v0.1.2 (2014-04-13) ------------------- - Improved stream selection for stations using PLS format playlists. - Added suggested additional gstreamer plugin packages. v0.1.1 (2014-02-24) ------------------- - Fixed package description typo and capitalisation inconsistency in name! v0.1.0 (2014-02-23) ------------------- - Initial release. 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-TuneIn-0.4.1/tests/0000775000175000017500000000000012730101757015216 5ustar nicknick00000000000000Mopidy-TuneIn-0.4.1/tests/test_playlists.py0000664000175000017500000000336412711237274020664 0ustar nicknick00000000000000from __future__ import unicode_literals import io import unittest from mopidy_tunein import tunein ASX = b""" Example Sample Title Example title Other title """ SIMPLE_ASX = b""" """ OLD_ASX = b"""[Reference] Ref1=file:///tmp/foo Ref2=file:///tmp/bar Ref3=file:///tmp/baz """ ASF_ASX = b"""[Reference] Ref1=http://tmp.com/foo-mbr?MSWMExt=.asf Ref2=mms://tmp.com:80/bar-mbr?mswmext=.asf Ref3=http://tmp.com/baz """ class BaseAsxPlaylistTest(object): valid = None parse = staticmethod(tunein.parse_asx) def test_parse_valid_playlist(self): uris = list(self.parse(io.BytesIO(self.valid))) expected = [b'file:///tmp/foo', b'file:///tmp/bar', b'file:///tmp/baz'] self.assertEqual(uris, expected) class AsxPlaylistTest(BaseAsxPlaylistTest, unittest.TestCase): valid = ASX class AsxSimplePlaylistTest(BaseAsxPlaylistTest, unittest.TestCase): valid = SIMPLE_ASX class AsxOldPlaylistTest(BaseAsxPlaylistTest, unittest.TestCase): valid = OLD_ASX class PlaylistTest(unittest.TestCase): parse = staticmethod(tunein.parse_asx) def test_parse_asf_playlist(self): uris = list(self.parse(io.BytesIO(ASF_ASX))) expected = [b'mms://tmp.com/foo-mbr?mswmext=.asf', b'mms://tmp.com:80/bar-mbr?mswmext=.asf', b'http://tmp.com/baz'] self.assertEqual(uris, expected) Mopidy-TuneIn-0.4.1/tests/test_extension.py0000664000175000017500000000074512711237274020654 0ustar nicknick00000000000000from __future__ import unicode_literals import unittest from mopidy_tunein import Extension class ExtensionTest(unittest.TestCase): def test_get_default_config(self): ext = Extension() config = ext.get_default_config() self.assertIn('[tunein]', config) self.assertIn('enabled = true', config) def test_get_config_schema(self): ext = Extension() schema = ext.get_config_schema() self.assertIn('timeout', schema) Mopidy-TuneIn-0.4.1/tests/__init__.py0000664000175000017500000000000012711237274017320 0ustar nicknick00000000000000