Closes #688 (closed)
This Merge Request includes:
A changelog fragment (cf https://docs.funkwhale.audio/contributing.html#changelog-management)
In-place imported tracks have no audio_file attribute but only a source attribute. The transcoding code assumes that the file has an audio_file attribute, so it failed on these cases.
By splitting the transcoding function into one that takes files, and one that takes pydub.AudioSegment, we can make a method on Upload that gives the AudioSegment, either by reading from self.audio_file.open() or open(self.source).
It looks like transcode_file is not used anywhere else, so it could also be an option to delete it entirely and just preserve the function that takes an AudioSegment. Is the function needed for any planned changes?
Another option would be to allow passing open files to transcode_file, which only opens them if it is needed. I'm not sure how to do this idiomatically.