Skip to content

Latest commit

 

History

68 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask Mega Downloader

A small Flask app for managing MEGA downloads from a browser.

It queues public MEGA links into approved local folders, shows live job status, can extract common archive formats, and can remux decrypted Blu-ray folder backups into MKV files.

Install or update in Proxmox

For an existing Debian or Ubuntu Proxmox LXC:

bash -c "$(curl -H 'Cache-Control: no-cache' -fsSL https://raw.githubusercontent.com/dashdogy/FlaskMegaDownloader/master/install/proxmox-helper.sh)"

The helper script is safe to run again. On first run it installs the app under /opt/flask-mega-downloader; later runs update the checkout, refresh the virtualenv, reinstall the systemd unit, and restart the service.

It also handles the usual host setup:

  • Creates /etc/flask-mega-downloader/config.py once and preserves it on update
  • Generates a one-time admin password if auth has not been configured
  • Installs MEGAcmd and prompts for mega-login when needed
  • Installs mediainfo
  • Tries to build and install the MakeMKV CLI for Blu-ray remux jobs
  • Offers to enable the systemd service at boot

Supported LXC guest versions:

  • Debian 11, 12, 13
  • Ubuntu 20.04, 22.04, 24.04

What it does

  • Queues one or more public MEGA links
  • Resolves supported public filecrypt.cc container pages
  • Uses MEGAcmd for real downloads
  • Shows live download, archive, media, and log state in the UI
  • Restricts browsing and output paths to configured roots
  • Extracts ZIP, RAR, and 7Z archives
  • Supports password-protected ZIP files
  • Can auto-sort extracted video files into saved Movies and TvShows move favorites
  • Remuxes decrypted Blu-ray BDMV folder backups with MakeMKV
  • Grants Plex read/write ACLs for completed outputs when enabled

Local development

python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -r requirements.txt
python app.py

By default the app binds to 0.0.0.0:8090 and built-in auth is enabled.

For local UI work, either set AUTH_ENABLED = False in your config or set ADMIN_PASSWORD_HASH to a Werkzeug password hash.

The fake backend is available for UI testing:

MEGA_DOWNLOADER_BACKEND=fake python app.py

Example fake URLs:

  • https://example.local/sample.zip
  • https://example.local/encrypted.zip?pw=secret123
  • https://example.local/archive.7z

Configuration

The app only writes inside saved destination roots. A minimal config looks like:

from pathlib import Path

ALLOWED_DESTINATIONS = {
    "downloads": {"label": "Downloads", "path": Path("/srv/mega-downloads")},
    "media": {"label": "Media", "path": Path("/srv/media/incoming")},
}

Common settings:

  • MEGA_DOWNLOADER_CONFIG: path to a config file
  • MEGA_DOWNLOADER_BACKEND: auto, mega, or fake
  • MEGA_DOWNLOADER_HOST / MEGA_DOWNLOADER_PORT: bind address
  • MEGA_DOWNLOADER_AUTH_ENABLED: enable or disable built-in auth
  • MEGA_DOWNLOADER_ADMIN_USERNAME: admin username
  • MEGA_DOWNLOADER_ADMIN_PASSWORD_HASH: admin password hash
  • MEGACMD_BINARY: override mega-get
  • MAKEMKVCON_BINARY: override makemkvcon
  • MEDIAINFO_BINARY: override mediainfo
  • SEVEN_ZIP_BINARY: override 7z

Runtime state is stored in SQLite. If an old jobs.json file exists, the app imports it on first boot after upgrade and then renames it so the migration is not repeated.

MEGA login

The Proxmox install runs the service as www-data with HOME=/var/www, so MEGAcmd keeps its session across restarts.

Check login state:

runuser -u www-data -- env HOME=/var/www mega-whoami

Log in manually:

runuser -u www-data -- env HOME=/var/www mega-login your@email.example 'your-password'

In auto mode, missing MEGAcmd causes submissions to fail with a clear error. Use MEGA_DOWNLOADER_BACKEND=fake only when you want the simulator.

Blu-ray remux

Blu-ray jobs are submitted from the explorer by selecting decrypted Blu-ray folders and using Compile Selected Blu-rays.

Current behavior:

  • Source must be a BDMV folder backup
  • The app picks the main feature by duration and size
  • Output is a lossless MKV remux with all tracks kept
  • Existing output files are not overwritten
  • MediaInfo is used for verification and Dolby Vision / Atmos signals

MediaInfo verification is useful, but it is not a playback guarantee for every Plex client, display, AVR, or soundbar.

systemd

The included service runs Waitress as www-data:

  • Working directory: /opt/flask-mega-downloader
  • Config: /etc/flask-mega-downloader/config.py
  • Home: /var/www
  • Launcher: server.py

Useful checks:

systemctl status flask-mega-downloader
runuser -u www-data -- env HOME=/var/www mega-whoami
makemkvcon --help
mediainfo --Version

Security notes

  • Built-in auth is enabled by default
  • POST routes require CSRF tokens
  • Explorer access is restricted to configured roots
  • Routine actions use relative paths inside saved roots
  • Archive extraction validates output paths before writing
  • Download commands are run with argument lists, not shell expansion
  • Plex access uses setfacl for the configured Plex user instead of broad world-writable permissions

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages