Skip to content
barkodrPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

601 Commits

Folders and files

Repository files navigation

Kino

Netflix style family library for the storage box, with the torbox sync, server stats and settings for the admin. Runs on the vps behind nginx at kino.reece.page and only listens on 127.0.0.1:8282 itself.

How people get in

  • Family dont need a login. If there internet address is on the allow list they see the Who's watching? screen and pick a profile.
  • Profiles can sit in folders like Smith Family or Jones Family, the picker shows each folder as one iOS style folder tile with its first 4 profiles inside, and tapping it opens the rest. Set it on the profile's Edit sheet.
  • Watch Together on the picker joins two profiles into a joint one like "Tina & Trevor". It sees both people's history, ratings, My List and interests, and what's watched on it is saved to both of them. Locked profiles need their own code to join, either code opens the joint one, and it can be split any time.
  • Profile icons can be one of Kino's own, a movie or show poster, a meme (imgflip) or a brand logo (simple-icons), all searchable on the Edit sheet.
  • Each profile has its own continue watching, watched ticks, thumbs up or down, recommendations and playback settings (audio and subtitle language, subtitle size, autoplay, skip intros).
  • The Admin button in the corner of the profile screen is the only login. It unlocks the Sync and Server pages, adding and deleting profiles, the allow list, fix match, deleting from the library and marking intros.
  • Add family networks under Settings > Allowed networks. A small root helper (kino-allowlist) rewrites the nginx list within a few seconds, the app checks the same list as a second lock.

What else it does

  • Home shelves: continue watching, top picks, recently added, because you watched, critically acclaimed, genre shelves and not watched yet. Picks come from what each profile watched and rated.
  • Search across titles, actors, genres and episode names.
  • Player: up next with a countdown, skip intro (from chapters in the file or times the admin marked for a season), playback speed, AirPlay and picture in picture where the device supports them.
  • Installable as an app on iPhone, iPad and Mac (Share > Add to Home Screen, or the install button in Chrome).
  • The sync skips nfo files, samples and extras, skips anything you already have in 1080p or better, and only downloads the best copy when TorBox has several.
  • kino-watchdog checks the storage box mount every minute and reconnects it if it drops or freezes.

Android app

android/ is a small native app (about 1 MB) for phones, tablets, Android TV and Fire TV. It's the same Kino in a full screen webview, plus the things a browser can't do:

  • Videos play in Kino's own player screen (same look as the web player: logo, timeline, round buttons, subtitle, audio and speed menus, skip intro, up next, loading screen). Underneath it's ExoPlayer, the player Stremio uses on Android TV, straight to the device's hardware decoder. It falls back to the server's converted stream for sound or Dolby Vision the device can't play

  • The Player menu in the player switches to Android's own player (a backup that decodes differently), or opens the video in VLC or any other video app with a signed link that only works from that device for 6 hours. Kino remembers the player you picked on each device, and saves where VLC got to when you come back

  • On low memory TVs the page behind the player is let go while a video plays and comes back after, and the app reports pages that crashed or were closed for memory to Server > App Problems

  • It updates itself: when it opens it checks /app/version, and if there's a newer one it offers to download it and opens Android's installer. The first time, Android asks to allow Kino to install apps

  • Full screen video, picture in picture when you leave the app mid film (phones and tablets), and the screen stays on while playing

  • The back button closes the player or a popup first, then goes back a page

  • TV remotes: the arrows move around the page like Apple TV (the sidebar is its own column, Back jumps to it), play/pause and skip buttons work, and the search button opens Search

  • Voice search with the phone's or TV's own voice typing

  • Downloads go to the Downloads folder

  • It shows up on the Android TV home screen with its own banner

Download it from Settings > Android App, or https://kino.reece.page/app (on a Fire TV type that into the Downloader app). The app counts as its own device for Allowed Devices.

Build it with cd android && ./gradlew assembleRelease (needs the Android SDK). To sign with the Kino key set KINO_KEYSTORE and KINO_KEYSTORE_PASSWORD. Keep that key safe, Android only installs updates signed with the same key. Copy the result to app/static/kino.apk so /app serves it, and put the same versionCode and versionName in app/static/kino-version.json (CI checks they match) so the apps offer the update. The Android app workflow builds it on every change to android/.

History and backups

Settings > History shows what each profile has watched, grouped by day, with Play and Remove (removing also clears its progress), and Clear History.

Every night around 4 the database (profiles, watch history, ratings, addons, devices) is copied to the Storage Box in kino-backups/. The last 14 nights and the newest one of each of the last 6 months are kept. Server > Backups shows the last one, has Back Up Now, and lets the admin download any of them.

Restoring a backup

systemctl stop kino
sudo -u kino /opt/kino/venv/bin/python /opt/kino/app.py restore /srv/torbox/kino-backups/kino-2026-10-30-0400.db.gz
systemctl start kino

It checks the backup isn't damaged first, and keeps the current database next to it as kino-before-restore-*.db in /var/lib/kino, so a restore can be undone. app.py backup makes one by hand.

TorBox first

When a film or episode isn't on the Storage Box yet but it's already finished in your TorBox account, Kino plays it from TorBox before trying any public domain copy. It matches by title and year (or show, season and episode), goes through the same player as the library (so mkv, other audio tracks and addon subtitles all work), and saves progress like everything else. The TorBox key is read from the sync's /root/torbox-sync/.env, so nothing new needs setting up. Only files from your own account are used, through the TorBox api.

Allowed devices

Next to the ip list there's Settings > Allowed Devices. An approved device can open Kino from any network (mobile data, holidays, a friend's wifi). nginx lets a request in when its ip is on the list or the app says the device is approved (satisfy any with an auth_request to /api/gate). Everything else is sent to /gate, which shows the device's code and an Ask for Access button (one press, the name is filled in). Approve it in Settings, or type the code there. Devices you turned down are listed there too and can be allowed again. Every flow, step by step, is in docs/auth.md.

Real hardware ids (serial numbers, MAC addresses, the iPhone UDID, Android id) can't be read by a website at all, browsers block that for privacy. So Kino gives every browser and installed app its own random id in a long lasting cookie, shown as a short code like K7F-29Q. Clearing the browser's site data, or using a different browser, means a new code. On iPhone the Home Screen app and Safari count as two devices.

Look

Kino is laid out like the Apple TV app: a floating sidebar on the left (Search, Home, Movies, TV Shows, My List, and a Settings group that folds open with Settings, Sync and Server), an icon rail on smaller screens and a tab bar on phones. The profile at the top of the sidebar opens Switch Profile, admin sign in and Appearance. Light and dark follow the device unless you pick one (per device, under Appearance or in Settings). Artwork heroes and the player always stay dark.

My List, kids and intros

  • My List: every profile can add films and shows (from the library or from addons) with the + button. When a show in someone's list gets new episodes on the Storage Box, a big "New Episodes in My List" card shows up at the top of their Home until they open the show.
  • Kids profiles: turn on Kids Profile when editing a profile (admin only). Kids only see titles whose genres are family or animation and nothing scary (horror, thriller, crime, war and so on), and the admin tools are hidden. Admins can override any title with Allow for Kids or Hide from Kids in the title's admin menu.
  • Intros are found automatically: Kino compares the audio at the start of episodes in the same season and finds the bit they share, so Skip Intro works without marking anything. It runs in the background and needs at least two episodes of a season. Chapters in the file and intros the admin marked still win.
  • Storage: when the Storage Box is over 90% full (STORAGE_WARN_PCT in kino.env), admins get a warning on Home. Server > Free Up Space lists what everyone has watched and what nobody started in 3 months, biggest first, with delete buttons.

Live TV

Add IPTV playlists (M3U links) in Settings under Live TV, with an XMLTV guide link if the playlist doesn't name its own. Your own TV server (Tvheadend, Jellyfin Live TV, ErsatzTV, Threadfin, an HDHomeRun) can make both, tick On My Network for one at home. Kino checks the channels in the background and hides the ones that don't work, and puts English channels first: the UK, then the US, then other English speaking countries.

Streams that are already HLS play through Kino's proxy (so the browser and the app don't trip over CORS or links that only work from the server), anything else (MPEG-TS from a tuner) is turned into HLS by ffmpeg live. Addons with tv type catalogs show up on the Live TV page too. In the player the remote's up and down (or channel buttons) change channel.

Stremio addons

Kino speaks the Stremio addon protocol, so any addon link that works in Stremio can be pasted in under Settings > Addons (admin only). The link ends with /manifest.json, stremio:// links work too.

What Kino uses from an addon:

  • Catalogs show up as shelves on Home (taking turns between addons, max 8) and in Search under "From Addons". Each shelf can be hidden. Titles that arent in the library open a details page that says so, anything that is in the library links to the normal page.
  • Metadata is used for titles Cinemeta doesnt know (anime from Kitsu for example), for those detail pages and in Fix Match.
  • Subtitles get added to the subtitle menu in the player, the profiles subtitle language is picked automatically. Kino sends the OpenSubtitles hash of the file so the timing usually matches.
  • Watch activity (player and library events, used by tracking addons like Trakt) is only sent for profiles that turn on "Share Watch Activity with Addons" in their settings.
  • Streams only from archive.org. Kino plays an addons stream only when the video is a public domain copy on archive.org (like the Archive.org and Public Domain Shows addons). Shows get seasons, episodes, resume and up next like library shows, and saved episodes land in archive/Show/Season 01/. Torrents, debrid links, youtube and every other host get dropped, this is a fixed list in the code (PD_HOSTS) and not a setting. The video goes through Kino so the allow list still applies, resume and addon subtitles work, and admins can hit Save to Library to download it to the Storage Box (it lands in archive/).

Good ones to start with: https://v3-cinemeta.strem.io/manifest.json, https://opensubtitles-v3.strem.io/manifest.json and https://anime-kitsu.strem.fun/manifest.json.

Addons are outside servers so Kino only talks to them over https and refuses any link that points at a private or local address (so an addon cant be used to poke at the vps itself). Answers are size limited and cached.

Setup

  1. Cloudflare DNS: add an A record, name kino, value 169.58.99.51, proxy status DNS only (grey cloud).
  2. On your Mac, copy the package to the vps:
    scp ~/Downloads/kino.tar.gz root@169.58.99.51:/root/
    
  3. On the vps:
    cd /root && tar xzf kino.tar.gz && cd kino
    bash install.sh
    
    It asks for an admin username and a password (12+ characters) at the end.
  4. Open https://kino.reece.page and sign in.

Auto deploy from GitHub

Every push to main runs the checks in .github/workflows/deploy.yml (syntax, the app starts, logins are required). If they pass, GitHub logs into the vps and runs kino-update, which pulls the repo into /srv/kino and runs install.sh --update. Pull requests only get checked, they go live once merged.

The key GitHub uses is locked on the server so it can only run kino-update, nothing else. Run kino-update by hand on the vps if you ever want to redeploy without pushing.

Repo secrets (Settings > Secrets and variables > Actions):

  • DEPLOY_HOST: 169.58.99.51
  • KINO_DEPLOY_KEY: the private key from /root/.ssh/kino_actions on the vps

Admin account

sudo -u kino /opt/kino/venv/bin/python /opt/kino/app.py adduser NAME
sudo -u kino /opt/kino/venv/bin/python /opt/kino/app.py passwd NAME

Locked out of every device? Allow one from the server by the code on its screen:

sudo -u kino /opt/kino/venv/bin/python /opt/kino/app.py devices
sudo -u kino /opt/kino/venv/bin/python /opt/kino/app.py allow-device K7F-29Q
sudo -u kino /opt/kino/venv/bin/python /opt/kino/app.py remove-device K7F-29Q

Your home ip changed

If you can still get in from somewhere on the list, change it under Settings > Allowed networks. If youre locked out, ssh into the vps and edit /var/lib/kino/allowlist.json, the nginx list updates by itself. To see what ip the server sees: tail -n 5 /var/log/nginx/kino.access.log.

Useful commands

What Command
Dashboard logs journalctl -u kino -f
Sync logs journalctl -u torbox-sync -f
Restart dashboard systemctl restart kino
Unban an ip from fail2ban fail2ban-client set kino unbanip 1.2.3.4
Redeploy without a push kino-update
See deploys the Actions tab on GitHub

Whats where

  • App: /opt/kino, config: /etc/kino/kino.env, database and caches: /var/lib/kino
  • Sync script: /root/torbox-sync/sync.py (the old one is kept next to it as sync.py.bak-...)
  • Sync status file the dashboard reads: /var/lib/torbox-sync/status.json
  • Pause file the sync reads: /var/lib/kino/pause.json

Test sandbox

tools/sandbox/ runs the real app on this machine with fake Cinemeta, addons and TorBox, a seeded profile, a TV remote harness for the browser and the Android emulator, and scenarios for known TV bugs. Start with tools/sandbox/run.sh, see tools/sandbox/README.md. Nothing in it is used on the server.

Security bits

  • Passwords are hashed with scrypt (admin: N=2^17, r=8, p=1, older hashes are upgraded at the next sign in), sessions are random tokens in an httponly secure cookie
  • In production a default admin password is refused at sign in, and Kino warns about it in the log at start
  • 5 wrong logins from one ip locks it for 15 min, nginx also limits the login to 5 per minute, fail2ban bans after 8
  • Every change request needs a custom header so other sites cant trigger actions
  • Strict content security policy, no outside scripts at all (hls.js is bundled)
  • Download links for vlc are signed and run out after 6 hours
  • Addon links have to be https and can't point at private or local addresses, every redirect gets checked again
  • The dashboard runs as its own kino user and polkit only lets it start or stop torbox-sync.service, nothing else

Credits

hls.js (Apache 2.0) is bundled in app/static/hls.min.js. Metadata and artwork come from Cinemeta and Metahub, plus whatever addons you install.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages