Get notified when a new drop is available on Twitch https://ttvdrops.lovinator.space/
  • Python 84.7%
  • HTML 15.3%
Find a file
Joakim Hellsén 4d53a46850
All checks were successful
Deploy to Server / deploy (push) Successful in 9s
Add database connection timeout option to settings
2026-02-21 23:45:43 +01:00
.github Add deployment workflow 2026-02-21 23:34:36 +01:00
.vscode rip Docker, long live systemd 2026-02-21 06:05:07 +01:00
config Add database connection timeout option to settings 2026-02-21 23:45:43 +01:00
static Add Docker support; add favicon 2026-01-09 20:28:28 +01:00
templates Add support for modern image formats (WebP and AVIF) and implement image conversion commands 2026-02-12 21:29:17 +01:00
tools/systemd rip Docker, long live systemd 2026-02-21 06:05:07 +01:00
twitch Remove caching logic from better_import_drops command and related tests 2026-02-21 17:04:31 +01:00
.env.example rip Docker, long live systemd 2026-02-21 06:05:07 +01:00
.gitignore Remove uv.lock 2026-02-07 13:58:03 +01:00
.pre-commit-config.yaml Add Silk middleware and related settings for performance monitoring 2026-02-09 20:02:19 +01:00
example.json Add DropCampaign image fallback logic and update templates for best image URL 2026-02-12 02:50:10 +01:00
manage.py Add and use pre-commit hooks 2025-11-28 04:44:07 +01:00
pyproject.toml Remove systemd dependency and remove setproctitle version constraint 2026-02-21 06:14:14 +01:00
README.md rip Docker, long live systemd 2026-02-21 06:05:07 +01:00

ttvdrops

Get notified when a new drop is available on Twitch

TL;DR (Arch Linux + PostgreSQL)

Install and initialize Postgres, then start the service:

sudo pacman -S postgresql
sudo -u postgres initdb -D /var/lib/postgres/data
sudo systemctl enable --now postgresql

Create a local role and database:

sudo -u postgres createuser -P ttvdrops
sudo -u postgres createdb -O ttvdrops ttvdrops

Point Django at the unix socket used by Arch (/run/postgresql):

POSTGRES_USER=ttvdrops
POSTGRES_PASSWORD=your_password
POSTGRES_DB=ttvdrops
POSTGRES_HOST=/run/postgresql
POSTGRES_PORT=5432

Linux (Systemd)

sudo useradd --create-home --home-dir /home/ttvdrops --shell /bin/fish ttvdrops
sudo passwd ttvdrops
sudo usermod -aG wheel ttvdrops
su - ttvdrops
git clone https://github.com/TheLovinator1/ttvdrops.git
cd ttvdrops
uv sync --no-dev

# Modify .env with the correct database credentials and other settings, then run migrations:
uv run python manage.py migrate

Install the systemd service from the repo:

sudo install -m 0644 tools/systemd/ttvdrops.socket /etc/systemd/system/ttvdrops.socket
sudo install -m 0644 tools/systemd/ttvdrops.service /etc/systemd/system/ttvdrops.service

Enable and start the service:

sudo systemctl daemon-reload
sudo systemctl enable --now ttvdrops.socket
sudo systemctl enable --now ttvdrops.service

curl --unix-socket /run/ttvdrops/ttvdrops.sock http://ttvdrops.lovinator.space

Install and enable timers:

sudo install -m 0644 tools/systemd/ttvdrops-backup.{service,timer} /etc/systemd/system/
sudo install -m 0644 tools/systemd/ttvdrops-import-drops.{service,timer} /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now ttvdrops-backup.timer ttvdrops-import-drops.timer

Development

uv run python manage.py createsuperuser
uv run python manage.py makemigrations
uv run python manage.py migrate
uv run python manage.py collectstatic
uv run python manage.py runserver
uv run pytest

Import Drops

uv run python manage.py better_import_drops <file|dir> [--recursive] [--verbose] [--crash-on-error] [--skip-broken-moves]

Import Chat Badges

Import Twitch's global chat badges for archival and reference:

uv run python manage.py import_chat_badges

Requires TWITCH_CLIENT_ID and TWITCH_CLIENT_SECRET environment variables to be set.

Create DB Backup

Create a zstd-compressed SQL dump (only twitch_ tables) in the datasets directory:

uv run python manage.py backup_db

Optional arguments:

uv run python manage.py backup_db --output-dir "<path>" --prefix "ttvdrops"

How the duck does permissions work on Linux?

sudo groupadd responses
sudo usermod -aG responses lovinator
sudo usermod -aG responses ttvdrops

sudo chown -R lovinator:responses /mnt/fourteen/Data/Responses
sudo chown -R lovinator:responses /mnt/fourteen/Data/ttvdrops
sudo chmod -R 2775 /mnt/fourteen/Data/Responses
sudo chmod -R 2775 /mnt/fourteen/Data/ttvdrops

# Import dir
sudo setfacl -b /mnt/fourteen/Data/Responses /mnt/fourteen/Data/Responses/imported
sudo setfacl -m g:responses:rwx /mnt/fourteen/Data/Responses /mnt/fourteen/Data/Responses/imported
sudo setfacl -d -m g:responses:rwx /mnt/fourteen/Data/Responses /mnt/fourteen/Data/Responses/imported

# Backup dir
sudo setfacl -b /mnt/fourteen/Data/ttvdrops
sudo setfacl -m g:responses:rwx /mnt/fourteen/Data/ttvdrops
sudo setfacl -d -m g:responses:rwx /mnt/fourteen/Data/ttvdrops