Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Could be the case that a playlist, or an artist with two identical albums have identical tracks. Freyr, resolving them to the same source, ends up downloading the track to the same cache stage, encoding and writing it out to the same output file.
Lots of potential for clashes, and race conditions. At the end of the day, the file may end up corrupt.
It's a game of russian roulette, basically.
This patch makes it so, a file is only ever touched by freyr once in the entire lifetime of the program's execution.
So if a track is being downloaded by being on another album, that download task carries through for the whole program.
And if they're writing to the same file, well, only one gets to do the writing.