AmpFin
AmpFin copied to clipboard
feat: Save audio type on download v2
This will save file mime-type and encode it into a negative number, and then encode it into the downloadId
key of the OfflineTrack
. When this key is nil, it defaults to -1
, which corresponds to flac
to match the old behavior, and the item downloaded in an older version can still be played.
I really don't want to resort to something like this, but the problem is out of my control, and I believe it's a SwiftData issue. I'm concerned that any further changes to the Data-schema for the Persistence Manager will be impossible until Apple fixes this migration issue. I can't even complete the migration by removing everything from the old context. However, for our current use case, this solution will work, as the downloadId
provided by URLSession is never negative, and we have a finite number of file types to support.