Skip to content

Commit

Permalink
Uploader: Added ability to disable throttles on a per-uploader basis
Browse files Browse the repository at this point in the history
New uploader config attribute "can_be_throttled" if present and set to
false will disable throttling for that uploader.
  • Loading branch information
sabrsorensen authored and desimaniac committed Jan 20, 2020
1 parent 8728027 commit e4c7cfa
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -311,6 +311,7 @@ Cloudplow has 3 main functions:
},
"uploader": {
"google": {
"can_be_throttled": true,
"check_interval": 30,
"exclude_open_files": true,
"max_size_gb": 400,
Expand Down Expand Up @@ -739,6 +740,7 @@ If multiple uploader tasks are specified, the tasks will run sequentially (vs in
```
"uploader": {
"google": {
"can_be_throttled": true,
"check_interval": 30,
"exclude_open_files": true,
"max_size_gb": 500,
Expand All @@ -760,6 +762,8 @@ If multiple uploader tasks are specified, the tasks will run sequentially (vs in

In the example above, the uploader references `"google"` from the `remotes` section.

`"can_be_throttled"`: When this attribute is missing or set to `true`, this uploader can be throttled if enabled in the Plex config section. When set to `false`, no throttling will be attempted on this uploader.

`"check_interval"`: How often (in minutes) to check the size of this remotes `upload_folder`. Once it reaches the size threshold as specified in `max_size_gb`, the uploader will start.

`"exclude_open_files"`: When set to `true`, open files will be excluded from the Rclone upload (i.e. upload will occur without them).
Expand Down
9 changes: 7 additions & 2 deletions cloudplow.py
Expand Up @@ -277,9 +277,14 @@ def do_upload(remote=None):
notify.send(message="Upload of %d GB has begun for remote: %s" % (
path.get_size(rclone_config['upload_folder'], uploader_config['size_excludes']), uploader_remote))

# start the plex stream monitor before the upload begins, if enabled
# start the plex stream monitor before the upload begins, if enabled for both plex and the uploader
if conf.configs['plex']['enabled'] and plex_monitor_thread is None:
plex_monitor_thread = thread.start(do_plex_monitor, 'plex-monitor')
# Only disable throttling if 'can_be_throttled' is both present in uploader_config and is set to False.
if 'can_be_throttled' in uploader_config and not uploader_config['can_be_throttled']:
log.debug("Skipping check for Plex stream due to throttling disabled in remote: %s", uploader_remote)
# Otherwise, assume throttling is desired.
else:
plex_monitor_thread = thread.start(do_plex_monitor, 'plex-monitor')

# pause the nzbget queue before starting the upload, if enabled
if conf.configs['nzbget']['enabled']:
Expand Down
1 change: 1 addition & 0 deletions config.json.sample
Expand Up @@ -78,6 +78,7 @@
},
"uploader": {
"google": {
"can_be_throttled": true,
"check_interval": 30,
"exclude_open_files": true,
"max_size_gb": 200,
Expand Down
1 change: 1 addition & 0 deletions utils/config.py
Expand Up @@ -142,6 +142,7 @@ def default_config(self):
# add example uploader
cfg['uploader'] = {
'google': {
'can_be_throttled': True,
'check_interval': 30,
'max_size_gb': 200,
'size_excludes': [
Expand Down

0 comments on commit e4c7cfa

Please sign in to comment.