mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-01-08 04:00:03 -08:00
bfb45c180a
Remove version checks and update logic Remove extraneous constants: SOURCE_ROOT, SYS_ARGV, APP_FILENAME, CONFIG_MOVIE_FILE, MY_APP, CONFIG_TV_FILE, GIT_* Remove nzb2media.utils.processes Update requirements Flatten project structure Keep settings close to code Refactor NZBget, torrent configs, torrents, transcoder, tools, constants and forks Refactor `nzbToMedia.main` to `nzb2media.app.main` Fix flake/lint issues
41 lines
870 B
Python
41 lines
870 B
Python
from __future__ import annotations
|
|
|
|
import logging
|
|
|
|
from syno.downloadstation import DownloadStation
|
|
|
|
log = logging.getLogger(__name__)
|
|
log.addHandler(logging.NullHandler())
|
|
|
|
HOST = None
|
|
PORT = None
|
|
USERNAME = None
|
|
PASSWORD = None
|
|
|
|
|
|
def configure_syno(config):
|
|
global HOST
|
|
global PORT
|
|
global USERNAME
|
|
global PASSWORD
|
|
|
|
HOST = config['synoHost'] # localhost
|
|
PORT = int(config['synoPort'])
|
|
USERNAME = config['synoUSR'] # mysecretusr
|
|
PASSWORD = config['synoPWD'] # mysecretpwr
|
|
|
|
|
|
def configure_client():
|
|
agent = 'synology'
|
|
host = HOST
|
|
port = PORT
|
|
user = USERNAME
|
|
password = PASSWORD
|
|
log.debug(f'Connecting to {agent}: http://{host}:{port}')
|
|
try:
|
|
client = DownloadStation(host, port, user, password)
|
|
except Exception:
|
|
log.error('Failed to connect to synology')
|
|
else:
|
|
return client
|