export APP_PROWLARR_RADARR_CONFIG_XML=$(cat "${DFWEBOS_ROOT}/app-data/radarr/data/config/config.xml" 2>/dev/null || echo "")
export APP_PROWLARR_LIDARR_CONFIG_XML=$(cat "${DFWEBOS_ROOT}/app-data/lidarr/data/config/config.xml" 2>/dev/null || echo "")
export APP_PROWLARR_SONARR_CONFIG_XML=$(cat "${DFWEBOS_ROOT}/app-data/sonarr/data/config/config.xml" 2>/dev/null || echo "")
export APP_PROWLARR_READARR_CONFIG_XML=$(cat "${DFWEBOS_ROOT}/app-data/readarr/data/config/config.xml" 2>/dev/null || echo "")

# Проверьте, установлены ли qBittorrent и SABnzbd.
installed_apps=$("${DFWEBOS_ROOT}/scripts/app" ls-installed)

if echo "$installed_apps" | grep --quiet 'qbittorrent'; then
  export APP_PROWLARR_QBITTORRENT_INSTALLED="true"
fi

if echo "$installed_apps" | grep --quiet 'sabnzbd'; then
  export APP_PROWLARR_SABNZBD_INSTALLED="true"
  # экспортируйте SABNZBD_API_KEY, который имеет формат:
  # api_key = 98e3444f7fab45e592958673bf656g3
  export APP_PROWLARR_SABNZBD_API_KEY=$(grep -Po 'api_key = \K.*' "${DFWEBOS_ROOT}/app-data/sabnzbd/data/config/sabnzbd.ini")
fi
