# DBRepair development

**URL:** <https://forums.plex.tv/t/dbrepair-development/822684>\
**Category:** Apps & Creations\
**Created:** [December 14, 2022, 3:57am UTC](https://forums.plex.tv/t/dbrepair-development/822684 "2022-12-14T03:57:23Z")\
**Posts on this page:** 20\
**Page:** 41

<div class="post-metadata">

**Author:** ![Tony\_T](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/tony_t/32/311528_2.png) [@Tony\_T](https://forums.plex.tv/u/Tony_T)\
**Post date:** [February 2, 2026, 1:13pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/870 "2026-02-02T13:13:56Z")

</div>

Another vote for python.

And for checking code, I have found using Google Gemini in Pro Mode very helpful (just don’t blindly rely on what Gemini provides), it really does a great job with code checking (better than ChatGPT)

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [February 2, 2026, 11:38pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/871 "2026-02-02T23:38:27Z")

</div>

I do not use AI to write code. Never have – Never will.  
The biggest problem with it is that it’s not perfect. It’s just a great big ruleset which is known to be incomplete.

I do use linters to double check my syntax but **never** semantics.  
I’m the only one who knows what I’m trying to accomplish.

I will stop here before I offend anyone who things AI-written code is “Cat’s Pajamas”

🤣

---

<div class="post-metadata">

**Author:** ![Tony\_T](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/tony_t/32/311528_2.png) [@Tony\_T](https://forums.plex.tv/u/Tony_T)\
**Post date:** [February 3, 2026, 12:02am UTC](https://forums.plex.tv/t/dbrepair-development/822684/872 "2026-02-03T00:02:19Z")

</div>

> [@ChuckPa](#):
>
> I do not use AI to write code. Never have – Never will.

Did I say to write code?  
Didn’t I say don’t blindly rely on what Gemini provides.

Lint is old school (I used to use it). AI is a faster lint.

Ask Gemini to explain what I said.

😄

---

<div class="post-metadata">

**Author:** ![Tony\_T](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/tony_t/32/311528_2.png) [@Tony\_T](https://forums.plex.tv/u/Tony_T)\
**Post date:** [February 3, 2026, 12:33am UTC](https://forums.plex.tv/t/dbrepair-development/822684/873 "2026-02-03T00:33:49Z")

</div>

> [@Tony\_T](#):
>
> Did I say to write code?  
> Didn’t I say don’t blindly rely on what Gemini provides.
> 
> Lint is old school (I used to use it). AI is a faster lint.
> 
> Ask Gemini to explain what I said.

Oh, what the hell, I will 😉

**Answer** : _The speaker recommends Python for development and suggests using Google Gemini (specifically Pro Mode) for code verification, noting that it outperforms ChatGPT in this regard but requires human oversight._

_The user is providing a testimonial based on personal experience, highlighting a shift in preference toward Google’s AI for technical tasks. They include a standard industry warning: AI tools can produce errors (“hallucinations”), so manual verification is mandatory._

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [February 3, 2026, 2:36am UTC](https://forums.plex.tv/t/dbrepair-development/822684/874 "2026-02-03T02:36:22Z")

</div>

You can have it fast or you can have it correct. Please choose one.

1. I WILL write this by hand
2. I HAVE a class structure already in mind
3. I WILL create the Python version in the same manner as I did the original DBRepair (Start small and add as it’s vetted)

Questions:

- Maintain & distribute two different packages?

- Distribute as one package or two ?

---

<div class="post-metadata">

**Author:** ![Tony\_T](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/tony_t/32/311528_2.png) [@Tony\_T](https://forums.plex.tv/u/Tony_T)\
**Post date:** [February 3, 2026, 3:07am UTC](https://forums.plex.tv/t/dbrepair-development/822684/875 "2026-02-03T03:07:19Z")

</div>

Maintain and distribute one package, python would be my vote.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [February 3, 2026, 4:12am UTC](https://forums.plex.tv/t/dbrepair-development/822684/876 "2026-02-03T04:12:42Z")

</div>

ALL:

Very simple question - Is python available for Windows platforms?  
If so, is it native or must it be installed ?

If DBRepair is to be distributed in Python, should installing python be a prerequisite ? ( regular Linux, Synology, and QNAP have it installed by default )

---

<div class="post-metadata">

**Author:** ![pshanew](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/pshanew/32/160555_2.png) [@pshanew](https://forums.plex.tv/u/pshanew)\
**Post date:** [February 3, 2026, 4:22am UTC](https://forums.plex.tv/t/dbrepair-development/822684/877 "2026-02-03T04:22:04Z")

</div>

> [@ChuckPa](#):
>
> Very simple question - Is python available for Windows platforms?  
> If so, is it native or must it be installed ?

Yes, Python is available on Windows (and is fully-supported by Python’s developers). I do some dev work on Windows using Python which is why I suggested it.

> [@ChuckPa](#):
>
> If DBRepair is to be distributed in Python, should installing python be a prerequisite ?

Python _may_ require a simple one-click installation on Windows (from the Windows Store). Once installed, it will be updated like any other Windows application. On Windows 11 (at least) if you attempt to run `python` from the command-line, and it’s not already installed, it will take you directly to the store listing for it where you can immediately install it. There’s nearly zero friction.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [February 3, 2026, 5:22am UTC](https://forums.plex.tv/t/dbrepair-development/822684/878 "2026-02-03T05:22:55Z")

</div>

We’re off …

🏇

I have a full schedule so this will take a bit but I’ll get there.

Function HostConfig() is the biggest amount of work.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [February 4, 2026, 9:50pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/879 "2026-02-04T21:50:51Z")

</div>

Short update.

Couldn’t sleep.  
Started working on the new `HostConfig` function which is central to DBRepair.

I’m 400+ lines into it with about 200 to go.

BSD will be an issue as will some of the containers .  
They will require a completely new detection strategy

The new implementation is largely named like the old familiar DBRepair with some additions

1. A new `Host` class object for all host-specific (configuration) variables.
2. Still mostly procedural but restructured .
3. Added new functions to clean up past evils (to make room for new evils) 😈

When I think I’m ready, I’d like to present it here so we can test-drive HostConfig.

It should properly detect and report the specifics of the machine it’s invoked on.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [February 6, 2026, 12:40am UTC](https://forums.plex.tv/t/dbrepair-development/822684/880 "2026-02-06T00:40:00Z")

</div>

About to hit the sack. Offline a few days.

Today’s progress 🙂

```auto
[chuck@lizum python.547]$ ./d3.py 
<class ' __main__.HostClass'>
Invoking HostConfig
Found Linux Host
Host Configured: Ubuntu 24.04.3 LTS
Ubuntu 24.04.3 LTS
--- type Members ---
__module__ = __main__
 __init__ = <function HostClass. __init__ at 0x774467a14220>
__dict__ = <attribute ' __dict__' of 'HostClass' objects>
__weakref__ = <attribute ' __weakref__' of 'HostClass' objects>
__doc__ = None
PkgDir = /usr/lib/plexmediaserver
PlexSQLite = /usr/lib/plexmediaserver/Plex SQLite
LogTool = logger
AppSuppDir = /var/lib/plexmediaserver/Library/Application Support
DBDir = /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases
CacheDir = /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache/PhotoTranscoder
Pidfile = /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/plexmediaserver.pid
Logfile = /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/DBRepair.log
TmpDir = /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/tmp
SysTmp = /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/tmp
HostType = Ubuntu 24.04.3 LTS
HaveStartStop = True
StartCommand = systemctl start plexmediaserver
StopCommand = systemctl stop plexmediaserver
[chuck@lizum python.548]$ 

```

Thi is the default. Overrides not tested. Other hosts not tested.  
Small steps. I forgot a lot more than i realized

PS: HostConfig is fully written. It has everything the shell has with several improvements.

- BSD support is cleaner
- Variable HDD selection on Netgear and WD
- Checks paths really exist before accepting them.

HostConfig is 60 lines less than with sh/Bash. This includes how Python wants things formatted. Coming in at 401 lines 🙂

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [February 6, 2026, 5:06pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/881 "2026-02-06T17:06:08Z")

</div>

Dev update:

1. QNAP will require ‘Shython’ wrapper 🤮
2. Synology cannot be tested at this time.

 ![Screenshot from 2026-02-06 11-55-50](https://global.discourse-cdn.com/plex/original/4X/6/7/9/6793ba79372ba29ce5a911d01fa28e24af9ca718.png)

If folks will be gentle, ( Linux and Docker containers - Only)

For those who know Python, I’d like to continue detection testing.  
It’s of no help to say “Doesn’t work on XXXXXXX” without the necessary info about what doesn’t and why.

Thanks,

[DBRepair-Py-Dev.zip](https://forums.plex.tv/uploads/short-url/19prVl4HM9WwsPVH9qCwAcLy7Qd.zip) (5.6 KB)

---

<div class="post-metadata">

**Author:** ![Insomnic\_1](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/insomnic_1/32/215416_2.png) [@Insomnic\_1](https://forums.plex.tv/u/Insomnic_1)\
**Post date:** [February 6, 2026, 7:17pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/882 "2026-02-06T19:17:38Z")

</div>

> [@ChuckPa](#):
>
> QNAP will require ‘Shython’ wrapper 🤮

QNAP as odd ball out _again_ (no QNAP builds for latest beta\public or the new NFO preview build). 😛  
Dang QNAP being all finicky.

I assume the native Python install from QNAP App Store is missing functionality needed for the script. 😔

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [February 6, 2026, 7:34pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/883 "2026-02-06T19:34:29Z")

</div>

Corrections here:

I will add to this as I find things.

Corrections:

Line 242: `os.chdir(CurrDir)`

---

<div class="post-metadata">

**Author:** ![dane22](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dane22/32/4389_2.png) [@dane22](https://forums.plex.tv/u/dane22)\
**Post date:** [February 6, 2026, 7:40pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/884 "2026-02-06T19:40:01Z")

</div>

> [@Insomnic\_1](#):
>
> I assume the native Python install from QNAP App Store is missing functionality needed for the script

Confirmed

@ChuckPa Looks like Python on QNAP is missing f strings, so sadly needs to use format() instead. (Like Python 2.7 does)

---

<div class="post-metadata">

**Author:** ![shark2k](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/shark2k/32/305908_2.png) [@shark2k](https://forums.plex.tv/u/shark2k)\
**Post date:** [February 7, 2026, 12:30am UTC](https://forums.plex.tv/t/dbrepair-development/822684/885 "2026-02-07T00:30:45Z")

</div>

Question. For Docker, I am guessing this would be run similar to the current DBRepair.sh, right? Meaning I would exec into the Docker container and then run the script, i.e., ./DBRepair.py (making sure it is executable of course).

If so, I am using the [Linuxserver.io](http://Linuxserver.io) container and I tried running this from within the container and it fails with `/usr/bin/env: ‘python3’: No such file or directory`.

I did a quick Google search and found `command -v program_name` as a way to check that the executable is on your system. I ran `command -v python3` in the Docker container, which came back with no output (so not installed). I also ran the same command on the host as verification and it returned `/usr/bin/python3`.

So not sure if I am doing something wrong (very possible when it comes to Linux) or it just means that Python is not included in the [Linuxserver.io](http://Linuxserver.io) container (seems like the likely possibility).

My host is Debian 13 Trixie if that matters.

-Shark2k

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [February 7, 2026, 4:22am UTC](https://forums.plex.tv/t/dbrepair-development/822684/886 "2026-02-07T04:22:49Z")

</div>

DBRpair.py will be run using the same environment as DBRepair.sh

Regarding containers (Docker, LXC, or VM), it will be run from inside that namespace / environment.

If you want to test the actual detection within the container, you can modify the `#!` on line 1 to give it your actual python3 path

Here we are, running into trouble invoking python and seeing which vendors offer (or don’t offer) which libraries

There’re a lot more Python funtions which will be needed as the functions within DBRepair are ported.

Folks want portability and what me to write in Python , which I’ve resisted.

I suggest that Python is already showing how “Not Universally Portable” it actually is.

I will press on until(if) a complete “Show Stopper” is encountered.

---

<div class="post-metadata">

**Author:** ![rossinior](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@rossinior](https://forums.plex.tv/u/rossinior)\
**Post date:** [February 7, 2026, 9:12am UTC](https://forums.plex.tv/t/dbrepair-development/822684/887 "2026-02-07T09:12:12Z")

</div>

Remember that we came from “oh, Windows users have to wait for somebody to do the PowerShell conversion”…. we are now not that far away from that for QNAP users since we all know how crippled the Python installation on this vendor’s system can be. Older QNAP systems are even worse (but could still use the shell script).

I will probably not go the extra mile to install something else to my ecosystem in order to use what could be used OOTB before.

Don’t get me wrong… I can fully understand anybody who wants it to work in their own ecosystem more flawlessly (older version of DBRepair is available in PowerShell). In my view, the use of Python is simply shifting the problem from one group of users to another group of users. I will now save the current version to keep it to have something that I could use later.

Let’s watch how this will evolve… maybe @ChuckPa can work it out.

---

<div class="post-metadata">

**Author:** ![JCHH](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/jchh/32/84326_2.png) [@JCHH](https://forums.plex.tv/u/JCHH)\
**Post date:** [February 7, 2026, 9:25am UTC](https://forums.plex.tv/t/dbrepair-development/822684/888 "2026-02-07T09:25:45Z")

</div>

> [@rossinior](#):
>
> Remember that we came from “oh, Windows users have to wait for somebody to do the PowerShell conversion”…. we are now not that far away from that for QNAP users…

> [@rossinior](#):
>
> In my view, the use of Python is simply shifting the problem from one group of users to another group of users.

I fear this also and, whilst I am very happy with how to run the script, I have been unable to follow the Python portion of this thread and think that maybe I will not be able to use it (at least the effort required to learn how to use it and then actually use it will be more than I am prepared or able to do).

I totally get why we’re moving to Python, but I fear that I’m effectively precluded going forward.

Edit: I’m on a QNAP

---

<div class="post-metadata">

**Author:** ![Insomnic\_1](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/insomnic_1/32/215416_2.png) [@Insomnic\_1](https://forums.plex.tv/u/Insomnic_1)\
**Post date:** [February 7, 2026, 2:39pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/889 "2026-02-07T14:39:15Z")

</div>

I’ll second (third?) the last two folks… I’ll keep the latest .sh version around instead of trying to setup an environment for python compatibility. I use synology and qnap for simplicity and am not interested in the awkward steps required so far to get a “python is more universal” environment setup on my NAS servers. Just weighing in, not making a case or argument.

I do appreciate the intent and the efforts being put in here. 🙂

[Previous page](https://forums.plex.tv/t/dbrepair-development/822684.md?page=40)

[Next page](https://forums.plex.tv/t/dbrepair-development/822684.md?page=42)
