Script now takes a config file as an optional arg

This commit is contained in:
strNophix 2022-07-22 15:16:04 +02:00
parent ffa8090399
commit 66a602b06f
2 changed files with 17 additions and 9 deletions

View File

@ -2,10 +2,16 @@
A small script for syncing your currently watching anime from AniList to Sonarr/Radarr. A small script for syncing your currently watching anime from AniList to Sonarr/Radarr.
## Usage ## Usage
Assuming you have [poetry](https://python-poetry.org/docs/#installation) installed:
```sh ```sh
cp .env.example .env pip install git+https://git.cesium.pw/niku/al-arr-sync.git#egg=al-arr-sync
# Update the config with your editor of choice.
poetry install wget -O config.ini https://git.cesium.pw/niku/al-arr-sync/raw/branch/main/config.ini.example
poetry run python3 -m al_arr_sync nano config.ini
python -m al_arr_sync
```
In case you want to use a specific config:
```sh
python -m al_arr_sync ~/home/.config/al-arr-sync/config.ini
``` ```

View File

@ -1,4 +1,5 @@
import os import sys
import typing
from al_arr_sync.anilist import AniListClient from al_arr_sync.anilist import AniListClient
from al_arr_sync.radarr import RadarrClient from al_arr_sync.radarr import RadarrClient
@ -7,8 +8,9 @@ from al_arr_sync.types import DlAutomator
from al_arr_sync.config import load_config from al_arr_sync.config import load_config
def main() -> int: def main(args: typing.Sequence[str]) -> int:
cfg = load_config("config.ini") cfg_path = args[0] if len(args) > 0 else "./config.ini"
cfg = load_config(cfg_path)
al = AniListClient() al = AniListClient()
sonarr: DlAutomator = SonarrClient.from_config(cfg) sonarr: DlAutomator = SonarrClient.from_config(cfg)
@ -44,4 +46,4 @@ def main() -> int:
if __name__ == "__main__": if __name__ == "__main__":
raise SystemExit(main()) raise SystemExit(main(sys.argv[1:]))