|
1 |
| -# media-utilities |
2 |
| -Currently supports syncing watch status between plex and emby. This utility uses plex, tautulli, emby and jellystat |
| 1 | +# Media-Utilities |
| 2 | +Media-Utilities is a collection of services to assist in your Plex and Emby media management. |
3 | 3 |
|
4 |
| -## First run |
| 4 | +1. Sync Watched Status |
| 5 | +* Allows the syncing of watch status from plex to emby |
| 6 | +* Allows the syncing of watch status from emby to plex. For admin of plex server only. |
| 7 | +2. Delete Watched (DVR function) |
| 8 | +* Delete watched items after a specified time period |
| 9 | +* Uses Tautulli or Jellystat to get watched items |
| 10 | +3. DVR Maintainer |
| 11 | +* Allows user to specify a show and how to keep episodes |
| 12 | +* Can be keep last X days |
| 13 | +* Can be keep length X days |
| 14 | +4. Folder Cleanup |
| 15 | +* Cleanup empty folders and notify media servers of delete |
5 | 16 |
|
6 |
| -``` |
7 |
| -run docker compose on example compose.yml |
8 |
| -``` |
| 17 | +Each service can be configured independently. Each service allows for a cron rate on when to run. |
| 18 | + |
| 19 | +## Installing Media-Utilities |
| 20 | +Media-Utilities offers a pre-compiled [docker image](https://hub.docker.com/repository/docker/brikim/media-utilities/general) |
9 | 21 |
|
10 |
| -## Logs |
| 22 | +### Usage |
| 23 | +Use docker compose to run Media-Utilities |
11 | 24 |
|
12 |
| -You can also export the logs by mounting a volume on `/logs`: |
| 25 | +### compose.yml |
| 26 | +```yaml |
| 27 | +--- |
| 28 | +services: |
| 29 | + media-utilities: |
| 30 | + image: brikim/media-utilities:latest |
| 31 | + container_name: media-utilities |
| 32 | + security_opt: |
| 33 | + - no-new-privileges:true |
| 34 | + environment: |
| 35 | + - TZ=America/Chicago |
| 36 | + volumes: |
| 37 | + - /docker/media-utilities/config:/config |
| 38 | + - /docker/media-utilities/logs:/logs |
| 39 | + - /pathToMedia:/media |
| 40 | + restart: unless-stopped |
13 | 41 | ```
|
14 |
| -volumes: |
15 |
| - /logPath:/logs |
| 42 | +> [!NOTE] |
| 43 | +> 📝 /media folder can not be read only for all services to function correctly |
| 44 | +
|
| 45 | +### Environment Variables |
| 46 | +| Env | Function | |
| 47 | +| :------- | :------------------------ | |
| 48 | +| TZ | specify a timezone to use | |
| 49 | +
|
| 50 | +### Volume Mappings |
| 51 | +| Volume | Function | |
| 52 | +| :------- | :------------------------ | |
| 53 | +| /config | Path to a folder containing config.yml used to setup Media-Utilities | |
| 54 | +| /logs | Path to a folder to store Media-Utilities log files | |
| 55 | +| /media | Path to your media files. Used by services to monitor your media files | |
| 56 | +
|
| 57 | +### Configuration File |
| 58 | +A configuration file is required to use Media-Utilities. Create a config.yml file in the volume mapped to /config |
| 59 | +
|
| 60 | +#### config.yml |
| 61 | +```yaml |
| 62 | +{ |
| 63 | + "plex_url": "http://0.0.0.0:32400", |
| 64 | + "plex_api_key": "", |
| 65 | + "plex_admin_user_name": "AdminUserName", |
| 66 | + "plex_media_path": "/media/", |
| 67 | + |
| 68 | + "tautulli_url": "http://0.0.0.0:0000", |
| 69 | + "tautulli_api_key": "", |
| 70 | + |
| 71 | + "emby_url": "http://0.0.0.0:8096", |
| 72 | + "emby_api_key": "", |
| 73 | + "emby_media_path": "/media/", |
| 74 | + |
| 75 | + "jellystat_url": "http://0.0.0.0:8888", |
| 76 | + "jellystat_api_key": "", |
| 77 | + |
| 78 | + "gotify_logging": { |
| 79 | + "enabled": "True", |
| 80 | + "url": "", |
| 81 | + "app_token": "", |
| 82 | + "message_title": "Title of message", |
| 83 | + "priority": 6 |
| 84 | + }, |
| 85 | + |
| 86 | + "sync_watched": { |
| 87 | + "enabled": "True", |
| 88 | + "cron_run_rate": "0 */2", |
| 89 | + |
| 90 | + "users": [ |
| 91 | + {"plex_name": "User1", "can_sync_plex_watch": "True", "emby_name": "User1"}, |
| 92 | + {"plex_name": "User2", "can_sync_plex_watch": "False", "emby_name": "User2"} |
| 93 | + ] |
| 94 | + }, |
| 95 | + |
| 96 | + "delete_watched": { |
| 97 | + "enabled": "True", |
| 98 | + "cron_run_rate": "0 */2", |
| 99 | + "delete_time_hours": 24, |
| 100 | + "users": [ |
| 101 | + {"plex_name": "User1", "emby_name": "User1"}, |
| 102 | + {"plex_name": "User2", "emby_name": "User2"} |
| 103 | + ], |
| 104 | + "libraries": [ |
| 105 | + { |
| 106 | + "plex_library_name": "PlexLibraryName", "plex_media_path": "/pathPlexUsesForMedia", |
| 107 | + "emby_library_name": "EmbyLibraryName", "emby_media_path": "/pathEmbyUsesForMedia", |
| 108 | + "utilities_path": "/pathUtilitiesToMedia" |
| 109 | + } |
| 110 | + ] |
| 111 | + }, |
| 112 | + |
| 113 | + "dvr_maintainer": { |
| 114 | + "enabled": "True", |
| 115 | + "cron_run_rate": "0 */2", |
| 116 | + "_comment": "shows actions include KEEP_LAST_ followed by an integer of total shows to keep and KEEP_LENGTH_DAYS_ followed by an integer of days", |
| 117 | + "libraries": [ |
| 118 | + { |
| 119 | + "plex_library_name": "PlexLibraryNameThatContainsName1", |
| 120 | + "emby_library_name": "EmbyLibraryNameThatContainsName1", |
| 121 | + "utilities_path": "/pathUtilitiesToMedia", |
| 122 | + "shows": [ |
| 123 | + {"name": "DirectoryNameInUtilitiesLibraryPath", "action": "KEEP_LAST_5"}, |
| 124 | + {"name": "DirectoryNameInUtilitiesLibraryPath2", "action": "KEEP_LENGTH_DAYS_7"} |
| 125 | + ] |
| 126 | + }, |
| 127 | + { |
| 128 | + "plex_library_name": "PlexLibraryNameThatContainsName2", |
| 129 | + "emby_library_name": "EmbyLibraryNameThatContainsName2", |
| 130 | + "utilities_path": "/pathUtilitiesToMedia2", |
| 131 | + "shows": [ |
| 132 | + {"name": "DirectoryNameInUtilitiesLibraryPath", "action": "KEEP_LAST_5"}, |
| 133 | + {"name": "DirectoryNameInUtilitiesLibraryPath2", "action": "KEEP_LENGTH_DAYS_7"} |
| 134 | + ] |
| 135 | + } |
| 136 | + ] |
| 137 | + }, |
| 138 | + |
| 139 | + "folder_cleanup": { |
| 140 | + "enabled": "True", |
| 141 | + "cron_run_rate": "0 */2", |
| 142 | + "paths_to_check": [ |
| 143 | + {"path": "/pathToCheckForEmpty", "plex_library_name": "nameOfPlexLibrary", "emby_library_name": "nameOfEmbyLibrary"} |
| 144 | + ], |
| 145 | + "_comment_ignore_folder_in_check": "Folders to ignore for the path to be considered empty", |
| 146 | + "ignore_folder_in_empty_check": [ |
| 147 | + {"ignore_folder": "someFolderToIgnore"} |
| 148 | + ], |
| 149 | + "_comment_ignore_files_in_check": "Files to ignore for the path to be considered empty", |
| 150 | + "ignore_file_in_empty_check": [ |
| 151 | + {"ignore_file": "someFileToIgnore"} |
| 152 | + ] |
| 153 | + } |
| 154 | +} |
16 | 155 | ```
|
| 156 | + |
| 157 | +#### Option Descriptions |
| 158 | +You only have to define the variables for servers in your system. For plex only define plex_url and plex_api_key in your file. The emby and jellyfin variables are not required. |
| 159 | +| Media Server | Function | |
| 160 | +| :----------- | :------------------------ | |
| 161 | +| plex_url | Url to your plex server (Make sure you include the port if not reverse proxy) | |
| 162 | +| plex_api_key | API Key to access your plex server | |
| 163 | +| plex_admin_user_name | Name of the admin user for the plex server | |
| 164 | +| plex_media_path | Path your plex media server is using in the container to its media | |
| 165 | +| tautulli_url | Url to your tautulli server (Make sure you include the port if not reverse proxy) | |
| 166 | +| tautulli_api_key | API key to access your tautulli server | |
| 167 | +| emby_url | Url to your emby server (Make sure you include the port if not reverse proxy) | |
| 168 | +| emby_api_key | API Key to access your emby server | |
| 169 | +| emby_media_path | Path your emby media server is using in the container to its media | |
| 170 | +| jellystat_url | Url to your jellystat server (Make sure you include the port if not reverse proxy) | |
| 171 | +| jellystat_api_key | API Key to access your jellystat server | |
| 172 | + |
| 173 | +#### Gotify Logging |
| 174 | +Not required unless wanting to send Warnings or Errors to Gotify |
| 175 | +| Gotify | Function | |
| 176 | +| :--------------- | :------------------------ | |
| 177 | +| enabled | Enable the function with 'True' | |
| 178 | +| url | Url including port to your gotify server | |
| 179 | +| app_token | Gotify app token to be used to send notifications | |
| 180 | +| message_title | Title to put in the title bar of the message | |
| 181 | +| priority | The priority of the message to send to gotify | |
| 182 | + |
| 183 | +#### Sync Watched configuration |
| 184 | +Sync Watched service will sync the watch status between Plex and Emby users. Requires Tautulli and Jellystat to work. Define a plex user name to sync to an emby user name and vice versa. |
| 185 | + |
| 186 | +| sync_watched | Function | |
| 187 | +| :--------------- | :------------------------ | |
| 188 | +| enabled | Enable the sync watch service | |
| 189 | +| cron_run_rate | Rate at which to run this service. Cron format but only uses minutes and hours | |
| 190 | +| users | A list of users to sync watch status | |
| 191 | + |
| 192 | +1 to many users can be listed for sync watched |
| 193 | +| users | Function | |
| 194 | +| :--------------- | :------------------------ | |
| 195 | +| plex_name | The plex user name to sync watch status | |
| 196 | +| can_sync_plex_watch | This should be True for the admin user of the server only | |
| 197 | +| emby_name | The emby user name to sync watch status | |
| 198 | + |
| 199 | +#### Delete Watched |
| 200 | +Plex by default does not allow users to delete media. This service was intended to be used on a TV Recordings library but can be used however you want. Define a set of libraries and users. If the service detects an item has been watched by a defined user it will delete the item after a defined time period. |
| 201 | + |
| 202 | +| delete_watched | Function | |
| 203 | +| :--------------- | :------------------------ | |
| 204 | +| enabled | Enable the delete watched service | |
| 205 | +| cron_run_rate | Rate at which to run this service. Cron format but only uses minutes and hours | |
| 206 | +| delete_time_hours | How long to wait in hours after a show has been watched to delete | |
| 207 | +| users | A list of users to monitor for watched status | |
| 208 | +| libraries | A list of libraries to monitor for defined user watches | |
| 209 | + |
| 210 | +1 to many users can be listed for sync watched |
| 211 | +| users | Function | |
| 212 | +| :--------------- | :------------------------ | |
| 213 | +| plex_name | The plex user name to to monitor for watches (Optional) | |
| 214 | +| emby_name | The emby user name to to monitor for watches (Optional) | |
| 215 | + |
| 216 | +1 to many libraries can be listed for sync watched |
| 217 | +| libraries | Function | |
| 218 | +| :--------------- | :------------------------ | |
| 219 | +| plex_library_name | The name of the plex library to monitor for user watches (Optional) | |
| 220 | +| emby_library_name | The name of the emby library to monitor for user watches (Optional) | |
| 221 | +| utilities_path | The path in the media-utilities container that corresponds to the plex or emby library media | |
| 222 | + |
| 223 | +#### DVR Maintainer |
| 224 | +Plex and Emby have a very basic DVR function for removing media after a certain amount of time or a max episode limit. This service expands on this and allows you to specify a max number of episodes or a length in days a episode is allowed to be on the server. |
| 225 | + |
| 226 | +| dvr_maintainer | Function | |
| 227 | +| :--------------- | :------------------------ | |
| 228 | +| enabled | Enable the delete watched service | |
| 229 | +| cron_run_rate | Rate at which to run this service. Cron format but only uses minutes and hours | |
| 230 | +| libraries | A list of libraries to monitor for media deletion | |
| 231 | + |
| 232 | +1 to many libraries can be listed for dvr maintainer |
| 233 | +| libraries | Function | |
| 234 | +| :--------------- | :------------------------ | |
| 235 | +| plex_library_name | Name of the plex library to notify on media deletion (Optional) | |
| 236 | +| emby_library_name | Name of the emby library to notify on media deletion (Optional) | |
| 237 | +| utilities_path | Path in the container that corresponds to this libraries media | |
| 238 | +| shows | A list of shows to monitor and how long episodes should be kept | |
| 239 | + |
| 240 | +1 to many shows can be listed for each library |
| 241 | +| shows | Function | |
| 242 | +| :--------------- | :------------------------ | |
| 243 | +| name | Name of the show to monitor for deletions | |
| 244 | +| action | Action for the keep time/number of this show. Two options are supported. KEEP_LAST_X - Where X is the number of episodes to keep for this show. Must be an integer. Will delete the oldest shows by file timestamp. KEEP_LENGTH_DAYS_X. Where X is the number of days to keep episodes in this show. | |
| 245 | + |
| 246 | +#### Folder cleanup |
| 247 | +Will remove empty folders within a specified directory. This can be useful running with DVR Maintainer. Emby will still list a show in the library even though media does not exist in it. This service cleans up empty folders and notified media servers of this change. |
| 248 | + |
| 249 | +| folder_cleanup | Function | |
| 250 | +| :--------------- | :------------------------ | |
| 251 | +| enabled | Enable the delete watched service | |
| 252 | +| cron_run_rate | Rate at which to run this service. Cron format but only uses minutes and hours | |
| 253 | +| paths_to_check | A list of paths to check for empty folders | |
| 254 | +| ignore_folder_in_empty_check | A list folder names to ignore empty checks | |
| 255 | +| ignore_file_in_empty_check | A list of files to ignore. If a folder contains this file it will still be considered empty | |
| 256 | + |
| 257 | +1 to many ignore_folder_in_empty_check can be listed |
| 258 | +| ignore_folder_in_empty_check | Function | |
| 259 | +| :--------------- | :------------------------ | |
| 260 | +| path | Path to check for empty folders | |
| 261 | + |
| 262 | +1 to many ignore_folder_in_empty_check can be listed |
| 263 | +| ignore_folder_in_empty_check | Function | |
| 264 | +| :--------------- | :------------------------ | |
| 265 | +| ignore_folder | Path to ignore for empty checks. If this path is found the folder will still be considered empty | |
| 266 | + |
| 267 | +1 to many ignore_file_in_empty_check can be listed |
| 268 | +| ignore_file_in_empty_check | Function | |
| 269 | +| :--------------- | :------------------------ | |
| 270 | +| ignore_file | File to ignore for empty checks. If this file is found the folder will still be considered empty | |
0 commit comments