Skip to Content
Hands-On Reactive Programming with Python
book

Hands-On Reactive Programming with Python

by Romain Picard
October 2018
Intermediate to advanced
420 pages
10h 26m
English
Packt Publishing
Content preview from Hands-On Reactive Programming with Python

Returning data in the encoding driver

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') ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Programming with Design Patterns

Python Programming with Design Patterns

James W. Cooper

Publisher Resources

ISBN: 9781789138726Supplemental Content