{ "info": { "author": "Adam Krueger", "author_email": "adamkru@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "=========\npyfoobeef\n=========\n\nAllows control of the Foobar2000 and DeaDBeeF media players through the `beefweb `_ plugin API.\n\n* Both asynchronous and synchronous clients\n* An asynchronous event listener with callbacks\n* For Python 3.6 and up\n* MIT License\n\n\nInstallation\n------------\n1. Install and configure the `beefweb `_ plugin for your media player.\n\n2. Run::\n\n pip install pyfoobeef\n\n\nDocumentation\n-------------\n\nDocumentation available at https://pyfoobeef.readthedocs.io/en/latest/\n\n\nExamples\n--------\nSynchronous client:\n\n.. code-block:: python\n\n import pyfoobeef\n from time import sleep\n\n\n player = pyfoobeef.Client(\"localhost\", 8880)\n\n # Add a new playlist.\n new_playlist = player.add_playlist(title=\"My New Playlist\")\n player.set_current_playlist(new_playlist)\n\n # Add items to the playlist. Note that paths including drive letters\n # are case sensitive even on Windows due to limitations of the beefweb\n # plugin (so r\"c:\\Music\" would not work here).\n player.add_playlist_items(new_playlist, items=[r\"C:\\Music\"])\n\n player.play_specific(new_playlist, 1)\n # Give the media player a bit of time to actually start playing.\n sleep(0.5)\n\n # Column maps represent the media data fields to retrieve and the names\n # to assign the returned data to.\n column_map = {\n \"%artist%\": \"artist\",\n \"%title%\": \"title\",\n \"%album% - %track number% - %title%\": \"my_custom_column\",\n }\n status = player.get_player_state(column_map)\n\n if status.active_item.has_columns():\n # Returned columns may be addressed by subscripting or as attributes.\n print(status.active_item.columns[\"artist\"])\n print(status.active_item.columns.title)\n print(status.active_item.columns.my_custom_column)\n\n # Display the playback state (ex. \"playing\")\n print(status.playback_state)\n\n # Display information about the volume level (current, min, max, etc.)\n print(status.volume)\n\n\nThe asynchronous client follows a very similar format:\n\n.. code-block:: python\n\n import pyfoobeef\n import asyncio\n\n\n async def example():\n player = pyfoobeef.AsyncClient(\"localhost\", 8880)\n\n # Add a new playlist.\n new_playlist = await player.add_playlist(title=\"My New Playlist\")\n await player.set_current_playlist(new_playlist)\n\n # Add items to the playlist. Note that paths including drive letters\n # are case sensitive even on Windows due to limitations of the beefweb\n # plugin (so r\"c:\\Music\" would not work here).\n await player.add_playlist_items(new_playlist, items=[r\"C:\\Music\"])\n\n # sort items by length\n await player.sort_playlist_items(new_playlist, by=\"%length_seconds%\")\n\n # Get information about the first 10 items in a playlist.\n items = await player.get_playlist_items(\n new_playlist,\n column_map=[\"%artist%\", \"%title%\", \"%length%\"],\n offset=0,\n count=10,\n )\n for item in items:\n print(item)\n\n # Play a specific item.\n await player.play_specific(new_playlist, 4)\n\n\n asyncio.run(example())\n\n\nThe asynchronous event listener can automatically execute callbacks when certain events are received or the media players state can be determined from the EventListener object's attributes:\n\n.. code-block:: python\n\n import pyfoobeef\n import asyncio\n\n\n def print_active_item(state):\n print(\"From player state callback. Active item is:\")\n print(state.active_item)\n\n\n def print_playlists(playlists):\n print(\"From playlists callback. Current playlists:\")\n for playlist in playlists:\n print(playlist)\n\n\n async def example():\n listener = pyfoobeef.EventListener(\n base_url=\"localhost\",\n port=8880,\n active_item_column_map={\n \"%artist%\": \"artist\",\n \"%title%\": \"title\",\n \"%length%\": \"length\",\n },\n )\n\n # Add callbacks for player events.\n listener.add_callback(\"player_state\", print_active_item)\n listener.add_callback(\"playlists\", print_playlists)\n\n # Start listening for events from the player.\n await listener.connect(reconnect_time=1)\n\n await asyncio.sleep(10)\n\n # The last received information about the player state and playlists\n # can be accessed from the listener object itself.\n print(\"From the last player state object saved to listener.\"\n \" Active item is:\")\n print(listener.player_state.active_item)\n print(\"Estimated playback position: \",\n listener.player_state.estimated_position_mmss())\n for playlist in listener.playlists:\n print(playlist)\n\n await asyncio.sleep(10)\n\n # The listener should always be disconnected when done.\n await listener.disconnect()\n\n\n asyncio.run(example())\n\n\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Ada-Kru/pyfoobeef", "keywords": "Foobar2000 DeaDBeeF Media Player Beefweb Music Audio", "license": "", "maintainer": "", "maintainer_email": "", "name": "pyfoobeef", "package_url": "https://pypi.org/project/pyfoobeef/", "platform": "", "project_url": "https://pypi.org/project/pyfoobeef/", "project_urls": { "Homepage": "https://github.com/Ada-Kru/pyfoobeef" }, "release_url": "https://pypi.org/project/pyfoobeef/0.9.0.4/", "requires_dist": [ "urllib3", "aiohttp (>=3)", "aiohttp-sse-client" ], "requires_python": ">=3.6", "summary": "Allows control of the Foobar2000 and DeaDBeeF media players in Python through the beefweb plugin.", "version": "0.9.0.4" }, "last_serial": 5863042, "releases": { "0.9.0.1": [ { "comment_text": "", "digests": { "md5": "c45138496e08064d87d0012c23e6132f", "sha256": "e36f7120f75a2218f18b7c212672c6103008e28c5fe1901cb2281390bde8ecc6" }, "downloads": -1, "filename": "pyfoobeef-0.9.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c45138496e08064d87d0012c23e6132f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 23356, "upload_time": "2019-09-14T21:55:09", "url": "https://files.pythonhosted.org/packages/52/3e/307253057d601df46a050e47058683bd7a25114b507d72f2399f01e184ff/pyfoobeef-0.9.0.1-py3-none-any.whl" } ], "0.9.0.2": [ { "comment_text": "", "digests": { "md5": "e3ffe794348db2b6eda96f17d68ecbc2", "sha256": "799c77308713bc381003355d2fe86ff3b5a1d52f84c3fde637f0c9880cdb7070" }, "downloads": -1, "filename": "pyfoobeef-0.9.0.2post1-py3-none-any.whl", "has_sig": false, "md5_digest": "e3ffe794348db2b6eda96f17d68ecbc2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 24052, "upload_time": "2019-09-15T20:15:05", "url": "https://files.pythonhosted.org/packages/f7/3d/d151184d93debe8f2c690b7832f59a4cc51c2824e381875cfee006a397d5/pyfoobeef-0.9.0.2post1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "87953f2d8dafaf3613891b6c28fe13bc", "sha256": "fca8b2501f815a3419d030dbd59feefa91a92525877dac1818f3493f26a8ad78" }, "downloads": -1, "filename": "pyfoobeef-0.9.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "87953f2d8dafaf3613891b6c28fe13bc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 23511, "upload_time": "2019-09-14T23:28:22", "url": "https://files.pythonhosted.org/packages/c6/37/3786ef421570c23d6dbffe67541443560effa0deaee6f1dfb0cf24a2701e/pyfoobeef-0.9.0.2-py3-none-any.whl" } ], "0.9.0.3": [ { "comment_text": "", "digests": { "md5": "489fa434386691afc6c788cf0cc61076", "sha256": "9535efcf4e9b6f723f6578ea5b606852a67a2af52c88ef1ae8709288e7199c42" }, "downloads": -1, "filename": "pyfoobeef-0.9.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "489fa434386691afc6c788cf0cc61076", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 24052, "upload_time": "2019-09-15T20:20:48", "url": "https://files.pythonhosted.org/packages/ef/a3/96d155b0afb812150d0403f5022f816126f06e2de87a3f55813381ac0499/pyfoobeef-0.9.0.3-py3-none-any.whl" } ], "0.9.0.4": [ { "comment_text": "", "digests": { "md5": "3d46c5d706d1a022aa7db256a273d60b", "sha256": "4f0bb182a80da46d2385875858f210b83cc14607c020a25e9813a697fcbf6688" }, "downloads": -1, "filename": "pyfoobeef-0.9.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "3d46c5d706d1a022aa7db256a273d60b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 24174, "upload_time": "2019-09-15T20:47:48", "url": "https://files.pythonhosted.org/packages/df/9d/6fdbd705963bf42a1b137ee9aad33067c7470a1525c96eca8d25effa877d/pyfoobeef-0.9.0.4-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3d46c5d706d1a022aa7db256a273d60b", "sha256": "4f0bb182a80da46d2385875858f210b83cc14607c020a25e9813a697fcbf6688" }, "downloads": -1, "filename": "pyfoobeef-0.9.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "3d46c5d706d1a022aa7db256a273d60b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 24174, "upload_time": "2019-09-15T20:47:48", "url": "https://files.pythonhosted.org/packages/df/9d/6fdbd705963bf42a1b137ee9aad33067c7470a1525c96eca8d25effa877d/pyfoobeef-0.9.0.4-py3-none-any.whl" } ] }