clean up readme; add auto_search option

pull/21/head
Leonardo Merza 4 years ago
parent 3eff1cd929
commit a8c0ed1876

@ -46,45 +46,29 @@ Syncs two Radarr/Sonarr/Lidarr servers through the web API. Useful for syncing a
key = XXXXX
profile = lossless
path = /data/lossless_music
```
5. By default Syncarr will sync unidirectionally from instance A to instance B but you can add bidirectional syncing with:
```ini
[general]
sync_bidirectionally = 1
```
If `sync_bidirectionally` is set to true, then instance A will require either `profile_id` or `profile` AND `path`
6. syncarr will try to find the `profile_id` given a `profile` name, if no match is found, syncarr will exit with error. You can also specify a `profile_id` directly instead of a `profile` name:
```ini
[radarrB]
url = http://127.0.0.1:8080
key = XXXXX
profile_id = 1
path = /data/4k_Movies
```
**Note** you cannot have a mix of radarr, lidarr, or sonarr config setups at the same time.
7. You can filter content to be synced only from a certain profile/profile_id by adding the `profile_filter` or `profile_filter_id` to instance A. The same goes to instance B if syncing bidirectionally.
5. Optional Configuration
```ini
[radarrA]
[sonarrA]
url = http://127.0.0.1:8080
key = XXXXX
profile_filter = 1080p
```
profile_filter = 1080p # add a filter to only sync contents belonging to this profile (can set by profile_filter_id as well)
8. Sonarr v3 can specify a `language` or `language_id` (for Docker `SONARR_A/B_LANGUAGE` or `SONARR_A/B_LANGUAGE_ID`) to specify a show's language when copying over a show. When syncing SonarrA to SonarrB:
```ini
[sonarrB]
url = http://127.0.0.1:8080
key = XXXXX
language = Vietnamese # when using docker -> SONARR_B_LANGUAGE: Vietnamese
```
---
profile_id = 1 # Syncarr will try to find id from name but you can specify the id directly if you want
language = Vietnamese # can set language for new content added (Sonarr v3 only) (can set by language_id as well)
path = /data/4k_Movies
## Notes
* you cannot have a mix of radarr, lidarr, or sonarr config setups at the same time.
* for radarr, sonarr, and lidarr, an optional `profile` can be added to instance A so only content with that `profile` will be synced from instance A to instance B. This will be also true if bidirectional syncing is enabled **only** if both `profile`s are supplied. The same behavior can be spplied with `profile_id`s.
[general]
sync_bidirectionally = 1 # sync from instance A to B **AND** instance B to A
auto_search = 1 # start search on all new content added
```
**Note** If `sync_bidirectionally` is set to `1`, then instance A will require either `profile_id` or `profile` AND `path` as well
---
## How to Run
@ -158,9 +142,12 @@ For just plain docker (radarr example):
docker run -it --rm --name syncarr -e RADARR_A_URL=https://example.com:443 -e RADARR_A_KEY=XXXXX -e RADARR_B_URL=http://127.0.0.1:8080 -e RADARR_B_KEY=XXXXX -e RADARR_B_PROFILE=1080p -e RADARR_B_PATH=/data/4k_Movies -e SYNC_INTERVAL_SECONDS=300 syncarr/syncarr
```
**Note:**
You can also specify the `PROFILE_ID` directly through the `*ARR_A_PROFILE_ID` and `*ARR_B_PROFILE_ID` ENV variables.
**Notes**
* You can also specify the `PROFILE_ID` directly through the `*ARR_A_PROFILE_ID` and `*ARR_B_PROFILE_ID` ENV variables.
To filter by profile in docker use `ARR_A_PROFILE_FILTER` or `ARR_A_PROFILE_FILTER_ID` ENV variables. (same for `*arr_B` in bidirectional sync)
* Language for new content (Sonarr v3 only) can be set by `SONARR_B_LANGUAGE` or `SONARR_B_LANGUAGE_ID` (and `SONARR_B` if bidirectional sync)
* Set bidirectional sync with `SYNCARR_BIDIRECTIONAL_SYNC=1`
* Set auto searching on new content with `SYNCARR_AUTO_SEARCH=1`
---
## Requirements

@ -13,6 +13,15 @@ VER = '1.5.0'
V3_API_PATH = 'v3/'
########################################################################################################################
# get docker based ENV vars
is_in_docker = os.environ.get('IS_IN_DOCKER')
instance_sync_interval_seconds = os.environ.get('SYNC_INTERVAL_SECONDS')
if instance_sync_interval_seconds:
instance_sync_interval_seconds = int(instance_sync_interval_seconds)
########################################################################################################################
def ConfigSectionMap(section):
'''get all config options from config file'''
dict1 = {}
@ -49,13 +58,6 @@ else:
config = configparser.ConfigParser()
config.read(settingsFilename)
########################################################################################################################
# get docker based ENV vars
is_in_docker = os.environ.get('IS_IN_DOCKER')
instance_sync_interval_seconds = os.environ.get('SYNC_INTERVAL_SECONDS')
if instance_sync_interval_seconds:
instance_sync_interval_seconds = int(instance_sync_interval_seconds)
########################################################################################################################
# get config settings from ENV or config files for Radarr
radarrA_url = get_config_value('RADARR_A_URL', 'url', 'radarrA')
@ -136,6 +138,10 @@ sync_bidirectionally = get_config_value(
'SYNCARR_BIDIRECTIONAL_SYNC', 'bidirectional', 'general') or 0
if sync_bidirectionally:
sync_bidirectionally = int(sync_bidirectionally) or 0
auto_search = get_config_value(
'SYNCARR_AUTO_SEARCH', 'auto_search', 'general') or 0
if auto_search:
auto_search = int(auto_search) or 0
########################################################################################################################
@ -355,7 +361,7 @@ def get_profile_path(instance_url, key):
logger.debug({
'instanceA_url': instanceA_url,
'instanceA_key': instanceA_key,
'instanceB_path': instanceB_path,
'instanceA_path': instanceA_path,
'instanceB_url': instanceB_url,
'instanceB_key': instanceB_key,
'instanceB_path': instanceB_path,

@ -20,7 +20,7 @@ from config import (
content_id_key, logger, is_sonarr, is_radarr, is_lidarr,
get_status_path, get_content_path, get_search_path, get_profile_path, get_language_path,
is_in_docker, instance_sync_interval_seconds, sync_bidirectionally,
is_in_docker, instance_sync_interval_seconds, sync_bidirectionally, auto_search,
tested_api_version, api_version, V3_API_PATH,
)
@ -139,7 +139,7 @@ def search_synced(search_ids, instance_search_url, instance_session):
def sync_servers(instanceA_contents, instanceB_language_id, instanceB_contentIds,
instanceB_path, instanceB_profile_id, instanceB_session,
instanceB_url, profile_filter_id, instanceB_key):
global auto_search
search_ids = []
# if given instance A profile id then we want to filter out content without that id
@ -180,7 +180,9 @@ def sync_servers(instanceA_contents, instanceB_language_id, instanceB_contentIds
logging.info('{0} contents synced successfully'.format(len(search_ids)))
instanceB_search_url = get_search_path(instanceB_url, instanceB_key)
search_synced(search_ids, instanceB_search_url, instanceB_session)
if auto_search:
search_synced(search_ids, instanceB_search_url, instanceB_session)
def get_instance_contents(instance_url, instance_key, instance_session, instance_name=''):

Loading…
Cancel
Save