Skip to content
/ vdator Public
forked from werrpy/vdator

Remux validator Discord bot

License

Notifications You must be signed in to change notification settings

MiM-MiM/vdator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vdator

Remux validator Discord bot

Code style: black Test Dependencies Integration Tests

Takes a Pastebin link with BDInfo and MediaInfo dump, and validates the remux.

Checks:

Video track names
Movie/TV name format
IMDB/TMDB ids
Filename
Video language matches first audio language
No muxing mode
Uses latest mkvtoolnix
Video and audio track names match
DTS-HD MA 1.0/2.0 to FLAC, LPCM 1.0/2.0 to FLAC, LPCM > 2.0 to DTS-HD MA
Commentary to AC-3 @ 224 kbps
Commentary track people and spellcheck
Subtitle order
Subtitle default flag
Should have chapters
Chapter languages
Chapter padding

Table of Contents

Supported pastebin sites

Setup

Requires Python >= 3.5.4, tested with Python >= 3.7

Create a Discord bot and add it to a server. Edit vdator/.env and set DISCORD_BOT_SECRET to your bot's token.

Request a TMDB API Key and set TMDB_API_KEY.

Don't forget to create channels on the server and set them in vdator/.env for REVIEW_CHANNELS, REVIEW_REPLY_CHANNELS, and BOT_CHANNELS.

Create a python3 virtual environment:

Use pip and virtual env to run vdator.

In the vdator directory run:

python3 -m venv .

If the command fails to install pip, you will see an error similar to:

Error: Command '['python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

Start over by creating a virutal environment without pip, and then install pip manually inside it:

python3 -m venv --without-pip .
source bin/activate
curl https://bootstrap.pypa.io/get-pip.py | python3
deactivate

Installing dependencies

Install PyHunSpell

Install dependencies

source bin/activate
pip3 install -r requirements.txt
deactivate

Updating dependencies

source bin/activate
pip3 install -r requirements.txt --upgrade
pip3 freeze > requirements.txt
deactivate

Running manually

Run the bot manually for testing, exceptions will get printed:

source bin/activate
python3 main.py

Running with systemd

Create a systemd service to run vdator, /etc/systemd/system/vdator.service

[Unit]
Description=vdator
After=multi-user.target

[Service]
WorkingDirectory=/home/USER/vdator/venv/vdator
User=
Group=
ExecStart=/home/USER/vdator/venv/bin/python3 /home/USER/vdator/venv/vdator/main.py
Type=idle
Restart=always
RestartSec=15

[Install]
WantedBy=multi-user.target

Set User to the user to run vdator as, and Group to the user's group (list with groups), usually both are the username. Replace /home/USER/vdator/venv/ with the full path to your venv.

Run systemctl enable vdator to start on boot. Use systemctl to start/stop vdator, systemctl start vdator, systemctl stop vdator, systemctl restart vdator

Lint

black .

Using

Type !help in one of the bot channels for more information.

Adding a pastebin site

Edit vdator/data/urls.json and add your pastebin site.

# hostname
'example.com': {
    # regex to get paste's unique identifier
    'slug_regex': 'https://example.com/(.*)',
    
    # link to raw text using {} in place of the unique identifier
    'raw_url': 'https://example.com/raw/{}'
}

API

Run with python api.py

Example using Postman:

POST http://127.0.0.1:5000/text
    Body, raw
    [INSERT TEXT HERE]

Gives back json:

{
	"discord_reply":"...",
	"html_reply":"..."
}

discord_reply - the text that the bot usually sends to discord
html_reply - discord text formatted as html

Insert the html_reply text into the example_html_viewer.html to see it formatted simialr to discord.

About

Remux validator Discord bot

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.4%
  • Shell 1.1%
  • HTML 0.5%