Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metadata support to Snapcast media players #132283

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from

Conversation

mill1000
Copy link
Contributor

@mill1000 mill1000 commented Dec 4, 2024

Proposed change

Add metadata support to Snapcast media players.

Snapcast streams can contain metadata provided via a stream plugin or natively.

Snapcast includes metadata support for the following sources:

  • Librespot via stream plugin
  • Mopidy via stream plugin
  • MPD via stream plugin
  • Airplay natively

Additionally I have developed a stream plugin for UPnP renderers: https://github.com/mill1000/snapcast-upnp

Example Screenshots
UPnP Stream Plugin
330454032-bb276db4-d279-4e23-99ad-5087613552e6

Airplay Native
330456246-49a6b188-a1d2-419b-8fc8-bb944b3ffa79

This is a redo of my original PR #117372 which was split into multiple phases.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes # N/A
  • This PR is related to issue: N/A
  • Link to documentation pull request: N/A

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • [N/A] The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • [N/A] New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • [N/A] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant
Copy link

home-assistant bot commented Dec 4, 2024

Hey there @luar123, mind taking a look at this pull request as it has been labeled with an integration (snapcast) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of snapcast can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign snapcast Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@joostlek
Copy link
Member

joostlek commented Dec 4, 2024

Snapcast includes support for the following sources

The integration or the software/devices?

@mill1000
Copy link
Contributor Author

mill1000 commented Dec 4, 2024

Snapcast includes support for the following sources

The integration or the software/devices?

The software.

@home-assistant home-assistant bot marked this pull request as draft December 18, 2024 12:45
@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@mill1000 mill1000 marked this pull request as ready for review December 18, 2024 23:53
@home-assistant home-assistant bot requested a review from joostlek December 18, 2024 23:53
@mill1000
Copy link
Contributor Author

mill1000 commented Jan 8, 2025

@joostlek Any additional concerns with this change?

Copy link
Member

@joostlek joostlek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I think I like to have tests for this so we can be sure that it works like we expect, but that's not a hard requirement

@home-assistant home-assistant bot marked this pull request as draft January 9, 2025 09:43
@mill1000
Copy link
Contributor Author

Ok, add some tests to check the metadata properties and some basic media player state. Plenty to expand upon as well.

I ended up switching back to Mapping[str, Any]] for the metadata property as I couldn't make mypy happy with the more complex type hint.

@mill1000 mill1000 marked this pull request as ready for review January 23, 2025 23:51
@home-assistant home-assistant bot requested a review from joostlek January 23, 2025 23:51
Update test case to better catch above mistake
@chriscn
Copy link

chriscn commented Mar 4, 2025

@mill1000 would you like any help on this, think this would be a massive value add for a lot of people using the snapcast integration.

@mill1000
Copy link
Contributor Author

mill1000 commented Mar 4, 2025

Sure! Any help would be appreciated.

I'm not aware of any additional requested changes to this PR. I think it just needs final approval and to be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants