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
639 stars 42 forks source link

[Bug]: Hard links not detected in sub folders #541

Closed HomebrewDotNET closed 2 months ago

HomebrewDotNET commented 2 months ago

Describe the Bug

I use the following folder setup for my media libraries: /media/movies/Library /media/movies/radarr /media/series/Library /media/series/sonarr

I've noticed all my torrents are tagged that they have no hard links.

I've validated with ls on these shares and the files are indeed hard linked so I'm not sure what's wrong with my setup. I guess it could be because of the sub folders?

Config

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

qbt:
  # qBittorrent parameters
  host: 127.0.0.1:6882
  user: SomeUser
  pass: VeryStrongPassword

settings:
  force_auto_tmm: true # Will force qBittorrent to enable Automatic Torrent Management for each torrent.
  tracker_error_tag: ~cleanup_TrackerIssue # Will set the tag of any torrents that do not have a working tracker.
  nohardlinks_tag: ~cleanup_Unreferenced # Will set the tag of any torrents with no hardlinks.
  share_limits_tag: ~group # 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.
  - ~cleanup_Unreferenced
  - ~cleanup_TrackerIssue
  - ~cleanup_MinSeedTimeNotReached
  - ~cleanup_MinSeedsNotMet
  - ~cleanup_LastActiveLimitNotReached
  - ~type_PrivateTracker
  - ~type_PublicTracker
  - cross-seed
  share_limits_min_seeding_time_tag: ~cleanup_MinSeedTimeNotReached
  share_limits_min_num_seeds_tag: ~cleanup_MinSeedsNotMet
  share_limits_last_active_tag: ~cleanup_LastActiveLimitNotReached
  cross_seed_tag: cross-seed
  cat_filter_completed: true
  share_limits_filter_completed: true
  tag_nohardlinks_filter_completed: true
  force_retag_all: false
directory:
  # Do not remove these
  # Cross-seed var: </your/path/here/>  # Output directory of cross-seed
  # root_dir var: </your/path/here/>  # Root downloads directory used to check for orphaned files, noHL, and RecycleBin.
  # <OPTIONAL> remote_dir var: </your/path/here/>  # Path of docker host mapping of root_dir.
  # remote_dir must be set if you're running qbit_manage locally and qBittorrent/cross_seed is in a docker
  # remote_dir should not be set if qbit_manage is running in a container
  # <OPTIONAL> recycle_bin var: </your/path/here/>   # Path of the RecycleBin folder. Default location is set to remote_dir/.RecycleBin
  # <OPTIONAL> torrents_dir var: </your/path/here/>  # Path of the your qbittorrent torrents directory. Required for `save_torrents` attribute in recyclebin
  # <OPTIONAL> orphaned_dir var: </your/path/here/>  # Path of the the Orphaned Data folder. This is similar to RecycleBin, but only for orphaned data.
  cross_seed: /cross-seeds
  root_dir: /media/
  remote_dir: /media/
  recycle_bin: /tmp/recyclebin
  torrents_dir: /torrents/
  orphaned_dir: /tmp/orphaned_data
cat:
  # Category & Path Parameters
  # <Category Name> : <save_path>  # Path of your save directory.
  seeding: /downloads/finished/seeding
  radarr-imported: /media/movies/radarr
  sonarr-imported: /media/series/sonarr
  radarr: /media/movies/radarr
  sonarr: /media/series/sonarr

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>

tracker:
  # Mandatory
  # Tag Parameters
  # <Tracker URL Keyword>:    # <MANDATORY> This is the keyword in the tracker url. You can define multiple tracker urls by splitting with `|` delimiter
  # <MANDATORY> Set tag name. Can be a list of tags or a single tag
  #   tag: <Tag Name>
  # <OPTIONAL> Set the category based on tracker URL. This category option takes priority over the category defined by save directory
  #   cat: <Category Name>
  # <OPTIONAL> Set this to the notifiarr react name. This is used to add indexer reactions to the notifications sent by Notifiarr
  #   notifiarr: <notifiarr indexer>
  digitalcore:
    tag: [~tracker_DigitalCore, ~type_PrivateTracker, ~goal_RatioBuilding]
  milkie:
    tag: [~tracker_Milkie.cc, ~type_PrivateTracker]
  fearnopeer:
    tag: [~tracker_FearNoPeer, ~type_PrivateTracker, ~goal_RatioBuilding]
  lastdigitalunderground|theldu:
    tag: [~tracker_LastDigitalUnderground, ~type_PrivateTracker, ~goal_RatioBuilding]
  scenetime:
    tag: [~tracker_SceneTime, ~type_PrivateTracker, ~goal_RatioBuilding]
  speed.connecting.center:
    tag: [~tracker_Speed.CD, ~type_PrivateTracker, ~goal_RatioBuilding]
  upload.cx:
    tag: [~tracker_Upload.CX, ~type_PrivateTracker, ~goal_RatioBuilding]
  itatorrents.xyz:
    tag: [~tracker_ItaTorrents, ~type_PrivateTracker, ~goal_RatioBuilding]
  polishtorrent|ptt:
    tag: [~tracker_PolishTorrent, ~type_PrivateTracker, ~goal_RatioBuilding]
  hawke.uno:
    tag: [~tracker_Huno, ~type_PrivateTracker, ~goal_RatioBuilding]
  other:
    tag: ~type_PublicTracker

nohardlinks:
  # Tag Movies/Series that are not hard linked outside the root directory
  # 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
- sonarr-imported
- radarr-imported
- sonarr-imported.cross-seed
- radarr-imported.cross-seed
- sonarr
- radarr

share_limits:
  private-ratiobuilding:
    priority: 1
    include_all_tags:
    - ~goal_RatioBuilding
    - ~cleanup_Unreferenced
    max_ratio: -1
    max_seeding_time: -1
    cleanup: false
  cross-seeding:
    priority: 2
    include_all_tags:
    - cross-seed
    exclude_any_tags:
    - ~cleanup_Unreferenced
    cleanup: false
  cross-seeding-unreferenced:
    priority: 3
    include_all_tags:
    - cross-seed
    - ~cleanup_Unreferenced
    cleanup: true
  private-seeding:
    priority: 4
    categories:
    - radarr-imported
    - sonarr-imported
    include_all_tags:
    - ~type_PrivateTracker
    - ~cleanup_Unreferenced
    max_ratio: 10
    max_seeding_time: 131487
    min_seeding_time: 43829
    min_num_seeds: 2
    last_active: 1440
    cleanup: true
  private-library:
    priority: 5
    include_all_tags:
    - ~type_PrivateTracker
    exclude_all_tags:
    - ~cleanup_Unreferenced
    max_ratio: -1
    max_seeding_time: -1
    cleanup: false
  public-seeding-orphaned:
    priority: 6
    categories:
    - radarr
    - sonarr
    include_all_tags:
    - ~type_PublicTracker
    - ~cleanup_Unreferenced
    last_active: 1440
    cleanup: true
  public-seeding:
    priority: 7
    categories:
    - radarr-imported
    - sonarr-imported
    include_all_tags:
    - ~type_PublicTracker
    - ~cleanup_Unreferenced
    max_ratio: 2
    max_seeding_time: 10080
    min_seeding_time: 4320
    min_num_seeds: 1
    limit_upload_speed: 16
    cleanup: true
  public-library:
    priority: 8
    categories:
    - radarr-imported
    - sonarr-imported
    include_all_tags:
    - ~type_PublicTracker
    exclude_all_tags:
    - ~cleanup_Unreferenced
    max_ration: 2
    max_seeding_time: 10080
    limit_upload_speed: 16
    cleanup: false

  default:
    priority: 999
    limit_upload_speed: 16
    cleanup: false

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: false
  # <OPTIONAL> empty_after_x_days var:
  # Will automatically remove all files and folders in recycle bin after x days. (Checks every script run)
  # If this variable is not defined it, the RecycleBin will never be emptied.
  # WARNING: Setting this variable to 0 will delete all files immediately upon script run!
  empty_after_x_days: 30
  # <OPTIONAL> save_torrents var:
  # If this option is set to true you MUST fill out the torrents_dir in the directory attribute.
  # This will save a copy of your .torrent and .fastresume file in the recycle bin before deleting it from qbittorrent
  save_torrents: true
  # <OPTIONAL> split_by_category var:
  # This will split the recycle bin folder by the save path defined in the `cat` attribute
  # 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:
  # Orphaned files are those in the root_dir download directory that are not referenced by any active torrents.
  # Will automatically remove all files and folders in orphaned data after x days. (Checks every script run)
  # If this variable is not defined it, the orphaned data will never be emptied.
  # WARNING: Setting this variable to 0 will delete all files immediately upon script run!
  empty_after_x_days: 60
  # 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'
  - '**/Thumbs.db'
  - '**/@eaDir'
  - /data/torrents/temp/**
  - '**/*.!qB'
  - '**/*_unpackerred'
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/HomebrewDotNET/dd433359ea9cf35f818164e9a16d3b17

Screenshots

No response

Installation

Docker

Version Number

4.1.2

What branch are you on?

master

bobokun commented 2 months ago

Duplicate issue of #538 . Please test by switching to develop branch and adding the following in your configuration. https://github.com/StuffAnThings/qbit_manage/blob/b371562e15a73b002eae190f3d63833e1e62dae9/config/config.yml.sample#L141-L142

bakerboy448 commented 2 months ago

Note that your root_dir in QBm should be your download folder root dir. additionally your library folders should not be contained within your root dir either. See trash guides which the Starr documentation has links all over to for proper path setups