qbit_manage/modules/bhd.py
bobokun f4dcc3900c
4.1.3 (#542)
* 4.1.3-develop1

* removes `ignoreTags_OnUpdate` setting as it was confusing for users
- Adds cache for tag updates
- Updates doc to include cat in tracker

* Bump dependabot/fetch-metadata from 2.0.0 to 2.1.0 (#537)

* Bump dependabot/fetch-metadata from 2.0.0 to 2.1.0

Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](https://github.com/dependabot/fetch-metadata/compare/v2.0.0...v2.1.0)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* minor bug fix in process torrent issues

* remove force_retag setting since it's no longer valid with the new tag-update

* move hotio webhook to start earlier

* adds better trace logs for share limits #533

* Adds #538

* [pre-commit.ci] pre-commit autoupdate (#539)

* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 24.4.0 → 24.4.2](https://github.com/psf/black/compare/24.4.0...24.4.2)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* add additional trace logs for noHL

* nohl config fixes

* Fixes #540

* adds cron scheduling support

* minor bug fix in rounding minutes

* bugfixes in cron scheduling

* don't spam the logs

* chore: Update qbit_manage.py to display next run time after first cron run

* remove spam in logs

* QOL improvement: Refactor time parsing logic for share limits

* bug fix in new parse data

* 4.1.3

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-05-05 14:07:36 -04:00

40 lines
1.3 KiB
Python
Executable file

"""Module for BeyondHD (BHD) tracker."""
from json import JSONDecodeError
from modules import util
from modules.util import Failed
logger = util.logger
BASE_URL = "https://beyond-hd.me/api/"
class BeyondHD:
"""BeyondHD (BHD) tracker class."""
def __init__(self, config, params):
self.config = config
self.apikey = params["apikey"]
logger.secret(self.apikey)
json = {"search": "test"}
self.search(json)
def search(self, json, path="torrents/"):
"""Search BHD."""
url = f"{BASE_URL}{path}{self.apikey}"
json["action"] = "search"
logger.trace(url)
logger.trace(f"JSON: {json}")
try:
response = self.config.post(url, json=json, headers={"User-Agent": "Chrome"})
logger.trace(response)
response_json = response.json()
except JSONDecodeError as err:
logger.debug(err)
return {}
if response.status_code >= 400:
logger.debug(f"Response: {response_json}")
raise Failed(f"({response.status_code} [{response.reason}]) {response_json}")
if not response_json.get("success"):
raise Failed(f"BHD Error: {response_json.get('status_message', 'Issue receiving response from BHD API.')}")
return response_json