Skip to main content

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.

image Above: The Discord RPC Application using Py Now Playing and Pypresence

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_now_playing-0.1.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

py_now_playing-0.1.0-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

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

Hashes for py_now_playing-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d754aef8652d5477a92ac7871c9795d0c7e92ba91e82e8857ee81dc24c7bfcd8
MD5 e502e5d7055fda39ecfafd5118535df7
BLAKE2b-256 b81be5bdd2437865e1605b8ed35d2ebf44a5360cc3c76ddd04ef1e918daf726c

See more details on using hashes here.

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

Hashes for py_now_playing-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c07541b36de7e115bdaad26d2f2849b39a8fd6a14849c903e0af3c78a6dd91e
MD5 4f0024d5b27f0d91ac92771f8f95cc56
BLAKE2b-256 611395f6076d0eb69b7d0631d3d5957f2425e7a00e465d75335fd37997336d73

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page