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

Support regex in players whitelist #33

Closed
BachoSeven opened this issue Dec 28, 2023 · 3 comments · Fixed by #34
Closed

Support regex in players whitelist #33

BachoSeven opened this issue Dec 28, 2023 · 3 comments · Fixed by #34
Labels
enhancement New feature or request

Comments

@BachoSeven
Copy link
Contributor

BachoSeven commented Dec 28, 2023

Use case: I'd been using sptlrx to get the lyrics for ncspot, a TUI Spotify player, and for a few versions it's not advertised as "ncspot" on MPRIS, but instead as ncspot.instancexxxxx, where xxxxx is a random number like 23409.

For this reason, it would be really useful to be able to write a regex such as

mpris:
  players: [ncspot.instance*, tauon, spotify]

instead of removing the whitelist altogether (which would mean that things like Chrome tabs get recognised as lyrics).

Thanks for making this project btw, it's awesome!

@raitonoberu raitonoberu added the enhancement New feature or request label Dec 28, 2023
@raitonoberu
Copy link
Owner

This will definitely be added, how nice that Go has a built-in function for such matching :)

Thank you for staying here from the very beginning, I really appreciate it.

@BachoSeven
Copy link
Contributor Author

BachoSeven commented Jan 8, 2024

By the way, I've given it a little more thought and the initial issue can be solved more systematically (and with less user intervention) by checking both for the player's Name and Name.instanceXXXXX, for players which allow multiple instances to be running at the same time as specificed in the MPRIS spec.

This is how it also was implemented in the rescrobbled project.

I can make another PR if you want, and I think that with hindsight there is no other reason for matching regexes (which was a workaround for this problem in the first place).

@raitonoberu
Copy link
Owner

This is a good find. I agree that this solution is much better. If you have some spare time, I would appreciate it if you could make a PR. The last release is still quite "hot", so we could release v1.2.1 without waiting another six months :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants