Skip to content

Commit

Permalink
[patch] Fixed Hardlink import mode and stopped torrent pausing on com…
Browse files Browse the repository at this point in the history
…pletion if not force uploaded
  • Loading branch information
Feramance committed Jan 10, 2024
1 parent 351f036 commit 45665a9
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 19 deletions.
16 changes: 8 additions & 8 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ Category = "sonarr-tv"
# Toggle whether to send a query to Servarr to search any failed torrents
ReSearch = true

# The Servarr's Import Mode(one of Move, Copy or Hardlink)
importMode = "Hardlink"
# The Servarr's Import Mode(one of Move, Copy or Auto)
importMode = "Auto"

# Timer to call RSSSync (In minutes) - Set to 0 to disable (Values below 5 can cause errors for maximum retires)
RssSyncTimer = 1
Expand Down Expand Up @@ -243,8 +243,8 @@ Category = "sonarr-anime"
# Toggle whether to send a query to Servarr to search any failed torrents
ReSearch = true

# The Servarr's Import Mode(one of Move, Copy or Hardlink)
importMode = "Hardlink"
# The Servarr's Import Mode(one of Move, Copy or Auto)
importMode = "Auto"

# Timer to call RSSSync (In minutes) - Set to 0 to disable (Values below 5 can cause errors for maximum retires)
RssSyncTimer = 1
Expand Down Expand Up @@ -424,8 +424,8 @@ Category = "radarr-1080"
# Toggle whether to send a query to Servarr to search any failed torrents
ReSearch = true

# The Servarr's Import Mode(one of Move, Copy or Hardlink)
importMode = "Hardlink"
# The Servarr's Import Mode(one of Move, Copy or Auto)
importMode = "Auto"

# Timer to call RSSSync (In minutes) - Set to 0 to disable (Values below 5 can cause errors for maximum retires)
RssSyncTimer = 1
Expand Down Expand Up @@ -614,8 +614,8 @@ Category = "radarr-4k"
# Toggle whether to send a query to Servarr to search any failed torrents
ReSearch = true

# The Servarr's Import Mode(one of Move, Copy or Hardlink)
importMode = "Hardlink"
# The Servarr's Import Mode(one of Move, Copy or Auto)
importMode = "Auto"

# Timer to call RSSSync (In minutes) - Set to 0 to disable (Values below 5 can cause errors for maximum retires)
RssSyncTimer = 1
Expand Down
36 changes: 27 additions & 9 deletions qBitrr/arss.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ def __init__(
self.apikey = CONFIG.get_or_raise(f"{name}.APIKey")
self.re_search = CONFIG.get(f"{name}.ReSearch", fallback=False)
self.import_mode = CONFIG.get(f"{name}.importMode", fallback="Auto")
if self.import_mode == "Hardlink":
self.import_mode = "Auto"
self.refresh_downloads_timer = CONFIG.get(f"{name}.RefreshDownloadsTimer", fallback=1)
self.arr_error_codes_to_blocklist = CONFIG.get(
f"{name}.ArrErrorCodesToBlocklist", fallback=[]
Expand Down Expand Up @@ -1608,8 +1610,12 @@ def db_update(self):
completed = True
if self.search_by_year:
for s in series:
if isinstance(s, str):
continue
episodes = self.client.get_episode(s["id"], True)
for e in episodes:
if isinstance(e, str):
continue
if "airDateUtc" in e and (
"absoluteEpisodeNumber" in e or "sceneAbsoluteEpisodeNumber" in e
):
Expand Down Expand Up @@ -1643,8 +1649,12 @@ def db_update(self):

else:
for s in series:
if isinstance(s, str):
continue
episodes = self.client.get_episode(s["id"], True)
for e in episodes:
if isinstance(e, str):
continue
if "airDateUtc" in e and (
"absoluteEpisodeNumber" in e or "sceneAbsoluteEpisodeNumber" in e
):
Expand Down Expand Up @@ -1672,6 +1682,8 @@ def db_update(self):
completed = True
if self.search_by_year:
for s in series:
if isinstance(s, str):
continue
if s["year"] < self.search_current_year:
continue
if s["year"] > self.search_current_year:
Expand All @@ -1681,6 +1693,8 @@ def db_update(self):
self.db_update_single_series(db_entry=s, series=True)
else:
for s in series:
if isinstance(s, str):
continue
if not s["monitored"]:
continue
self.db_update_single_series(db_entry=s, series=True)
Expand All @@ -1698,6 +1712,8 @@ def db_update(self):
completed = True
if self.search_by_year:
for m in movies:
if isinstance(m, str):
continue
if m["year"] < self.search_current_year:
continue
if m["year"] > self.search_current_year:
Expand All @@ -1707,6 +1723,8 @@ def db_update(self):
self.db_update_single_series(db_entry=m)
else:
for m in movies:
if isinstance(m, str):
continue
if not m["monitored"]:
continue
self.db_update_single_series(db_entry=m)
Expand Down Expand Up @@ -3570,15 +3588,15 @@ def _process_single_torrent(self, torrent: qbittorrentapi.TorrentDictionary):
elif torrent.state_enum == TorrentStates.MISSING_FILES:
self._process_single_torrent_missing_files(torrent)
# If a torrent is Uploading Pause it, as long as its not being Forced Uploaded.
elif (
self.is_uploading_state(torrent)
and torrent.seeding_time > 1
and torrent.amount_left == 0
and torrent.added_on > 0
and torrent.content_path
and self.seeding_mode_global_remove_torrent != -1
) and torrent.hash in self.cleaned_torrents:
self._process_single_torrent_uploading(torrent, leave_alone)
# elif (
# self.is_uploading_state(torrent)
# and torrent.seeding_time > 1
# and torrent.amount_left == 0
# and torrent.added_on > 0
# and torrent.content_path
# and self.seeding_mode_global_remove_torrent != -1
# ) and torrent.hash in self.cleaned_torrents:
# self._process_single_torrent_uploading(torrent, leave_alone)
# Mark a torrent for deletion
elif (
torrent.state_enum != TorrentStates.PAUSED_DOWNLOAD
Expand Down
4 changes: 2 additions & 2 deletions qBitrr/gen_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ def _gen_default_cat(category: str, config: TOMLDocument):
)
_gen_default_line(
cat_default,
"The Servarr's Import Mode(one of Move, Copy or Hardlink)",
"The Servarr's Import Mode(one of Move, Copy or Auto)",
"importMode",
"Hardlink",
"Auto",
)
_gen_default_line(
cat_default,
Expand Down

0 comments on commit 45665a9

Please sign in to comment.