adafruit-circuitpython-ble-apple-media


Nameadafruit-circuitpython-ble-apple-media JSON
Version 0.9.16 PyPI version JSON
download
home_page
SummarySupport for the Apple Media Service which provides media playback info and control.
upload_time2023-12-09 17:42:53
maintainer
docs_urlNone
author
requires_python
licenseMIT
keywords adafruit blinka circuitpython micropython ble_apple_media apple media ble
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Introduction
============

.. image:: https://readthedocs.org/projects/adafruit-circuitpython-ble_apple_media/badge/?version=latest
    :target: https://docs.circuitpython.org/projects/ble_apple_media/en/latest/
    :alt: Documentation Status

.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg
    :target: https://adafru.it/discord
    :alt: Discord

.. image:: https://github.com/adafruit/Adafruit_CircuitPython_BLE_Apple_Media/workflows/Build%20CI/badge.svg
    :target: https://github.com/adafruit/Adafruit_CircuitPython_BLE_Apple_Media/actions
    :alt: Build Status

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black
    :alt: Code Style: Black

Support for the Apple Media Service which provides media playback info and control.


Dependencies
=============
This driver depends on:

* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_

Please ensure all dependencies are available on the CircuitPython filesystem.
This is easily achieved by downloading
`the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_.

Installing from PyPI
=====================

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
PyPI <https://pypi.org/project/adafruit-circuitpython-ble_apple_media/>`_. To install for current user:

.. code-block:: shell

    pip3 install adafruit-circuitpython-ble-apple-media

To install system-wide (this may be required in some cases):

.. code-block:: shell

    sudo pip3 install adafruit-circuitpython-ble-apple-media

To install in a virtual environment in your current project:

.. code-block:: shell

    mkdir project-name && cd project-name
    python3 -m venv .venv
    source .venv/bin/activate
    pip3 install adafruit-circuitpython-ble-apple-media

Usage Example
=============

.. code-block:: python

    import adafruit_ble
    from adafruit_ble.advertising.standard import SolicitServicesAdvertisement
    from adafruit_ble_apple_media import AppleMediaService

    radio = adafruit_ble.BLERadio()
    a = SolicitServicesAdvertisement()
    a.solicited_services.append(AppleMediaService)
    radio.start_advertising(a)

    while not radio.connected:
        pass

    print("connected")

    known_notifications = set()

    i = 0
    while radio.connected:
        for connection in radio.connections:
            if not connection.paired:
                connection.pair()
                print("paired")

            ams = connection[AppleMediaService]
            print("App:", ams.player_name)
            print("Title:", ams.title)
            print("Album:", ams.album)
            print("Artist:", ams.artist)
            if ams.playing:
                print("Playing")
            elif ams.paused:
                print("Paused")

            if i > 3:
                ams.toggle_play_pause()
                i = 0
        print()
        time.sleep(3)
        i += 1

    print("disconnected")


Documentation
=============

API documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/ble_apple_media/en/latest/>`_.

For information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.

Contributing
============

Contributions are welcome! Please read our `Code of Conduct
<https://github.com/adafruit/Adafruit_CircuitPython_BLE_Apple_Media/blob/main/CODE_OF_CONDUCT.md>`_
before contributing to help this project stay welcoming.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "adafruit-circuitpython-ble-apple-media",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "adafruit,blinka,circuitpython,micropython,ble_apple_media,apple,media,ble",
    "author": "",
    "author_email": "Adafruit Industries <circuitpython@adafruit.com>",
    "download_url": "https://files.pythonhosted.org/packages/c0/f6/4362545836450111d209aca0da32d6c3fdc7e695bc723141fb037350985a/adafruit-circuitpython-ble-apple-media-0.9.16.tar.gz",
    "platform": null,
    "description": "Introduction\n============\n\n.. image:: https://readthedocs.org/projects/adafruit-circuitpython-ble_apple_media/badge/?version=latest\n    :target: https://docs.circuitpython.org/projects/ble_apple_media/en/latest/\n    :alt: Documentation Status\n\n.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg\n    :target: https://adafru.it/discord\n    :alt: Discord\n\n.. image:: https://github.com/adafruit/Adafruit_CircuitPython_BLE_Apple_Media/workflows/Build%20CI/badge.svg\n    :target: https://github.com/adafruit/Adafruit_CircuitPython_BLE_Apple_Media/actions\n    :alt: Build Status\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n    :alt: Code Style: Black\n\nSupport for the Apple Media Service which provides media playback info and control.\n\n\nDependencies\n=============\nThis driver depends on:\n\n* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_\n\nPlease ensure all dependencies are available on the CircuitPython filesystem.\nThis is easily achieved by downloading\n`the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_.\n\nInstalling from PyPI\n=====================\n\nOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from\nPyPI <https://pypi.org/project/adafruit-circuitpython-ble_apple_media/>`_. To install for current user:\n\n.. code-block:: shell\n\n    pip3 install adafruit-circuitpython-ble-apple-media\n\nTo install system-wide (this may be required in some cases):\n\n.. code-block:: shell\n\n    sudo pip3 install adafruit-circuitpython-ble-apple-media\n\nTo install in a virtual environment in your current project:\n\n.. code-block:: shell\n\n    mkdir project-name && cd project-name\n    python3 -m venv .venv\n    source .venv/bin/activate\n    pip3 install adafruit-circuitpython-ble-apple-media\n\nUsage Example\n=============\n\n.. code-block:: python\n\n    import adafruit_ble\n    from adafruit_ble.advertising.standard import SolicitServicesAdvertisement\n    from adafruit_ble_apple_media import AppleMediaService\n\n    radio = adafruit_ble.BLERadio()\n    a = SolicitServicesAdvertisement()\n    a.solicited_services.append(AppleMediaService)\n    radio.start_advertising(a)\n\n    while not radio.connected:\n        pass\n\n    print(\"connected\")\n\n    known_notifications = set()\n\n    i = 0\n    while radio.connected:\n        for connection in radio.connections:\n            if not connection.paired:\n                connection.pair()\n                print(\"paired\")\n\n            ams = connection[AppleMediaService]\n            print(\"App:\", ams.player_name)\n            print(\"Title:\", ams.title)\n            print(\"Album:\", ams.album)\n            print(\"Artist:\", ams.artist)\n            if ams.playing:\n                print(\"Playing\")\n            elif ams.paused:\n                print(\"Paused\")\n\n            if i > 3:\n                ams.toggle_play_pause()\n                i = 0\n        print()\n        time.sleep(3)\n        i += 1\n\n    print(\"disconnected\")\n\n\nDocumentation\n=============\n\nAPI documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/ble_apple_media/en/latest/>`_.\n\nFor information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.\n\nContributing\n============\n\nContributions are welcome! Please read our `Code of Conduct\n<https://github.com/adafruit/Adafruit_CircuitPython_BLE_Apple_Media/blob/main/CODE_OF_CONDUCT.md>`_\nbefore contributing to help this project stay welcoming.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Support for the Apple Media Service which provides media playback info and control.",
    "version": "0.9.16",
    "project_urls": {
        "Homepage": "https://github.com/adafruit/Adafruit_CircuitPython_BLE_Apple_Media"
    },
    "split_keywords": [
        "adafruit",
        "blinka",
        "circuitpython",
        "micropython",
        "ble_apple_media",
        "apple",
        "media",
        "ble"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "05ef7d30820e3ab4dffa983bc76c7b0803ed0829bf9f3d98e39814e8ab70e12a",
                "md5": "64ef8cc8854dd60fe16111030ad8da97",
                "sha256": "fc9a241a32d12a3a79c9354e4ad80fb5b879e9f0737c174085d7b488cd38ed91"
            },
            "downloads": -1,
            "filename": "adafruit_circuitpython_ble_apple_media-0.9.16-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "64ef8cc8854dd60fe16111030ad8da97",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6838,
            "upload_time": "2023-12-09T17:42:51",
            "upload_time_iso_8601": "2023-12-09T17:42:51.066325Z",
            "url": "https://files.pythonhosted.org/packages/05/ef/7d30820e3ab4dffa983bc76c7b0803ed0829bf9f3d98e39814e8ab70e12a/adafruit_circuitpython_ble_apple_media-0.9.16-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c0f64362545836450111d209aca0da32d6c3fdc7e695bc723141fb037350985a",
                "md5": "955fe2411b9c6b59eb5a66b403cbdb51",
                "sha256": "cb395f2cd31d5c74f61d85a4f36ab24abbad3f3dea0cd01ddb4f16527be9967f"
            },
            "downloads": -1,
            "filename": "adafruit-circuitpython-ble-apple-media-0.9.16.tar.gz",
            "has_sig": false,
            "md5_digest": "955fe2411b9c6b59eb5a66b403cbdb51",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 28036,
            "upload_time": "2023-12-09T17:42:53",
            "upload_time_iso_8601": "2023-12-09T17:42:53.065938Z",
            "url": "https://files.pythonhosted.org/packages/c0/f6/4362545836450111d209aca0da32d6c3fdc7e695bc723141fb037350985a/adafruit-circuitpython-ble-apple-media-0.9.16.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-09 17:42:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "adafruit",
    "github_project": "Adafruit_CircuitPython_BLE_Apple_Media",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "adafruit-circuitpython-ble-apple-media"
}
        
Elapsed time: 0.66091s