38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
"""
|
|
Patches the library "PyAudacity" to work with Tenacity.
|
|
"""
|
|
|
|
import traceback
|
|
|
|
from utils import inputYN
|
|
|
|
print('This patches the PyAudacity library to work with Tenacity.')
|
|
print('Also I\'m pretty sure this is only required if you run Linux.')
|
|
print('DO NOT USE THIS IF YOU USE AUDACITY.')
|
|
print('If you\'d like to undo the patch, just reinstall PyAudacity through pip.')
|
|
print('')
|
|
cont = inputYN('Would you still like to continue? (y/n) > ')
|
|
|
|
if not cont:
|
|
print('User abort.')
|
|
exit()
|
|
|
|
try:
|
|
import pyaudacity
|
|
except ImportError as e:
|
|
print('There was an error importing pyaudacity. Do you have the library installed?')
|
|
print(traceback.format_exc())
|
|
exit(1)
|
|
|
|
print(f'Found PuAudacity at {pyaudacity.__file__}')
|
|
|
|
print('Patching...')
|
|
with open(pyaudacity.__file__, 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
with open(pyaudacity.__file__, 'w', encoding='utf-8') as f:
|
|
f.write(content.replace('audacity_script_pipe', 'tenacity_script_pipe'))
|
|
|
|
print('Done.')
|
|
input('Press enter to continue...')
|