Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Video Preloader (avoids HDD spinup latency when starting a Movie or Episode through Plex, Jellyfin or Emby)

Featured Replies

  • Author
48 minutes ago, kizer said:

Is there a code change that you could recommend that says to skip those or ignore them?

This should be possible.

 

Maybe I could also add an option which allows sorting by the year which is inside the parent folder name like "2004" in "/Lost (2004)/S01E01.mkv". But by that recently added content which has an old airing date, won't be cached.

  • Replies 200
  • Views 63.6k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • Feature Requests from Reddit: - determine which disks were involved and spin them down after script execution - multiple path support (to scan movies and tv shows through one script) realise

  • In case it helps, I think this is how to get the On Deck from Plex using the API: wget -q -O- http://$PLEXURL:32400/library/onDeck?X-Plex-Token=$PLEXTOKEN Set $PLEXURL to your PMS's ip address,

  • Yes the script is broken. Will fix it....

Posted Images

3 minutes ago, mgutt said:

This should be possible.

 

Maybe I could also add an option which allows sorting by the year which is inside the parent folder name like "2004" in "/Lost (2004)/S01E01.mkv". But by that recently added content which has an old airing date, won't be cached.


I have found a Bulk renamer and have begun changing the messed up files from 2038 to 2018. Not sure what happened, but I think I have a plan of attack. Thank you for the offer/idea. It’s only a 100-200 or so files and I’m 1/4 of the way done. 

  • Author
49 minutes ago, kizer said:

Bulk renamer

This should not help. The script sorts by file modification time and not the year in the filename (that was the idea I mentioned in my last post) ;)

 

All files, renamed by this bulk renamer tool, will probably receive a newer file modification time and so pushed to the top of the preloading list.

Edited by mgutt

I checked the file listing and it shows the Modified date as 2018 vs 2038. I’m basically changing the attributes not the actual file name. 
 

I’ll do my thing and report back. Or actually I’ll test it again and see if the priority has shifted first before doing more. 

 

update********

 

Every file I’ve changed the modified date is not being scanned. So it’s doing exactly what I hoped it would accomplish.  Just have to do some house cleaning on my end. 
 

Thanks so much for this script. I can verify it does work on 6.9 RC-30. 

hi guys, maybe stupid question, but if I don't want to map these to RAM (don't have a huge amount), but to cache instead, would it work?

  • Author
6 minutes ago, LSL1337 said:

but if I don't want to map these to RAM (don't have a huge amount)

At the moment you can't map it to something else. But note: Preloading does not reserve RAM. It stays free. But with a small amount of RAM the preloaded data will be overwritten by other processes really fast, so the use of preloading will be really low on your setup.

Thanks this script, I always do same thing, but fetch whole moive to RAM during watching.

 

Sound good have additional features, when a file open time long enough i.e. 5min, ( or simple as file scan still in open state if compare to previous file scan ) then fetch those files to RAM automatically.

Edited by Vr2Io

  • 2 weeks later...

Hello,

 

Fantastic script, works great!

 

One question, is there a more reliable way to determine if the content is coming from the RAM or Disk? I ask because it seems on my machine even from RAM is taking ~ 0.170s which from looking at your script it means this gets counted as from Disk.

 

I am also working on a solution to catch what is On Deck, I will share once I have it working.

 

Thanks,

Chris

1 hour ago, christoefar said:

I am also working on a solution to catch what is On Deck, I will share once I have it working.

 

Thanks,

Chris


That would be neat to have too. Any consideration if you have multiple users on your Plex Server unless Plex just sees all on deck files?

Didn't install it yet but the On Deck feature could be enough for me to get to it. 🙂 

Hello,

 

Same Chris as before - just a new email address.

 

I have it working in a crude way, it does only work for me currently. I will have a look at the Plex API and see if it is possible to pull back the On Deck for all users. Selfishly, my main concern is me though!

 

@mgutt is the code on GitHub by any chance?

 

Chris

5 minutes ago, chris.child said:

Same Chris as before - just a new email address.

Do you mean @christoefar ?

1 hour ago, chris.child said:

Hello,

 

Same Chris as before - just a new email address.

 

I have it working in a crude way, it does only work for me currently. I will have a look at the Plex API and see if it is possible to pull back the On Deck for all users. Selfishly, my main concern is me though!

 

@mgutt is the code on GitHub by any chance?

 

Chris

 

The code for this project is in the first few posts to this thread. 

 

I wouldn't mind just me because I'm selfish too Lol. However if would could cover all users it would round out the code very nicely.

The script works great.  I like the On Deck idea.  Another feature request would be the ability to pick certain episodes or movies to always be preloaded into Ram.  For example, my kids tend to watch the same episodes and movies over and over.  But because they have been on my Plex server for so long, they are not preloaded.  Thanks and keep up the good work!

 

Brad

  • 2 months later...

Oh man On Deck would be great. Thanks so much work making this script.

Would it be possible to get this script working for emby?

How often should I run this script? 

  • Author
6 minutes ago, ffhelllskjdje said:

How often should I run this script? 

Daily, after your backup scripts (or they will overwrite your free RAM again).

  • 8 months later...

Trying to figure out how this script works. How does plex know to load the initial data from RAM, and the rest of it from the disk?

 

Would like to adapt the script to use an SSD instead of RAM for the first bit of data (since that could just be persistent, and has A LOT more space to store all of it).

 

edit: looking more at the script, it looks like the head and tail commands are used for printing the beginning and end of the file to /dev/null. So I guess that by doing so, the system automatically caches that bit of the file?

Edited by xorinzor

  • Author
28 minutes ago, xorinzor said:

So I guess that by doing so, the system automatically caches that bit of the file?

Yes. This is the default behaviour of Linux. Everything which is read from a disk is written to the RAM. So this is only a trick to prefill the RAM. And because of that it's impossible to use the SSD. I tried to use a swap file, but it's sadly not possible to read data directly into the swap file.

  • 3 weeks later...
...
preload_tail_size="1MB" # 10MB, should be sufficient even for 4K
...

So what is the recommendation for 4K? 1MB or 10MB? (Looks a bit unclear.)

  • Author
20 hours ago, JoergHH said:

4K? 1MB or 10MB?

I missed to correct the comment. 1MB is sufficient.

Would it somehow be possible to do reserve ram for this?

I have 64GB of RAM in my server and it'd be nice to allocate a few GB for this. But I'd also like to guarantee that no other processes use the RAM (there's way more then enough, so I can spare to allocate a bunch).

 

EDIT: nvm, forgot about the head_size being 60MB (or even more).

Edited by xorinzor

  • Author
On 11/9/2021 at 11:15 AM, xorinzor said:

Would it somehow be possible to do reserve ram for this?

By now I did not found a solution to realize this 

  • 2 months later...

Is there still support for this script? Coming across an error message -

tr: write error: Broken pipe
tr: write error
cut: write error: Broken pipe

I have 128GB of RAM installed, and set free ram usage to 75% so I should be able to utilize about 96GB, my dashboard only shows about 9% utilized overall, i'm assuming this error is preventing the script from fully running.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.