This is the backend for Media Translator. It gets, changes, and sets MOGRTs using Premiere application. It also has the ability to launch more than once instance of Premire with with the exchange CEP panel starting on different ports.
This backend requires a CEP panel made by me. This CEP panel runs two JSX files, one that gets MOGRTs and one that sets MOGRTs.
You can download the CEP panel from here:
https://github.com/Chubek/cep-panel-for-carlo
So here's how it works. You first send a request to /get_txt_jsons
, given a save path, and your current .prproj
file. It will exract the texts, and save them in the save path as a singular JSON file that resembles sample_json.json
.
After that is all done, you should change the JSONs yourself or via a frontend. In casae of the latter, please send a request to /change_jsons
. It will change the JSON file based on the jsons in the request body.
Then send a request to /set_txt_jsons
. It will set the MOGRTs for the file based on the saved JSON.
This is a concurrent application. It uses Sandboxie to launch multiple instances of Premiere. Even if you're testing it locally, DO NOT run Premiere yourself. Use /op_prem_instance
. It will launch a Premiere instance with the CEP panel's port set to the port youp give it. You can also stop a certain instance using this endpoint.
The following table lists the endpoints of this backend:
Endpoint | Body/Args | Job |
---|---|---|
GET /op_prem_instance?port=port&action=action | action: start or stop port: Target port |
Starts or stops a Premiere instance |
POST /get_txt_jsons | project_id: ID of the project, can be anything job_id: ID of the job, can be anything save_path: Path to save the JSONs current_file: Current prproj file |
Gets the MOGRTs and saves them in a folder |
POST /set_txt_jsons | project_id: ID of the project, can be anything job_id: ID of the job, can be anything save_path: Path to the saved the JSONs current_file: Current prproj file |
Sets the MOGRTs based on what is in the folder |
POST /change_jsons | save_path: Path to the JSONs req_jsons: An array of JSONs you have changed, refer to sample_jsons.json . |
Change JSONs in folder. |
Create a file called .env
in the root. It should contain the following environment variables:
Variable | Job |
---|---|
ASSIGN_PORT_LOC | A text file that contains all the assigned ports, no need to create it. |
BUSY_PORT_LOC | A text file that contains all the busy ports. No need to document it. |
ADDRESS | Your address, like localhost. |
PATH_TO_PREMIERE | Path to Premiere executable file. |
- Clone.
- Create a Conva env or a VirtualEnv.
pip install -r requirements.txt
- Run the pywin32 post install script
- Run
python prem_app.py
This app is still in the testing stage. Report errors to Chubak#7400.