Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mvdwetering/aioytmdesktopapi
Python library to communicate with a YouTube Music Desktop instance
https://github.com/mvdwetering/aioytmdesktopapi
Last synced: about 13 hours ago
JSON representation
Python library to communicate with a YouTube Music Desktop instance
- Host: GitHub
- URL: https://github.com/mvdwetering/aioytmdesktopapi
- Owner: mvdwetering
- License: apache-2.0
- Created: 2022-06-18T13:33:04.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-01T11:27:58.000Z (8 months ago)
- Last Synced: 2024-08-09T23:47:35.894Z (3 months ago)
- Language: Python
- Size: 29.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# YouTube Music Desktop Remote Control API
Async IO API package for [YouTube Music Desktop app](https://ytmdesktop.app/).
> This package currently supports the API used by YTMDv1
## Installation
```bash
python3 -m pip install aioytmdesktopapi
```## Contents
This package contains the `YtmDesktop` class which represents the API.
Check the [API documentation](https://github.com/ytmdesktop/ytmdesktop/wiki/Remote-Control-API) to see what functionality is available and how to use it.## Example usage
Check `example.py` for a runnable example.
```python
async with aiohttp.ClientSession() as session:
async with YtmDesktop(session, "192.168.1.123", password="PASSWORD") as ytmdesktop:
# Initialize first before using any of the functionality
await ytmdesktop.initialize()# Print status of some attributes
print(f"{ytmdesktop.player.has_song=}")
print(f"{ytmdesktop.player.is_paused=}")
print(f"{ytmdesktop.track.author=}")
print(f"{ytmdesktop.track.title=}")
print(f"{ytmdesktop.track.album=}")# Pause the current track
await ytmdesktop.send_command.track_pause()
# Call `.update()` to update the internal state of the API with the state of the actual player instance
await ytmdesktop.update()
# Print updated state
print(f"{ytmdesktop.player.is_paused=}")time.sleep(2)
# Play the current track
await ytmdesktop.send_command.track_play()
# Call `.update()` to update the internal state of the API with the state of the actual player instance
await ytmdesktop.update()
# Print updated state
print(f"{ytmdesktop.player.is_paused=}")
```