diff --git a/.env.template b/.env.template index d7d762b..a22a867 100644 --- a/.env.template +++ b/.env.template @@ -51,4 +51,5 @@ PYTHONUNBUFFERED=TRUE PUID= PGID= UMASK=002 -DOCKER_NETWORK="docker_network_default" \ No newline at end of file +DOCKER_NETWORK="scripts_default" +DOCKER_NETWORK_EXTERNAL=false \ No newline at end of file diff --git a/README.md b/README.md index c8c3e30..db4aa61 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,7 @@ - `PGID`: Set this to the group ID that the service should run as. - `UMASK`: Set this to control the default file creation permissions. - `DOCKER_NETWORK`: Set this to the name of the Docker network to be used by the services. + - `DOCKER_NETWORK_EXTERNAL`: Set this to `true` if specifying an external Docker network above, otherwise set to `false`. ## Blackhole diff --git a/docker-compose.yml b/docker-compose.yml index 1ae78dd..d323952 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3.8' - x-blackhole: &blackhole build: context: . @@ -9,8 +7,6 @@ x-blackhole: &blackhole env_file: - .env restart: unless-stopped - networks: - - ${DOCKER_NETWORK:-docker_network_default} x-repair: &repair build: @@ -21,8 +17,6 @@ x-repair: &repair env_file: - .env restart: unless-stopped - networks: - - ${DOCKER_NETWORK:-docker_network_default} services: blackhole: @@ -36,41 +30,101 @@ services: - ${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH}:/${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH} profiles: [blackhole, blackhole_all, all] - blackhole_4k: - <<: *blackhole - container_name: blackhole_4k_service - environment: - - SONARR_HOST=${SONARR_HOST_4K} - - SONARR_API_KEY=${SONARR_API_KEY_4K} - - RADARR_HOST=${RADARR_HOST_4K} - - RADARR_API_KEY=${RADARR_API_KEY_4K} - - BLACKHOLE_BASE_WATCH_PATH=/${BLACKHOLE_BASE_WATCH_PATH} - volumes: - - ${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}:${BLACKHOLE_RD_MOUNT_TORRENTS_PATH} - - ${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_SONARR_PATH} 4k:/${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_SONARR_PATH} - - ${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH} 4k:/${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH} - profiles: [blackhole_4k, blackhole_all, all] + # blackhole_4k: + # <<: *blackhole + # container_name: blackhole_4k_service + # environment: + # - SONARR_HOST=${SONARR_HOST_4K} + # - SONARR_API_KEY=${SONARR_API_KEY_4K} + # - RADARR_HOST=${RADARR_HOST_4K} + # - RADARR_API_KEY=${RADARR_API_KEY_4K} + # - BLACKHOLE_BASE_WATCH_PATH=/${BLACKHOLE_BASE_WATCH_PATH} + # volumes: + # - ${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}:${BLACKHOLE_RD_MOUNT_TORRENTS_PATH} + # - ${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_SONARR_PATH} 4k:/${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_SONARR_PATH} + # - ${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH} 4k:/${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH} + # profiles: [blackhole_4k, blackhole_all, all] + + # blackhole_anime: + # <<: *blackhole + # container_name: blackhole_anime_service + # environment: + # - SONARR_HOST=${SONARR_HOST_ANIME} + # - SONARR_API_KEY=${SONARR_API_KEY_ANIME} + # - RADARR_HOST=${RADARR_HOST_ANIME} + # - RADARR_API_KEY=${RADARR_API_KEY_ANIME} + # - BLACKHOLE_BASE_WATCH_PATH=/${BLACKHOLE_BASE_WATCH_PATH} + # volumes: + # - ${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}:${BLACKHOLE_RD_MOUNT_TORRENTS_PATH} + # - ${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_SONARR_PATH} anime:/${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_SONARR_PATH} + # - ${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH} anime:/${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH} + # profiles: [blackhole_anime, blackhole_all, all] + + # blackhole_mux: + # <<: *blackhole + # container_name: blackhole_mux_service + # environment: + # - SONARR_HOST=${SONARR_HOST_MUX} + # - SONARR_API_KEY=${SONARR_API_KEY_MUX} + # - RADARR_HOST=${RADARR_HOST_MUX} + # - RADARR_API_KEY=${RADARR_API_KEY_MUX} + # - BLACKHOLE_BASE_WATCH_PATH=/${BLACKHOLE_BASE_WATCH_PATH} + # volumes: + # - ${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}:${BLACKHOLE_RD_MOUNT_TORRENTS_PATH} + # - ${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_SONARR_PATH} mux:/${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_SONARR_PATH} + # - ${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH} mux:/${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH} + # profiles: [blackhole_mux, blackhole_all, all] repair_service: <<: *repair container_name: repair_service volumes: + - ${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}:${BLACKHOLE_RD_MOUNT_TORRENTS_PATH} - ${SONARR_ROOT_FOLDER}:${SONARR_ROOT_FOLDER} - ${RADARR_ROOT_FOLDER}:${RADARR_ROOT_FOLDER} profiles: [repair, repair_all, all] - repair_4k: - <<: *repair - container_name: repair_4k_service - environment: - - SONARR_HOST=${SONARR_HOST_4K} - - SONARR_API_KEY=${SONARR_API_KEY_4K} - - RADARR_HOST=${RADARR_HOST_4K} - - RADARR_API_KEY=${RADARR_API_KEY_4K} - volumes: - - ${SONARR_ROOT_FOLDER_4K}:${SONARR_ROOT_FOLDER} - - ${RADARR_ROOT_FOLDER_4K}:${RADARR_ROOT_FOLDER} - profiles: [repair_4k, repair_all, all] + # repair_4k: + # <<: *repair + # container_name: repair_4k_service + # environment: + # - SONARR_HOST=${SONARR_HOST_4K} + # - SONARR_API_KEY=${SONARR_API_KEY_4K} + # - RADARR_HOST=${RADARR_HOST_4K} + # - RADARR_API_KEY=${RADARR_API_KEY_4K} + # volumes: + # - ${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}:${BLACKHOLE_RD_MOUNT_TORRENTS_PATH} + # - ${SONARR_ROOT_FOLDER_4K}:${SONARR_ROOT_FOLDER} + # - ${RADARR_ROOT_FOLDER_4K}:${RADARR_ROOT_FOLDER} + # profiles: [repair_4k, repair_all, all] + + # repair_anime: + # <<: *repair + # container_name: repair_anime_service + # environment: + # - SONARR_HOST=${SONARR_HOST_ANIME} + # - SONARR_API_KEY=${SONARR_API_KEY_ANIME} + # - RADARR_HOST=${RADARR_HOST_ANIME} + # - RADARR_API_KEY=${RADARR_API_KEY_ANIME} + # volumes: + # - ${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}:${BLACKHOLE_RD_MOUNT_TORRENTS_PATH} + # - ${SONARR_ROOT_FOLDER_ANIME}:${SONARR_ROOT_FOLDER} + # - ${RADARR_ROOT_FOLDER_ANIME}:${RADARR_ROOT_FOLDER} + # profiles: [repair_anime, repair_all, all] + + # repair_mux: + # <<: *repair + # container_name: repair_mux_service + # environment: + # - SONARR_HOST=${SONARR_HOST_MUX} + # - SONARR_API_KEY=${SONARR_API_KEY_MUX} + # - RADARR_HOST=${RADARR_HOST_MUX} + # - RADARR_API_KEY=${RADARR_API_KEY_MUX} + # volumes: + # - ${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}:${BLACKHOLE_RD_MOUNT_TORRENTS_PATH} + # - ${SONARR_ROOT_FOLDER_MUX}:${SONARR_ROOT_FOLDER} + # - ${RADARR_ROOT_FOLDER_MUX}:${RADARR_ROOT_FOLDER} + # profiles: [repair_mux, repair_all, all] watchlist: build: @@ -118,5 +172,6 @@ services: profiles: [plex_request, all] networks: - ${DOCKER_NETWORK:-docker_network_default}: - external: true \ No newline at end of file + default: + name: ${DOCKER_NETWORK:-scripts_default} + external: ${DOCKER_NETWORK_EXTERNAL:-false} \ No newline at end of file diff --git a/repair.py b/repair.py index 9350592..ee80ca4 100644 --- a/repair.py +++ b/repair.py @@ -3,7 +3,7 @@ import time from shared.arr import Sonarr, Radarr from shared.discord import discordUpdate -from shared.shared import repair, intersperse +from shared.shared import repair, blackhole, intersperse def parse_interval(interval_str): """Parse a smart interval string (e.g., '1w2d3h4m5s') into seconds.""" @@ -71,8 +71,7 @@ def main(): realPath = os.path.realpath(fullPath) realPaths.append(realPath) - - if os.path.islink(fullPath) and not os.path.exists(realPath): + if os.path.islink(fullPath) and realPath.startswith(blackhole['rdMountTorrentsPath']) and not os.path.exists(realPath): brokenSymlinks.append(realPath) # If not full season just repair individual episodes?