You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The script will expect to connect to your Plex Server using your `Plex URL` and `Plex Token` Options ([Finding a Token](https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/)).
171
-
172
-
* **Environment Variables:**
173
-
174
-
* `PLEX_URL=http://192.168.1.12:32400`
175
-
176
-
* `PLEX_TOKEN=123456789`
177
-
178
-
* **Shell Commands:**
179
-
180
-
* `-u "http://192.168.1.12:32400"` or `--url "http://192.168.1.12:32400"`
181
-
182
-
* `-t "123456789"` or `--token "123456789"`
183
-
184
171
#### Plex Path
185
172
186
-
The only other required Option is the `Plex Path` Option which is the Plex Config Directory containing the servers Metadata including `Cache`, `Metadata`, and `Plug-in Support`.
173
+
The only required Option is the `Plex Path` Option which is the Plex Config Directory containing the servers Metadata including `Cache`, `Metadata`, and `Plug-in Support`.
187
174
188
175
To set the `Plex Path` for the run:
189
-
190
176
* **Environment Variable:** `PLEX_PATH=C:\Plex Media Server`
191
-
192
177
* **Shell Command:** `-p "C:\Plex Media Server"` or `--plex "C:\Plex Media Server"`
193
-
194
-
**Will also check `/plex` relative to the base directory of the script if neither of the above are specified.**
178
+
* Will also check `/plex` relative to the base directory of the script if neither of the above are specified.
195
179
196
180
#### Mode
197
181
198
182
How Plex Image Cleanup runs depends on the `Mode` Option that's currently set for that run.
199
183
200
-
Here, "unused images" refers to unused uploaded images as described above.
184
+
* `report`: Metadata Directory File changes will be reported but not performed.
185
+
* `move`: Metadata Directory Files will be moved to the PIC Restore Directory. (CAN BE RESTORED)
186
+
* `restore`: Restores the Metadata Directory Files from the PIC Restore Directory.
187
+
* `clear`: Clears out the PIC Restore Directory. (CANNOT BE RESTORED)
188
+
* `remove`: Metadata Directory Files will be removed. (CANNOT BE RESTORED)
189
+
* `nothing`: Metadata Directory Files will not even be looked at.
201
190
202
-
* `report`: Reports statistics on unused images [count, size] but takes no action on them [like moving or deleting].
191
+
To set the Global `Mode` for the run:
192
+
* **Environment Variable:** `MODE=remove`
193
+
* **Shell Command:** `-m remove` or `--mode remove`
203
194
204
-
* `move`: Moves unused images to the PIC Restore Directory. From there they can be `restore`d or `clear`ed.
195
+
### Database
205
196
206
-
* `restore`: Restores the unused images from the PIC Restore Directory [as created by `move`] to the Metadata Directory. This restores Plex to its state prior to running PIC.
197
+
The script needs to query the server's plex database to make sure it doesn't remove actively selected images.
207
198
208
-
* `clear`: Deletes the unused images from the PIC Restore Directory [as created by `move`]. (CANNOT BE UNDONE)
199
+
#### Download From Plex API
209
200
210
-
* `remove`: Deletes the unused images from the Metadata Directory immediately, without the stop in the PIC Restore Directory. (CANNOT BE UNDONE)
201
+
By default, the script will expect to connect to your Plex Server to download the Database using your `Plex URL` and `Plex Token` Options ([Finding a Token](https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/)).
211
202
212
-
* `nothing`: Does nothing with unused images; no report, no action.
203
+
* **Environment Variables:**
204
+
* `PLEX_URL=http://192.168.1.12:32400`
205
+
* `PLEX_TOKEN=123456789`
206
+
* **Shell Commands:**
207
+
* `-u "http://192.168.1.12:32400"` or `--url "http://192.168.1.12:32400"`
208
+
* `-t "123456789"` or `--token "123456789"`
213
209
214
-
To set the Global `Mode` for the run:
210
+
#### Copy From Local
215
211
216
-
* **Environment Variable:** `MODE=remove`
212
+
Alternatively the database can be copied from your local config directory you supplied in the [`Plex Path`](#plex-path) Option by using the `Local DB` Option.
217
213
218
-
* **Shell Command:** `-m remove` or `--mode remove`
214
+
* **Environment Variable:** `LOCAL_DB=True`
215
+
* **Shell Command:** `-l` or `--local`
216
+
217
+
**IMPORTANT! When Copying the Local Database, it is recommended to restart Plex before running this script and to make sure Plex is idle.**
218
+
219
+
Restarting allows for all temp SQLite files to be written to the primary Plex DB ensuring that all currently selected posters are properly known and preserved.
220
+
221
+
The script will not run when the temp SQLite files are found. To ignore this error, use the `Ignore Running` Option.
222
+
223
+
* **Environment Variable:** `IGNORE_RUNNING=True`
224
+
* **Shell Command:** `-i` or `--ignore`
225
+
226
+
#### Use Existing
227
+
228
+
A previously downloaded or copied database can be used if it's less than 2 hours old by using the `Use Existing` Option. If the database is more than 2 hours old a new one will be downloaded or copied.
219
229
220
-
**NOTE: `report` is the default mode if you do not specify a mode.**
0 commit comments