qbit_manage/modules/qbittorrent.py

528 lines
26 KiB
Python
Raw Normal View History

"""Qbittorrent Module"""
2024-02-11 00:15:41 +08:00
2022-10-29 23:19:09 +08:00
import os
import sys
4.1.0 (#520) * Sample solution. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update modules/config.py Increase efficiency by using a boolean in place of a functional check. Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * Bump softprops/action-gh-release from 1 to 2 Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * update group_uplolad_speed logic * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Bump dependabot/fetch-metadata from 1.6.0 to 2.0.0 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.6.0 to 2.0.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.6.0...v2.0.0) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump pre-commit from 3.6.2 to 3.7.0 Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.6.2 to 3.7.0. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.6.2...v3.7.0) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/hhatto/autopep8: v2.0.4 → v2.1.0](https://github.com/hhatto/autopep8/compare/v2.0.4...v2.1.0) - [github.com/asottile/pyupgrade: v3.15.1 → v3.15.2](https://github.com/asottile/pyupgrade/compare/v3.15.1...v3.15.2) - [github.com/psf/black: 24.2.0 → 24.3.0](https://github.com/psf/black/compare/24.2.0...24.3.0) * Bump qbittorrent-api from 2024.2.59 to 2024.3.60 Bumps [qbittorrent-api](https://github.com/rmartin16/qbittorrent-api) from 2024.2.59 to 2024.3.60. - [Release notes](https://github.com/rmartin16/qbittorrent-api/releases) - [Changelog](https://github.com/rmartin16/qbittorrent-api/blob/main/CHANGELOG.md) - [Commits](https://github.com/rmartin16/qbittorrent-api/compare/v2024.2.59...v2024.3.60) --- updated-dependencies: - dependency-name: qbittorrent-api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Bump 4.0.10 * Revert "Add Aggregate Group Speed Capabilities" * Bump gitpython from 3.1.42 to 3.1.43 Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.42 to 3.1.43. - [Release notes](https://github.com/gitpython-developers/GitPython/releases) - [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES) - [Commits](https://github.com/gitpython-developers/GitPython/compare/3.1.42...3.1.43) --- updated-dependencies: - dependency-name: gitpython dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Add new args for mover.old * Revert "Revert "Add Aggregate Group Speed Capabilities"" This reverts commit f112b2c92e41f3a80090fb3ac5b889902b042367. Fixes bug in original commit code * Remove username and password from debug logs sinced they are redacted anyways * adds support for #513 * Fixes #501 * Fixes bug not logging torrents being deleted after meeting share_limits * Adds additional error checking for invalid share_limits in config * fixes bug in torrents not untagging min_seeding_time_tag * Fixes bug in #494 * Bi-directional Wiki Sync Action * Bump actions/checkout from 2 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bug fix on share limits being applied every run * Revert "Revert "Revert "Add Aggregate Group Speed Capabilities""" This reverts commit 41d5170ba649f47fe4ff8fd59a087453bd524089. * Fixes #494 with new enable_group_upload_speed flag * Fixes bug found in #494 * 4.1.0 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Paul Walker <walkerp1@yahoo.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com>
2024-04-06 08:39:00 +08:00
from functools import cache
2022-10-29 23:19:09 +08:00
from qbittorrentapi import Client
from qbittorrentapi import LoginFailed
from qbittorrentapi import NotFound404Error
from qbittorrentapi import TrackerStatus
2022-10-29 23:19:09 +08:00
from qbittorrentapi import Version
from modules import util
2023-04-01 01:26:16 +08:00
from modules.util import Failed
2023-04-11 08:50:55 +08:00
from modules.util import TorrentMessages
2024-02-11 00:15:41 +08:00
from modules.util import list_in_text
logger = util.logger
2021-12-29 01:19:58 +08:00
class Qbt:
"""
Qbittorrent Class
"""
2023-04-01 01:26:16 +08:00
SUPPORTED_VERSION = Version.latest_supported_app_version()
MIN_SUPPORTED_VERSION = "v4.3.0"
TORRENT_DICT_COMMANDS = ["recheck", "cross_seed", "rem_unregistered", "tag_tracker_error", "tag_nohardlinks", "share_limits"]
2023-04-01 01:26:16 +08:00
def __init__(self, config, params):
self.config = config
self.host = params["host"]
self.username = params["username"]
self.password = params["password"]
logger.secret(self.username)
logger.secret(self.password)
4.1.0 (#520) * Sample solution. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update modules/config.py Increase efficiency by using a boolean in place of a functional check. Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * Bump softprops/action-gh-release from 1 to 2 Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * update group_uplolad_speed logic * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Bump dependabot/fetch-metadata from 1.6.0 to 2.0.0 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.6.0 to 2.0.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.6.0...v2.0.0) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump pre-commit from 3.6.2 to 3.7.0 Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.6.2 to 3.7.0. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.6.2...v3.7.0) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/hhatto/autopep8: v2.0.4 → v2.1.0](https://github.com/hhatto/autopep8/compare/v2.0.4...v2.1.0) - [github.com/asottile/pyupgrade: v3.15.1 → v3.15.2](https://github.com/asottile/pyupgrade/compare/v3.15.1...v3.15.2) - [github.com/psf/black: 24.2.0 → 24.3.0](https://github.com/psf/black/compare/24.2.0...24.3.0) * Bump qbittorrent-api from 2024.2.59 to 2024.3.60 Bumps [qbittorrent-api](https://github.com/rmartin16/qbittorrent-api) from 2024.2.59 to 2024.3.60. - [Release notes](https://github.com/rmartin16/qbittorrent-api/releases) - [Changelog](https://github.com/rmartin16/qbittorrent-api/blob/main/CHANGELOG.md) - [Commits](https://github.com/rmartin16/qbittorrent-api/compare/v2024.2.59...v2024.3.60) --- updated-dependencies: - dependency-name: qbittorrent-api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Bump 4.0.10 * Revert "Add Aggregate Group Speed Capabilities" * Bump gitpython from 3.1.42 to 3.1.43 Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.42 to 3.1.43. - [Release notes](https://github.com/gitpython-developers/GitPython/releases) - [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES) - [Commits](https://github.com/gitpython-developers/GitPython/compare/3.1.42...3.1.43) --- updated-dependencies: - dependency-name: gitpython dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Add new args for mover.old * Revert "Revert "Add Aggregate Group Speed Capabilities"" This reverts commit f112b2c92e41f3a80090fb3ac5b889902b042367. Fixes bug in original commit code * Remove username and password from debug logs sinced they are redacted anyways * adds support for #513 * Fixes #501 * Fixes bug not logging torrents being deleted after meeting share_limits * Adds additional error checking for invalid share_limits in config * fixes bug in torrents not untagging min_seeding_time_tag * Fixes bug in #494 * Bi-directional Wiki Sync Action * Bump actions/checkout from 2 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bug fix on share limits being applied every run * Revert "Revert "Revert "Add Aggregate Group Speed Capabilities""" This reverts commit 41d5170ba649f47fe4ff8fd59a087453bd524089. * Fixes #494 with new enable_group_upload_speed flag * Fixes bug found in #494 * 4.1.0 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Paul Walker <walkerp1@yahoo.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com>
2024-04-06 08:39:00 +08:00
logger.debug(f"Host: {self.host}")
ex = ""
try:
self.client = Client(
host=self.host,
username=self.username,
password=self.password,
VERIFY_WEBUI_CERTIFICATE=False,
2023-06-24 22:06:03 +08:00
REQUESTS_ARGS={"timeout": (45, 60)},
)
self.client.auth_log_in()
2023-04-01 01:26:16 +08:00
self.current_version = self.client.app.version
logger.debug(f"qBittorrent: {self.current_version}")
logger.debug(f"qBittorrent Web API: {self.client.app.web_api_version}")
logger.debug(f"qbit_manage supported versions: {self.MIN_SUPPORTED_VERSION} - {self.SUPPORTED_VERSION}")
if self.current_version < self.MIN_SUPPORTED_VERSION:
ex = (
2023-04-01 01:26:16 +08:00
f"Qbittorrent Error: qbit_manage is only compatible with {self.MIN_SUPPORTED_VERSION} or higher. "
f"You are currently on {self.current_version}."
2022-10-29 23:19:09 +08:00
+ "\n"
+ f"Please upgrade your qBittorrent version to {self.MIN_SUPPORTED_VERSION} or higher to use qbit_manage."
2022-10-29 23:19:09 +08:00
)
2023-04-01 01:26:16 +08:00
elif not Version.is_app_version_supported(self.current_version):
ex = (
2023-04-01 01:26:16 +08:00
f"Qbittorrent Error: qbit_manage is only compatible with {self.SUPPORTED_VERSION} or lower. "
f"You are currently on {self.current_version}."
2022-10-29 23:19:09 +08:00
+ "\n"
+ f"Please downgrade your qBittorrent version to {self.SUPPORTED_VERSION} to use qbit_manage."
2022-10-29 23:19:09 +08:00
)
if ex:
if self.config.commands["skip_qb_version_check"]:
ex += "\n[BYPASS]: Continuing because qBittorrent version check is bypassed... Please do not ask for support!"
logger.print_line(ex, "WARN")
else:
self.config.notify(ex, "Qbittorrent")
logger.print_line(ex, "CRITICAL")
v4.0.5 (#418) * Fixes #388 * Bump docker/setup-buildx-action from 2 to 3 Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2 to 3. - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](https://github.com/docker/setup-buildx-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/setup-buildx-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump docker/login-action from 2 to 3 Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3. - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/login-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump docker/build-push-action from 4 to 5 Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4 to 5. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v4...v5) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump gitpython from 3.1.35 to 3.1.36 Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.35 to 3.1.36. - [Release notes](https://github.com/gitpython-developers/GitPython/releases) - [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES) - [Commits](https://github.com/gitpython-developers/GitPython/compare/3.1.35...3.1.36) --- updated-dependencies: - dependency-name: gitpython dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/asottile/reorder-python-imports: v3.10.0 → v3.11.0](https://github.com/asottile/reorder-python-imports/compare/v3.10.0...v3.11.0) - [github.com/asottile/pyupgrade: v3.10.1 → v3.11.0](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.11.0) - [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1) * Error handling when BHD API doesn't respond * add BHD specific announce related issues * handle JSONDecodeError * Special mapping to leave torrents uncategorized on cat-update (#398) Special mapping to leave torrents uncategorized on cat-update (closes #395) * Bump gitpython from 3.1.36 to 3.1.37 Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.36 to 3.1.37. - [Release notes](https://github.com/gitpython-developers/GitPython/releases) - [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES) - [Commits](https://github.com/gitpython-developers/GitPython/compare/3.1.36...3.1.37) --- updated-dependencies: - dependency-name: gitpython dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump ruamel-yaml from 0.17.32 to 0.17.33 Bumps [ruamel-yaml](https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree) from 0.17.32 to 0.17.33. --- updated-dependencies: - dependency-name: ruamel-yaml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * last_active flag for share_limits (#397) Added a last_active flag for share_limits to resume torrents and avoid cleanup if there was activity in the last X minutes. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#405) updates: - [github.com/asottile/reorder-python-imports: v3.10.0 → v3.11.0](https://github.com/asottile/reorder-python-imports/compare/v3.10.0...v3.11.0) - [github.com/asottile/pyupgrade: v3.10.1 → v3.13.0](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.13.0) - [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * Bump schedule from 1.2.0 to 1.2.1 Bumps [schedule](https://github.com/dbader/schedule) from 1.2.0 to 1.2.1. - [Changelog](https://github.com/dbader/schedule/blob/master/HISTORY.rst) - [Commits](https://github.com/dbader/schedule/compare/1.2.0...1.2.1) --- updated-dependencies: - dependency-name: schedule dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump ruamel-yaml from 0.17.33 to 0.17.34 Bumps [ruamel-yaml](https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree) from 0.17.33 to 0.17.34. --- updated-dependencies: - dependency-name: ruamel-yaml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * fix exit codes when program fails (#411) Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * Bump ruamel-yaml from 0.17.34 to 0.17.35 Bumps [ruamel-yaml](https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree) from 0.17.34 to 0.17.35. --- updated-dependencies: - dependency-name: ruamel-yaml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * [pre-commit.ci] pre-commit autoupdate (#409) updates: - [github.com/asottile/reorder-python-imports: v3.10.0 → v3.12.0](https://github.com/asottile/reorder-python-imports/compare/v3.10.0...v3.12.0) - [github.com/asottile/pyupgrade: v3.10.1 → v3.14.0](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.14.0) - [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * New option cat in trackers (#400) * New option cat in trackers * [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> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * update config.sample for #200 * add additional script to edit trackers * clarify remote_dir usage (#417) * Bump gitpython from 3.1.35 to 3.1.37 (#414) Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.35 to 3.1.37. - [Release notes](https://github.com/gitpython-developers/GitPython/releases) - [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES) - [Commits](https://github.com/gitpython-developers/GitPython/compare/3.1.35...3.1.37) --- updated-dependencies: - dependency-name: gitpython dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#413) updates: - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.5.0) - [github.com/asottile/reorder-python-imports: v3.10.0 → v3.12.0](https://github.com/asottile/reorder-python-imports/compare/v3.10.0...v3.12.0) - [github.com/asottile/pyupgrade: v3.10.1 → v3.15.0](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.15.0) - [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * 4.0.5 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Esteban Thilliez <77675611+estebanthi@users.noreply.github.com> Co-authored-by: Fabricio Silva <hi@fabricio.dev> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com>
2023-10-14 23:08:33 +08:00
sys.exit(1)
logger.info("Qbt Connection Successful")
2024-02-15 23:48:54 +08:00
except LoginFailed:
ex = "Qbittorrent Error: Failed to login. Invalid username/password."
self.config.notify(ex, "Qbittorrent")
2024-02-15 23:48:54 +08:00
raise Failed(ex)
except Exception as exc:
2023-07-16 03:03:29 +08:00
self.config.notify(exc, "Qbittorrent")
2024-02-15 23:48:54 +08:00
raise Failed(exc)
logger.separator("Getting Torrent List", space=False, border=False)
2022-10-29 23:19:09 +08:00
self.torrent_list = self.get_torrents({"sort": "added_on"})
2024-02-16 08:39:56 +08:00
self.torrentfiles = {} # a map of torrent files to track cross-seeds
self.global_max_ratio_enabled = self.client.app.preferences.max_ratio_enabled
self.global_max_ratio = self.client.app.preferences.max_ratio
self.global_max_seeding_time_enabled = self.client.app.preferences.max_seeding_time_enabled
self.global_max_seeding_time = self.client.app.preferences.max_seeding_time
2023-04-10 23:52:51 +08:00
if any(config.commands.get(command, False) for command in self.TORRENT_DICT_COMMANDS):
2021-12-29 01:19:58 +08:00
# Get an updated torrent dictionary information of the torrents
2023-04-10 23:52:51 +08:00
self.get_torrent_info()
else:
self.torrentinfo = None
self.torrentissue = None
self.torrentvalid = None
self.get_tags = cache(self.get_tags)
self.get_category = cache(self.get_category)
self.get_category_save_paths = cache(self.get_category_save_paths)
2023-04-10 23:52:51 +08:00
def get_torrent_info(self):
"""
Will create a 2D Dictionary with the torrent name as the key
2024-02-16 08:39:56 +08:00
self.torrentinfo = {'TorrentName1' : {'Category':'TV', 'save_path':'/data/torrents/TV', 'msg':'[]'...},
'TorrentName2' : {'Category':'Movies', 'save_path':'/data/torrents/Movies'}, 'msg':'[]'...}
2023-04-10 23:52:51 +08:00
List of dictionary key definitions
Category = Returns category of the torrent (str)
save_path = Returns the save path of the torrent (str)
msg = Returns a list of torrent messages by name (list of str)
status = Returns the list of status numbers of the torrent by name
(0: Tracker is disabled (used for DHT, PeX, and LSD),
1: Tracker has not been contacted yet,
2: Tracker has been contacted and is working,
3: Tracker is updating,
4: Tracker has been contacted, but it is not working (or doesn't send proper replies)
is_complete = Returns the state of torrent
(Returns True if at least one of the torrent with the State is categorized as Complete.)
"""
self.torrentinfo = {}
self.torrentissue = [] # list of unregistered torrent objects
self.torrentvalid = [] # list of working torrents
t_obj_list = [] # list of all torrent objects
settings = self.config.settings
logger.separator("Checking Settings", space=False, border=False)
if settings["force_auto_tmm"]:
logger.print_line(
Release 4.1.8 (#645) * 4.1.8-develop1 * Bump humanize from 4.9.0 to 4.10.0 (#603) Bumps [humanize](https://github.com/python-humanize/humanize) from 4.9.0 to 4.10.0. - [Release notes](https://github.com/python-humanize/humanize/releases) - [Commits](https://github.com/python-humanize/humanize/compare/4.9.0...4.10.0) --- updated-dependencies: - dependency-name: humanize dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Print the schedule and delay before starting the sleep (#606) * Bump croniter from 2.0.5 to 2.0.7 (#607) Bumps [croniter](https://github.com/kiorky/croniter) from 2.0.5 to 2.0.7. - [Changelog](https://github.com/kiorky/croniter/blob/master/CHANGELOG.rst) - [Commits](https://github.com/kiorky/croniter/compare/2.0.5...2.0.7) --- updated-dependencies: - dependency-name: croniter dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump qbittorrent-api from 2024.5.63 to 2024.7.64 (#611) Bumps [qbittorrent-api](https://github.com/rmartin16/qbittorrent-api) from 2024.5.63 to 2024.7.64. - [Release notes](https://github.com/rmartin16/qbittorrent-api/releases) - [Changelog](https://github.com/rmartin16/qbittorrent-api/blob/main/CHANGELOG.md) - [Commits](https://github.com/rmartin16/qbittorrent-api/compare/v2024.5.63...v2024.7.64) --- updated-dependencies: - dependency-name: qbittorrent-api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Check for symlinks prior to counting file as a hardlink (#609) * Bump croniter from 2.0.7 to 3.0.1 (#617) * Update SUPPORTED_VERSIONS.json (#618) * Update SUPPORTED_VERSIONS.json (#612) Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * Bump croniter from 3.0.1 to 3.0.3 (#621) Bumps [croniter](https://github.com/kiorky/croniter) from 3.0.1 to 3.0.3. - [Changelog](https://github.com/kiorky/croniter/blob/master/CHANGELOG.rst) - [Commits](https://github.com/kiorky/croniter/compare/3.0.1...3.0.3) --- updated-dependencies: - dependency-name: croniter dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pre-commit from 3.7.1 to 3.8.0 (#620) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.7.1 to 3.8.0. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.7.1...v3.8.0) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs: bump required python version to 3.9.0+ (#623) * Typo fix in ` docs/Config-Setup.md` (#627) * Typo fix in `config.yml.sample` (#626) * Bump flake8 from 7.1.0 to 7.1.1 (#628) Bumps [flake8](https://github.com/pycqa/flake8) from 7.1.0 to 7.1.1. - [Commits](https://github.com/pycqa/flake8/compare/7.1.0...7.1.1) --- updated-dependencies: - dependency-name: flake8 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(docs): Sync wiki to docs [skip-cd] * Bump qbittorrent-api from 2024.7.64 to 2024.8.65 (#637) Bumps [qbittorrent-api](https://github.com/rmartin16/qbittorrent-api) from 2024.7.64 to 2024.8.65. - [Release notes](https://github.com/rmartin16/qbittorrent-api/releases) - [Changelog](https://github.com/rmartin16/qbittorrent-api/blob/main/CHANGELOG.md) - [Commits](https://github.com/rmartin16/qbittorrent-api/compare/v2024.7.64...v2024.8.65) --- updated-dependencies: - dependency-name: qbittorrent-api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update SUPPORTED_VERSIONS.json (#639) * Extend logging to explain why torrent files were not deleted. (#640) * Extend logging to explain why torrent files were not deleted. * [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> * update tox * Add force_auto_tmm_ignore_tags feature (#634) * Add force_auto_tmm_ignore_tags feature to qbittorrent module This commit introduces a new configuration option 'force_auto_tmm_ignore_tags' that allows users to specify tags which will prevent the force_auto_tmm feature from being applied to that torrent. Changes: qbittorrent.py: Modified the get_torrent_info method in the Qbt class Added a check for matching tags to ignore when applying force_auto_tmm config.py: Added 'force_auto_tmm_ignore_tags' to the settings dictionary Implemented check_for_attribute method call to load the new setting from config.yml config.yml: Added 'force_auto_tmm_ignore_tags' to the settings section Included example tags 'cross-seed' and 'Upload' as default values to ignore * remove extra spacing between lines. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix line length to adhere to flake8 * change log output for force_auto_tmm to multiline comment to adhere to flake8 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add comment explaining logic for ignoring force_auto_tmm using tags. * Add force_auto_tmm_ignore_tags feature to qbittorrent module This commit introduces a new configuration option 'force_auto_tmm_ignore_tags' that allows users to specify tags which will prevent the force_auto_tmm feature from being applied to that torrent. Changes: qbittorrent.py: Modified the get_torrent_info method in the Qbt class Added a check for matching tags to ignore when applying force_auto_tmm config.py: Added 'force_auto_tmm_ignore_tags' to the settings dictionary Implemented check_for_attribute method call to load the new setting from config.yml config.yml: Added 'force_auto_tmm_ignore_tags' to the settings section Included example tags 'cross-seed' and 'Upload' as default values to ignore remove extra spacing between lines. fix line length to adhere to flake8 [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci change log output for force_auto_tmm to multiline comment to adhere to flake8 [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Add comment explaining logic for ignoring force_auto_tmm using tags. * fixed text formatting so its displayed properly when script is run * remove f-string --------- Co-authored-by: TJZine <tzine@student.bridgew.edu> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * Bump peter-evans/create-pull-request from 6 to 7 (#642) Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 6 to 7. - [Release notes](https://github.com/peter-evans/create-pull-request/releases) - [Commits](https://github.com/peter-evans/create-pull-request/compare/v6...v7) --- updated-dependencies: - dependency-name: peter-evans/create-pull-request dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * 4.1.8 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: bobokun <jon.cy.lee98@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: ineednewpajamas <73252768+ineednewpajamas@users.noreply.github.com> Co-authored-by: Nicholas Sereni <glicholas@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> Co-authored-by: James Tufarelli <8152401+Minituff@users.noreply.github.com> Co-authored-by: Actionbot <actions@github.com> Co-authored-by: darkeclipse <5069005+Dark3clipse@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Tristan Zine <72631199+TJZine@users.noreply.github.com> Co-authored-by: TJZine <tzine@student.bridgew.edu>
2024-09-06 08:08:15 +08:00
"force_auto_tmm set to True. Will force Auto Torrent Management "
"for all torrents without matching force_auto_tmm_ignore_tags.",
self.config.loglevel,
2023-04-10 23:52:51 +08:00
)
logger.separator("Gathering Torrent Information", space=True, border=True)
for torrent in self.torrent_list:
is_complete = False
msg = None
status = None
working_tracker = None
issue = {"potential": False}
Release 4.1.8 (#645) * 4.1.8-develop1 * Bump humanize from 4.9.0 to 4.10.0 (#603) Bumps [humanize](https://github.com/python-humanize/humanize) from 4.9.0 to 4.10.0. - [Release notes](https://github.com/python-humanize/humanize/releases) - [Commits](https://github.com/python-humanize/humanize/compare/4.9.0...4.10.0) --- updated-dependencies: - dependency-name: humanize dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Print the schedule and delay before starting the sleep (#606) * Bump croniter from 2.0.5 to 2.0.7 (#607) Bumps [croniter](https://github.com/kiorky/croniter) from 2.0.5 to 2.0.7. - [Changelog](https://github.com/kiorky/croniter/blob/master/CHANGELOG.rst) - [Commits](https://github.com/kiorky/croniter/compare/2.0.5...2.0.7) --- updated-dependencies: - dependency-name: croniter dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump qbittorrent-api from 2024.5.63 to 2024.7.64 (#611) Bumps [qbittorrent-api](https://github.com/rmartin16/qbittorrent-api) from 2024.5.63 to 2024.7.64. - [Release notes](https://github.com/rmartin16/qbittorrent-api/releases) - [Changelog](https://github.com/rmartin16/qbittorrent-api/blob/main/CHANGELOG.md) - [Commits](https://github.com/rmartin16/qbittorrent-api/compare/v2024.5.63...v2024.7.64) --- updated-dependencies: - dependency-name: qbittorrent-api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Check for symlinks prior to counting file as a hardlink (#609) * Bump croniter from 2.0.7 to 3.0.1 (#617) * Update SUPPORTED_VERSIONS.json (#618) * Update SUPPORTED_VERSIONS.json (#612) Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * Bump croniter from 3.0.1 to 3.0.3 (#621) Bumps [croniter](https://github.com/kiorky/croniter) from 3.0.1 to 3.0.3. - [Changelog](https://github.com/kiorky/croniter/blob/master/CHANGELOG.rst) - [Commits](https://github.com/kiorky/croniter/compare/3.0.1...3.0.3) --- updated-dependencies: - dependency-name: croniter dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pre-commit from 3.7.1 to 3.8.0 (#620) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.7.1 to 3.8.0. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.7.1...v3.8.0) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs: bump required python version to 3.9.0+ (#623) * Typo fix in ` docs/Config-Setup.md` (#627) * Typo fix in `config.yml.sample` (#626) * Bump flake8 from 7.1.0 to 7.1.1 (#628) Bumps [flake8](https://github.com/pycqa/flake8) from 7.1.0 to 7.1.1. - [Commits](https://github.com/pycqa/flake8/compare/7.1.0...7.1.1) --- updated-dependencies: - dependency-name: flake8 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(docs): Sync wiki to docs [skip-cd] * Bump qbittorrent-api from 2024.7.64 to 2024.8.65 (#637) Bumps [qbittorrent-api](https://github.com/rmartin16/qbittorrent-api) from 2024.7.64 to 2024.8.65. - [Release notes](https://github.com/rmartin16/qbittorrent-api/releases) - [Changelog](https://github.com/rmartin16/qbittorrent-api/blob/main/CHANGELOG.md) - [Commits](https://github.com/rmartin16/qbittorrent-api/compare/v2024.7.64...v2024.8.65) --- updated-dependencies: - dependency-name: qbittorrent-api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update SUPPORTED_VERSIONS.json (#639) * Extend logging to explain why torrent files were not deleted. (#640) * Extend logging to explain why torrent files were not deleted. * [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> * update tox * Add force_auto_tmm_ignore_tags feature (#634) * Add force_auto_tmm_ignore_tags feature to qbittorrent module This commit introduces a new configuration option 'force_auto_tmm_ignore_tags' that allows users to specify tags which will prevent the force_auto_tmm feature from being applied to that torrent. Changes: qbittorrent.py: Modified the get_torrent_info method in the Qbt class Added a check for matching tags to ignore when applying force_auto_tmm config.py: Added 'force_auto_tmm_ignore_tags' to the settings dictionary Implemented check_for_attribute method call to load the new setting from config.yml config.yml: Added 'force_auto_tmm_ignore_tags' to the settings section Included example tags 'cross-seed' and 'Upload' as default values to ignore * remove extra spacing between lines. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix line length to adhere to flake8 * change log output for force_auto_tmm to multiline comment to adhere to flake8 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add comment explaining logic for ignoring force_auto_tmm using tags. * Add force_auto_tmm_ignore_tags feature to qbittorrent module This commit introduces a new configuration option 'force_auto_tmm_ignore_tags' that allows users to specify tags which will prevent the force_auto_tmm feature from being applied to that torrent. Changes: qbittorrent.py: Modified the get_torrent_info method in the Qbt class Added a check for matching tags to ignore when applying force_auto_tmm config.py: Added 'force_auto_tmm_ignore_tags' to the settings dictionary Implemented check_for_attribute method call to load the new setting from config.yml config.yml: Added 'force_auto_tmm_ignore_tags' to the settings section Included example tags 'cross-seed' and 'Upload' as default values to ignore remove extra spacing between lines. fix line length to adhere to flake8 [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci change log output for force_auto_tmm to multiline comment to adhere to flake8 [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Add comment explaining logic for ignoring force_auto_tmm using tags. * fixed text formatting so its displayed properly when script is run * remove f-string --------- Co-authored-by: TJZine <tzine@student.bridgew.edu> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * Bump peter-evans/create-pull-request from 6 to 7 (#642) Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 6 to 7. - [Release notes](https://github.com/peter-evans/create-pull-request/releases) - [Commits](https://github.com/peter-evans/create-pull-request/compare/v6...v7) --- updated-dependencies: - dependency-name: peter-evans/create-pull-request dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * 4.1.8 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: bobokun <jon.cy.lee98@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: ineednewpajamas <73252768+ineednewpajamas@users.noreply.github.com> Co-authored-by: Nicholas Sereni <glicholas@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> Co-authored-by: James Tufarelli <8152401+Minituff@users.noreply.github.com> Co-authored-by: Actionbot <actions@github.com> Co-authored-by: darkeclipse <5069005+Dark3clipse@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Tristan Zine <72631199+TJZine@users.noreply.github.com> Co-authored-by: TJZine <tzine@student.bridgew.edu>
2024-09-06 08:08:15 +08:00
if (
torrent.auto_tmm is False
and settings["force_auto_tmm"]
and torrent.category != ""
and not self.config.dry_run
# check whether the torrent has a matching tag to ignore force_auto_tmm.
and not any(tag in torrent.tags for tag in self.config.settings.get("force_auto_tmm_ignore_tags", []))
):
2023-04-10 23:52:51 +08:00
torrent.set_auto_management(True)
try:
2024-02-15 01:34:58 +08:00
torrent_name = torrent.name
2023-04-10 23:52:51 +08:00
torrent_hash = torrent.hash
torrent_is_complete = torrent.state_enum.is_complete
save_path = torrent.save_path
category = torrent.category
torrent_trackers = torrent.trackers
4.1.4 (#553) * 4.1.4-develop1 * Fixes #545 * Fixes #546 * oops forgot to check if group_tag is enabled * (fix) blu unregistered torrent message (#547) InfoHash not found. * fix broken tags check * Fixes MinSeedTimeNotReached not being applied correctly #548 * Bump pre-commit from 3.7.0 to 3.7.1 (#549) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.7.0 to 3.7.1. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.7.0...v3.7.1) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 * minor debug comment update * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 for those that don't use recycle bin * Fixes cross-seed bug introduced in v6 with cross-seed-data * optimize remove_empty_dirs and remove empty folders in orphaned_data * Additional blutopia unregistered_torrent status, do not delete orphaned_data root folder if it's empty * Adds additional logging for cleaning up empty folders * 4.1.4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-18 22:39:24 +08:00
self.add_torrent_files(torrent_hash, torrent.files, save_path)
2023-04-10 23:52:51 +08:00
except Exception as ex:
self.config.notify(ex, "Get Torrent Info", False)
logger.warning(ex)
if torrent_name in self.torrentinfo:
t_obj_list.append(torrent)
msg_list = self.torrentinfo[torrent_name]["msg"]
status_list = self.torrentinfo[torrent_name]["status"]
is_complete = True if self.torrentinfo[torrent_name]["is_complete"] is True else torrent_is_complete
2022-08-14 04:49:02 +08:00
else:
2023-04-10 23:52:51 +08:00
t_obj_list = [torrent]
msg_list = []
status_list = []
is_complete = torrent_is_complete
for trk in torrent_trackers:
4.1.7 (#602) * 4.1.7 * chore(docs): Sync wiki to docs [skip-cd] * Bump flake8 from 7.0.0 to 7.1.0 (#585) Bumps [flake8](https://github.com/pycqa/flake8) from 7.0.0 to 7.1.0. - [Commits](https://github.com/pycqa/flake8/compare/7.0.0...7.1.0) --- updated-dependencies: - dependency-name: flake8 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump docker/build-push-action from 5 to 6 (#588) * chore(docs): Sync wiki to docs [skip-cd] * fix(unregistered): Ignore 520 (#592) * fix: max vs min seeding time check (#596) * fix: max vs min seeding time check Allow max_seeding_time to be unlimited (-1) even if a min_seeding_time is set * [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> * fix pre-commit test * fix: check tracker status in udp & wss as well (#586) * fix: check tracker status in udp & wss as well * bump VERSION --------- Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#584) updates: - [github.com/hhatto/autopep8: v2.2.0 → v2.3.1](https://github.com/hhatto/autopep8/compare/v2.2.0...v2.3.1) - [github.com/asottile/pyupgrade: v3.15.2 → v3.16.0](https://github.com/asottile/pyupgrade/compare/v3.15.2...v3.16.0) - [github.com/PyCQA/flake8: 7.0.0 → 7.1.0](https://github.com/PyCQA/flake8/compare/7.0.0...7.1.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Fixes #595 to use BHD deleted reason list instead of API * Fixes #591 [FR]: Logging header doesn't get logged for every run * minor fixes in #591 * Adds deprecated message for bhd attribute in config * Fix min_seeding_time tag removal when max_seeding_time is -1 (#598) * Update share_limits.py to fix #590 --------- Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * Adds logging to mover script * Fixes [FR]: Remove orphaned without moving to orphaned_dir #590 * Fixes bug in printing schedule mode when run is True * Fix bug in Use BHD list of reasons instead of API #595 * Add additional BHD deletion reason #595 * Fix bug in #595 when status contains optional message * Update mover.py: add optional arg --status-filter to allow fine tune which torrents to pauseUpdate mover.py: add optional arg --status-filter to allow fine tune which torrents to pause (#599) * Update mover.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update mover.py: making the default behavior to only move `completed` torrents This will leave 1) unfinished files 2) actively seeding files in `downloading` torrents in cache. This helps to keep write-heavy operation on Cache, not on hard drive. Change this to "all" if you want this to always move everything every time. * minor fixes in help description --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * modify noHL threshold to address false positives * Add additional BHD deletion reason #595 * Bump dependabot/fetch-metadata from 2.1.0 to 2.2.0 (#601) Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 2.1.0 to 2.2.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v2.1.0...v2.2.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> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * 4.1.7 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Actionbot <actions@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Amos (lflare) <me@amosng.com> Co-authored-by: ineednewpajamas <73252768+ineednewpajamas@users.noreply.github.com> Co-authored-by: Tony <5747393+convexshiba@users.noreply.github.com>
2024-07-06 04:55:11 +08:00
if trk.url.split(":")[0] in ["http", "https", "udp", "ws", "wss"]:
2023-04-10 23:52:51 +08:00
status = trk.status
msg = trk.msg.upper()
if TrackerStatus(trk.status) == TrackerStatus.WORKING:
2023-04-10 23:52:51 +08:00
working_tracker = True
break
# Add any potential unregistered torrents to a list
if TrackerStatus(trk.status) == TrackerStatus.NOT_WORKING and not list_in_text(
2023-04-11 08:50:55 +08:00
msg, TorrentMessages.EXCEPTIONS_MSGS
):
2023-04-10 23:52:51 +08:00
issue["potential"] = True
issue["msg"] = msg
issue["status"] = status
if working_tracker:
status = 2
msg = ""
self.torrentvalid.append(torrent)
elif issue["potential"]:
status = issue["status"]
msg = issue["msg"]
self.torrentissue.append(torrent)
if msg is not None:
msg_list.append(msg)
if status is not None:
status_list.append(status)
torrentattr = {
"torrents": t_obj_list,
"Category": category,
"save_path": save_path,
"msg": msg_list,
"status": status_list,
"is_complete": is_complete,
2022-08-14 04:49:02 +08:00
}
2023-04-10 23:52:51 +08:00
self.torrentinfo[torrent_name] = torrentattr
2022-08-14 04:49:02 +08:00
4.1.4 (#553) * 4.1.4-develop1 * Fixes #545 * Fixes #546 * oops forgot to check if group_tag is enabled * (fix) blu unregistered torrent message (#547) InfoHash not found. * fix broken tags check * Fixes MinSeedTimeNotReached not being applied correctly #548 * Bump pre-commit from 3.7.0 to 3.7.1 (#549) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.7.0 to 3.7.1. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.7.0...v3.7.1) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 * minor debug comment update * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 for those that don't use recycle bin * Fixes cross-seed bug introduced in v6 with cross-seed-data * optimize remove_empty_dirs and remove empty folders in orphaned_data * Additional blutopia unregistered_torrent status, do not delete orphaned_data root folder if it's empty * Adds additional logging for cleaning up empty folders * 4.1.4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-18 22:39:24 +08:00
def add_torrent_files(self, torrent_hash, torrent_files, save_path):
2024-02-16 08:39:56 +08:00
"""Process torrent files by adding the hash to the appropriate torrent_files list.
Example structure:
torrent_files = {
"folder1/file1.txt": {"original": torrent_hash1, "cross_seed": ["torrent_hash2", "torrent_hash3"]},
"folder1/file2.txt": {"original": torrent_hash1, "cross_seed": ["torrent_hash2"]},
"folder2/file1.txt": {"original": torrent_hash2, "cross_seed": []},
}
"""
for file in torrent_files:
4.1.4 (#553) * 4.1.4-develop1 * Fixes #545 * Fixes #546 * oops forgot to check if group_tag is enabled * (fix) blu unregistered torrent message (#547) InfoHash not found. * fix broken tags check * Fixes MinSeedTimeNotReached not being applied correctly #548 * Bump pre-commit from 3.7.0 to 3.7.1 (#549) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.7.0 to 3.7.1. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.7.0...v3.7.1) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 * minor debug comment update * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 for those that don't use recycle bin * Fixes cross-seed bug introduced in v6 with cross-seed-data * optimize remove_empty_dirs and remove empty folders in orphaned_data * Additional blutopia unregistered_torrent status, do not delete orphaned_data root folder if it's empty * Adds additional logging for cleaning up empty folders * 4.1.4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-18 22:39:24 +08:00
full_path = os.path.join(save_path, file.name)
if full_path not in self.torrentfiles:
self.torrentfiles[full_path] = {"original": torrent_hash, "cross_seed": []}
2024-02-16 08:39:56 +08:00
else:
4.1.4 (#553) * 4.1.4-develop1 * Fixes #545 * Fixes #546 * oops forgot to check if group_tag is enabled * (fix) blu unregistered torrent message (#547) InfoHash not found. * fix broken tags check * Fixes MinSeedTimeNotReached not being applied correctly #548 * Bump pre-commit from 3.7.0 to 3.7.1 (#549) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.7.0 to 3.7.1. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.7.0...v3.7.1) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 * minor debug comment update * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 for those that don't use recycle bin * Fixes cross-seed bug introduced in v6 with cross-seed-data * optimize remove_empty_dirs and remove empty folders in orphaned_data * Additional blutopia unregistered_torrent status, do not delete orphaned_data root folder if it's empty * Adds additional logging for cleaning up empty folders * 4.1.4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-18 22:39:24 +08:00
self.torrentfiles[full_path]["cross_seed"].append(torrent_hash)
2024-02-16 08:39:56 +08:00
def is_cross_seed(self, torrent):
"""Check if the torrent is a cross seed if it has one or more files that are cross seeded."""
t_hash = torrent.hash
t_name = torrent.name
if torrent.downloaded != 0:
logger.trace(f"Torrent: {t_name} [Hash: {t_hash}] is not a cross seeded torrent. Download is > 0.")
return False
cross_seed = True
for file in torrent.files:
4.1.4 (#553) * 4.1.4-develop1 * Fixes #545 * Fixes #546 * oops forgot to check if group_tag is enabled * (fix) blu unregistered torrent message (#547) InfoHash not found. * fix broken tags check * Fixes MinSeedTimeNotReached not being applied correctly #548 * Bump pre-commit from 3.7.0 to 3.7.1 (#549) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.7.0 to 3.7.1. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.7.0...v3.7.1) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 * minor debug comment update * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 for those that don't use recycle bin * Fixes cross-seed bug introduced in v6 with cross-seed-data * optimize remove_empty_dirs and remove empty folders in orphaned_data * Additional blutopia unregistered_torrent status, do not delete orphaned_data root folder if it's empty * Adds additional logging for cleaning up empty folders * 4.1.4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-18 22:39:24 +08:00
full_path = os.path.join(torrent.save_path, file.name)
if self.torrentfiles[full_path]["original"] == t_hash or t_hash not in self.torrentfiles[full_path]["cross_seed"]:
logger.trace(f"File: [{full_path}] is found in Torrent: {t_name} [Hash: {t_hash}] as the original torrent")
2024-02-16 08:39:56 +08:00
cross_seed = False
break
4.1.4 (#553) * 4.1.4-develop1 * Fixes #545 * Fixes #546 * oops forgot to check if group_tag is enabled * (fix) blu unregistered torrent message (#547) InfoHash not found. * fix broken tags check * Fixes MinSeedTimeNotReached not being applied correctly #548 * Bump pre-commit from 3.7.0 to 3.7.1 (#549) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.7.0 to 3.7.1. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.7.0...v3.7.1) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 * minor debug comment update * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 for those that don't use recycle bin * Fixes cross-seed bug introduced in v6 with cross-seed-data * optimize remove_empty_dirs and remove empty folders in orphaned_data * Additional blutopia unregistered_torrent status, do not delete orphaned_data root folder if it's empty * Adds additional logging for cleaning up empty folders * 4.1.4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-18 22:39:24 +08:00
elif self.torrentfiles[full_path]["original"] is None:
2024-02-16 08:39:56 +08:00
cross_seed = False
break
logger.trace(f"Torrent: {t_name} [Hash: {t_hash}] {'is' if cross_seed else 'is not'} a cross seed torrent.")
return cross_seed
def has_cross_seed(self, torrent):
"""Check if the torrent has a cross seed"""
cross_seed = False
t_hash = torrent.hash
t_name = torrent.name
for file in torrent.files:
4.1.4 (#553) * 4.1.4-develop1 * Fixes #545 * Fixes #546 * oops forgot to check if group_tag is enabled * (fix) blu unregistered torrent message (#547) InfoHash not found. * fix broken tags check * Fixes MinSeedTimeNotReached not being applied correctly #548 * Bump pre-commit from 3.7.0 to 3.7.1 (#549) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.7.0 to 3.7.1. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.7.0...v3.7.1) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 * minor debug comment update * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 for those that don't use recycle bin * Fixes cross-seed bug introduced in v6 with cross-seed-data * optimize remove_empty_dirs and remove empty folders in orphaned_data * Additional blutopia unregistered_torrent status, do not delete orphaned_data root folder if it's empty * Adds additional logging for cleaning up empty folders * 4.1.4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-18 22:39:24 +08:00
full_path = os.path.join(torrent.save_path, file.name)
if len(self.torrentfiles[full_path]["cross_seed"]) > 0:
logger.trace(f"{full_path} has cross seeds: {self.torrentfiles[full_path]['cross_seed']}")
2024-02-16 08:39:56 +08:00
cross_seed = True
break
logger.trace(f"Torrent: {t_name} [Hash: {t_hash}] {'has' if cross_seed else 'has no'} cross seeds.")
return cross_seed
def remove_torrent_files(self, torrent):
"""Update the torrent_files list after a torrent is deleted"""
torrent_hash = torrent.hash
for file in torrent.files:
4.1.4 (#553) * 4.1.4-develop1 * Fixes #545 * Fixes #546 * oops forgot to check if group_tag is enabled * (fix) blu unregistered torrent message (#547) InfoHash not found. * fix broken tags check * Fixes MinSeedTimeNotReached not being applied correctly #548 * Bump pre-commit from 3.7.0 to 3.7.1 (#549) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.7.0 to 3.7.1. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.7.0...v3.7.1) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 * minor debug comment update * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 for those that don't use recycle bin * Fixes cross-seed bug introduced in v6 with cross-seed-data * optimize remove_empty_dirs and remove empty folders in orphaned_data * Additional blutopia unregistered_torrent status, do not delete orphaned_data root folder if it's empty * Adds additional logging for cleaning up empty folders * 4.1.4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-18 22:39:24 +08:00
full_path = os.path.join(torrent.save_path, file.name)
if self.torrentfiles[full_path]["original"] == torrent_hash:
if len(self.torrentfiles[full_path]["cross_seed"]) > 0:
self.torrentfiles[full_path]["original"] = self.torrentfiles[full_path]["cross_seed"].pop(0)
logger.trace(f"Updated {full_path} original to {self.torrentfiles[full_path]['original']}")
2024-02-16 08:39:56 +08:00
else:
4.1.4 (#553) * 4.1.4-develop1 * Fixes #545 * Fixes #546 * oops forgot to check if group_tag is enabled * (fix) blu unregistered torrent message (#547) InfoHash not found. * fix broken tags check * Fixes MinSeedTimeNotReached not being applied correctly #548 * Bump pre-commit from 3.7.0 to 3.7.1 (#549) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.7.0 to 3.7.1. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.7.0...v3.7.1) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 * minor debug comment update * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 for those that don't use recycle bin * Fixes cross-seed bug introduced in v6 with cross-seed-data * optimize remove_empty_dirs and remove empty folders in orphaned_data * Additional blutopia unregistered_torrent status, do not delete orphaned_data root folder if it's empty * Adds additional logging for cleaning up empty folders * 4.1.4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-18 22:39:24 +08:00
self.torrentfiles[full_path]["original"] = None
2024-02-16 08:39:56 +08:00
else:
4.1.4 (#553) * 4.1.4-develop1 * Fixes #545 * Fixes #546 * oops forgot to check if group_tag is enabled * (fix) blu unregistered torrent message (#547) InfoHash not found. * fix broken tags check * Fixes MinSeedTimeNotReached not being applied correctly #548 * Bump pre-commit from 3.7.0 to 3.7.1 (#549) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.7.0 to 3.7.1. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.7.0...v3.7.1) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 * minor debug comment update * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 for those that don't use recycle bin * Fixes cross-seed bug introduced in v6 with cross-seed-data * optimize remove_empty_dirs and remove empty folders in orphaned_data * Additional blutopia unregistered_torrent status, do not delete orphaned_data root folder if it's empty * Adds additional logging for cleaning up empty folders * 4.1.4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-18 22:39:24 +08:00
if torrent_hash in self.torrentfiles[full_path]["cross_seed"]:
self.torrentfiles[full_path]["cross_seed"].remove(torrent_hash)
logger.trace(f"Removed {torrent_hash} from {full_path} cross seeds")
logger.trace(f"{full_path} original: {self.torrentfiles[full_path]['original']}")
logger.trace(f"{full_path} cross seeds: {self.torrentfiles[full_path]['cross_seed']}")
2024-02-16 08:39:56 +08:00
2023-04-10 23:52:51 +08:00
def get_torrents(self, params):
"""Get torrents from qBittorrent"""
return self.client.torrents.info(**params)
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-06 02:07:36 +08:00
def get_tracker_urls(self, trackers):
"""Get tracker urls from torrent"""
return tuple(x.url for x in trackers if x.url.startswith(("http", "udp", "ws")))
def get_tags(self, urls):
2023-04-10 23:52:51 +08:00
"""Get tags from config file based on keyword"""
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-06 02:07:36 +08:00
urls = list(urls)
2023-04-10 23:52:51 +08:00
tracker = {}
tracker["tag"] = None
v4.0.5 (#418) * Fixes #388 * Bump docker/setup-buildx-action from 2 to 3 Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2 to 3. - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](https://github.com/docker/setup-buildx-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/setup-buildx-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump docker/login-action from 2 to 3 Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3. - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/login-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump docker/build-push-action from 4 to 5 Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4 to 5. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v4...v5) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump gitpython from 3.1.35 to 3.1.36 Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.35 to 3.1.36. - [Release notes](https://github.com/gitpython-developers/GitPython/releases) - [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES) - [Commits](https://github.com/gitpython-developers/GitPython/compare/3.1.35...3.1.36) --- updated-dependencies: - dependency-name: gitpython dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/asottile/reorder-python-imports: v3.10.0 → v3.11.0](https://github.com/asottile/reorder-python-imports/compare/v3.10.0...v3.11.0) - [github.com/asottile/pyupgrade: v3.10.1 → v3.11.0](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.11.0) - [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1) * Error handling when BHD API doesn't respond * add BHD specific announce related issues * handle JSONDecodeError * Special mapping to leave torrents uncategorized on cat-update (#398) Special mapping to leave torrents uncategorized on cat-update (closes #395) * Bump gitpython from 3.1.36 to 3.1.37 Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.36 to 3.1.37. - [Release notes](https://github.com/gitpython-developers/GitPython/releases) - [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES) - [Commits](https://github.com/gitpython-developers/GitPython/compare/3.1.36...3.1.37) --- updated-dependencies: - dependency-name: gitpython dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump ruamel-yaml from 0.17.32 to 0.17.33 Bumps [ruamel-yaml](https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree) from 0.17.32 to 0.17.33. --- updated-dependencies: - dependency-name: ruamel-yaml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * last_active flag for share_limits (#397) Added a last_active flag for share_limits to resume torrents and avoid cleanup if there was activity in the last X minutes. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#405) updates: - [github.com/asottile/reorder-python-imports: v3.10.0 → v3.11.0](https://github.com/asottile/reorder-python-imports/compare/v3.10.0...v3.11.0) - [github.com/asottile/pyupgrade: v3.10.1 → v3.13.0](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.13.0) - [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * Bump schedule from 1.2.0 to 1.2.1 Bumps [schedule](https://github.com/dbader/schedule) from 1.2.0 to 1.2.1. - [Changelog](https://github.com/dbader/schedule/blob/master/HISTORY.rst) - [Commits](https://github.com/dbader/schedule/compare/1.2.0...1.2.1) --- updated-dependencies: - dependency-name: schedule dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump ruamel-yaml from 0.17.33 to 0.17.34 Bumps [ruamel-yaml](https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree) from 0.17.33 to 0.17.34. --- updated-dependencies: - dependency-name: ruamel-yaml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * fix exit codes when program fails (#411) Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * Bump ruamel-yaml from 0.17.34 to 0.17.35 Bumps [ruamel-yaml](https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree) from 0.17.34 to 0.17.35. --- updated-dependencies: - dependency-name: ruamel-yaml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * [pre-commit.ci] pre-commit autoupdate (#409) updates: - [github.com/asottile/reorder-python-imports: v3.10.0 → v3.12.0](https://github.com/asottile/reorder-python-imports/compare/v3.10.0...v3.12.0) - [github.com/asottile/pyupgrade: v3.10.1 → v3.14.0](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.14.0) - [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * New option cat in trackers (#400) * New option cat in trackers * [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> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * update config.sample for #200 * add additional script to edit trackers * clarify remote_dir usage (#417) * Bump gitpython from 3.1.35 to 3.1.37 (#414) Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.35 to 3.1.37. - [Release notes](https://github.com/gitpython-developers/GitPython/releases) - [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES) - [Commits](https://github.com/gitpython-developers/GitPython/compare/3.1.35...3.1.37) --- updated-dependencies: - dependency-name: gitpython dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#413) updates: - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.5.0) - [github.com/asottile/reorder-python-imports: v3.10.0 → v3.12.0](https://github.com/asottile/reorder-python-imports/compare/v3.10.0...v3.12.0) - [github.com/asottile/pyupgrade: v3.10.1 → v3.15.0](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.15.0) - [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * 4.0.5 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Esteban Thilliez <77675611+estebanthi@users.noreply.github.com> Co-authored-by: Fabricio Silva <hi@fabricio.dev> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com>
2023-10-14 23:08:33 +08:00
tracker["cat"] = None
2023-04-10 23:52:51 +08:00
tracker["notifiarr"] = None
tracker["url"] = None
tracker_other_tag = self.config.util.check_for_attribute(
self.config.data, "tag", parent="tracker", subparent="other", default_is_none=True, var_type="list", save=False
)
try:
tracker["url"] = util.trunc_val(urls[0], os.sep)
except IndexError as e:
tracker["url"] = None
if not urls:
urls = []
if not tracker_other_tag:
tracker_other_tag = ["other"]
tracker["url"] = "No http URL found"
else:
logger.debug(f"Tracker Url:{urls}")
logger.debug(e)
if "tracker" in self.config.data and self.config.data["tracker"] is not None:
tag_values = self.config.data["tracker"]
for tag_url, tag_details in tag_values.items():
for url in urls:
if tag_url in url:
if tracker["url"] is None:
default_tag = tracker_other_tag
else:
try:
tracker["url"] = util.trunc_val(url, os.sep)
default_tag = tracker["url"].split(os.sep)[2].split(":")[0]
except IndexError as e:
logger.debug(f"Tracker Url:{url}")
logger.debug(e)
2023-04-23 03:57:56 +08:00
tracker["tag"] = self.config.util.check_for_attribute(
self.config.data, "tag", parent="tracker", subparent=tag_url, default=tag_url, var_type="list"
)
v4.0.5 (#418) * Fixes #388 * Bump docker/setup-buildx-action from 2 to 3 Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2 to 3. - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](https://github.com/docker/setup-buildx-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/setup-buildx-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump docker/login-action from 2 to 3 Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3. - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/login-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump docker/build-push-action from 4 to 5 Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4 to 5. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v4...v5) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump gitpython from 3.1.35 to 3.1.36 Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.35 to 3.1.36. - [Release notes](https://github.com/gitpython-developers/GitPython/releases) - [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES) - [Commits](https://github.com/gitpython-developers/GitPython/compare/3.1.35...3.1.36) --- updated-dependencies: - dependency-name: gitpython dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/asottile/reorder-python-imports: v3.10.0 → v3.11.0](https://github.com/asottile/reorder-python-imports/compare/v3.10.0...v3.11.0) - [github.com/asottile/pyupgrade: v3.10.1 → v3.11.0](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.11.0) - [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1) * Error handling when BHD API doesn't respond * add BHD specific announce related issues * handle JSONDecodeError * Special mapping to leave torrents uncategorized on cat-update (#398) Special mapping to leave torrents uncategorized on cat-update (closes #395) * Bump gitpython from 3.1.36 to 3.1.37 Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.36 to 3.1.37. - [Release notes](https://github.com/gitpython-developers/GitPython/releases) - [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES) - [Commits](https://github.com/gitpython-developers/GitPython/compare/3.1.36...3.1.37) --- updated-dependencies: - dependency-name: gitpython dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump ruamel-yaml from 0.17.32 to 0.17.33 Bumps [ruamel-yaml](https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree) from 0.17.32 to 0.17.33. --- updated-dependencies: - dependency-name: ruamel-yaml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * last_active flag for share_limits (#397) Added a last_active flag for share_limits to resume torrents and avoid cleanup if there was activity in the last X minutes. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#405) updates: - [github.com/asottile/reorder-python-imports: v3.10.0 → v3.11.0](https://github.com/asottile/reorder-python-imports/compare/v3.10.0...v3.11.0) - [github.com/asottile/pyupgrade: v3.10.1 → v3.13.0](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.13.0) - [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * Bump schedule from 1.2.0 to 1.2.1 Bumps [schedule](https://github.com/dbader/schedule) from 1.2.0 to 1.2.1. - [Changelog](https://github.com/dbader/schedule/blob/master/HISTORY.rst) - [Commits](https://github.com/dbader/schedule/compare/1.2.0...1.2.1) --- updated-dependencies: - dependency-name: schedule dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump ruamel-yaml from 0.17.33 to 0.17.34 Bumps [ruamel-yaml](https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree) from 0.17.33 to 0.17.34. --- updated-dependencies: - dependency-name: ruamel-yaml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * fix exit codes when program fails (#411) Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * Bump ruamel-yaml from 0.17.34 to 0.17.35 Bumps [ruamel-yaml](https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree) from 0.17.34 to 0.17.35. --- updated-dependencies: - dependency-name: ruamel-yaml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * [pre-commit.ci] pre-commit autoupdate (#409) updates: - [github.com/asottile/reorder-python-imports: v3.10.0 → v3.12.0](https://github.com/asottile/reorder-python-imports/compare/v3.10.0...v3.12.0) - [github.com/asottile/pyupgrade: v3.10.1 → v3.14.0](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.14.0) - [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * New option cat in trackers (#400) * New option cat in trackers * [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> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * update config.sample for #200 * add additional script to edit trackers * clarify remote_dir usage (#417) * Bump gitpython from 3.1.35 to 3.1.37 (#414) Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.35 to 3.1.37. - [Release notes](https://github.com/gitpython-developers/GitPython/releases) - [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES) - [Commits](https://github.com/gitpython-developers/GitPython/compare/3.1.35...3.1.37) --- updated-dependencies: - dependency-name: gitpython dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#413) updates: - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.5.0) - [github.com/asottile/reorder-python-imports: v3.10.0 → v3.12.0](https://github.com/asottile/reorder-python-imports/compare/v3.10.0...v3.12.0) - [github.com/asottile/pyupgrade: v3.10.1 → v3.15.0](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.15.0) - [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * 4.0.5 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Esteban Thilliez <77675611+estebanthi@users.noreply.github.com> Co-authored-by: Fabricio Silva <hi@fabricio.dev> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com>
2023-10-14 23:08:33 +08:00
tracker["cat"] = self.config.util.check_for_attribute(
self.config.data,
"cat",
parent="tracker",
subparent=tag_url,
default_is_none=True,
var_type="str",
save=False,
do_print=False,
)
2023-04-23 03:57:56 +08:00
if tracker["tag"] == [tag_url]:
self.config.data["tracker"][tag_url]["tag"] = [tag_url]
if isinstance(tracker["tag"], str):
tracker["tag"] = [tracker["tag"]]
tracker["notifiarr"] = self.config.util.check_for_attribute(
self.config.data,
"notifiarr",
parent="tracker",
subparent=tag_url,
default_is_none=True,
do_print=False,
save=False,
)
2023-04-10 23:52:51 +08:00
return tracker
if tracker_other_tag:
tracker["tag"] = tracker_other_tag
tracker["notifiarr"] = self.config.util.check_for_attribute(
self.config.data,
"notifiarr",
parent="tracker",
subparent="other",
default_is_none=True,
do_print=False,
save=False,
)
return tracker
if tracker["url"]:
logger.trace(f"tracker url: {tracker['url']}")
if tracker_other_tag:
default_tag = tracker_other_tag
else:
default_tag = tracker["url"].split(os.sep)[2].split(":")[0]
tracker["tag"] = self.config.util.check_for_attribute(
self.config.data, "tag", parent="tracker", subparent=default_tag, default=default_tag, var_type="list"
)
if isinstance(tracker["tag"], str):
tracker["tag"] = [tracker["tag"]]
try:
self.config.data["tracker"][default_tag]["tag"] = [default_tag]
except Exception:
self.config.data["tracker"][default_tag] = {"tag": [default_tag]}
e = f'No tags matched for {tracker["url"]}. Please check your config.yml file. Setting tag to {default_tag}'
self.config.notify(e, "Tag", False)
logger.warning(e)
return tracker
def get_category(self, path):
"""Get category from config file based on path provided"""
category = []
2023-04-10 23:52:51 +08:00
path = os.path.join(path, "")
if "cat" in self.config.data and self.config.data["cat"] is not None:
cat_path = self.config.data["cat"]
for cat, save_path in cat_path.items():
if os.path.join(save_path, "") == path:
category.append(cat)
2023-04-10 23:52:51 +08:00
if not category:
default_cat = path.split(os.sep)[-2]
category = [default_cat]
2023-04-10 23:52:51 +08:00
self.config.util.check_for_attribute(self.config.data, default_cat, parent="cat", default=path)
self.config.data["cat"][str(default_cat)] = path
e = f"No categories matched for the save path {path}. Check your config.yml file. - Setting category to {default_cat}"
self.config.notify(e, "Category", False)
logger.warning(e)
return category
4.1.0 (#520) * Sample solution. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update modules/config.py Increase efficiency by using a boolean in place of a functional check. Co-authored-by: bobokun <12660469+bobokun@users.noreply.github.com> * Bump softprops/action-gh-release from 1 to 2 Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * update group_uplolad_speed logic * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Bump dependabot/fetch-metadata from 1.6.0 to 2.0.0 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.6.0 to 2.0.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.6.0...v2.0.0) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump pre-commit from 3.6.2 to 3.7.0 Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.6.2 to 3.7.0. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.6.2...v3.7.0) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/hhatto/autopep8: v2.0.4 → v2.1.0](https://github.com/hhatto/autopep8/compare/v2.0.4...v2.1.0) - [github.com/asottile/pyupgrade: v3.15.1 → v3.15.2](https://github.com/asottile/pyupgrade/compare/v3.15.1...v3.15.2) - [github.com/psf/black: 24.2.0 → 24.3.0](https://github.com/psf/black/compare/24.2.0...24.3.0) * Bump qbittorrent-api from 2024.2.59 to 2024.3.60 Bumps [qbittorrent-api](https://github.com/rmartin16/qbittorrent-api) from 2024.2.59 to 2024.3.60. - [Release notes](https://github.com/rmartin16/qbittorrent-api/releases) - [Changelog](https://github.com/rmartin16/qbittorrent-api/blob/main/CHANGELOG.md) - [Commits](https://github.com/rmartin16/qbittorrent-api/compare/v2024.2.59...v2024.3.60) --- updated-dependencies: - dependency-name: qbittorrent-api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Bump 4.0.10 * Revert "Add Aggregate Group Speed Capabilities" * Bump gitpython from 3.1.42 to 3.1.43 Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.42 to 3.1.43. - [Release notes](https://github.com/gitpython-developers/GitPython/releases) - [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES) - [Commits](https://github.com/gitpython-developers/GitPython/compare/3.1.42...3.1.43) --- updated-dependencies: - dependency-name: gitpython dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Add new args for mover.old * Revert "Revert "Add Aggregate Group Speed Capabilities"" This reverts commit f112b2c92e41f3a80090fb3ac5b889902b042367. Fixes bug in original commit code * Remove username and password from debug logs sinced they are redacted anyways * adds support for #513 * Fixes #501 * Fixes bug not logging torrents being deleted after meeting share_limits * Adds additional error checking for invalid share_limits in config * fixes bug in torrents not untagging min_seeding_time_tag * Fixes bug in #494 * Bi-directional Wiki Sync Action * Bump actions/checkout from 2 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bug fix on share limits being applied every run * Revert "Revert "Revert "Add Aggregate Group Speed Capabilities""" This reverts commit 41d5170ba649f47fe4ff8fd59a087453bd524089. * Fixes #494 with new enable_group_upload_speed flag * Fixes bug found in #494 * 4.1.0 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Paul Walker <walkerp1@yahoo.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com>
2024-04-06 08:39:00 +08:00
def get_category_save_paths(self):
"""Get all categories from qbitorrenta and return a list of save_paths"""
save_paths = set()
categories = self.client.torrent_categories.categories
for cat in categories:
save_path = categories[cat].savePath.replace(self.config.root_dir, self.config.remote_dir)
if save_path:
save_paths.add(save_path)
return list(save_paths)
def tor_delete_recycle(self, torrent, info):
"""Move torrent to recycle bin"""
2024-02-18 23:31:34 +08:00
try:
self.remove_torrent_files(torrent)
except ValueError:
logger.debug(f"Torrent {torrent.name} has already been removed from torrent files.")
4.1.4 (#553) * 4.1.4-develop1 * Fixes #545 * Fixes #546 * oops forgot to check if group_tag is enabled * (fix) blu unregistered torrent message (#547) InfoHash not found. * fix broken tags check * Fixes MinSeedTimeNotReached not being applied correctly #548 * Bump pre-commit from 3.7.0 to 3.7.1 (#549) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.7.0 to 3.7.1. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.7.0...v3.7.1) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 * minor debug comment update * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 for those that don't use recycle bin * Fixes cross-seed bug introduced in v6 with cross-seed-data * optimize remove_empty_dirs and remove empty folders in orphaned_data * Additional blutopia unregistered_torrent status, do not delete orphaned_data root folder if it's empty * Adds additional logging for cleaning up empty folders * 4.1.4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-18 22:39:24 +08:00
tor_files = []
try:
info_hash = torrent.hash
save_path = torrent.save_path.replace(self.config.root_dir, self.config.remote_dir)
# Define torrent files/folders
for file in torrent.files:
tor_files.append(os.path.join(save_path, file.name))
except NotFound404Error:
return
4.1.4 (#553) * 4.1.4-develop1 * Fixes #545 * Fixes #546 * oops forgot to check if group_tag is enabled * (fix) blu unregistered torrent message (#547) InfoHash not found. * fix broken tags check * Fixes MinSeedTimeNotReached not being applied correctly #548 * Bump pre-commit from 3.7.0 to 3.7.1 (#549) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.7.0 to 3.7.1. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.7.0...v3.7.1) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 * minor debug comment update * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 for those that don't use recycle bin * Fixes cross-seed bug introduced in v6 with cross-seed-data * optimize remove_empty_dirs and remove empty folders in orphaned_data * Additional blutopia unregistered_torrent status, do not delete orphaned_data root folder if it's empty * Adds additional logging for cleaning up empty folders * 4.1.4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-18 22:39:24 +08:00
if self.config.recyclebin["enabled"]:
2022-10-29 23:19:09 +08:00
if self.config.recyclebin["split_by_category"]:
recycle_path = os.path.join(save_path, os.path.basename(self.config.recycle_dir.rstrip(os.sep)))
else:
recycle_path = self.config.recycle_dir
2021-12-29 01:19:58 +08:00
# Create recycle bin if not exists
torrent_path = os.path.join(recycle_path, "torrents")
torrents_json_path = os.path.join(recycle_path, "torrents_json")
2023-06-04 19:44:17 +08:00
torrent_name = info["torrents"][0]
os.makedirs(recycle_path, exist_ok=True)
2022-10-29 23:19:09 +08:00
if self.config.recyclebin["save_torrents"]:
if os.path.isdir(torrent_path) is False:
os.makedirs(torrent_path)
if os.path.isdir(torrents_json_path) is False:
os.makedirs(torrents_json_path)
2023-06-04 19:44:17 +08:00
torrent_json_file = os.path.join(torrents_json_path, f"{torrent_name}.json")
torrent_json = util.load_json(torrent_json_file)
if not torrent_json:
2023-04-01 01:26:16 +08:00
logger.info(f"Saving Torrent JSON file to {torrent_json_file}")
2023-06-04 19:44:17 +08:00
torrent_json["torrent_name"] = torrent_name
torrent_json["category"] = info["torrent_category"]
2022-01-01 23:59:15 +08:00
else:
2023-04-01 01:26:16 +08:00
logger.info(f"Adding {info['torrent_tracker']} to existing {os.path.basename(torrent_json_file)}")
dot_torrent_files = []
for file in os.listdir(self.config.torrents_dir):
if file.startswith(info_hash):
dot_torrent_files.append(file)
try:
util.copy_files(os.path.join(self.config.torrents_dir, file), os.path.join(torrent_path, file))
except Exception as ex:
logger.stacktrace()
self.config.notify(ex, "Deleting Torrent", False)
2023-04-01 01:35:38 +08:00
logger.warning(f"RecycleBin Warning: {ex}")
if "tracker_torrent_files" in torrent_json:
tracker_torrent_files = torrent_json["tracker_torrent_files"]
else:
tracker_torrent_files = {}
tracker_torrent_files[info["torrent_tracker"]] = dot_torrent_files
2022-01-01 23:59:15 +08:00
if dot_torrent_files:
backup_str = "Backing up "
2022-01-01 23:59:15 +08:00
for idx, val in enumerate(dot_torrent_files):
2022-10-29 23:19:09 +08:00
if idx == 0:
backup_str += val
else:
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-06 02:07:36 +08:00
backup_str += f" and {val.replace(info_hash, '')}"
2022-01-01 23:59:15 +08:00
backup_str += f" to {torrent_path}"
logger.info(backup_str)
torrent_json["tracker_torrent_files"] = tracker_torrent_files
if "files" not in torrent_json:
files_cleaned = [f.replace(self.config.remote_dir, "") for f in tor_files]
torrent_json["files"] = files_cleaned
if "deleted_contents" not in torrent_json:
torrent_json["deleted_contents"] = info["torrents_deleted_and_contents"]
else:
2022-10-29 23:19:09 +08:00
if torrent_json["deleted_contents"] is False and info["torrents_deleted_and_contents"] is True:
torrent_json["deleted_contents"] = info["torrents_deleted_and_contents"]
2022-01-01 23:59:15 +08:00
logger.debug("")
2023-04-01 01:26:16 +08:00
logger.debug(f"JSON: {torrent_json}")
util.save_json(torrent_json, torrent_json_file)
2022-10-29 23:19:09 +08:00
if info["torrents_deleted_and_contents"] is True:
logger.separator(f"Moving {len(tor_files)} files to RecycleBin", space=False, border=False, loglevel="DEBUG")
if len(tor_files) == 1:
logger.print_line(tor_files[0], "DEBUG")
else:
logger.print_line("\n".join(tor_files), "DEBUG")
logger.debug(
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-06 02:07:36 +08:00
f"Moved {len(tor_files)} files to {recycle_path.replace(self.config.remote_dir, self.config.root_dir)}"
2022-10-29 23:19:09 +08:00
)
# Move files from torrent contents to Recycle bin
for file in tor_files:
src = file
dest = os.path.join(recycle_path, file.replace(self.config.remote_dir, ""))
# Move files and change date modified
try:
to_delete = util.move_files(src, dest, True)
except FileNotFoundError:
ex = logger.print_line(f"RecycleBin Warning - FileNotFound: No such file or directory: {src} ", "WARNING")
self.config.notify(ex, "Deleting Torrent", False)
4.1.4 (#553) * 4.1.4-develop1 * Fixes #545 * Fixes #546 * oops forgot to check if group_tag is enabled * (fix) blu unregistered torrent message (#547) InfoHash not found. * fix broken tags check * Fixes MinSeedTimeNotReached not being applied correctly #548 * Bump pre-commit from 3.7.0 to 3.7.1 (#549) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.7.0 to 3.7.1. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.7.0...v3.7.1) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 * minor debug comment update * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 for those that don't use recycle bin * Fixes cross-seed bug introduced in v6 with cross-seed-data * optimize remove_empty_dirs and remove empty folders in orphaned_data * Additional blutopia unregistered_torrent status, do not delete orphaned_data root folder if it's empty * Adds additional logging for cleaning up empty folders * 4.1.4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-18 22:39:24 +08:00
# Add src file to orphan exclusion since sometimes deleting files are slow in certain environments
exclude_file = src.replace(self.config.remote_dir, self.config.root_dir)
if exclude_file not in self.config.orphaned["exclude_patterns"]:
self.config.orphaned["exclude_patterns"].append(exclude_file)
# Delete torrent and files
torrent.delete(delete_files=to_delete)
# Remove any empty directories
4.1.4 (#553) * 4.1.4-develop1 * Fixes #545 * Fixes #546 * oops forgot to check if group_tag is enabled * (fix) blu unregistered torrent message (#547) InfoHash not found. * fix broken tags check * Fixes MinSeedTimeNotReached not being applied correctly #548 * Bump pre-commit from 3.7.0 to 3.7.1 (#549) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.7.0 to 3.7.1. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.7.0...v3.7.1) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 * minor debug comment update * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 for those that don't use recycle bin * Fixes cross-seed bug introduced in v6 with cross-seed-data * optimize remove_empty_dirs and remove empty folders in orphaned_data * Additional blutopia unregistered_torrent status, do not delete orphaned_data root folder if it's empty * Adds additional logging for cleaning up empty folders * 4.1.4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-18 22:39:24 +08:00
util.remove_empty_directories(save_path, self.get_category_save_paths())
else:
torrent.delete(delete_files=False)
else:
2022-10-29 23:19:09 +08:00
if info["torrents_deleted_and_contents"] is True:
4.1.4 (#553) * 4.1.4-develop1 * Fixes #545 * Fixes #546 * oops forgot to check if group_tag is enabled * (fix) blu unregistered torrent message (#547) InfoHash not found. * fix broken tags check * Fixes MinSeedTimeNotReached not being applied correctly #548 * Bump pre-commit from 3.7.0 to 3.7.1 (#549) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.7.0 to 3.7.1. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.7.0...v3.7.1) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 * minor debug comment update * Fixes exclude directory of recently deleted torrents from rem_orphaned #550 for those that don't use recycle bin * Fixes cross-seed bug introduced in v6 with cross-seed-data * optimize remove_empty_dirs and remove empty folders in orphaned_data * Additional blutopia unregistered_torrent status, do not delete orphaned_data root folder if it's empty * Adds additional logging for cleaning up empty folders * 4.1.4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-18 22:39:24 +08:00
for file in tor_files:
# Add src file to orphan exclusion since sometimes deleting files are slow in certain environments
exclude_file = file.replace(self.config.remote_dir, self.config.root_dir)
if exclude_file not in self.config.orphaned["exclude_patterns"]:
self.config.orphaned["exclude_patterns"].append(exclude_file)
torrent.delete(delete_files=True)
else:
torrent.delete(delete_files=False)
2023-04-10 03:37:23 +08:00
try:
if torrent in self.torrent_list:
self.torrent_list.remove(torrent)
except ValueError:
logger.debug(f"Torrent {torrent.name} has already been deleted from torrent list.")