mirror of
https://github.com/ChuckPa/PlexDBRepair.git
synced 2025-11-06 03:08:55 -05:00
New: Add menu option to ignore/honor duplicates / constraint errors
update code. bump to version 1.02.00 (new feature) update release notes. update readme
This commit is contained in:
parent
6c7157cb5f
commit
38749aef78
28
DBRepair.sh
28
DBRepair.sh
@ -2,12 +2,12 @@
|
||||
#########################################################################
|
||||
# Plex Media Server database check and repair utility script. #
|
||||
# Maintainer: ChuckPa #
|
||||
# Version: v1.01.04 #
|
||||
# Date: 25-Nov-2023 #
|
||||
# Version: v1.02.00 #
|
||||
# Date: 26-Nov-2023 #
|
||||
#########################################################################
|
||||
|
||||
# Version for display purposes
|
||||
Version="v1.01.04"
|
||||
Version="v1.02.00"
|
||||
|
||||
# Flag when temp files are to be retained
|
||||
Retain=0
|
||||
@ -258,9 +258,9 @@ MakeBackups() {
|
||||
ConfirmYesNo() {
|
||||
|
||||
Answer=""
|
||||
while [ "$Answer" = "" ]
|
||||
while [ "$Answer" != "Y" ] && [ "$Answer" != "N" ]
|
||||
do
|
||||
printf "$1 (Y/N) ? "
|
||||
printf "%s (Y/N) ? " "$1"
|
||||
read Input
|
||||
|
||||
# EOF = No
|
||||
@ -277,8 +277,8 @@ ConfirmYesNo() {
|
||||
esac
|
||||
|
||||
# Unrecognized
|
||||
if [ "$Answer" != "Y" ] || [ "$Answer" != "N" ]; then
|
||||
printf "$Input" was not a valid reply. Please try again.
|
||||
if [ "$Answer" != "Y" ] && [ "$Answer" != "N" ]; then
|
||||
echo \"$Input\" was not a valid reply. Please try again.
|
||||
continue
|
||||
fi
|
||||
done
|
||||
@ -840,6 +840,7 @@ DoRepair() {
|
||||
"$PLEX_SQLITE" $CPPL.db ".output '$TMPDIR/library.plexapp.sql-$TimeStamp'" .dump
|
||||
Result=$?
|
||||
[ $IgnoreErrors -eq 1 ] && Result=0
|
||||
|
||||
if ! SQLiteOK $Result; then
|
||||
|
||||
# Cannot dump file
|
||||
@ -1623,6 +1624,11 @@ do
|
||||
echo " 10 - 'show' - Show logfile."
|
||||
echo " 11 - 'status' - Report status of PMS (run-state and databases)."
|
||||
echo " 12 - 'undo' - Undo last successful command."
|
||||
|
||||
echo ""
|
||||
[ $IgnoreErrors -eq 0 ] && echo " 42 - 'ignore' - Ignore duplicate/constraint errors."
|
||||
[ $IgnoreErrors -eq 1 ] && echo " 42 - 'honor' - Honor all database errors."
|
||||
|
||||
echo ""
|
||||
echo " 88 - 'update' - Check for updates."
|
||||
echo " 99 - 'quit' - Quit immediately. Keep all temporary files."
|
||||
@ -1926,6 +1932,14 @@ do
|
||||
DoUndo
|
||||
;;
|
||||
|
||||
# Ignore/Honor errors
|
||||
42|igno*|hono*)
|
||||
|
||||
IgnoreErrors=$((IgnoreErrors ^ 1))
|
||||
[ $IgnoreErrors -eq 0 ] && Output "Honoring database errors." && WriteLog "Honoring database errors."
|
||||
[ $IgnoreErrors -eq 1 ] && Output "Ignoring database errors." && WriteLog "Ignoring database errors."
|
||||
;;
|
||||
|
||||
88|upda*)
|
||||
|
||||
DoUpdate=0
|
||||
|
||||
23
README.md
23
README.md
@ -50,7 +50,7 @@ If sufficient privleges exist (root), and supported by the environment, the opti
|
||||
|
||||
```
|
||||
Plex Media Server Database Repair Utility (_host_configuration_name_)
|
||||
Version v1.01.00
|
||||
Version v1.02.00
|
||||
|
||||
Select
|
||||
|
||||
@ -68,6 +68,8 @@ If sufficient privleges exist (root), and supported by the environment, the opti
|
||||
11 - 'status' - Report status of PMS (run-state and databases).
|
||||
12 - 'undo' - Undo last successful command.
|
||||
|
||||
42 - 'ignore' - Ignore duplicate/constraint errors.
|
||||
|
||||
88 - 'update' - Check for updates.
|
||||
99 - 'quit' - Quit immediately. Keep all temporary files.
|
||||
'exit' - Exit with cleanup options.
|
||||
@ -298,7 +300,7 @@ bash-4.4# ./DBRepair.sh
|
||||
|
||||
|
||||
Plex Media Server Database Repair Utility (Ubuntu 20.04.6 LTS)
|
||||
Version v1.01.00
|
||||
Version v1.02.00
|
||||
|
||||
|
||||
Select
|
||||
@ -317,6 +319,8 @@ Select
|
||||
11 - 'status' - Report status of PMS (run-state and databases).
|
||||
12 - 'undo' - Undo last successful command.
|
||||
|
||||
42 - 'ignore' - Ignore duplicate/constraint errors.
|
||||
|
||||
88 - 'update' - Check for updates.
|
||||
99 - 'quit' - Quit immediately. Keep all temporary files.
|
||||
'exit' - Exit with cleanup options.
|
||||
@ -342,6 +346,8 @@ Select
|
||||
11 - 'status' - Report status of PMS (run-state and databases).
|
||||
12 - 'undo' - Undo last successful command.
|
||||
|
||||
42 - 'ignore' - Ignore duplicate/constraint errors.
|
||||
|
||||
88 - 'update' - Check for updates.
|
||||
99 - 'quit' - Quit immediately. Keep all temporary files.
|
||||
'exit' - Exit with cleanup options.
|
||||
@ -393,6 +399,8 @@ Select
|
||||
11 - 'status' - Report status of PMS (run-state and databases).
|
||||
12 - 'undo' - Undo last successful command.
|
||||
|
||||
42 - 'ignore' - Ignore duplicate/constraint errors.
|
||||
|
||||
88 - 'update' - Check for updates.
|
||||
99 - 'quit' - Quit immediately. Keep all temporary files.
|
||||
'exit' - Exit with cleanup options.
|
||||
@ -418,6 +426,8 @@ Select
|
||||
11 - 'status' - Report status of PMS (run-state and databases).
|
||||
12 - 'undo' - Undo last successful command.
|
||||
|
||||
42 - 'ignore' - Ignore duplicate/constraint errors.
|
||||
|
||||
88 - 'update' - Check for updates.
|
||||
99 - 'quit' - Quit immediately. Keep all temporary files.
|
||||
'exit' - Exit with cleanup options.
|
||||
@ -446,6 +456,8 @@ Select
|
||||
11 - 'status' - Report status of PMS (run-state and databases).
|
||||
12 - 'undo' - Undo last successful command.
|
||||
|
||||
42 - 'ignore' - Ignore duplicate/constraint errors.
|
||||
|
||||
88 - 'update' - Check for updates.
|
||||
99 - 'quit' - Quit immediately. Keep all temporary files.
|
||||
'exit' - Exit with cleanup options.
|
||||
@ -595,6 +607,13 @@ root@lizum:/sata/plex/Plex Media Server/Plug-in Support/Databases#
|
||||
Exits the utility and removes all temporary database files created during processing.
|
||||
To save all intermediate databases, use the 'Quit' command.
|
||||
|
||||
### Ignore / Honor
|
||||
|
||||
Toggle the state (ON/OFF) of the IGNORE flag. When ON, Duplicates and UNIQUE constraint errors will be ignored.
|
||||
Caution is advised as other errors will be ignored during initial processing.
|
||||
|
||||
In ALL cases, DBRepair will never allow a bad database to be created.
|
||||
|
||||
### Import
|
||||
|
||||
Imports (raw) watch history from another PMS database without ability to check validity
|
||||
|
||||
@ -8,6 +8,15 @@
|
||||

|
||||
|
||||
# Release Info:
|
||||
v1.02.00
|
||||
|
||||
- Provide menu option to ignore/honor "Duplicate" and "UNIQUE Constraint" errors during DB Repair,
|
||||
and when importing data from other databases.
|
||||
This is equivalent to the '-i' command line option but now can be used interactively.
|
||||
|
||||
- Fixed. ConfirmYesNo would print error message when it shouldn't.
|
||||
- Fixed. Erroneous echo of your reply when responding to yes/no questions.
|
||||
|
||||
v1.01.04
|
||||
|
||||
- Missing IgnoreErrors (-i / -f) test when reimporting damaged DB with certain errors prevented repair
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user