DBRepair development

Thank you.

And, as some general feeback to the thread, I do have to say Plex is feeling noticeably more responsive, but I wouldn’t say it is popping up search results as fast as I type as others have mentioned. However, the results are displayed only a split second after I finish typing. Maybe I’m just a fast typist.

Overall, quite happy with the results of the tool.

This depends on:

  1. CPU
  2. OS
  3. Number of items indexed in the DB
  4. storage where the DB is (SSDs make a huge difference)

DBRepair.ah for v1.0.10 - Prevent negative watch counts :
File header says “ Version=“v1.0.9””

v1.0.10 - Prevent negative watch counts

Header and strings updated – (oops)

3 Likes

Hello!

I was on reddit reading how to optimize Plex database and came across this thread.

Unfortunately, I’m using Plex on Truenas Scale (Truecharts version) and I can’t find a way to get your app to work.
I might be wrong, but from what I’ve seen you only need the data stored inside “Library/Application Support/Plex Media Server

I can mount the Plex volume into a specified path thanks to heavyscript. It give me something like: /mnt/MY_POOL/mounted_pvc/plex-config/Library/Application\ Support/Plex\ Media\ Server/

With all these folders inside:

Cache Codecs ‘Crash Reports’ Diagnostics Drivers Logs Media Metadata ‘Plug-in Support’ Plug-ins Preferences.xml Scanners ‘Setup Plex.html’ Updates

I think that the missing part might be sqlite3, but it seems to be installed on Truenas:

root : sqlite3

SQLite version 3.34.1 2021-01-20 14:10:07
Enter “.help” for usage hints.
Connected to a transient in-memory database.
Use “.open FILENAME” to reopen on a persistent database.

I don’t know if it’s possible and I can’t find anyone who asked the question on this thread, that’s why I’m asking it.

Thank you anyway !

@Xiticks

You missed a key piece of info then started down the :rabbit: hole :slight_smile:

In the README.md –

EXAMPLE: Using DBRepair inside containers (manual start/stop included)

(Select containers allow stopping/starting PMS from the menu. See menu for details)

    sudo docker exec -it plex /bin/bash

    # extract from downloaded version file name then cd into directory
    tar xf PlexDBRepair-1.0.0.tar.gz
    cd PlexDBRepair-1.0.0
    chmod +x DBRepair.sh
    ./DBRepair.sh

On systems with Plex in a container:

  1. Everybody puts their container in an unpredictable location
  2. The only standards exist once inside the container
  3. The script understands how different container images are structured, detects this, and self configures.
  4. After self-configuration is complete, you see the Image name (or real host name if native) in the menu (examples also shown in the README.md)

Suggest you take a few minutes and read the entire README.md

Yeah I saw that, however the issue is that I’m not able to stop PMS with the script (Not available, stop manually) and since it’s running inside kubernetes, when I try kill -15 PMS (something like this) it restart the pod, so I can’t run the script
I must be missing something but I don’t know what.

Did you think to turn off health checking so it doesn’t poll for the PMS process???

ALL:

I am considering adding another function to DBRepair.

  1. The function I’m considering is not a database related function
  2. It does PMS maintenance which seems to not work correctly.

Specifically,

Remove JPG files from the Cache/PhotoTranscoder directory

As currently written,

  • Examine (Count) the number of JPGs found in the directory > 30 days old
  • If any found, offer to delete them
  • If in scripted/command line argument mode, Assume “YES” to remove them.

Given there are cases where the PhotoTranscoder directory has grown to ridiculous sizes, the most I’m willing to do is count the number of files which would be removed but even this will take time. I don’t want to waste even more time finding out how much disk space will be recovered (UNLESS that’s wanted)

Thoughts?

DBRepair-Development-1.02.99.tar (70 KB)

3 Likes

Great idea! :+1:

For Windows too, please? :grinning:

Luv it, great idea. Thanks Chuck

Gets my vote. I’ve been nuking this cache weekly via a cron job for years. The cache is just bloat, or at least it is based off my users usage of plex.

FYI… feature request thread here Cache/PhotoTranscoder Folder Size Sanity Check where a bunch of us done analysis of the cache and how bad it is.

2 Likes

I’ve got many many duplicates of many many files in the Cache/PhotoTranscoder folder.

But I’ve never seen files older than about a month. Plex is deleting old files reliably for me.

Does anybody have older files in that folder?

This would be a great feature. Indicating the number of files which would be removed is sufficient.

Chuck, FWIW, I just checked my PT folder. It’s 20GB with about 120k files and 256 folders. Not a single file is older than 30 days. So, I guess that shows that the cache CAN be well behaved :slight_smile:

I like the idea of your very useful tool becoming even more useful so it gets my vote. I don’t need disk space recovered info; having the count is good enough to identify if the expected cache clean-up was misbehaving.

Much appreciated!

Difficult choice time… :rofl:

“purge” - “Purge old files from PhotoTranscode cache”
“remove” - “Remove old files from PhotoTranscode cache”

My only concern is future development .

I’ve toyed with “Clear”, “Clean”, “Purge”, “Remove”, and “Delete”.

Delete - Can imply way too much
Clear - Not descriptive enough (clear what? the screen? - lol)
Clean - “clean the keyboard?” – lol

Purge & Remove seem best candidates.

I will change the numbering, I’ll move this down into its own “block” of command numbers so it’s not confused with primary functionality.

Thoughts?
Input?

1 Like

Purge and Remove, hopefully that will neutralize / minimize the insane cancerous growth of Photo Transcode cache.

As for Command or Ranking, (Lower) and optional would be a intuitive solution.

I vote for “Remove” as Purge seems too … dramatic?

Either is totally fine really; it’s easy to overthink these things though and it’s not like you can’t change it later. :slight_smile:

And putting it separate from the DB cleaning options makes sense to me.

But who doesn’t like drama?

:scream:

:rofl:

1 Like