Skip to content

Commit

Permalink
Merge pull request #152 from StuffAnThings/develop
Browse files Browse the repository at this point in the history
3.2.5
  • Loading branch information
bobokun authored Aug 26, 2022
2 parents f35ad59 + 6215316 commit 86e8272
Show file tree
Hide file tree
Showing 14 changed files with 716 additions and 457 deletions.
7 changes: 4 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ ignore =
E701, # E701 Multiple statements on one line (colon)
E241, # E241 Multiple spaces after ','
E272, # E272 Multiple spaces before keyword
C901 # C901 Function is too complex
E722 # E722 Do not use bare except, specify exception instead
W503 # W503 Line break occurred before a binary operator
C901, # C901 Function is too complex
E722, # E722 Do not use bare except, specify exception instead
W503, # W503 Line break occurred before a binary operator
E402, # E402 module level import not at top of file
max-line-length = 200
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.4
3.2.5
59 changes: 41 additions & 18 deletions config/config.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,21 @@
# Please refer to the link below for more details on how to set up the configuration file
# https://github.com/StuffAnThings/qbit_manage/wiki/Config-Setup

# qBittorrent parameters
commands:
# The commands defined below will IGNORE any commands used in command line and docker env variables.
dry_run: True
cross_seed: False
recheck: False
cat_update: False
tag_update: False
rem_unregistered: False
tag_tracker_error: False
rem_orphaned: False
tag_nohardlinks: False
skip_recycle: False

qbt:
# qBittorrent parameters
host: "localhost:8080"
user: "username"
pass: "password"
Expand All @@ -31,14 +44,24 @@ directory:
recycle_bin: "/mnt/user/data/torrents/.RecycleBin"
torrents_dir: "/qbittorrent/data/BT_backup"

# Category & Path Parameters
cat:
# Category & Path Parameters
# <Category Name> : <save_path> # Path of your save directory.
movies: "/data/torrents/Movies"
tv: "/data/torrents/TV"

# Tag Parameters
cat_change:
# This moves all the torrents from one category to another category. This executes on --cat-update
# WARNING: if the paths are different and Default Torrent Management Mode is set to automatic the files could be moved !!!
# <Old Category Name> : <New Category>
Radarr-HD.cross-seed: movies-hd
Radarr-UHD.cross-seed: movies-uhd
movies-hd.cross-seed: movies-hd
movies-uhd.cross-seed: movies-uhd


tracker:
# Tag Parameters
# <Tracker URL Keyword>: # <MANDATORY> This is the keyword in the tracker url
# <MANDATORY> Set tag name. Can be a list of tags or a single tag
# tag: <Tag Name>
Expand Down Expand Up @@ -103,8 +126,8 @@ tracker:
tv-vault:
tag: TV-Vault

# Tag Movies/Series that are not hard linked
nohardlinks:
# Tag Movies/Series that are not hard linked
# Mandatory to fill out directory parameter above to use this function (root_dir/remote_dir)
# This variable should be set to your category name of your completed movies/completed series in qbit. Acceptable variable can be any category you would like to tag if there are no hardlinks found
movies-completed:
Expand Down Expand Up @@ -141,9 +164,9 @@ nohardlinks:
# <OPTIONAL> min seeding time var: Will ensure that torrent is not deleted by cleanup variable if torrent does not meet minimum seeding time (min).
min_seeding_time: 43200

# Recycle Bin method of deletion will move files into the recycle bin (Located in /root_dir/.RecycleBin) instead of directly deleting them in qbit
# By default the Recycle Bin will be emptied on every run of the qbit_manage script if empty_after_x_days is defined.
recyclebin:
# Recycle Bin method of deletion will move files into the recycle bin (Located in /root_dir/.RecycleBin) instead of directly deleting them in qbit
# By default the Recycle Bin will be emptied on every run of the qbit_manage script if empty_after_x_days is defined.
enabled: true
# <OPTIONAL> empty_after_x_days var:
# Will automatically remove all files and folders in recycle bin after x days. (Checks every script run)
Expand All @@ -159,8 +182,8 @@ recyclebin:
# and add the base folder name of the recycle bin that was defined in the `recycle_bin` sub-attribute under directory.
split_by_category: false

# Orphaned files are those in the root_dir download directory that are not referenced by any active torrents.
orphaned:
# Orphaned files are those in the root_dir download directory that are not referenced by any active torrents.
# File patterns that will not be considered orphaned files. Handy for generated files that aren't part of the torrent but belong with the torrent's files
exclude_patterns:
- "**/.DS_Store"
Expand All @@ -169,29 +192,29 @@ orphaned:
- "/data/torrents/temp/**"
- "**/*.!qB"

# Apprise integration with webhooks
# Leave Empty/Blank to disable
apprise:
# Apprise integration with webhooks
# Leave Empty/Blank to disable
# Mandatory to fill out the url of your apprise API endpoint
api_url: http://apprise-api:8000
# Mandatory to fill out the notification url/urls based on the notification services provided by apprise. https://github.com/caronc/apprise/wiki
notify_url:

# Notifiarr integration with webhooks
# Leave Empty/Blank to disable
notifiarr:
# Notifiarr integration with webhooks
# Leave Empty/Blank to disable
# Mandatory to fill out API Key
apikey: ####################################
# <OPTIONAL> Set to a unique value (could be your username on notifiarr for example)
instance:

# Webhook notifications:
# Possible values:
# Set value to notifiarr if using notifiarr integration
# Set value to apprise if using apprise integration
# Set value to a valid webhook URL
# Leave Empty/Blank to disable
webhooks:
# Webhook notifications:
# Possible values:
# Set value to notifiarr if using notifiarr integration
# Set value to apprise if using apprise integration
# Set value to a valid webhook URL
# Leave Empty/Blank to disable
error: https://mywebhookurl.com/qbt_manage
run_start: notifiarr
run_end: apprise
Expand All @@ -206,6 +229,6 @@ webhooks:
tag_nohardlinks: notifiarr
empty_recyclebin: notifiarr

# BHD Integration used for checking unregistered torrents
bhd:
# BHD Integration used for checking unregistered torrents
apikey:
5 changes: 3 additions & 2 deletions modules/apprise.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import logging
from modules import util
from modules.util import Failed
logger = logging.getLogger("qBit Manage")
logger = util.logger


class Apprise:
def __init__(self, config, params):
self.config = config
self.api_url = params["api_url"]
logger.secret(self.api_url)
self.notify_url = ",".join(params["notify_url"])
response = self.config.get(self.api_url)
if response.status_code != 200:
Expand Down
7 changes: 4 additions & 3 deletions modules/bhd.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import logging
from modules import util
from modules.util import Failed
from json import JSONDecodeError

logger = logging.getLogger("qBit Manage")
logger = util.logger
base_url = "https://beyond-hd.me/api/"


class BeyondHD:
def __init__(self, config, params):
self.config = config
self.apikey = params["apikey"]
logger.secret(self.apikey)
json = {"search": "test"}
self.search(json)

def search(self, json, path="torrents/"):
url = f"{base_url}{path}{self.apikey}"
json["action"] = "search"
if self.config.trace_mode:
logger.debug(url.replace(self.apikey, "APIKEY"))
logger.debug(url)
logger.debug(f"JSON: {json}")
try:
response = self.config.post(url, json=json)
Expand Down
Loading

0 comments on commit 86e8272

Please sign in to comment.