|
1 | | ---- |
2 | | -title: StarrScripts |
3 | | ---- |
4 | | - |
5 | 1 | # StarrScripts |
6 | 2 |
|
7 | | -Bash scripts for Starr apps (Radarr, Sonarr, Lidarr, Readarr): custom formats, naming, duplicate management, and update automation. |
| 3 | +[](https://github.com/baker-scripts/StarrScripts/actions/workflows/shellcheck.yml) |
| 4 | + |
| 5 | +A curated collection of scripts to optimize and manage various functions related to Starr applications and associated tools. |
| 6 | +Occasionally holds random useful scripts as well. |
| 7 | +These scripts are designed to enhance functionality, improve management, and automate routine tasks. |
| 8 | +All scripts are **Created By: [Bakerboy448](https://github.com/bakerboy448/) unless otherwise noted.** |
| 9 | + |
| 10 | +**Warning**: Do not edit files on Windows that will be executed on Linux without ensuring the line-endings are set to `LF`. |
| 11 | +This means that `CRLF` cannot be used in .sh scripts. Bash scripts will not execute properly and you will receive an |
| 12 | +error. |
| 13 | + |
| 14 | +## Scripts Overview |
| 15 | + |
| 16 | +### qui Cross-Seed Trigger for Starr Apps |
| 17 | + |
| 18 | +- **Script:** `qui-xseed.sh` |
| 19 | +- **Description:** Triggers a [qui](https://github.com/autobrr/qui) data-based cross-seed search when Radarr or Sonarr completes an import. The script creates a dir-scan entry in qui, triggers a scan, polls for completion, then cleans up. |
| 20 | +- **Creator:** [Bakerboy448](https://github.com/bakerboy448/) |
| 21 | +- **Requirements:** |
| 22 | + - [qui](https://github.com/autobrr/qui) with API access enabled |
| 23 | + - Radarr/Sonarr with Custom Script connect support |
| 24 | +- **Instructions:** |
| 25 | + 1. Copy `.env.sample` to `.env` and configure the `QUI_*` variables. |
| 26 | + 2. Docker Users: Mount `.env` and `qui-xseed.sh` to your Starr's `/config` mount. |
| 27 | + 3. In Radarr: `Settings` -> `Connect` -> `Custom Script` -> select "On Import" and "On Upgrade". |
| 28 | + 4. In Sonarr: `Settings` -> `Connect` -> `Custom Script` -> select "On Import Complete". |
| 29 | + 5. Test and Save. |
| 30 | +- **Configuration (`.env`):** |
| 31 | + - `QUI_HOST` - qui hostname (default: `localhost`) |
| 32 | + - `QUI_PORT` - qui API port (default: `7476`) |
| 33 | + - `QUI_APIKEY` - qui API key |
| 34 | + - `QUI_TARGET_INSTANCE_ID` - qui instance ID (default: `1`) |
| 35 | + - `QUI_QBIT_PATH_PREFIX` - optional path prefix for qBittorrent |
| 36 | + - `QUI_TAGS` - optional comma-separated tags |
| 37 | + - `TORRENT_CLIENTS` - comma-separated torrent client names (default: `qBittorrent`) |
| 38 | + - `USENET_CLIENTS` - comma-separated usenet client names (default: `SABnzbd`) |
| 39 | + - `LOG_FILE` - log file path (default: `./qui_xseed.log`) |
| 40 | +- **Notes:** |
| 41 | + - Only errors are written to stderr (which starr apps capture). All other logging goes to the log file only, to avoid noisy notifications. |
| 42 | + - The script is idempotent — duplicate download IDs are skipped via the ID log file. |
| 43 | + - Replaces the legacy `xseed.sh` (removed in v4.0.0) which used the cross-seed API directly. |
| 44 | + |
| 45 | +### Duplicate File Manager |
| 46 | + |
| 47 | +- **Script:** `dupe.sh` |
| 48 | +- **Description:** Executes `jdupes` to find and manage duplicate files in the specified directory. |
| 49 | +- **Instructions:** |
| 50 | + 1. Copy `.env.sample` to `.env`. |
| 51 | + 2. Populate required values under "# Jdupes" header. |
| 52 | + 3. Review and adjust script parameters to fit your use case. |
| 53 | +- **Output:** Results are saved to a file as specified in the script. |
| 54 | + |
| 55 | +### Merge Folders Utility |
| 56 | + |
| 57 | +- **Script:** `merge_folders.py` |
| 58 | +- **Description:** A robust utility designed for merging multiple directories into a single target directory, ensuring that no existing files are overwritten in the process. This script uses a recursive function to efficiently merge content, while providing detailed logging of each step to monitor the creation, movement, and skipping of files and directories. |
| 59 | +- **Features:** |
| 60 | + - **Recursive Merging:** Seamlessly combines contents of source directories into a target directory. |
| 61 | + - **Non-destructive:** Preserves existing files by not overwriting them. |
| 62 | + - **Error Handling:** Captures and logs errors during the merging process, ensuring reliable operations. |
| 63 | + - **Detailed Logging:** Tracks and logs every file and directory operation, providing clear visibility into the process. |
| 64 | +- **Usage Case:** Ideal for consolidating data in scenarios like organizing media libraries, merging data backups, or simplifying file system structures. |
| 65 | +- **Instructions:** |
| 66 | + 1. Update `source_dirs` and uncomment the variable |
| 67 | + 2. Update `target_dir` and uncomment the variable |
| 68 | + 3. Uncomment `atomic_moves` to engage the movement operation |
| 69 | + 4. Run the script with `python3 merge_folders.py` |
| 70 | + |
| 71 | +### Plex Image Cleanup Updater |
| 72 | + |
| 73 | +- **Script:** `pic-update.sh` |
| 74 | +- **Description:** Updates [Plex-Image-Cleanup](https://github.com/meisnate12/Plex-Image-Cleanup) to the latest branch. |
| 75 | +- **Review:** Check that script parameters are suitable for your environment. |
| 76 | + |
| 77 | +### Plex Meta Manager Updater |
| 78 | + |
| 79 | +- **Script:** `pmm-update.sh` |
| 80 | +- **Description:** Updates [Plex Meta Manager](https://github.com/meisnate12/Plex-Meta-Manager) to the latest branch. |
| 81 | +- **Review:** Confirm script parameters align with your configuration. |
| 82 | + |
| 83 | +### QbitManage API Trigger |
| 84 | + |
| 85 | +- **Script:** `qbm-api-trigger.sh` |
| 86 | +- **Description:** Triggers [QbitManage](https://github.com/StuffAnThings/qbit_manage) commands via Web API for specific torrent hashes. |
| 87 | +- **Requirements:** |
| 88 | + - QbitManage v4.5+ with Web API enabled (`QBT_WEB_SERVER=true`) |
| 89 | + - QbitManage container accessible via HTTP |
| 90 | +- **Instructions:** |
| 91 | + 1. Configure QbitManage Web API in your docker-compose.yml |
| 92 | + 2. In qBittorrent, navigate to `Options` -> `Downloads` -> `Run external program on torrent completion` |
| 93 | + 3. Add command: `/path/to/qbm-api-trigger.sh %I` |
| 94 | + 4. The `%I` variable passes the torrent hash to trigger commands like `tag_update`, `share_limits`, `rem_unregistered`, and `recheck` |
| 95 | +- **Notes:** |
| 96 | + - Script sends POST request to `http://127.0.0.1:4269/api/run-command` by default |
| 97 | + - Modify `API_URL` and `COMMANDS` variables in script to customize behavior |
| 98 | + - All execution details logged to `run_qbit_manage_commands.log` |
| 99 | + |
| 100 | +### QbitManage Updater |
| 101 | + |
| 102 | +- **Script:** `qbm-update.sh` |
| 103 | +- **Description:** Updates [QbitManage](https://github.com/StuffAnThings/qbit_manage) to the latest branch. |
| 104 | +- **Review:** Ensure script parameters match your setup before execution. |
| 105 | + |
| 106 | +### Servarr Bot Merger |
| 107 | + |
| 108 | +- **Script:** `servarr/servarr_bot_merge.sh` |
| 109 | +- **Description:** Merges the latest changes from the Servarr Wiki Bot Branch into the Prowlarr Indexers Wiki Master. |
| 110 | + |
| 111 | +### Backup Config |
| 112 | + |
| 113 | +- **Script:** `backup_config.sh` |
| 114 | +- **Description:** Backs up configuration directories to a compressed archive. |
| 115 | + |
| 116 | +### Fail2ban Config Dump |
| 117 | + |
| 118 | +- **Script:** `f2b-dump.sh` |
| 119 | +- **Description:** Dumps Fail2ban configuration details to a temporary file for review. |
| 120 | + |
| 121 | +### Omegabrr Updater |
| 122 | + |
| 123 | +- **Script:** `omegabrr_upgrade.sh` |
| 124 | +- **Description:** Upgrades [Omegabrr](https://github.com/autobrr/omegabrr) to the latest version. |
| 125 | + |
| 126 | +### Radarr Duplicate Finder |
| 127 | + |
| 128 | +- **Script:** `radarr_dupefinder.sh` |
| 129 | +- **Description:** Finds duplicate files in Radarr library directories. |
| 130 | + |
| 131 | +### Sonarr Duplicate Finder |
| 132 | + |
| 133 | +- **Script:** `sonarr_dupefinder.sh` |
| 134 | +- **Description:** Finds duplicate files in Sonarr library directories. |
| 135 | + |
| 136 | +### ZFS Snapshot Cleanup |
| 137 | + |
| 138 | +- **Script:** `zfsburn.sh` |
| 139 | +- **Description:** Deletes ZFS autosnapshots older than a specified number of days. |
| 140 | +- **Instructions:** |
| 141 | + 1. Copy `.env.sample` to `.env`. |
| 142 | + 2. Fill in the required values under "# ZFS Destroy" header. |
| 143 | + |
| 144 | +## Contributing |
| 145 | + |
| 146 | +Issues and pull requests welcome. See the [contributing guidelines](https://github.com/baker-scripts/.github/blob/main/CONTRIBUTING.md); [open an issue](https://github.com/baker-scripts/StarrScripts/issues) to discuss larger changes. |
| 147 | + |
| 148 | +## Contributors |
| 149 | + |
| 150 | +<a href="https://github.com/baker-scripts/StarrScripts/graphs/contributors"> |
| 151 | + <img src="https://contrib.rocks/image?repo=baker-scripts/StarrScripts" alt="Contributors" /> |
| 152 | +</a> |
8 | 153 |
|
9 | | -<div class="bs-actions" markdown="0"> |
10 | | - <a class="bs-btn bs-btn--primary" href="https://github.com/baker-scripts/StarrScripts">View on GitHub →</a> |
11 | | -</div> |
| 154 | +## Disclaimer |
12 | 155 |
|
13 | | -## Highlights |
| 156 | +These scripts are provided as-is with no warranty. Scripts may delete files, modify configurations, or interact with external APIs. Always review scripts before running and test in a non-production environment first. The authors are not responsible for any data loss or issues resulting from their use. |
14 | 157 |
|
15 | | -- `qui-xseed.sh`: triggers a [qui](https://github.com/autobrr/qui) cross-seed search when Radarr or Sonarr finishes an import. |
16 | | -- `qbm-api-trigger.sh`: fires [QbitManage](https://github.com/StuffAnThings/qbit_manage) commands per torrent hash via the Web API. |
17 | | -- Radarr and Sonarr duplicate finders, plus a non-destructive folder-merge utility. |
18 | | -- Updater scripts for QbitManage, Kometa, Omegabrr, and Plex-Image-Cleanup. |
19 | | -- Housekeeping: ZFS snapshot cleanup, config backup, fail2ban config dump. |
| 158 | +## License |
20 | 159 |
|
21 | | -Full script list, requirements, and configuration: **[GitHub README →](https://github.com/baker-scripts/StarrScripts#readme)** |
| 160 | +[MIT](https://github.com/baker-scripts/StarrScripts/blob/main/LICENSE) |
0 commit comments