{ "info": { "author": "Asbj\u00f8rn Olling", "author_email": "asbjornolling@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3 :: Only", "Topic :: Multimedia :: Sound/Audio :: Players", "Topic :: Software Development :: Libraries" ], "description": "MopidyAPI\n=========\n\n`MopidyAPI` is a Python (3.6+) library for interacting with\n[Mopidy](https://www.mopidy.com/) via its [JSON RPC\nAPI](https://docs.mopidy.com/en/latest/api/http/).\n\n`MopidyAPI` uses HTTP to call RPC methods, and websockets to listen for events.\n\nIt is compatible with all functions present in Mopidy 2.2.\n\n## Installation\n\n```\npip install mopidyapi\n```\n\n## Usage\n\n`MopidyAPI` contains functions mapping to each of [the Mopidy v2.2 core API functions.](https://docs.mopidy.com/en/release-2.2/api/core/)\n\nFor example `mopidy.core.PlaybackController.pause()` in the documentation maps to `MopidyAPI.playback.pause()` here. \n\n### Quick example\n\n```python\n>>> from mopidyapi import MopidyAPI\n>>> m = MopidyAPI()\n>>> tracks = m.tracklist.get_tracks()\n>>> tracks[0].name\n\n\t'I've Seen Footage'\n\n>>> tracks[0].artists\n\n\t[Artist(name='Death Grips', uri='spotify:artist:5RADpgYLOuS2ZxDq7ggYYH')]\n\n>>> tracks[0]._fields\n\n\t('album',\n\t 'name',\n\t 'disc_no',\n\t 'uri',\n\t 'length',\n\t 'track_no',\n\t 'artists',\n\t 'date',\n\t 'bitrate')\n```\n\n\n### Connecting to Mopidy\n\nTo connect to Mopidy, you need to instantiate a `MopidyAPI` object.\nBy default, it will connect to Mopidy at `localhost:6680`,\nso you might not need to give the constructor any arguments.\n\n```python\nfrom mopidyapi import MopidyAPI\nm = MopidyAPI(host='my.mopidy.host.com', port=6680)\n```\n\nYou can also pass `use_websockets=False`, to prevent starting the websocket listener,\nwhich runs in a separate thread. However, event listening (described below) won't work with this set.\n\n\n### Calling Mopidy functions\n\nAll of the functions described in the\n[Mopidy 2.2 core API documentation](http://docs.mopidy.com/en/latest/api/core/)\nare available in `MopidyAPI`.\n\nFunctions named in the Mopidy docs as `core.Controller.()`,\nwill be under the name `MopidyAPI..()`\n\nFor example, you can pause the music by calling `m.playback.pause()`,\nor you could search for a song by calling e.g. `m.library.search(artist='Rick Astley')`, where `m = MopidyAPI()`.\n\nFunctions will return\n[Python native `namedtuple`](https://docs.python.org/3.7/library/collections.html#collections.namedtuple)\nrepresentations of the returned data.\n\n\n### Event listening\n\nYou can use function decorators to mark specific functions to be called when an event arrives. See example below.\n\nThe events used are described in [Mopidy's core events documentation.](https://docs.mopidy.com/en/latest/api/core/#core-events)\n\n```python\nfrom mopidyapi import MopidyAPI\nm = MopidyAPI()\n\n@m.on_event('volume_changed')\ndef print_volume(event):\n print(f\"Volume changed to: {event.volume}\")\n\n@m.on_event('track_playback_started')\ndef print_newtracks(event):\n print(f\"Started playing track: {event.track.name}\")\n\n```\n\nLike with function calls, the events passed are [namedtuples.](https://docs.python.org/3.7/library/collections.html#collections.namedtuple)\n\nAn important caveat with the event listener decorators,\nis that it will not warn you in any way, if you use an invalid event name (e.g. you misspell the event name).\n\n## Note on the choice of `namedtuples`\n\n### Why `namedtuples`?\n\nThe choice of namedtuples might seem unusual (or even inconvenient),\nbut they have a number of advantages over dictionaries for this application:\n\n**1. Less verbose than dicts.**\n\n`event.tl_track.track.album.name`\n\nis shorter and easier on the eyes than \n\n`event['tl_track']['track']['album']['name']`\n\n**2. They print much more neatly.**\n\n`Artist(name='Death Grips', uri='spotify:artist:5RADpgYLOuS2ZxDq7ggYYH')`\n\nis much better than\n\n`{'name': 'Death Grips', 'uri': 'spotify:artist:5RADpgYLOuS2ZxDq7ggYYH'}`.\n\n**3. `namedtuples` accurately represent the immutable nature of the data.**\n\nBeing allowed to mutate the data coming from Mopidy might give one the idea that this would change the data inside Mopidy, which is obviously not the case.\n\n\n### ...but, I know dicts!\n\nOkay, so if you need `.keys()`, you can use `._fields()` instead,\nand if you absolutely need a dict, you can use `._asdict()`,\nwhich will return an actual dict.\n\n\n## Contributing\n\nPlease do tell me about bugs via the [github issue tracker](https://github.com/AsbjornOlling/mopidyapi).\n\nAlso feel free to write, if you're just in the mood to help me improve this project. I don't bite :)\n\n\n## License\n\nThis project is licensed under the GPLv3.\nSee the `LICENSE` file for details.\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/AsbjornOlling/mopidyapi", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "mopidyapi", "package_url": "https://pypi.org/project/mopidyapi/", "platform": "", "project_url": "https://pypi.org/project/mopidyapi/", "project_urls": { "Homepage": "https://github.com/AsbjornOlling/mopidyapi" }, "release_url": "https://pypi.org/project/mopidyapi/0.6.4/", "requires_dist": [ "requests", "websockets" ], "requires_python": ">=3.6", "summary": "MopidyAPI", "version": "0.6.4" }, "last_serial": 5417394, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "a8c36893fd6f55d3e3e7cf8fd57130fe", "sha256": "d8f47534aa8fa6e8ccd533cbba657b49176a75fb4176268fc45dd649c83605f9" }, "downloads": -1, "filename": "mopidyapi-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a8c36893fd6f55d3e3e7cf8fd57130fe", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 75259, "upload_time": "2019-05-12T17:54:14", "url": "https://files.pythonhosted.org/packages/93/78/96a25815ab93c8a04cd0f5b25b244d6b7c6a98aedec74391f65ad1186dc4/mopidyapi-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fed1fa1bd538aa0e72d9677e32a914ed", "sha256": "b14fef1195c31c1659c9ac9a338173c862be3f95886657830f8233cee6c50448" }, "downloads": -1, "filename": "mopidyapi-0.1.0.tar.gz", "has_sig": false, "md5_digest": "fed1fa1bd538aa0e72d9677e32a914ed", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 27123, "upload_time": "2019-05-12T17:54:31", "url": "https://files.pythonhosted.org/packages/3b/30/6566db8b8b8e445179312a4f2af0916fa3afe54d91e5b2b0e3481896f2d7/mopidyapi-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "9d7f8ef2f4358740b3120d2ab0cb472f", "sha256": "04c3e3ff7d0211e89489fcf32a8ddbbe3745707a9d5aa3971f3b80481ae8763c" }, "downloads": -1, "filename": "mopidyapi-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "9d7f8ef2f4358740b3120d2ab0cb472f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 75269, "upload_time": "2019-05-12T18:15:50", "url": "https://files.pythonhosted.org/packages/04/2f/f41b27a92dd5e6e551fe8b2ef226273c2b347ae1b0e4748e1affaf6815fc/mopidyapi-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b566bb1ef6967bf729459395c24acaf6", "sha256": "7cb4504c91bd787fc065172eae0a3cf61698ed9e665be6076b8163a3c7bed990" }, "downloads": -1, "filename": "mopidyapi-0.2.0.tar.gz", "has_sig": false, "md5_digest": "b566bb1ef6967bf729459395c24acaf6", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 27140, "upload_time": "2019-05-12T18:15:57", "url": "https://files.pythonhosted.org/packages/bd/fc/78cdab413f31e031cf8bf29b5aac7e208f54cb69bb6160fe0f600cb11421/mopidyapi-0.2.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "e47af11f09e2798703e2d0c2879efcca", "sha256": "b1a6749df1c7719e4d21cd3b9b6a83553ce9fe0c9a3f1ac2d72df0ca390cf509" }, "downloads": -1, "filename": "mopidyapi-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "e47af11f09e2798703e2d0c2879efcca", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 74594, "upload_time": "2019-05-18T12:25:52", "url": "https://files.pythonhosted.org/packages/14/e0/66ba661f08c4a7c28b19dfe747bc375d64820e87196bc3833a818f5e20ad/mopidyapi-0.3.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1b5c52ac295d6d1f941138365afc809f", "sha256": "6efccf342e26835339059c486dcd98eaf1127431be2385b25fa4735bb2adff5c" }, "downloads": -1, "filename": "mopidyapi-0.3.1.tar.gz", "has_sig": false, "md5_digest": "1b5c52ac295d6d1f941138365afc809f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 28637, "upload_time": "2019-05-18T12:25:56", "url": "https://files.pythonhosted.org/packages/eb/7a/33994bd7ae4b0d1af1f8d194aaa82a8a0f28a3bae30576a8feec9ed50da1/mopidyapi-0.3.1.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "8b91b4a1e3eb8fd92c59caa97c00fd83", "sha256": "acae9daf34824ceb3913591a293f424c99060315ad45af33f7d85802ae7d5245" }, "downloads": -1, "filename": "mopidyapi-0.4.1-py3-none-any.whl", "has_sig": false, "md5_digest": "8b91b4a1e3eb8fd92c59caa97c00fd83", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 76914, "upload_time": "2019-05-18T19:43:20", "url": "https://files.pythonhosted.org/packages/22/1c/dabfbe0bd823d2ab39048ddae969528d6961e2cfc89733b122215bfa7c6a/mopidyapi-0.4.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "83e5ca2a31a1610c63e03b5535138a58", "sha256": "62b70cede460fc8e351e6702553a14a4390b7a76c48cf679b3b418d76c970f69" }, "downloads": -1, "filename": "mopidyapi-0.4.1.tar.gz", "has_sig": false, "md5_digest": "83e5ca2a31a1610c63e03b5535138a58", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 28920, "upload_time": "2019-05-18T19:43:25", "url": "https://files.pythonhosted.org/packages/29/4d/86122b4a33dee0311e8a4160d94bef69c2a6f1620c691d400b2a21b158bc/mopidyapi-0.4.1.tar.gz" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "d4aaceeb246957fb7ffc3c0c1a8096e9", "sha256": "f6fdf33743d82f491f540ff5ac22973057aff84c1349d043d7f7f1fc16ff9024" }, "downloads": -1, "filename": "mopidyapi-0.4.2-py3-none-any.whl", "has_sig": false, "md5_digest": "d4aaceeb246957fb7ffc3c0c1a8096e9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 77047, "upload_time": "2019-05-19T00:52:27", "url": "https://files.pythonhosted.org/packages/66/ee/c562a5a9d2a8365c055c0b13fa46d51b647bb9fb50de9e215e45f3d1171b/mopidyapi-0.4.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d8a21ab85c0a5f2020535390a52d767c", "sha256": "f89ee45c801654e039f403caf1f47c716fc29984b7cfd28f612aee9760f900e4" }, "downloads": -1, "filename": "mopidyapi-0.4.2.tar.gz", "has_sig": false, "md5_digest": "d8a21ab85c0a5f2020535390a52d767c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 29003, "upload_time": "2019-05-19T00:52:40", "url": "https://files.pythonhosted.org/packages/9d/4a/c427bab216d20642521d0aa39507ef46ad9ca53e4d91dcaee69d193d5878/mopidyapi-0.4.2.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "9922ccc9451ad484663276776c197d6f", "sha256": "e27b522e531f44ce3fd9728a05bea6bcaf0a86daec350d83b219b0c611e7be34" }, "downloads": -1, "filename": "mopidyapi-0.5.0-py3-none-any.whl", "has_sig": false, "md5_digest": "9922ccc9451ad484663276776c197d6f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 77990, "upload_time": "2019-05-23T21:39:01", "url": "https://files.pythonhosted.org/packages/c5/43/b059d2f0a0180a571dd63c1a90ce960f99b36630e4d63041acd193b5fb38/mopidyapi-0.5.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b6caf562dcbd49812433a7ac1cad4221", "sha256": "5f52848749bf83e67c09ba8ebe7f6692aa8f056d6b723a7aa867d58be10ead2b" }, "downloads": -1, "filename": "mopidyapi-0.5.0.tar.gz", "has_sig": false, "md5_digest": "b6caf562dcbd49812433a7ac1cad4221", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 29200, "upload_time": "2019-05-23T21:39:09", "url": "https://files.pythonhosted.org/packages/e8/6b/e03814b256915394d49a7532be07d9219b13946fd579766ef293a1836b93/mopidyapi-0.5.0.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "aab61c2e576efe49b415accd05f7fa7f", "sha256": "914c2bc7c7fbd96c4d9e4ceb3a06cfdfa4a747ccccbf43ef5f10747a809f393a" }, "downloads": -1, "filename": "mopidyapi-0.6.0-py3-none-any.whl", "has_sig": false, "md5_digest": "aab61c2e576efe49b415accd05f7fa7f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 78606, "upload_time": "2019-05-31T12:05:51", "url": "https://files.pythonhosted.org/packages/e3/8e/09efb8d021304384d0bc3feeb4f90a073570d33a0624c6a033fb8a034730/mopidyapi-0.6.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fbaf1a20b8d1ff609405906c9c37acfa", "sha256": "cc97302cee8abd739a8ac132bfb80eeb0f85127853af07001cd50c18dd35ebf9" }, "downloads": -1, "filename": "mopidyapi-0.6.0.tar.gz", "has_sig": false, "md5_digest": "fbaf1a20b8d1ff609405906c9c37acfa", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 30924, "upload_time": "2019-05-31T12:06:14", "url": "https://files.pythonhosted.org/packages/45/ee/baeffbbafa96f4f200d87ceb482b2fa26e33e457206d469be38157423a63/mopidyapi-0.6.0.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "b32114df69f325055aad14dcbf7caeb5", "sha256": "a751a68b6ca5898a675ae5c0f5cb65367bbbe9b585a6f0c6762b1ae5d8086678" }, "downloads": -1, "filename": "mopidyapi-0.6.1-py3-none-any.whl", "has_sig": false, "md5_digest": "b32114df69f325055aad14dcbf7caeb5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 78791, "upload_time": "2019-05-31T12:09:44", "url": "https://files.pythonhosted.org/packages/be/26/c47ac4e3c73d8c28b1f7e2f9c79dba7b140618abb45e04f2e9ed2f2b6473/mopidyapi-0.6.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4e1233e5c4e6ff924944ae2dbe7a3240", "sha256": "0edc4ff9051ab87f4504d445188e5c4937aca4417765c07db976cebf1554b733" }, "downloads": -1, "filename": "mopidyapi-0.6.1.tar.gz", "has_sig": false, "md5_digest": "4e1233e5c4e6ff924944ae2dbe7a3240", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 30985, "upload_time": "2019-05-31T12:09:50", "url": "https://files.pythonhosted.org/packages/fd/76/82d9ddfbf702b20f80b64d9920a5f91c25951267297b886a28170b4c4de7/mopidyapi-0.6.1.tar.gz" } ], "0.6.4": [ { "comment_text": "", "digests": { "md5": "5c93eee5508fee8dc7df2c51560eb8ce", "sha256": "4d3d2073a467914968e4ad9781250b68e82b06d7d0845e3759b257e280aad0ee" }, "downloads": -1, "filename": "mopidyapi-0.6.4-py3-none-any.whl", "has_sig": false, "md5_digest": "5c93eee5508fee8dc7df2c51560eb8ce", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 79167, "upload_time": "2019-06-18T21:31:33", "url": "https://files.pythonhosted.org/packages/4d/ad/9e7f5ec2b10a26c1dd1e3932ab8cc1b70ffabb7998290bc78077efe55fe0/mopidyapi-0.6.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1b3acbaf01cfeca7b6934324b2afa260", "sha256": "0c62047b21bbee964b31d5d7abc7db9c7f05befad508d2b56c1a17abeb4219b6" }, "downloads": -1, "filename": "mopidyapi-0.6.4.tar.gz", "has_sig": false, "md5_digest": "1b3acbaf01cfeca7b6934324b2afa260", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 31025, "upload_time": "2019-06-18T21:31:43", "url": "https://files.pythonhosted.org/packages/5d/ff/3f992d2555aecbf564b9f6c84e4a24722ec66bc6dc489f5760f94489c7a6/mopidyapi-0.6.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5c93eee5508fee8dc7df2c51560eb8ce", "sha256": "4d3d2073a467914968e4ad9781250b68e82b06d7d0845e3759b257e280aad0ee" }, "downloads": -1, "filename": "mopidyapi-0.6.4-py3-none-any.whl", "has_sig": false, "md5_digest": "5c93eee5508fee8dc7df2c51560eb8ce", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 79167, "upload_time": "2019-06-18T21:31:33", "url": "https://files.pythonhosted.org/packages/4d/ad/9e7f5ec2b10a26c1dd1e3932ab8cc1b70ffabb7998290bc78077efe55fe0/mopidyapi-0.6.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1b3acbaf01cfeca7b6934324b2afa260", "sha256": "0c62047b21bbee964b31d5d7abc7db9c7f05befad508d2b56c1a17abeb4219b6" }, "downloads": -1, "filename": "mopidyapi-0.6.4.tar.gz", "has_sig": false, "md5_digest": "1b3acbaf01cfeca7b6934324b2afa260", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 31025, "upload_time": "2019-06-18T21:31:43", "url": "https://files.pythonhosted.org/packages/5d/ff/3f992d2555aecbf564b9f6c84e4a24722ec66bc6dc489f5760f94489c7a6/mopidyapi-0.6.4.tar.gz" } ] }