Alec Benjamin mentioned!
Neat project.
Alec Benjamin mentioned!
Neat project.
The Media Player Remote Interfacing Specification (MPRIS) is a standard D-Bus interface which aims to provide a common programmatic API for controlling media players.
This metadata is only for media streams, not something that would be embedded as metadata in a file?
There's another notch where you only ask questions and do the writing alone
Small nitpick that I noticed while skimming the code:
Where you define your constants, you can change those comments to be doc-comments instead, so that your editor can display them when you hover over constants.
And personally, I would go one step further with the units, by putting them at the end of the name of the constant, like you did with some variables in the code. That way, the unit shows up inline while reading code that uses the constant, which makes it easy to see that units match up (or not).
Side-note: You don't have to denote the unit for Duration. You construct it from milliseconds, but then it's unitless and you decide where you use it in what unit you want the value. So, Duration is very cool and I would recommend using it for LRC_START_THRESHOLD as well.
But yeah, back to the comments-thing: Plain comments are kind of inherently crappy, because they only show up in one place in the code, so you're less likely to see them and less likely to update them. By putting things into doc-comments, names, log statements, error messages etc., they show up in at least two places.
Plain comments only really make sense for explaining why the code does something. The what can generally be explained in other ways, at least in a sufficiently abstracted language like Rust.
Side-note: You don't have to denote the unit for
Duration. You construct it from milliseconds, but then it's unitless and you decide where you use it in what unit you want the value. So,Durationis very cool and I would recommend using it forLRC_START_THRESHOLDas well.
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 Duration types for these. The values in Hz (aka n/sec) can be inversed to turn them into Durations (which happens below them to create REFRESH_DURATION and METADATA_REFRESH_DURATION which, 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 :)
all 5 comments