Skip to content

Commit

Permalink
[patch] Fixed error handling and pathing config
Browse files Browse the repository at this point in the history
  • Loading branch information
Feramance committed Aug 27, 2023
1 parent 099648e commit a64e55c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions qBitrr/arss.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -1298,9 +1298,9 @@ def _db_request_update(self, request_ids: dict[str, set[int | str]]):
.order_by(self.model_arr_file.Added.desc())
):
self.db_update_single_series(db_entry=db_entry, request=True)
except BaseException:
except requests.exceptions.ConnectionError:
self.logger.error("Connection Error")
raise DelayLoopException(length=300, type="arr")
raise DelayLoopException(length=300, type=self._name)

def db_overseerr_update(self):
if (not self.search_missing) or (not self.overseerr_requests):
Expand Down Expand Up @@ -1399,7 +1399,7 @@ def db_update(self):
self.db_update_single_series(db_entry=movies)
except BaseException:
self.logger.error("Error reading arr db file")
raise DelayLoopException(length=300, type="delay")
raise DelayLoopException(length=NO_INTERNET_SLEEP_TIMER, type="delay")
self.logger.trace(f"Finished updating database")

def minimum_availability_check(
Expand Down Expand Up @@ -3027,7 +3027,7 @@ def get_queue(
)
except requests.exceptions.ConnectionError:
self.logger.error("Failed to get queue")
raise DelayLoopException(length=300, type="arr")
raise DelayLoopException(length=300, type=self._name)
try:
res = res.get("records", [])
except AttributeError:
Expand Down Expand Up @@ -3256,6 +3256,7 @@ def run_search_loop(self) -> NoReturn:
try:
for entry, todays, limit_bypass, series_search in self.db_get_files():
if timer < (datetime.now(timezone.utc) - loop_timer):
self.refresh_download_queue()
self.force_grab()
raise RestartLoopException
while (
Expand Down
6 changes: 3 additions & 3 deletions qBitrr/gen_config.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from tomlkit.toml_document import TOMLDocument

from qBitrr.env_config import ENVIRO_CONFIG
from qBitrr.home_path import APPDATA_FOLDER, ON_DOCKER
from qBitrr.home_path import APPDATA_FOLDER, HOME_PATH, ON_DOCKER

T = TypeVar("T")

Expand All @@ -23,7 +23,7 @@ def generate_doc() -> TOMLDocument:
'Make sure to change all entries of "CHANGE_ME".'
)
)
config.add(comment('This is a config file should be moved to "' f'{APPDATA_FOLDER}".'))
config.add(comment('This is a config file should be moved to "' f'{HOME_PATH}".'))
config.add(nl())
_add_settings_section(config)
_add_qbit_section(config)
Expand Down Expand Up @@ -773,7 +773,7 @@ def _write_config_file(docker=False) -> pathlib.Path:
file_name = "config.rename_me.toml"
else:
file_name = "config.toml"
CONFIG_FILE = APPDATA_FOLDER.joinpath(file_name)
CONFIG_FILE = HOME_PATH.joinpath(file_name)
if CONFIG_FILE.exists() and not docker:
print(f"{CONFIG_FILE} already exists, File is not being replaced.")
CONFIG_FILE = pathlib.Path.cwd().joinpath("config_new.toml")
Expand Down

0 comments on commit a64e55c

Please sign in to comment.