October 2018
Intermediate to advanced
420 pages
10h 26m
English
The current implementation of the encoding driver returns the full path of the file that has been encoded. This made sense in the previous implementation because the encoding driver also wrote the transcoded file at its destination location. Now that the transcoded file is saved on a database, this must change. Instead, the encoding driver should return the data from the transcoded file, so that it can be written anywhere. For this, some evolutions are needed in the audio encoding function of the driver, as demonstrated in the following example:
def mp3_to_flac(data): tmp_filename = os.path.join('/tmp/transcode-tmp.mp3') tmp2_filename = os.path.join('/tmp/transcode-tmp.flac') with open(tmp_filename, 'wb') ...