{ "info": { "author": "Stephan Heuel", "author_email": "mail@ping13.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Other Environment", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# Control an HEOS player with a Python script\n\n## Requirements\n\nYou have an [HEOS][] speaker in your local network and Python 2.7 or\nPython 3.\n\n## Usage\n\n0. Install the package with `pip install heospy` or by downloading the source\n package and run `python setup.py install`.\n\n1. Create a `config.json` file, which may reside in the current directory, in\n `$HOME/.heospy` or in a directory wich is specified by the environment\n variable `$HEOSPY_CONF`. The config file contains the name of the lead\n [HEOS][] player you want to control and the username and password of your\n [HEOS account][]. See `example-config.json` for an example.\n\n2. Run the script for the first time to see how this works:\n\n $ heos_player\n 2017-02-12 20:32:29,880 INFO Starting to discover your HEOS player 'Living room' in your local network\n 2017-02-12 20:32:36,824 INFO Found 'Living room' in your local network\n $\n \n3. Now you can call any command from the [CLI specs][specs], see also `docs/`\n folder. Additional arguments are given with `-p`. The player id will be\n automatically submitted. Some examples:\n\n heos_player player/toggle_mute\n heos_player player/set_volume -p level=19\n heos_player player/play_preset -p preset=3\n heos_player player/set_play_state -p state=stop\n heos_player group/toggle_mute\n heos_player group/toggle_mute -p gid=-1352658342\n\n Use the flag `--help` for a detailed help.\n\n[specs]: http://rn.dmglobal.com/euheos/HEOS_CLI_ProtocolSpecification.pdf\n[HEOS]: http://heoslink.denon.com\n[HEOS account]: http://denon.custhelp.com/app/answers/detail/a_id/1968\n\n## Parsing the response from HEOS\n\n`heos_player` returns a JSON object which directly comes from an HEOS\nplayer. For example:\n\n python heospy/heos_player.py player/get_volume\n \ngives something like\n\n {\n \"heos\": {\n \"message\": \"pid=-1352658342&level=13\", \n \"command\": \"player/get_volume\", \n \"result\": \"success\"\n }\n }\n\nUnfortunately, HEOS hides some of the results in the `message` property (here:\nthe volume level of the main player). `heospy` parses the message string and\nputs the contained attributes in a seperate property `heos_message_parsed`:\n\n {\n \"heos_message_parsed\": {\n \"pid\": \"-1352658342\", \n \"level\": \"13\"\n }, \n \"heos\": {\n \"message\": \"pid=-1352658342&level=13\", \n \"command\": \"player/get_volume\", \n \"result\": \"success\"\n }\n }\n\nWith [`jq`](https://stedolan.github.io/jq/), you can directly get the result on\nthe command line:\n\n $ python heospy/heos_player.py player/get_volume | jq .heos_message_parsed.level\n \"13\"\n\n## Main player setting and referencing other players by name\n\nThe class `HeosPlayer` assumes a main HEOS player, stored in the config\nfile. For commands starting with `player/`, we assume that this player should\nbe used, otherwise you need to specify the player id explicitly as a parameter\n`pid`. \n\nYou may also specify a player by name by using the fake parameter `pname`: the\nclass `HeosPlayer` will search for a player with the given name and will try to\ntranslate it to a player id, e.g. with:\n\n $ python heospy/heos_player.py player/get_volume -p pname=K\u00fcche\n [...]\n 2019-01-15 20:04:51,624 INFO Issue command 'player/get_volume' with arguments {\"pname\": \"K\\u00fcche\"}\n 2019-01-15 20:04:51,624 DEBUG translated name 'K\u00fcche' to {'pname': 'pid', 'gname': 'gid'}=941891005\n 2019-01-15 20:04:51,625 INFO cmd : player/get_volume, args &pid=941891005\n [...]\n {\n \"heos_message_parsed\": {\n \"pid\": \"941891005\", \n \"level\": \"12\"\n }, \n \"heos\": {\n \"message\": \"pid=941891005&level=12\", \n \"command\": \"player/get_volume\", \n \"result\": \"success\"\n }\n }\n\nIf the main player is a lead player in a group, this group is also the main\ngroup for commands starting with `group/`. Again, you can override this setting\nbe explicitly mention the group id as a parameter. You may also specify the\ngroup by name with a fake parameter `gname`.\n\n## Rudimentary scripting of HEOS commands\n\nYou can also execute a sequence of commands at once. The sequence can be given\nin a text file:\n\n heos_player -i cmds.txt\n\nAn example for `cmds.txt` is:\n\n system/heart_beat\n # let's set a volume level\n player/set_volume level=10\n # let's check if the volume is correct\n player/get_volume\n\nNote that comments are possible and start with a `#`. There is also a special\ncommand `wait`, which waits a number of seconds until the next command is\nplayed.\n\n # play an MP3 file, wait 360 seconds and then turn the mute button on\n player/play_stream pname=K\u00fcche url=http://example.com/example.mp3\n wait 360 \n player/set_mute -p state=on\n\nIt's a current limitation that `heospy` doesn't listen to events emitted from\nany HEOS player.\n\nYou can also get the sequence of commands from `stdin`:\n\n printf \"system/heart_beat\\nplayer/set_volume level=10\\nplayer/get_volume\" | heos_player -i -\n\n## Usage with Raspberry Pi and Kodi\n\nIf you have [OSMC][] or any other [Kodi Media center][Kodi] implementation on\nyour [Raspberry Pi][raspi], you can map certain actions for your HEOS on a\n[keymap][].\n\n[OSMC]: https://osmc.tv\n[raspi]: https://www.raspberrypi.org\n[Kodi]: http://kodi.wiki/view/Kodi\n[keymap]: http://kodi.wiki/view/Keymaps\n\nExample `keyboard.xml`-file:\n\n```xml\n\n\n\nRunScript(heos_player, player/play_preset, -p, preset=1)\nRunScript(heos_player, player/play_preset, -p, preset=2)\nRunScript(heos_player, player/play_preset, -p, preset=3)\nRunScript(heos_player, player/play_preset, -p, preset=4)\nRunScript(heos_player, player/set_play_state, -p, state=stop)\n\n\n\n\n\n```\n\n## Limitations\n\nCurrently, heospy cannot listen to events from an HEOS player. Events are\ndescribed in the [specification][specs]. Please contact me, if you are\ninterested in helping out.\n\n## Credits\n\n- first code from \n- the SSDS discovery library is from\n , with an additional modification\n by Adam Baxter to get this working for Python 3.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/heospy/", "keywords": "api,heos,marantz,denon,audio", "license": "LICENSE.txt", "maintainer": "Stephan Heuel", "maintainer_email": "mail@ping13.net", "name": "heospy", "package_url": "https://pypi.org/project/heospy/", "platform": "", "project_url": "https://pypi.org/project/heospy/", "project_urls": { "Bug Tracker": "https://github.com/ping13/heospy/issues", "Homepage": "http://pypi.python.org/pypi/heospy/", "Source Code": "https://github.com/ping13/heospy.git" }, "release_url": "https://pypi.org/project/heospy/0.1.4/", "requires_dist": null, "requires_python": "", "summary": "Control Denon's HEOS speakers with Python.", "version": "0.1.4" }, "last_serial": 5280922, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "f064d34c1adac00243fe1678f84bcb3f", "sha256": "d8ce273bbf6d3bb6cc10f8156e1ff78ca94d7715beb989a8f7f5718066ea6d05" }, "downloads": -1, "filename": "heospy-0.1.0-py2-none-any.whl", "has_sig": false, "md5_digest": "f064d34c1adac00243fe1678f84bcb3f", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 13277, "upload_time": "2018-12-27T10:06:06", "url": "https://files.pythonhosted.org/packages/fd/29/f88de741ce91e1cb13a15c613a09960e90479636825690fd28a1a046dd7f/heospy-0.1.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7bf99509d45c007779fbf5b4393ccfb0", "sha256": "2537a5a642ab507e9b8004dd68110c69c88cb3441e82d3357fee2f4c10b6bd06" }, "downloads": -1, "filename": "heospy-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7bf99509d45c007779fbf5b4393ccfb0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 13574, "upload_time": "2018-12-27T10:48:47", "url": "https://files.pythonhosted.org/packages/ba/cf/8ac1016b60a32b2cd740b6de0ba83772291051759bd06c8c7b88908a6991/heospy-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "70a4422584119ba3b1512dc8cd6cfcd5", "sha256": "fe3a8f02c3439fc2abc1b62bcccd5608d84dd5b9dcd6f6fe3c961c7eca2a34c7" }, "downloads": -1, "filename": "heospy-0.1.0.tar.gz", "has_sig": false, "md5_digest": "70a4422584119ba3b1512dc8cd6cfcd5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8656, "upload_time": "2018-12-27T10:48:48", "url": "https://files.pythonhosted.org/packages/83/85/169b26eca62db2397a0ec720f9d54e57a0ef7232a5a9e5e24e489bdf818f/heospy-0.1.0.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "130e08741430317026eb6ea5e31ccb3f", "sha256": "c30b0a43b5efb0d359932088822c68e1abddaaeac0e27880a737295c6fd10571" }, "downloads": -1, "filename": "heospy-0.1.3.tar.gz", "has_sig": false, "md5_digest": "130e08741430317026eb6ea5e31ccb3f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13026, "upload_time": "2019-01-15T21:37:13", "url": "https://files.pythonhosted.org/packages/78/0a/ee33e183b6dc8dce2bd788e72cdcb652d892fc54cb0fbb2857c30721df15/heospy-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "2363766ecef57061f5e48cd225028195", "sha256": "96c9070177734526bb0721017eca7e29ca38528d55dd6a6850cef9f260ae26d8" }, "downloads": -1, "filename": "heospy-0.1.4.tar.gz", "has_sig": false, "md5_digest": "2363766ecef57061f5e48cd225028195", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13060, "upload_time": "2019-05-17T07:32:17", "url": "https://files.pythonhosted.org/packages/dc/cb/8cbab7184b612067b2c998528434cc8c3b8edc25356fa88237d4c60534fe/heospy-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2363766ecef57061f5e48cd225028195", "sha256": "96c9070177734526bb0721017eca7e29ca38528d55dd6a6850cef9f260ae26d8" }, "downloads": -1, "filename": "heospy-0.1.4.tar.gz", "has_sig": false, "md5_digest": "2363766ecef57061f5e48cd225028195", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13060, "upload_time": "2019-05-17T07:32:17", "url": "https://files.pythonhosted.org/packages/dc/cb/8cbab7184b612067b2c998528434cc8c3b8edc25356fa88237d4c60534fe/heospy-0.1.4.tar.gz" } ] }