forked from t3mujin/t3mujinpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remove_t3mujinpack.bat
127 lines (98 loc) · 3.4 KB
/
remove_t3mujinpack.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
@echo off
rem Removes all t3mujinpack styles from Darktable database.
rem
rem Author: João Almeida <info@joaoalmeidaphotography.com>
rem Initialize output colors
set ESC=
set LIGHT_GREY=%ESC%[34m
set YELLOW=%ESC%[31m
set GREEN=%ESC%[34m
set LIGHT_BLUE=%ESC%[34m
set NC=%ESC%[37m
echo.
echo ----------------------------------------------------------------------
echo t3mujinpack - Film emulation presets for Darktable
echo.
echo Presets Uninstall script
echo ----------------------------------------------------------------------
echo.
rem Validate Darktable installation
set darktable_path="%ProgramFiles%\darktable\bin\darktable.exe"
IF not exist %darktable_path% (
echo.
echo Darktable was not found at %darktable_path%.
echo.
exit /B
)
rem Setup database file
IF [%1] == [] (
echo.
echo Using default database files
set data_database_file="%localappdata%\darktable\data.db"
set library_database_file="%localappdata%\darktable\library.db"
) ELSE (
IF [%2] == [] (
echo.
echo You must also specify the library database file
echo.
exit /B
) ELSE (
echo Using given database files
set data_database_file=%1
set library_database_file=%2
)
)
IF NOT exist %data_database_file% (
echo.
echo Database file %data_database_file% does not exist
echo.
exit /B
)
rem Validate Darktable model
echo Current metadata database file: %data_database_file%
echo Current library database file: %library_database_file%
set output_data=
for /f %%i in ('bin\sqlite3.exe %data_database_file% "select count(1) from sqlite_master where name = 'styles' or name = 'style_items' or name = 'tags'"') do set output_data=%%i
if not %output_data% == 3 (
echo.
echo %data_database_file% is not an Darktable 3.0.x metadata database
echo Execution has ended and presets have NOT been uninstalled!
echo.
exit /B
)
set output_library=
for /f %%i in ('bin\sqlite3.exe %library_database_file% "select count(1) from sqlite_master where name = 'tagged_images'"') do set output_library=%%i
if not %output_library% == 1 (
echo.
echo %library_database_file% is not an Darktable 3.0.x metadata database
echo Execution has ended and presets have NOT been uninstalled!
echo.
exit /B
)
rem Validate t3mujinpack instalation (including older version)
set styles_list=
for /f %%i in ('bin\sqlite3.exe %data_database_file% "select name from styles where name like 't3mujin - %%' or name like 't3mujinpack - %%' order by name"') do set styles_list=%%i
if "%styles_list%" == "" (
echo.
echo t3mujinpack is not installed
echo.
exit /B
)
set "reply=y"
set /p "reply=Uninstall all t3mujinpack styles? [y|n]: "
IF not "%reply%" == "y" (
echo.
echo Uninstall aborted
exit /B
)
rem Execute uninstall
echo.
echo Removing styles definitions...
for /f %%i in ('bin\sqlite3.exe %data_database_file% "delete from style_items where style_items.styleid in ( select id from styles where name like '%%t3mujin - %%')"') do set styles_list=%%i
for /f %%i in ('bin\sqlite3.exe %data_database_file% "delete from style_items where style_items.styleid in ( select id from styles where name like '%%t3mujinpack - %%')"') do set styles_list=%%i
for /f %%i in ('bin\sqlite3.exe %data_database_file% "delete from styles where name like '%%t3mujin - %%'"') do set styles_list=%%i
for /f %%i in ('bin\sqlite3.exe %data_database_file% "delete from styles where name like '%%t3mujinpack - %%'"') do set styles_list=%%i
echo.
echo.
echo t3mujinpack presets have been uninstalled!
echo.