Install this library using pip
:
pip install streampot
Here's a simple example that converts a video file to an audio file:
from streampot import StreamPot
client = StreamPot(secret='yourToken')
job = client.input('https://download.samplelib.com/mp4/sample-5s.mp4') \
.output('audio.mp3') \
.run_and_wait()
print(job.outputs['audio.mp3'])
If you want to run the job in the background, you can use the run
method:
job = client.input('https://download.samplelib.com/mp4/sample-5s.mp4') \
.output('audio.mp3') \
.run()
And fetch the job info using the get_job
method:
job = client.get_job(job.id)
print(job.status)
print(job.outputs['audio.mp3']) # output url by file name
print(job.logs) # error logs if any
print(job.created_at)
print(job.completed_at)
To contribute to this library, first checkout the code. Then create a new virtual environment:
cd streampot
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest