Your next YouTube media manager
Find a file
2024-03-24 09:21:01 -07:00
.github Adds platform option when building docker containers 2024-03-24 09:20:07 -07:00
assets Pre-prepare for alpha launch (#44) 2024-03-01 19:47:19 -08:00
config Source title regex filtering (#98) 2024-03-20 17:51:14 -07:00
lib Adds a method for retrying stuck jobs (#112) 2024-03-24 09:21:01 -07:00
priv Improve README (#101) 2024-03-20 19:26:44 -07:00
rel/overlays/bin Prod packaging v1 (#23) 2024-02-16 18:50:00 -08:00
test Add docs link (#103) 2024-03-21 17:26:51 -07:00
.check.exs Upgrade to Elixir 1.16.2 (#71) 2024-03-11 18:47:13 -07:00
.credo.exs Misc refactors 2024-03-14 (#89) 2024-03-15 17:44:58 -07:00
.dockerignore Prod packaging v1 (#23) 2024-02-16 18:50:00 -08:00
.formatter.exs Redo indexing mechanism (#16) 2024-02-09 18:23:37 -08:00
.gitignore Switch to sqlite (#22) 2024-02-16 17:11:41 -08:00
.iex.exs Adds a method for retrying stuck jobs (#112) 2024-03-24 09:21:01 -07:00
.prettierignore Add CI (#4) 2024-01-19 23:43:25 -08:00
.prettierrc.js Initial setup (first pass) (#1) 2024-01-19 17:49:16 -08:00
.sobelow-conf Improve dev tooling (#30) 2024-02-21 17:28:27 -08:00
dev.Dockerfile Adds local details to local dockerfile (#75) 2024-03-11 20:05:19 -07:00
docker-compose.ci.yml Improve dev tooling (#30) 2024-02-21 17:28:27 -08:00
docker-compose.yml Prod packaging v1 (#23) 2024-02-16 18:50:00 -08:00
docker-run.dev.sh Prod packaging v1 (#23) 2024-02-16 18:50:00 -08:00
ideas.md Upgrade to Elixir 1.16.2 (#71) 2024-03-11 18:47:13 -07:00
LICENSE Pre-prepare for alpha launch (#44) 2024-03-01 19:47:19 -08:00
mix.exs Out of alpha, into beta 2024-03-22 17:43:38 -07:00
mix.lock Refactor modules into contexts (#78) 2024-03-12 17:54:55 -07:00
package.json Pre-prepare for alpha launch (#44) 2024-03-01 19:47:19 -08:00
README.md Add docs link (#103) 2024-03-21 17:26:51 -07:00
selfhosted.Dockerfile Enabled perf profiler for erlang JIT 2024-03-22 23:34:56 -07:00
yarn.lock Add CI (#4) 2024-01-19 23:43:25 -08:00

Pinchflat Logo by @hernandito

logo by @hernandito

Your next YouTube media manager

Table of contents:

What it does

Pinchflat is a self-hosted app for downloading YouTube content built using yt-dlp. It's designed to be lightweight, self-contained, and easy to use. You set up rules for how to download content from YouTube channels or playlists and it'll do the rest, checking periodically for new content. It's perfect for people who want to download content for use in with a media center app (Plex, Jellyfin, Kodi) or for those who want to archive media!

It's not great for downloading one-off videos - it's built to download large amounts of content and keep it up to date. It's also not meant for consuming content in-app - Pinchflat downloads content to disk where you can then watch it with a media center app or VLC.

If it doesn't work for your use case, please make a feature request! You can also check out these great alternatives: Tube Archivist, ytdl-sub, and TubeSync

Features

  • Self-contained - just one Docker container with no external dependencies
  • Powerful naming system so content is stored where and how you want it
  • Easy-to-use web interface with presets to get you started right away
  • First-class support for media center apps like Plex, Jellyfin, and Kodi
  • Automatically downloads new content from channels and playlists
    • Uses a novel approach to download new content more quickly than other apps
  • Supports downloading audio content
  • Custom rules for handling YouTube Shorts and livestreams
  • Advanced options like setting cutoff dates and filtering by title
  • Reliable hands-off operation

Screenshots

Pinchflat screenshot Pinchflat screenshot

Installation

Unraid

Simply search for Pinchflat in the Community Apps store!

Docker

  1. Create two directories on your host machine: one for storing config and one for storing downloaded media. Make sure they're both writable by the user running the Docker container.
  2. Prepare the docker image in one of the two ways below:
    • From Docker Hub: docker pull keglin/pinchflat:latest, or;
    • Building locally: docker build . --file selfhosted.Dockerfile -t keglin/pinchflat:latest
  3. Run the container:
# Be sure to replace /host/path/to/config and /host/path/to/downloads below with
# the paths to the directories you created in step 1
docker run \
  -p 8945:8945 \
  -v /host/path/to/config:/config \
  -v /host/path/to/downloads:/downloads \
  keglin/pinchflat:latest

NOTE: it's recommended to not run the container as root. Doing so can create permission issues if other apps need to work with the downloaded media. If you need to run any command as root, you can run su from the container's shell as there is no password set for the root user.

Authentication

HTTP basic authentication is optionally supported. To use it, set the BASIC_AUTH_USERNAME and BASIC_AUTH_PASSWORD environment variables when starting the container. No authentication will be required unless you set both of these.

EFF donations

A portion of all donations to Pinchflat will be donated to the Electronic Frontier Foundation. The EFF defends your online liberties and backed youtube-dl when Google took them down. See here for a list of donation receipts.

Pre-release disclaimer

This is pre-release software and anything can break at any time. I make not guarantees about the stability of this software, forward-compatibility of updates, or integrity (both related to and independent of Pinchflat). Essentially, use at your own risk and expect there will be rough edges for now.

Development

Pinchflat is written in Elixir - a functional programming language that runs on the Erlang VM. It uses the Phoenix web framework and SQLite for the database. The frontend is mostly normal server-rendered HTML with a little Alpine.js as-needed.

Elixir is a personal favourite of mine and is ideal for building fault-tolerant systems. It's also a joy to work with and has a great community. If you're interested in contributing, I'd be happy to help you get started with Elixir - just open an issue with some questions and we can chat!

Local setup

  • docker compose build --no-cache
  • docker compose up -d && docker attach pinchflat-phx-1
  • After a few minutes the app should be accessible at localhost:4008
    • Please let me know if you run into any hiccups here - I haven't had to bootstrap the app from scratch in a long time and I might have forgotten something
  • Media downloads and config will be stored in the tmp directory. Not the OS's /tmp directory, but the one in the root of the project

Running tests and linting

  • Open a shell with docker compose exec phx bash
  • Run mix test to run the tests
  • Run mix check to do a full testing, linting, and static analysis pass

Top tips

  • Look for any module that ends in *_worker.ex - these are where the interesting stuff happens and you can trace back from there to see how the app works. lib/pinchflat/slow_indexing/media_collection_indexing_worker.ex is a good place to start

License

See LICENSE file