Added skip_missing config (#57)

pull/58/head 1.11.0
aljohn92 4 years ago committed by GitHub
parent 4b27d8b432
commit ad6856cfb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -7,6 +7,7 @@ Syncs two Radarr/Sonarr/Lidarr servers through the web API. Useful for syncing a
* Supports Docker for multiple instances * Supports Docker for multiple instances
* Can set interval for syncing * Can set interval for syncing
* Support two way sync (one way by default) * Support two way sync (one way by default)
* Skip content with missing files
* Set language profiles (Sonarr v3 only) * Set language profiles (Sonarr v3 only)
* Filter syncing by content file quality (Radarr only) * Filter syncing by content file quality (Radarr only)
* Filter syncing by tags (Sonarr/Radarr v3 only) * Filter syncing by tags (Sonarr/Radarr v3 only)
@ -76,6 +77,7 @@ Syncs two Radarr/Sonarr/Lidarr servers through the web API. Useful for syncing a
[general] [general]
sync_bidirectionally = 1 # sync from instance A to B **AND** instance B to A sync_bidirectionally = 1 # sync from instance A to B **AND** instance B to A
auto_search = 0 # search is automatically started on new content - disable by setting to 0 (default 1) auto_search = 0 # search is automatically started on new content - disable by setting to 0 (default 1)
skip_missing = 1 # content with missing files are skipped on sync - disable by setting to 0 (default 1)
monitor_new_content = 0 # set to 0 to never monitor new content synced or to 1 to always monitor new content synced (default 1) monitor_new_content = 0 # set to 0 to never monitor new content synced or to 1 to always monitor new content synced (default 1)
test_run = 1 # enable test mode - will run through sync program but will not actually sync content test_run = 1 # enable test mode - will run through sync program but will not actually sync content
``` ```

@ -170,6 +170,16 @@ if auto_search is not None:
else: else:
auto_search = 1 auto_search = 1
# set to skip missing if config not set
skip_missing = get_config_value('SYNCARR_SKIP_MISSING', 'skip_missing', 'general')
if skip_missing is not None:
try:
skip_missing = int(skip_missing)
except ValueError:
skip_missing = 0
else:
skip_missing = 1
# set to monitor if config not set # set to monitor if config not set
monitor_new_content = get_config_value('SYNCARR_MONITOR_NEW_CONTENT', 'monitor_new_content', 'general') monitor_new_content = get_config_value('SYNCARR_MONITOR_NEW_CONTENT', 'monitor_new_content', 'general')
if monitor_new_content is not None: if monitor_new_content is not None:
@ -497,6 +507,7 @@ logger.debug({
'monitor_new_content': monitor_new_content, 'monitor_new_content': monitor_new_content,
'sync_bidirectionally': sync_bidirectionally, 'sync_bidirectionally': sync_bidirectionally,
'auto_search': auto_search, 'auto_search': auto_search,
'skip_missing': skip_missing,
'api_version': api_version, 'api_version': api_version,
}) })

@ -25,7 +25,7 @@ from config import (
get_status_path, get_content_path, get_profile_path, get_language_path, get_tag_path, get_status_path, get_content_path, get_profile_path, get_language_path, get_tag_path,
is_in_docker, instance_sync_interval_seconds, is_in_docker, instance_sync_interval_seconds,
sync_bidirectionally, auto_search, monitor_new_content, sync_bidirectionally, auto_search, skip_missing, monitor_new_content,
tested_api_version, api_version, V3_API_PATH, is_test_run, tested_api_version, api_version, V3_API_PATH, is_test_run,
) )
@ -207,6 +207,13 @@ def sync_servers(instanceA_contents, instanceB_language_id, instanceB_contentIds
title = content.get('title') or content.get('artistName') title = content.get('title') or content.get('artistName')
instance_path = instanceB_path or dirname(content.get('path')) instance_path = instanceB_path or dirname(content.get('path'))
# if skipping missing files, we want to skip any that don't have files
if skip_missing:
content_has_file = content.get('hasFile')
if not content_has_file:
logging.debug(f'Skipping content {title} - file missing')
continue
# if given this, we want to filter from instance by profile id # if given this, we want to filter from instance by profile id
if instanceA_profile_filter_id: if instanceA_profile_filter_id:
quality_profile_id = content.get('qualityProfileId') quality_profile_id = content.get('qualityProfileId')

Loading…
Cancel
Save