-
Notifications
You must be signed in to change notification settings - Fork 80
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 option to output metadata as JSON #64
Comments
I don't know if this is something to really be concerned about. It's a weird output format and I don't think anyone is parsing it.
The only concern I have is adding a dependency. What is the use case you have for parsing the json that can't be handled with getting a metadata prop with a command such as |
@acrisci It would just be nice to be able to get all of the metadata at once rather than querying for each prop individually (which is what I'm doing now). Other than that, there's not a huge need for it. I definitely understand the concern for adding a dependency. Maybe a simpler option would be to just output newline-delimited |
Yeah, that is a bit awkward and you bring up some good points that the current output format is weird. But I think json is a bit overkill if you're just trying to print something like "artist -title" or something. I've thought of a few ways to make this easier. Let me know if you like these ideas better than the json. Idea 1: tsv output format
Idea 2: format string Playerctl metadata queries accept a format string like this:
This prints |
What about just modifying the E.g. $ playerctl metadata xesam:artist xesam:title mpris:length xesam:userRating
Bonobo
Outlier
475000000
1 |
I think these are all good ideas :) let's break this up into separate issues and close this since we can do the same thing without a dependency. If you want to work on any of them feel free to pick it up. If anyone has a use case that is not covered here where you really need json, feel free to reopen. |
Sounds good, opened #68 and closing this. |
I'm having a bit of a tough time parsing the metadata output.
According to #22, it's formatted in "GVariant", which is rather obscure and lacks many utilities to assist with parsing it.
It seems a more standard format like JSON would make more sense.
Adding a flag like
--output=FORMAT
whereFORMAT
is one ofjson
,gvariant
, etc. and keepinggvariant
as the default would ensure this change wouldn't break any existing dependent code.The text was updated successfully, but these errors were encountered: