mirror of
https://github.com/ChuckPa/PlexDBRepair.git
synced 2026-02-12 05:56:11 -06:00
Compare commits
4 Commits
212162dece
...
f576274e66
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f576274e66 | ||
|
|
e63b7552bb | ||
|
|
47bd6e7c56 | ||
|
|
beeaa88315 |
@@ -6,8 +6,7 @@ REM - everything is done without need to interact.
|
|||||||
REM
|
REM
|
||||||
REM -- WARNNING -- WARNING -- WARNING
|
REM -- WARNNING -- WARNING -- WARNING
|
||||||
REM
|
REM
|
||||||
REM 1. This is stable working software but not "Released" software. Development will continue.
|
REM This is stable working software but not "Released" software. Development will continue.
|
||||||
REM 2. You must ensure variable PlexData points to your databases. (there is no automatic detection at this time)
|
|
||||||
REM
|
REM
|
||||||
REM ### Create Timestamp
|
REM ### Create Timestamp
|
||||||
set Hour=%time:~0,2%
|
set Hour=%time:~0,2%
|
||||||
@@ -20,9 +19,33 @@ set Hour=%Hour: =%
|
|||||||
REM ## Set TimeStamp ##
|
REM ## Set TimeStamp ##
|
||||||
set TimeStamp=%Hour%-%Min%-%Sec%
|
set TimeStamp=%Hour%-%Min%-%Sec%
|
||||||
|
|
||||||
REM These assume PMS is in the default location
|
REM Find PMS database location
|
||||||
set "PlexData=%LOCALAPPDATA%\Plex Media Server\Plug-in Support\Databases"
|
for /F "tokens=2* skip=2" %%a in ('REG.EXE QUERY "HKCU\Software\Plex, Inc.\Plex Media Server" /v "LocalAppDataPath" 2^> nul') do set "PlexData=%%b\Plex Media Server\Plug-in Support\Databases"
|
||||||
set "PlexSQL=%PROGRAMFILES%\Plex\Plex Media Server\Plex SQLite"
|
if not exist "%PlexData%" (
|
||||||
|
if exist "%LOCALAPPDATA%\Plex Media Server\Plug-in Support\Databases" (
|
||||||
|
set "PlexData=%LOCALAPPDATA%\Plex Media Server\Plug-in Support\Databases"
|
||||||
|
) else (
|
||||||
|
echo Could not determine Plex database path.
|
||||||
|
echo Normally %LOCALAPPDATA%\Plex Media Server\Plug-in Support\Databases
|
||||||
|
echo.
|
||||||
|
goto :EOF
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Find PMS installation location.
|
||||||
|
for /F "tokens=2* skip=2" %%a in ('REG.EXE QUERY "HKCU\Software\Plex, Inc.\Plex Media Server" /v "InstallFolder" 2^> nul') do set "PlexSQL=%%b\Plex SQLite.exe"
|
||||||
|
if not exist "%PlexSQL%" (
|
||||||
|
if exist "%PROGRAMFILES%\Plex\Plex Media Server\Plex SQLite.exe" (
|
||||||
|
set "PlexSQL=%PROGRAMFILES%\Plex\Plex Media Server\Plex SQLite.exe"
|
||||||
|
) else (
|
||||||
|
echo Could not determine SQLite path.
|
||||||
|
echo Normally %PROGRAMFILES%\Plex\Plex Media Server\Plex SQLite.exe
|
||||||
|
echo.
|
||||||
|
goto :EOF
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Set temporary file locations
|
||||||
set "DBtmp=%PlexData%\dbtmp"
|
set "DBtmp=%PlexData%\dbtmp"
|
||||||
set "TmpFile=%DBtmp%\results.tmp"
|
set "TmpFile=%DBtmp%\results.tmp"
|
||||||
|
|
||||||
@@ -42,7 +65,7 @@ if %ERRORLEVEL%==0 (
|
|||||||
|
|
||||||
cd "%PlexData%"
|
cd "%PlexData%"
|
||||||
|
|
||||||
mkdir "%PlexData%\dbtmp" 2>NUL
|
md "%PlexData%\dbtmp" 2>NUL
|
||||||
del "%TmpFile%" 2>NUL
|
del "%TmpFile%" 2>NUL
|
||||||
|
|
||||||
echo %time% -- Exporting Main DB
|
echo %time% -- Exporting Main DB
|
||||||
|
|||||||
19
DBRepair.sh
19
DBRepair.sh
@@ -1451,12 +1451,6 @@ DownloadAndUpdate() {
|
|||||||
url="$1"
|
url="$1"
|
||||||
filename="$2"
|
filename="$2"
|
||||||
|
|
||||||
# Check if script path is writable
|
|
||||||
if [ ! -w "$ScriptWorkingDirectory" ]; then
|
|
||||||
Output "Script path is not writable."
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Download the file and check if the download was successful
|
# Download the file and check if the download was successful
|
||||||
if curl -s "$url" --output "$filename"; then
|
if curl -s "$url" --output "$filename"; then
|
||||||
Output "Update downloaded successfully"
|
Output "Update downloaded successfully"
|
||||||
@@ -1922,13 +1916,18 @@ do
|
|||||||
DoUpdate=1
|
DoUpdate=1
|
||||||
Output "Version update available"
|
Output "Version update available"
|
||||||
else
|
else
|
||||||
Output "No update available"
|
Output "No update available or user declined update"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check if script path is writable
|
||||||
if [ $DoUpdate -eq 1 ]; then
|
if [ $DoUpdate -eq 1 ]; then
|
||||||
Output "Performing update"
|
if [ -w "$ScriptWorkingDirectory" ]; then
|
||||||
DownloadAndUpdate "https://raw.githubusercontent.com/ChuckPa/PlexDBRepair/master/DBRepair.sh" "$ScriptWorkingDirectory/$ScriptName"
|
Output "Performing update"
|
||||||
exit 0
|
DownloadAndUpdate "https://raw.githubusercontent.com/ChuckPa/PlexDBRepair/master/DBRepair.sh" "$ScriptWorkingDirectory/$ScriptName"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
Output "Script path is not writable."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $Scripted -eq 1 ]; then
|
if [ $Scripted -eq 1 ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user