/foreign-subs

Source code for

Primary LanguagePythonMIT LicenseMIT

Welcome

This is the repository for https://foreignsubs.com. It is currently a work in progress.

In short, the purpose of ForeignSubs is to document when a movie or tv show has foreign subtitles.

Foreign subtitles are defined as subtitles that exist to display information either not spoken but is relevant (e.g. 3 months later) or language spoken that is not in the main language of the media. So if the main language of the movie is in English, but there are some lines in Italian, the spoken Italian lines would be considered foreign subs.

How to Run

Technologies

ForeignSubs is built in three parts: A frontend built in TypeScript using Angular, a RESTful API built in Python3 using FastAPI, and MongoDB as the database.

Database

Inside the docker folder, run docker-compose up -d to launch MongoDB. Run docker-compose down to stop.

  • Make sure to update the database username and password if you are using this in production.

Backend

Fsubs uses Poetry to handle dependency management. You can install Poetry by running curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -.

Then installfsubs by running poetry install inside of the backend directory.

You can now run fsubs by running poetry run fsubs. Add --help for additional options.

Configuration

The --config/-c option lets you use a custom config file. It should be in ini format.

NOTE:

If you want to reload automatically while developing, you must create a file in backend/fsubs/config called default_reload.ini. In the section called [app] set reload=True.

Best practice: copy default.ini to default_reload.ini and change reload from False to True.

Environment Variables

fsubs can be configured using environment variables. They correspond to the command line options as follows:

Environment Variable CLI Option Description
FSUBS_APP_BASE_URL --base_url Set base url.
FSUBS_APP_BIND_ADDRESS --bind-address Set app bind IP address.
FSUBS_APP_BIND_PORT --bind-port Set app bind port.
FSUBS_APP_JWT_ALGORITHM --jwt_algorithm Set jwt algorithm. See pyjwt docs for possible values.
FSUBS_APP_JWT_EXPIRES --jwt_expires_hours Set jwt expire time in hours.
FSUBS_APP_JWT_SECRET --jwt_secret Set the jwt secret used for encoding/decoding.
FSUBS_APP_LOG_LEVEL --log-level Set app log level; valid values are debug,info,warning,error,critical.
FSUBS_DB_HOSTNAME --db-hostname Set the database hostname.
FSUBS_DB_PASSWORD --db-password Set the database password.
FSUBS_DB_PORT --db-port Set the database port.
FSUBS_DB_USERNAME --db-username Set the database username.

Configuration Order

Configuration values are read in the following order:

  • CLI params
  • environment vars
  • custom config file
  • default_reload.ini config
  • default.ini config

Frontend

This project was generated with Angular CLI version 8.1.1.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

More information for the frontend can be found in the frontend folder README.

License

This code is released under the MIT License. See the LICENSE file for details.

Authors

Thanks to all contributors of this repo! If you would like to contribute you can contact the authors or open a Github issue.