Skip to content

Commit

Permalink
Fix crash resp wrong method call. And error on no response from tracker.
Browse files Browse the repository at this point in the history
  • Loading branch information
vasilky3 committed Jan 10, 2024
1 parent 910a11a commit 52fed81
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class SearchType(Enum):
}


def pars_cap(atr_arr):
def parse_cap(atr_arr):
r = Cap(0)
for atr in atr_arr:
r |= flags_mapping.get(atr, Cap(0))
Expand All @@ -58,9 +58,9 @@ def __init__(self, root):
self.movie_enabled = root.find("./caps/searching/movie-search").get("available") == "yes"

tv_p = root.find("./caps/searching/tv-search").get("supportedParams").lower().split(",")
self.tv_caps = pars_cap(tv_p)
self.tv_caps = parse_cap(tv_p)
movie_p = root.find("./caps/searching/movie-search").get("supportedParams").lower().split(",")
self.movie_caps = pars_cap(movie_p)
self.movie_caps = parse_cap(movie_p)

def check_t_and_cap(self, t):
if t == SearchType.MOVIE and self.movie_enabled:
Expand Down Expand Up @@ -93,7 +93,7 @@ async def send_request(self, url, params=None):
async with self.session.get(url, params=params) as resp:
log.debug(f"Indexers request status: {resp.status}")
if resp.status != HTTPStatus.OK:
self.proceed_resp_error(resp.status, resp.message)
self.proceed_resp_error(resp.status, await resp.text())
return
response_time = time.monotonic() - start
body = await resp.text()
Expand Down Expand Up @@ -146,7 +146,7 @@ async def search_by_indexer(self, indexer, t, title, year, season=None, ep=None,
root = await self.send_request(self.query_by_indexer.format(indexer=indexer.id), params)

if not root:
return
return [], indexer
torr_list = parse_torrents(root)
log.info(f"Done searching. Got {len(torr_list)} torrents from {indexer.name}.")
return torr_list, indexer
Expand Down Expand Up @@ -242,8 +242,7 @@ def parse_item(item):
"info_hash": "",
"language": None,

# todo would be nice to assign correct icons but that can be very time consuming due to the number
# of indexers in Jackett
# nice to assign correct icons but that can be very time consuming due to the number of indexers in Jackett
"icon": get_icon_path(),

"_size_bytes": -1
Expand Down

0 comments on commit 52fed81

Please sign in to comment.