Closed SamInPgh closed 1 year ago
I think it's valid to check for a track's release date. Some tracks are released without an album, or months before the album is released. And such tracks should be playable.
From what I can see in the debug logs, there is no 'released_at' attribute defined for tracks --- only for albums. Therefore the 'if' would always evaluate as false.
Also, if a track were to be released on its own ahead of the album, as in your example, then $track->{album} would presumably be 'null' so it would still be playable according to the logic.
Looking into this a little further, it appears that Qobuz handles those advance-release "singles" by creating an album with the same name as the track and a track count of 1 --- sort of like a one-track EP. This album entry is where the 'released_at' attribute is stored. For example, Lana Del Rey has released 3 singles from her upcoming album over the last few months and each of them appears to the API as a one-track album. If a track item should ever appear without an associated album item, the 'released_at' value couldn't be checked and the track would be deemed playable, assuming it met the other criteria such as being streamable, etc.
That makes sense. And it probably also is one of the reason why some favorites can disappear again: once a track has been released on album, the streaming services could pull the standalone versions again. I'll look into this as soon as I find time. Thanks!
Populating the 'year' is for consistency only. Currently it shows up as 'undefined' in the debug log, which can be confusing. The typo is more important and could allow tracks from as-yet-unreleased albums to be played, which Qobuz probably wouldn't like. ;-)