Skip to content

Commit

Permalink
revert back to 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
meisnate12 committed Jan 11, 2024
1 parent cc91cc9 commit d559fe7
Show file tree
Hide file tree
Showing 4 changed files with 283 additions and 218 deletions.
79 changes: 45 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,17 @@ Plex Image Cleanup has multiple Global Options to change how it runs these are s

### Example .env File
```
PLEX_URL=http://192.168.1.12:32400
PLEX_TOKEN=123456789
PLEX_PATH=C:\Plex Media Server
MODE=report
SCHEDULE=
PLEX_URL=http://192.168.1.12:32400
PLEX_TOKEN=123456789
DISCORD=https://discord.com/api/webhooks/###################/####################################################################
TIMEOUT=600
SLEEP=60
IGNORE_RUNNING=False
LOCAL_DB=False
USE_EXISTING=False
PHOTO_TRANSCODER=False
EMPTY_TRASH=False
CLEAN_BUNDLES=False
Expand All @@ -165,59 +168,67 @@ LOG_REQUESTS=False
### Base Options
#### Plex URL & Token
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/)).
* **Environment Variables:**
* `PLEX_URL=http://192.168.1.12:32400`
* `PLEX_TOKEN=123456789`
* **Shell Commands:**
* `-u "http://192.168.1.12:32400"` or `--url "http://192.168.1.12:32400"`
* `-t "123456789"` or `--token "123456789"`
#### Plex Path
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`.
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`.
To set the `Plex Path` for the run:
* **Environment Variable:** `PLEX_PATH=C:\Plex Media Server`
* **Shell Command:** `-p "C:\Plex Media Server"` or `--plex "C:\Plex Media Server"`
**Will also check `/plex` relative to the base directory of the script if neither of the above are specified.**
* Will also check `/plex` relative to the base directory of the script if neither of the above are specified.
#### Mode
How Plex Image Cleanup runs depends on the `Mode` Option that's currently set for that run.
Here, "unused images" refers to unused uploaded images as described above.
* `report`: Metadata Directory File changes will be reported but not performed.
* `move`: Metadata Directory Files will be moved to the PIC Restore Directory. (CAN BE RESTORED)
* `restore`: Restores the Metadata Directory Files from the PIC Restore Directory.
* `clear`: Clears out the PIC Restore Directory. (CANNOT BE RESTORED)
* `remove`: Metadata Directory Files will be removed. (CANNOT BE RESTORED)
* `nothing`: Metadata Directory Files will not even be looked at.
* `report`: Reports statistics on unused images [count, size] but takes no action on them [like moving or deleting].
To set the Global `Mode` for the run:
* **Environment Variable:** `MODE=remove`
* **Shell Command:** `-m remove` or `--mode remove`
* `move`: Moves unused images to the PIC Restore Directory. From there they can be `restore`d or `clear`ed.
### Database
* `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.
The script needs to query the server's plex database to make sure it doesn't remove actively selected images.
* `clear`: Deletes the unused images from the PIC Restore Directory [as created by `move`]. (CANNOT BE UNDONE)
#### Download From Plex API
* `remove`: Deletes the unused images from the Metadata Directory immediately, without the stop in the PIC Restore Directory. (CANNOT BE UNDONE)
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/)).
* `nothing`: Does nothing with unused images; no report, no action.
* **Environment Variables:**
* `PLEX_URL=http://192.168.1.12:32400`
* `PLEX_TOKEN=123456789`
* **Shell Commands:**
* `-u "http://192.168.1.12:32400"` or `--url "http://192.168.1.12:32400"`
* `-t "123456789"` or `--token "123456789"`
To set the Global `Mode` for the run:
#### Copy From Local
* **Environment Variable:** `MODE=remove`
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.
* **Shell Command:** `-m remove` or `--mode remove`
* **Environment Variable:** `LOCAL_DB=True`
* **Shell Command:** `-l` or `--local`
**IMPORTANT! When Copying the Local Database, it is recommended to restart Plex before running this script and to make sure Plex is idle.**
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.
The script will not run when the temp SQLite files are found. To ignore this error, use the `Ignore Running` Option.
* **Environment Variable:** `IGNORE_RUNNING=True`
* **Shell Command:** `-i` or `--ignore`
#### Use Existing
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.
**NOTE: `report` is the default mode if you do not specify a mode.**
* **Environment Variable:** `USE_EXISTING=True`
* **Shell Command:** `-e` or `--existing`
### Other Operations
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.1
1.0.2!
7 changes: 5 additions & 2 deletions config/example.env
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
PLEX_URL=http://192.168.1.12:32400
PLEX_TOKEN=123456789
PLEX_PATH=C:\Plex Media Server
MODE=report
SCHEDULE=
PLEX_URL=http://192.168.1.12:32400
PLEX_TOKEN=123456789
DISCORD=https://discord.com/api/webhooks/###################/####################################################################
TIMEOUT=600
SLEEP=60
IGNORE_RUNNING=False
LOCAL_DB=False
USE_EXISTING=False
PHOTO_TRANSCODER=False
EMPTY_TRASH=False
CLEAN_BUNDLES=False
Expand Down
Loading

0 comments on commit d559fe7

Please sign in to comment.