qbit_manage: [Bug?]: Tagging torrents for cleanup after the criteria is met doesn't delete the files.

Describe the Bug

Tagging a torrent with a criteria for cleanup which is already met (for example max_seeding_time=1m, ratio=0.01,… ) doesn’t remove the files from the disk, only the .torrent from the client.

So when I start downloading something and I plan to delete it after let’s say it reaches ratio 2.0, but I have the scheduler run only every 24 hour, if I already reached a ratio 2+, and THEN scheduler tags it with that rule, the torrent is deleted, however the file stays on the disk.

Not sure if that’s intended though.

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:
  # The commands defined below will IGNORE any commands used in command line and docker env variables.
  dry_run: false
  cross_seed: false
  recheck: false
  cat_update: false
  tag_update: true
  rem_unregistered: true
  tag_tracker_error: false
  rem_orphaned: false
  tag_nohardlinks: false
  share_limits: true
  skip_qb_version_check: false
  skip_cleanup: false

qbt:
  # qBittorrent parameters
  host: 
  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: seed_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
  share_limits_min_seeding_time_tag: MinSeedTimeNotReached # Tag to be added to torrents that have not yet reached the minimum seeding time
  share_limits_min_num_seeds_tag: MinSeedsNotMet # Tag to be added to torrents that have not yet reached the minimum number of seeds
  share_limits_last_active_tag: LastActiveLimitNotReached # Tag to be added to torrents that have not yet reached the last active limit
  cross_seed_tag: cross-seed # Will set the tag of any torrents that are added by cross-seed command
  cat_filter_completed: false # Filters for completed torrents only when running cat_update command
  share_limits_filter_completed: false # Filters for completed torrents only when running share_limits command
  tag_nohardlinks_filter_completed: true # Filters for completed torrents only when running tag_nohardlinks command
  cat_update_all: true # Checks and udpates all torrent categories if set to True when running cat_update command, otherwise only update torrents that are uncategorized

directory:
  root_dir: /media/downloads/
  cross_seed:
  recycle_bin: '' #/media/downloads/.RecycleBin
  torrents_dir: '' #/config/qbittorrent/qBittorrent/BT_backup
  orphaned_dir: '' #/media/downloads/orphaned_data
  remote_dir: ''

cat:
  movie-radarr: /media/movies/
  show-sonarr: /media/shows/

cat_change:

tracker:
  ncore:
    tag: nCore
  other:
    tag: other

nohardlinks:

share_limits:
  nCore:
    priority: 1
    include_any_tags:
    - nCore
    max_seeding_time: 30d
    cleanup: true
  default:
    priority: 2
    max_seeding_time: 30d
    max_ratio: 2
    cleanup: true

recyclebin:
  enabled: false
  empty_after_x_days:
  save_torrents: false
  split_by_category: false

orphaned:
  empty_after_x_days: 10
  exclude_patterns:

apprise:

notifiarr:

webhooks:
  error:
  run_start:
  run_end:
  function:
    cross_seed:
    recheck:
    cat_update:
    tag_update:
    rem_unregistered:
    tag_tracker_error:
    rem_orphaned:
    tag_nohardlinks:
    share_limits:
    cleanup_dirs:

Logs

https://gist.github.com/daviddanko/44093e58e9bcef8ef65e830d4ba92a54

Screenshots

No response

Installation

Docker

Version Number

4.1.7

What branch are you on?

master

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (3 by maintainers)

Most upvoted comments

I changed the source code as follows:

if os.path.exists(torrent["content_path"].replace(self.root_dir, self.remote_dir)):
                    # Checks if any of the original torrents are working
                    if self.qbt.has_cross_seed(torrent) and ("" in t_msg or 2 in t_status):
                        self.stats_deleted += 1
                        attr["torrents_deleted_and_contents"] = False
                        t_deleted.add(t_name)
                        if not self.config.dry_run:
                            self.qbt.tor_delete_recycle(torrent, attr)
                        body += logger.print_line(
                            logger.insert_space("Deleted .torrent but NOT content files. Reason: is cross-seed", 8),
                            self.config.loglevel,
                        )
                    else:
                        self.stats_deleted_contents += 1
                        attr["torrents_deleted_and_contents"] = True
                        t_deleted_and_contents.add(t_name)
                        if not self.config.dry_run:
                            self.qbt.tor_delete_recycle(torrent, attr)
                        body += logger.print_line(
                            logger.insert_space("Deleted .torrent AND content files.", 8), self.config.loglevel
                        )
                else:
                    self.stats_deleted += 1
                    attr["torrents_deleted_and_contents"] = False
                    t_deleted.add(t_name)
                    if not self.config.dry_run:
                        self.qbt.tor_delete_recycle(torrent, attr)
                    body += logger.print_line(
                        logger.insert_space("Deleted .torrent but NOT content files. Reason: path does not exist [path="+torrent["content_path"].replace(self.root_dir, self.remote_dir)+"].", 8), self.config.loglevel
                    )

Now my tracing is as follows:

|    Torrent Name: Jonestown.Terror.in.the.Jungle.S01.1080p.AMZN.WEB-DL.DDP2.0.H.264-playWEB         |
|         Tracker: http://nebulance.io:4400                                                          |
|         Seeding Time vs Max Seed Time: 6 days, 20:39:42 >= 5 days, 0:00:00                         |
|         Cleanup: True [Meets Share Limits]                                                         |
|         Deleted .torrent but NOT content files. Reason: path does not exist [path=/mnt/user/data/torrents/autobrr/Jonestown.Terror.in.the.Jungle.S01.1080p.AMZN.WEB-DL.DDP2.0.H.264-playWEB]. |

Which is indeed not a correct path from the perspective of the running container. So this appears to be a configuration problem on my end, sorry for bumping the issue. Unsetting remote_dir solved it for me.

@bakerboy448 I don’t understand why other torrents could be refering to the same data. I’m not using cross seed, it’s from a private tracker, and it has its own content folder.

I’ve looked at the source code and I noticed there are multiple locations where this line is printed. I will try to make these prints unique and build a custom image, to see which of the print lines is triggering for me.

using a different image would not materially change the underlying qbitmanage code

PRing that logging tweak likely won’t hurt 😃

I seem to have the same issue. My torrents files don’t get deleted even though I don’t reference the same files in other torrents.

|    Torrent Name: Jonestown.Terror.in.the.Jungle.S01.1080p.AMZN.WEB-DL.DDP2.0.H.264-playWEB         |
|         Tracker: http://nebulance.io:4400                                                          |
|         Seeding Time vs Max Seed Time: 6 days, 19:09:14 >= 5 days, 0:00:00                         |
|         Cleanup: True [Meets Share Limits]                                                         |
|         Deleted .torrent but NOT content files.   

This happens for all my torrents.