GithubHelp home page GithubHelp logo

joshuaboniface / vmtouch-jellyfin-media Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 14 KB

Quick and dirty tool for pinning playing media to memory (Linux)

License: GNU General Public License v3.0

Python 100.00%

vmtouch-jellyfin-media's Introduction

vmtouch-jellyfin-media

This tool is designed to force media files opened with Jellyfin into resident memory using the vmtouch utility.

This can have numerous uses:

  1. Avoid dying mid-stream if storage is flaky/blocks.

  2. Allow faster skipping around the file.

  3. Mitigate (some, but very little!) hard drive load.

In my case, #1 (a Ceph cluster that could block reads) is the primary goal.

This script is a really quick and dirty hack. It is specific to my particular install, but I'm providing it as a useful jumping-off point for others who might want to do something similar.

Prerequisites

  • Requires Python 3 with several standard libraries (subprocess, threading, signal, re)

  • Requires Jellyfin running as a standard operating system process outputting to journald.

  • Requires the vmtouch tool installed and operational.

Usage

  1. Copy the vmtouch-jellyfin-media binary to /usr/local/sbin/

  2. Optionally, adjust the TOUCH_TYPE variable if you want to use a non-blocking lock.

  3. Copy the vmtouch-jellyfin-media.service service unit to /etc/systemd/system/

  4. Run sudo systemctl daemon-reload to reload the systemd configuration

  5. Run sudo systemctl enable --now vmtouch-jellyfin-media to enable and start the program

It will then continually watch the Jellyfin service output (via journalctl) and act when it sees a file opened for playback. Upon opening, the file will be read into memory with vmtouch until playback of that file stops, at which time it will release the file from memory.

Caveats/Limitations

  1. Needs systemd/journalctl in its current iteration, but this could be modified.

  2. Requires root privileges (for reading the journal, running vmtouch, etc.).

  3. Only works with locally-opened files; does not work with tools like RFFmpeg.

  4. If you stop playback, the file is purged from memory and must be re-read; this was a conscious design decision.

vmtouch-jellyfin-media's People

Contributors

joshuaboniface avatar

Stargazers

Matteo Bigoi avatar t3nzin avatar  avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.