cross-posted from: https://piefed.zip/c/rust@programming.dev/p/1873943/mpris-lyrics-a-simple-linux-cli-that-displays-synced-lyrics-from-the-mpris-xesam-astext-pr
So yeah, as the probably unnecessarily long title says, this is a CLI that displays the current playing lyrics, but instead of trying to go online and fetch a match it just uses the already there
xesam:asTextproperty in MPRIS.Sadly a lot of popular players that implement the MPRIS2 standard still don’t implement that specific one, so it wont work with them. Even the one used in the showcase had to be modified, tho I am hopefully gonna upstream it soon.
I am very strict about AI usage, so for this project the only hint of AI that was used was for tab auto completion that is just used for boilerplate like, idk, implementing the
Defaulttrait forPlayerState(not including the actual trickymetadata_last_updatedpart). Safe to say it was only one notch above no AI at all.So yeah, here you go give it a try and feel free to roast me, after all this is my first cli and cargo publish ;)


Expanding on this further, but the best kind of documentation for what a value represents is its type. Since all of these are duration-related, I would even go as far as using only
Durationtypes for these. The values in Hz (aka n/sec) can be inversed to turn them intoDurations (which happens below them to createREFRESH_DURATIONandMETADATA_REFRESH_DURATIONwhich, despite their names, are actually intervals from what I can tell).yeah, thinking about it, probably the naming of those isn’t the best, will make sure to change them and use doc comments
tho, I will probably keep the 2 Hz consts (while adding a _HZ in both their names) as they make it easier to understand imo [changed my mind: I guess it is easier if it is just the intervals]
thank u both for actually caring :)