TidyIt just performs basic house cleaning on your library by eliminating garbage files and meta data that have accumulated over time.
For example:
If you delete a video file through a third party application such as KODI (XBMC) or Plex, you'll notice that it leaves the old directories in place. It also leave lingering meta information behind such as poster info, subtitles, etc. This script is intended to just scan your library and eliminate any lingering content that is no longer being referenced or used.
TidyIt It operates in 3 modes:
- Preview: a Log Only mode which only prints what it would have done. By default, this is the mode the script always operates in unless you explicitly specify otherwise. This is a great mode for just surveying your media library from afar (through log files) without doing anything to it!
- Delete: The Delete mode actually does the removal of the data flagged to be handled. You might want to choose this option once you're satisfied with it's cleaning algorithm (seen from the Preview mode's output). Alternatively you can check out the Move mode (identified next) which is a little less of an extreme approach (in comparison to this option).
- Move: Similar to the Delete mode (explained above) except content is moved to a directory of your choice instead of being removed. This gives you the ability to at least survey what the script considered to be no good and make a final decision for yourself.
TidyIt NZBGet Script Details
Author: Chris Caron <lead2gold@gmail.com>
Current Version: 0.8.0
Release Date: Jul 19th, 2019
License: GPLv3
Source: GitHub / Direct Download Link
b]Updates[/b]:
- Jul 19th, 2019 Update (v0.8.0):
- Small bugfixes dating back to 2015
- Python 3 Support Added
- Carrying supported packages dropped and replaced with a requirements.txt file.
- Sep 25th, 2015 (v0.4.0):
- Original Build
The following needs to be ran in order to pull the packages this script depends on into your environment:
Code: Select all
# The requirements.txt can be found included in this package
pip install -r requirements.txt
Since this script operates as a Scheduling Plugin, you'll need to go into the Scheduler settings of NZBGet and add this script there in order for it to be ran. Schedule it to run whenever you want and remember that it runs in a Preview mode out of the box.
Features:
- Can scan more then one video library and recursively scans them all for videos and their containing folders.
- It supports safe-entries to over-ride the entire scripts functionality. If a directory or file is found that matches what you've defined as a safe-entry, then it will effectively cause the script to automatically ignore it (including subdirectories within) and all of it's contents.
- It can detect and remove zero byte files, empty directories since they're just wasting space anyway.
- You can optionally identify content you want to always remove if detected such as '*-sample.mkv'. By default there is nothing defined in this section.
- Eliminates unused/orphan subtitles and other meta information that have been downloaded (and reside in the same directory as other video files). It's smart enough to ignore metadata that is already associated with a video file.
- The script ignores any directories or files that is less then 1 hour old. This is intentional (but configurable) setting used to prevent cases where another processes is managing the same library.
* A CLI (Command Line Interface) allows you to the TidyIt.py manually if you like from the command line now. Run it with --help (-h) to see some options if you like. A simple command might be:- * TidyIt.py /a/path/to/your/library /another/path/to/another/library which simply scans the libraries and only prints what it would like to do. It will never actually preform any action (so don't worry about screwing anything up here!). This is equivalent to NZBGet's Disabled mode TidyIt offers.
* TidyIt.py -c /a/path/to/your/library /another/path/to/another/library is much more harsh. The --clean (-c) switch invokes the Delete mode. Anything marked for handling is deleted. Make sure you're comfortable with your settings before choosing this option.
* TidyIt.py -p /path/to/temporary/trash /a/path/to/your/library /another/path/to/another/library is a little more laid back. The --move-path (-p) switch invokes the Move mode. Anything marked for handling is moved into the path you specify instead. If the path doesn't exist, then it'll be created.
- * TidyIt.py /a/path/to/your/library /another/path/to/another/library which simply scans the libraries and only prints what it would like to do. It will never actually preform any action (so don't worry about screwing anything up here!). This is equivalent to NZBGet's Disabled mode TidyIt offers.
CLI Help Menu
Code: Select all
Usage: TidyIt.py [options] [scandir1 [scandir2 [...]]]
Options:
-h, --help show this help message and exit
-n ENCODING, --encoding=ENCODING
The system encoding to use (utf-8, ISO-8859-1, etc).
The default value is 'UTF-8'.
-s ENTRIES, --safe-entries=ENTRIES
If a safe-entry file/dir is located within a path
scanned then the path is ignored. Use safe-entry files
(or dirs) to intentionally ignore directories of your
choice that reside in your video library. You can
specify more then one safe-entry by separating them
with a comma (,). The default value(s) are
'.tidysafe'.
-t ENTRIES, --always-trash=ENTRIES
Identify any file extensions you wish to always trash
if matched. By default this is not set.You can specify
more then one trash entry by separating each of them
with a comma (,).
-M ENTRIES, --meta-content=ENTRIES
Identify any files and/or directories that should be
treated as meta content. Meta content is only handled
if it's the last thing within a media directory.You
can specify more then one meta entry by separating
each of them with a comma (,). By Default the
following are already defined: 'Thumbs.db', '@eaDir',
'.DS_Store', '.AppleDouble', '__MACOSX'.
-m SIZE_IN_MB, --video-minsize=SIZE_IN_MB
Specify the minimum size a video must be before it's
treated as part of your collection. This value is used
to diffentiate between video file and samples files.
This value is interpreted in MB (Megabytes) and
defaults to 150 MB.
-a AGE_IN_SEC, --min-age=AGE_IN_SEC
Specify the minimum age a directory and/or file must
be before considering it for processing. This value is
interpreted in seconds and defaults to 3600 sec(s).
-c, --clean Unless this switch is specified, this script only runs
in a log only mode (a dry-run) allowing you to see the
actions the script would have otherwise performed.
This switch can be combined with the --move-path (-p)
switch to move handled instead.
-p PATH, --move-path=PATH
Identifiy the path to place content into instead of
removing it. By specifying a --move-path, the --clean
(-c) switch is implied however handled content is
moved instead of being removed.
-L FILE, --logfile=FILE
Send output to the specified logfile instead of
stdout.
-D, --debug Debug Mode