{"id":16823283,"url":"https://github.com/caronc/nzbget-tidyit","last_synced_at":"2025-04-11T03:14:04.365Z","repository":{"id":32262002,"uuid":"35836464","full_name":"caronc/nzbget-tidyit","owner":"caronc","description":"Will clean up your video media library by eliminating directories that no longer contain the video file they once hosted","archived":false,"fork":false,"pushed_at":"2020-09-08T15:09:40.000Z","size":155,"stargazers_count":21,"open_issues_count":1,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-11T03:13:59.406Z","etag":null,"topics":["automation","cli","nzbget","nzbget-script","scheduling-script","video-library"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/caronc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"caronc","custom":["https://www.paypal.me/lead2gold"]}},"created_at":"2015-05-18T18:54:01.000Z","updated_at":"2023-06-17T20:41:19.000Z","dependencies_parsed_at":"2022-09-23T01:03:28.524Z","dependency_job_id":null,"html_url":"https://github.com/caronc/nzbget-tidyit","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caronc%2Fnzbget-tidyit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caronc%2Fnzbget-tidyit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caronc%2Fnzbget-tidyit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caronc%2Fnzbget-tidyit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caronc","download_url":"https://codeload.github.com/caronc/nzbget-tidyit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248333594,"owners_count":21086200,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","cli","nzbget","nzbget-script","scheduling-script","video-library"],"created_at":"2024-10-13T11:07:30.528Z","updated_at":"2025-04-11T03:14:04.348Z","avatar_url":"https://github.com/caronc.png","language":"Python","funding_links":["https://github.com/sponsors/caronc","https://www.paypal.me/lead2gold","https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=MHANV39UZNQ5E"],"categories":[],"sub_categories":[],"readme":"__Note:__ This script was intended to be an [NZBGet](http://nzbget.net) and _Scheduling_\nscript for _NZBGet_. However, it also works perfectly well as a standalone script for others too! It can be easily adapted to anyone's environment.\nSee the _Command Line_ section below for details how you can easily use this on it's own (without NZBGet).\n\n[![Paypal](http://repo.nuxref.com/pub/img/paypaldonate.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=MHANV39UZNQ5E)\n\n\nTidyIt Scheduler Script\n========================\nTidyIt is a script designed to tidy up your video library; house cleaning\none could say. It takes care of directories that once held video content,\nbut now is just either empty, or contains old meta data and other junk.\n\nThis script is especially useful if you use a third party application such as\nPlex or KODI (XBMC) to manage your video library. It also works great for Synology devices too. In fact, most third party applications and/or appliances that allow you to remove a video from your library will _only_ remove the video itself. They will not remove all the other content that surrounds it.\n\nSince the primary focus of this script is to remove content from your media\nlibrary, I will not be held responsible for any irrecoverable data loss you\nexperience. I can confirm the tool works for me, but that doesn't mean it\nwill work for you. The good news is that the script is filled with safe guards!\nThus you'd have to stray far from the default settings to damage your library.\n\nThe script intentionally operates in a _log only_ mode by default unless you\nexplicitly specify it to run differently. I encourage you to run the script\nin this _log only_ mode first anyway;  get an idea as to what it wants to do\nand the files it wants to handle. If you're happy with its decisions, you can\nflip a switch (to the _Move_ or _Delete_ mode) and the script will begin tidying up your library as promised to you.\n\nThe script operates in 3 modes:\n* __Preview__: This is the default option. It runs the script and just reports to the screen what it would have otherwise done. It doesn't actually do anthing at all to your library though. This might be all you need as it's output can allow you to take your own actions. Alternatively this is a great method to run in until you get the options the way you like them.\n* __Delete__: This mode performs the same check the Preview does however anything flagged to be handled is removed.\n* __Move__: This mode _moves_ handled content into another directory (that you identify). This allows you to review what is considered junk and decide for yourself if it should be removed. This method also requires you to be responsible for managing the directory you move content to.\n\nInstallation Instructions\n=========================\n1. Ensure you have at least Python v2.7 or higher installed onto your system.\n```bash\n# Pull in dependencies:\npip install -r requirements.txt\n```\n2. Simply place the __TidyIt.py__ into your NZBGet scripts directory.\n   * __NZBGet users__: you will want to place these inside of your _nzbget/scripts_ directory. Please ensure you are running _(at least)_ NZBGet v11.0 or higher. You can acquire the latest version of of it from [here](http://nzbget.net/download).\n\nThe Non-NZBGet users can also use this script via a cron (or simply call it\nfrom the command line) to automatically tidy their directories too.\nSee the __Command Line__ section below for more instructions on how to do this.\n\nCommand Line\n============\nTidyIt.py has a built in command line interface that can be easily tied\nto a cron entry or can be easilly called from the command line to automate\nthe cleanup of your media libraries.\n\nHere are the switches available to you:\n```\nUsage: TidyIt.py [options] [scandir1 [scandir2 [...]]]\n\nOptions:\n  -h, --help            Show this help message and exit.\n  -n ENCODING, --encoding=ENCODING\n                        The system encoding to use (utf-8, ISO-8859-1, etc).\n                        The default value is 'UTF-8'.\n  -s ENTRIES, --safe-entries=ENTRIES\n                        If a safe-entry file/dir is located within a path\n                        scanned then the path is ignored. Use safe-entry files\n                        (or dirs) to intentionally ignore directories of your\n                        choice that reside in your video library. You can\n                        specify more then one safe-entry by separating them\n                        with a comma (,). The default value(s) are\n                        '.tidysafe'.\n  -t ENTRIES, --always-trash=ENTRIES\n                        Identify any file extensions you wish to always trash\n                        if matched. By default this is not set. You can\n                        specify more then one trash entry by separating each\n                        of them with a comma (,).\n  -M ENTRIES, --meta-content=ENTRIES\n                        Identify any files and/or directories that should be\n                        treated as meta content. Meta content is only handled\n                        if it's the last thing within a media directory. You\n                        can specify more then one meta entry by separating\n                        each of them with a comma (,). By Default the\n                        following are already defined: 'Thumbs.db', '@eaDir',\n                        '.wdtv', '.DS_Store', '.AppleDouble', '__MACOSX'.\n  -m SIZE_IN_MB, --video-minsize=SIZE_IN_MB\n                        Specify the minimum size a video must be before it's\n                        treated as part of your collection. This value is used\n                        to diffentiate between video file and samples files.\n                        This value is interpreted in MB (Megabytes) and\n                        defaults to 150 MB.\n  -x ENTRIES, --video-extras=ENTRIES\n                        Identify the extra files you keep around with your\n                        video files as a comma delimited lit. The script will\n                        scan for these files explicitly and remove them if a\n                        video file bearing the same name is not found.  For\n                        this reason you do not want to specify video\n                        extensions here. This defaults to '.nfo,.??.srt,.srt,.\n                        sub,.txt,.sub,.idx,.jpg,.tbn,.nzb,.xml,.diz' if\n                        nothing is specified.\n  -a AGE_IN_SEC, --min-age=AGE_IN_SEC\n                        Specify the minimum age a directory and/or file must\n                        be before considering it for processing. This value is\n                        interpreted in seconds and defaults to 3600 sec(s).\n  -c, --clean           Unless this switch is specified, this script only runs\n                        in a log only mode (a dry-run) allowing you to see the\n                        actions the script would have otherwise performed.\n                        This switch can be combined with the --move-path (-p)\n                        switch to move handled instead.\n  -p PATH, --move-path=PATH\n                        Identifiy the path to place content into instead of\n                        removing it.  By specifying a --move-path, the --clean\n                        (-c) switch is implied however handled content is\n                        moved instead of being removed.\n  -k, --keep-directories\n                        Do not delete video directories during cleanup.\n  -L FILE, --logfile=FILE\n                        Send output to the specified logfile instead of\n                        stdout.\n  -D, --debug           Debug Mode\n```\n\nHere is a simple example:\n```bash\n# Scan your library (print only mode)\npython TidyIt.py /usr/share/TVShows\n# Happy with the results? Okay then run the script with the --clean (-c) switch:\n\npython TidyIt.py -c /usr/share/TVShows\n```\n\nYou can scan multiple directories with the following command:\n```bash\n# Scan your libraries (print only mode)\npython TidyIt.py /usr/share/TVShows /usr/share/Movies\n```\n\nIf you don't want your content to be removed; you can just have handled content moved to another directory for your review later on. All directory paths are preserved so it won't take any rocket science to figure out where the removed content came from. It's basically a safer mode then the --clean (-c) switch provides.\n```bash\n# Scan your libraries and move any content to be handled to the\n# TidyIt.Trash in your home directory (~ is supported)\npython TidyIt.py -m ~/TidyIt.Trash /usr/share/TVShows\n```\n\nIf the script behaves as you expect it should, you can schedule it as a cron\nto frequently clean your libraries every day with a command such as:\n```bash\n# $\u003e crontab -e\n0 0 * * * /path/to/TidyIt.py -c /usr/share/TVShows /usr/share/Movies\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaronc%2Fnzbget-tidyit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaronc%2Fnzbget-tidyit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaronc%2Fnzbget-tidyit/lists"}