A Python Library to get the currently playing media
Project description
Py Now Playing
This project started as me wanting to create a Discord RPC that would take the currently playing audio from a specified application, and put that onto my Discord activity. I found some windows apis that allow me to do this, however they weren't intuitive to use. So, I started this.
How to use
# Initalize the Class
np = NowPlaying()
#initalize the mediamanager
np.initalize_mediamanager()
To get the active media apps, use get_active_app_user_model_ids()
.
Then you can use a filter or a loop to find the application you're looking for.
list(filter(lambda app: app['Name'] == 'App Name', now_playing))
Then use something like now_playing[0]['AppID']
to get the appid from the filter, and pass that into get_now_playing(app_user_model_id)
to get the currently playing media for that application.
Other Notes
I've noticed that even when using Firefox and watching YouTube videos, that the playback_type is still MediaPlaybackType.MUSIC. I'll have to figure out why and if that changes at all.
Note that if you're testing the Amazon Music RPC I made in /tests, because Amazon has a skill issue Amazon Music doesn't always report the current song to Windows properly, so it may not appear correct.
Above: The Discord RPC Application using Py Now Playing and Pypresence
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file py_now_playing-0.1.0.tar.gz
.
File metadata
- Download URL: py_now_playing-0.1.0.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.11 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d754aef8652d5477a92ac7871c9795d0c7e92ba91e82e8857ee81dc24c7bfcd8 |
|
MD5 | e502e5d7055fda39ecfafd5118535df7 |
|
BLAKE2b-256 | b81be5bdd2437865e1605b8ed35d2ebf44a5360cc3c76ddd04ef1e918daf726c |
File details
Details for the file py_now_playing-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: py_now_playing-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.11 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c07541b36de7e115bdaad26d2f2849b39a8fd6a14849c903e0af3c78a6dd91e |
|
MD5 | 4f0024d5b27f0d91ac92771f8f95cc56 |
|
BLAKE2b-256 | 611395f6076d0eb69b7d0631d3d5957f2425e7a00e465d75335fd37997336d73 |