StuffAnThings / qbit_manage

This tool will help manage tedious tasks in qBittorrent and automate them. Tag, categorize, remove Orphaned data, remove unregistered torrents and much much more.
MIT License
729 stars 44 forks source link

[Bug]: Share_limit "Uncaught Exception" when using -2 for max_ratio and max_seeding_time #419

Closed Antorell closed 11 months ago

Antorell commented 11 months ago

Describe the Bug

qbit_manage crashes with an Uncaught Exception when I set max_ratioand max_seeding_time to -2

Installation is python on linux with venv

(venv) root@ubuntu:/opt/tools/qbit_manage

Config

# This is an example configuration file that documents all the options.
# It will need to be modified for your specific use case.
# 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

commands:

  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
  share_limits: true
  skip_qb_version_check: false
  skip_cleanup: false

qbt:

  host: 127.0.0.1:11000
  user: 
  pass: 

settings:
  force_auto_tmm: false # Will force qBittorrent to enable Automatic Torrent Management for each torrent.
  tracker_error_tag: issue # Will set the tag of any torrents that do not have a working tracker.
  nohardlinks_tag: noHL # Will set the tag of any torrents with no hardlinks.
  share_limits_tag: ~share_limit # Will add this tag when applying share limits to provide an easy way to filter torrents by share limit group/priority for each torrent
  ignoreTags_OnUpdate: # When running tag-update function, it will update torrent tags for a given torrent even if the torrent has at least one or more of the tags defined here. Otherwise torrents will not be tagged if tags exist.
  - noHL
  - issue
  - cross-seed

directory:

  cross_seed: ''
  root_dir: /home/torrent/Downloads/
  remote_dir: ''
  recycle_bin: /home/torrent/.RecycleBin
  torrents_dir: /home/torrent/.local/share/qBittorrent/BT_backup
  orphaned_dir: /home/torrent/orphaned_data

cat:

  RSS: /home/torrent/Downloads/RSS/
  torrentleech.org: /home/torrent/Downloads/torrentleech.org/

cat_change:

  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:

  other:
    tag: other

nohardlinks:

- movies-completed-4k
- series-completed-4k
- movies-completed:
      # <OPTIONAL> exclude_tags var: Will exclude torrents with any of the following tags when searching through the category.
    exclude_tags:
    - Beyond-HD
    - AnimeBytes
    - MaM

- series-completed:
      # <OPTIONAL> exclude_tags var: Will exclude torrents with any of the following tags when searching through the category.
    exclude_tags:
    - Beyond-HD
    - BroadcasTheNet

share_limits:

  tl:
    priority: 1
    max_ratio: -2
    max_seeding_time: -2
    include_all_tags:
      - tl
    cleanup: false
  default:
    priority: 999
    max_ratio: -1
    max_seeding_time: -1
    cleanup: false

recyclebin:

  enabled: true
  empty_after_x_days: 60
  save_torrents: true
  split_by_category: false

orphaned:
  empty_after_x_days: 60
  exclude_patterns:
  - '**/.DS_Store'
  - '**/Thumbs.db'
  - '**/@eaDir'
  - /data/torrents/temp/**
  - '**/*.!qB'
  - '**/*_unpackerred'

apprise:
  api_url: http://apprise-api:8000
  notify_url:

notifiarr:
  apikey: ####################################
  instance:

webhooks:
  error: https://mywebhookurl.com/qbt_manage
  run_start: notifiarr
  run_end: apprise
  function:
    cross_seed: https://mywebhookurl.com/qbt_manage
    recheck: notifiarr
    cat_update: apprise
    tag_update: notifiarr
    rem_unregistered: notifiarr
    tag_tracker_error: notifiarr
    rem_orphaned: notifiarr
    tag_nohardlinks: notifiarr
    share_limits: notifiarr
    cleanup_dirs: notifiarr

bhd:
  apikey:

Logs

https://gist.github.com/Antorell/20272165f8020544f97330b06a1793b8

Screenshots

|         Added Tag: ~share_limit_1.tl                                                               |
|     Share Limit: Use Global Share Limit                                                            |
| Uncaught Exception                                                                                 |
Traceback (most recent call last):
  File "/root/old/tools/qbit_manage/qbit_manage.py", line 637, in <module>
    start_loop()
  File "/root/old/tools/qbit_manage/qbit_manage.py", line 382, in start_loop
    start()
  File "/root/old/tools/qbit_manage/qbit_manage.py", line 491, in start
    share_limits = ShareLimits(qbit_manager)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/old/tools/qbit_manage/modules/core/share_limits.py", line 36, in __init__
    self.update_share_limits()
  File "/root/old/tools/qbit_manage/modules/core/share_limits.py", line 49, in update_share_limits
    self.update_share_limits_for_group(group_name, group_config, torrents)
  File "/root/old/tools/qbit_manage/modules/core/share_limits.py", line 228, in update_share_limits_for_group
    tor_reached_seed_limit = self.has_reached_seed_limit(
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/old/tools/qbit_manage/modules/core/share_limits.py", line 513, in has_reached_seed_limit
    elif max_ratio == -2 and self.global_max_ratio_enabled and _has_reached_min_seeding_time_limit():
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ShareLimits' object has no attribute 'global_max_ratio_enabled'

Installation

Nix

Version Number

4.0.5

What branch are you on?

master

Antorell commented 11 months ago

I'm closing this. I tried the the fix, qbit_manage doesn't show any error anymore and setting -2 to max_ratioand max_seeding_time sets the global limits.

Thanks.