This repository was archived by the owner on Jun 3, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed
Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -17,13 +17,13 @@ def __create_converted_file(file_path, encoding):
1717 .set_channels (1 ) \
1818 .set_sample_width (2 ) \
1919 .set_frame_rate (__sample_rate (audio_segment )) \
20- .export (os .environ ['CLEANSIO_CONVERSION ' ], format = encoding )
20+ .export (os .environ ['CLEANSIO_TEMP_FILE ' ], format = encoding )
2121
2222def convert (file_path , encoding = 'wav' ):
2323 """ Converts an audio file's encoding, returns the file path """
2424 milliseconds = int (round (time .time () * 1000 ))
2525 temp_dir = create_temp_dir ()
26- os .environ ['CLEANSIO_CONVERSION ' ] = temp_dir + \
26+ os .environ ['CLEANSIO_TEMP_FILE ' ] = temp_dir + \
2727 str (milliseconds ) + '.' + encoding
2828 __create_converted_file (file_path , encoding )
29- return os .environ ['CLEANSIO_CONVERSION ' ]
29+ return os .environ ['CLEANSIO_TEMP_FILE ' ]
Original file line number Diff line number Diff line change @@ -26,8 +26,8 @@ def setup_cleanup():
2626def remove_conversions ():
2727 """ Removes converted WAV file """
2828
29- if 'CLEANSIO_CONVERSION ' in environ :
30- temp_file = environ .get ('CLEANSIO_CONVERSION ' )
29+ if 'CLEANSIO_TEMP_FILE ' in environ :
30+ temp_file = environ .get ('CLEANSIO_TEMP_FILE ' )
3131 try :
3232 remove (temp_file )
3333 except FileNotFoundError :
Original file line number Diff line number Diff line change @@ -14,14 +14,14 @@ def test_cleanup():
1414 ## Temporary file ##
1515
1616 # Temp file shouldn't exist
17- if 'CLEANSIO_CONVERSION ' in os .environ : # Temp file var exists
17+ if 'CLEANSIO_TEMP_FILE ' in os .environ : # Temp file var exists
1818 # Fetch the name of the temp file
19- temp_file = os .environ .get ('CLEANSIO_CONVERSION ' )
19+ temp_file = os .environ .get ('CLEANSIO_TEMP_FILE ' )
2020 else : # Temp file variable doesn't exist
2121 temp_file_name = str (uuid4 ().hex ) # Fetch a random temporary file name
2222 # Create a path to the temporary file
2323 temp_file = "./{0}" .format (temp_file_name )
24- os .environ ['CLEANSIO_CONVERSION ' ] = temp_file # For function
24+ os .environ ['CLEANSIO_TEMP_FILE ' ] = temp_file # For function
2525
2626 create_temp_file (temp_file )
2727
You can’t perform that action at this time.
0 commit comments