Drapersniper / Qbitrr

A simple Python script to talk to Qbit and Arr's
MIT License
26 stars 4 forks source link

Build a docker image for the script #25

Closed deathvenom-369 closed 2 years ago

deathvenom-369 commented 2 years ago

[2022-01-21 11:48:33] [pid: 1911][tid:140218955368256] ERROR : qBitrr.Sonarr-TV : Expecting value: line 1 column 1 (char 0) Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/qBitrr/arss.py", line 1766, in process_torrents self.api_calls() File "/usr/local/lib/python3.8/dist-packages/qBitrr/arss.py", line 889, in api_calls self.post_command("RefreshMonitoredDownloads") File "/usr/local/lib/python3.8/dist-packages/qBitrr/arss.py", line 1733, in post_command res = self.client.request_post(path, data=data) File "/usr/local/lib/python3.8/dist-packages/pyarr/request_api.py", line 70, in request_post return res.json() File "/usr/local/lib/python3.8/dist-packages/requests/models.py", line 910, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib/python3.8/json/init.py", line 357, in loads return _default_decoder.decode(s) File "/usr/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Removing blank line fixes error: from future import annotations

import contextlib import itertools import logging import pathlib import re import sys import time from collections import defaultdict

To: from future import annotations import contextlib import itertools import logging import pathlib import re import sys import time from collections import defaultdict

Drapersniper commented 2 years ago

Just to check

from future import annotations

import contextlib

are you referencing this blank line between these 2 import statements?

If so thats not the source of the error you are seeing.

self.post_command("RefreshMonitoredDownloads")

this is the source of the error - Meaning Sonarr returned a non json response. Did your Sonarr instance become temporarely non-responsive ?

Wasn't aware that that specific endpoint could return anything thats not a json response.

Drapersniper commented 2 years ago

Can you please also confirm which version of the script and Sonarr you are currently using.

deathvenom-369 commented 2 years ago

You are rite sorry about that. When I made the change error went a way for a little while but is back.

deathvenom-369 commented 2 years ago

qBitrr: 2.1.20-3460838 sonnar: 3.0.6.1342

Drapersniper commented 2 years ago

Thank I'll take a look at it, tomorrow not able to do it today.

Can you confirm your config values for Sonarr-TV ? make sure all the settings are correct

deathvenom-369 commented 2 years ago

So I got it to work :) Turns out my weird networking set up was to blame. Inside my docker server like containers share a internal network with no port forwarding. They usually communicate on internal network via host-names. Management is threw reverse proxy only. I was unable to stably connect this way with script. Tho this is how sonarr communicates with qBittorrent. ended up passing communication threw reverse proxy.

Great script. I check torrents couple times a week hoping this brings that to once a month. THANK YOU!!

Drapersniper commented 2 years ago

I'll keep this issue open, seems like it may be worth while to build a docker image for it specially since I myself am moving to a full docker setup.

Drapersniper commented 2 years ago

@deathvenom-369 just in case you want, I've built a docker image to run the scrip, it uses pypy as a base so generally should be faster for this use case.

have a read of the README.md for more info if you have questions join the discord server and I'll be happy to answer any and all

deathvenom-369 commented 2 years ago

Awesome! I think having a docker will simplify things while hopefully bring attention to this great project.

deathvenom-369 commented 2 years ago

trying out the docker image. seemed to work for a while but now i get: Traceback (most recent call last):

  File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main

    return _run_code(code, main_globals, None,

  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code

    exec(code, run_globals)

  File "/usr/local/lib/python3.10/site-packages/qBitrr/main.py", line 197, in <module>

    run()

  File "/usr/local/lib/python3.10/site-packages/qBitrr/main.py", line 166, in run

    manager = qBitManager()

  File "/usr/local/lib/python3.10/site-packages/qBitrr/main.py", line 85, in __init__

    self.arr_manager = ArrManager(self).build_arr_instances()

  File "/usr/local/lib/python3.10/site-packages/qBitrr/arss.py", line 3319, in build_arr_instances

    managed_object = Arr(name, self, client_cls=call_cls)

  File "/usr/local/lib/python3.10/site-packages/qBitrr/arss.py", line 207, in __init__

    self.arr_db_file = pathlib.Path(arr_db_file)

  File "/usr/local/lib/python3.10/pathlib.py", line 958, in __new__

    self = cls._from_parts(args)

  File "/usr/local/lib/python3.10/pathlib.py", line 592, in _from_parts

    drv, root, parts = self._parse_args(args)

  File "/usr/local/lib/python3.10/pathlib.py", line 576, in _parse_args

    a = os.fspath(a)

TypeError: expected str, bytes or os.PathLike object, not NoneType
Drapersniper commented 2 years ago

please share your full config file removing ONLY API keys and URLs (keep paths intact, if you prefer join the discord and send me it in a DM)