Coder Social home page Coder Social logo

aurowora / nightconv Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 844 KB

Home Page: https://night.aurora.vg

License: GNU Affero General Public License v3.0

Makefile 0.15% HTML 0.79% TypeScript 8.83% Svelte 30.94% SCSS 2.54% JavaScript 2.83% Python 53.92%

nightconv's Introduction

Nightconv

A simple website written using FastAPI and Svelte to convert audio files into Nightcore.

Screenshot of Nightconv

Building

To compile the front end, simply run make with NodeJS and NPM installed:

make

This will compile the Svelte app and copy the public directory into the current folder so that it may be served by the application.

Configuration

The application can be configured by creating a file called .env in the working directory of the Python process. The file can also be read from elsewhere if the NCCONV_CONF environment variable has been set.

Inside this file, insert lines of form KEY=VALUE. The following configuration options are available:

Key Default Description
MONGO_URI No Default The URI to use to connect to MongoDB. Required.
MONGO_DB ncconv The name of the MongoDB database to use.
FFMPEG_BIN ffmpeg The path to the ffmpeg binary. Required if ffmpeg is not in the $PATH.
FFPROBE_BIN ffprobe Same as above, but for ffprobe.
TRUSTED_HOSTS 127.0.0.1,localhost List of domain names that this application is to be accessed from. Multiple can be specified by placing a comma between values (value1,value2). Required if not running on 127.0.0.1.
TRUSTED_CORS_HOSTS 127.0.0.1 List of domain names that are allowed to use the API from a web browser. Required if not running on 127.0.0.1.
TRUSTED_PROXIES 127.0.0.1 List of trusted proxy IP addresses. Required if running behind a proxy such as NGINX or Cloudflare (which is recommended!)
BIND_HTTP_IP 127.0.0.1 The IP to bind to. The default value is recommended almost always. If you wish to expose the application publicly, then use a reverse proxy that supports TLS like NGINX.
BIND_HTTP_PORT 8080 HTTP port to listen on.
HTTP_WORKERS # of CPUs The number of processes to spawn for handling HTTP requests.
FFMPEG_WORKERS # of CPUs The number of threads available for converting media files.
SENTRY_DSN None Enables error reporting to Sentry.
MAX_ARTIFACT_SIZE 20971520 The system will refuse to store any media file longer than this many bytes. Default is 20 MiB.

Further Notes Regarding Configuration

  • This application should be ran behind a reverse proxy rather than being directly exposed to the internet. Reverse proxies support nice things like TLS.
  • If the service is accessible from the internet, then a maximum upload size should be configured on the reverse proxy. Otherwise users could submit audio files of arbritrary size, which can easily consume large amounts of memory.
  • Audio files are stored in MongoDB using GridFS. Your database server should have sufficient storage to store these objects. A good rule of thumb is 3 - 4 MB per audio file.
  • It is safe to run multiple instances of the application against the same database.

Installing & Running

(Be sure that you've built the front-end as in Building before running the application.)

Running the application requires that python3, ffmpeg, ffprobe are all installed and available in the $PATH. Additionally, pip and virtual environment support must be present as well.

Start by initializing a virtual environment and installing the necessary dependencies:

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Then, run the main module:

python3 -m ncconv.main

You can configure the application to start on boot using your system's init daemon.

On Linux with systemd, create a new unit file at /etc/systemd/system/ncconv.service with the following contents:

[Unit]
Description = Nightconv Application Server

[Service]
Type=simple
ExecStart=/bin/sh -c 'source .venv/bin/activate && python3 -m ncconv.main'
WorkingDirectory=/path/to/this/repos/root/
User=nobody
Group=nogroup  # You may have to adjust the group names depending on your distro

[Install]
WantedBy=multi-user.target

Then, simply enable and start:

systemctl enable --now ncconv.service

License

Copyright (C) 2022 Aurora McGinnis

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation using version 3 of the License ONLY.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.

nightconv's People

Contributors

aurowora avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.