Code Monkey home page Code Monkey logo

qbit_manage's Introduction

qBit Manage

GitHub release (latest by date) GitHub commits since latest release (by SemVer) Docker Image Version (latest semver) Github Workflow Status pre-commit.ci status Ghcr packages Docker Pulls Sponsor or Donate

This is a program used to manage your qBittorrent instance such as:

  • Tag torrents based on tracker URLs
  • Apply category based on save_path to uncategorized torrents in category's save_path
  • Change categories based on current category (cat_change)
  • Remove unregistered torrents (delete data & torrent if it is not being cross-seeded, otherwise it will just remove the torrent)
  • Automatically add cross-seed torrents in paused state. *Note: cross-seed now allows for torrent injections directly to qBit, making this feature rarely needed/used.*
  • Recheck paused torrents sorted by lowest size and resume if completed
  • Remove orphaned files from your root directory that are not referenced by qBittorrent
  • Tag any torrents that have no hard links outside the root folder (for multi-file torrents the largest file is used)
  • Apply share limits based on groups filtered by tags/categories and allows optional cleanup to delete these torrents and contents based on maximum ratio and/or time seeded. Additionally allows for a minimum seed time to ensure tracker rules are respected and minimum number of seeders to keep torrents alive.
  • RecycleBin function to move files into a RecycleBin folder instead of deleting the data directly when deleting a torrent
  • Built-in scheduler to run the script every x minutes. (Can use --run command to run without the scheduler)
  • Webhook notifications with Notifiarr and Apprise API integration

Supported Qbittorrent Versions

Master

master - qBittorrent version

master - qbittorrent-api version

Develop

develop - qBittorrent version

develop - qbittorrent-api version

Getting Started

Check out the wiki for installation help

  1. Install qbit_manage either by installing Python 3.8.1+ on the localhost and following the Local Installation Guide or by installing Docker and following the Docker Installation Guide or the unRAID Installation Guide.
  2. Once installed, you have to set up your Configuration by create a Configuration File filled with all your values to connect to your qBittorrent instance.
  3. Please refer to the list of Commands that can be used with this tool.

Usage

To run the script in an interactive terminal with a list of possible commands run:

python qbit_manage.py -h

Support

  • If you have any questions or require support please join the Notifiarr Discord and post your question under the qbit-manage channel.
  • If you're getting an Error or have an Enhancement post in the Issues.
  • If you have a configuration question post in the Discussions.
  • Pull Request are welcome but please submit them to the develop branch.

qbit_manage's People

Contributors

aelfa avatar bakerboy448 avatar bobokun avatar buthed010203 avatar davo1624 avatar dependabot[bot] avatar drazzilb08 avatar ext4xfs avatar foux avatar ftc2 avatar github-actions[bot] avatar jeffreybytes avatar jonzauk avatar noonamer avatar pre-commit-ci[bot] avatar samuelcook avatar shanarys avatar stonecoleq avatar usa-reddragon avatar visorask avatar voltron4lyfe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qbit_manage's Issues

SyntaxError: invalid syntax

Hey there,

I've filled up my config with all needed data, but when I try to run python qbit_manage.py --rem-orphaned --dry-run or python qbit_manage.py -h I get this error ->
~/qbit_manage/qbit_manage-master$ python qbit_manage.py --rem-orphaned --dry-run File "qbit_manage.py", line 202 logger.dryrun(f'\n - Not Resuming {new_tag} - {torrent.name}') ^ SyntaxError: invalid syntax
May I know if I'm doing something wrong here? Thanks

[FR]: Tag torrents which have a tracker issue.

Is your feature request related to a problem? Please elaborate.

I maintain a script that does this but was wondering if this project could support the feature.

https://github.com/k8s-at-home/qbittorrent-scripts

Thanks!

Describe the solution you'd like

Unregistered torrents on trackers are hard to find in the UI. It would be nice to have those be tagged or optionally deleted.

Does your solution involve any of the following?

  • New config option
  • New command option

Describe alternatives you've considered

N/A

Who will this benefit?

Anyone that uses trackers that delete their torrents when a media file is bad or upgraded.

Additional Information

No response

Potentiall unregistered torrent

If a torrent has two trackers (for example tleechreload and torrentleech) and the torrent is removed from one of the trackers but is still active on the other tracker qbit_manage will report the torrent as potentially unregistered.

[BUG] - Category XYZ is defined under nohardlinks attribute but is not defined in the cat attribute.

I've seen the following error in my logs:

modules.util.Failed: Config Error: Category Permaseed is defined under nohardlinks attribute but is not defined in the cat attribute. 

Config Error: Category Permaseed is defined under nohardlinks attribute but is not defined in the cat attribute.

I manually categorize torrents as Permaseed if I choose to keep them. IE 4K movies and TV episodes. Sometimes the *arrs will upgrade a movie/episode and I'll want to remove whatever was permaseeded in favour of the upgrade. So my workflow goes:

  1. Find the old permaseed-ed torrent (NoHL option does this for me now)
  2. Delete the old permaseed-ed torrent along with the files
  3. Find the upgraded torrent
  4. Categorize it as Permaseed
  5. Set no share limit

I have a another "permaseed" category for cross seeding purposes, cross-seed-permaseed. This basically tags any cross seeds found for permaseeded torrents and categorizes it as cross-seed-permaseed.

I went in and added the Permaseed category to the cat property in the config, but that was marking my cross-seeded torrents as Permaseed and not cross-seed-permaseed.

Any solution to this? Perhaps I can set up my config differently?

[FR] Start/Finish of each run marker

Something like this

___________           .___         _____  __________              
\_   _____/ ____    __| _/   _____/ ____\ \______   \__ __  ____  
 |    __)_ /    \  / __ |   /  _ \   __\   |       _/  |  \/    \ 
 |        \   |  \/ /_/ |  (  <_> )  |     |    |   \  |  /   |  \
/_______  /___|  /\____ |   \____/|__|     |____|_  /____/|___|  /
        \/     \/      \/                         \/           \/ 
unregistered torrents found:        X torrents
new torrents to tag:                X torrents
torrents categorize:                X torrents
tag/set ratio limit/seeding time:   X torrents
Items thrown to RecyclingBin.       X torrents/data
info                                X blah blah blah
infoooooooooooo
Stuffs
More info
Yup

This way it is easier to read between runs and know what was done on the run above.

error: unrecognized arguments: config.yml

Help please :)

Hi, I am getting this message. Seem like I messed something in .yml but not sure what. I am also not sure about cross-seed paths. I am running cross-seed in docker so inside container cross-seed sees /storage/data/.torrents

I am using this from terminal

python3 qbit_manage.py config.yml -m --dry-run --log LOGLEVEL INFO

# qBittorrent parameters
qbt:
  host: '192.168.1.167:8080'
  user: 'username'
  pass: 'passWord'

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
  # <OPTIONAL> remote_dir var: </your/path/here/> # Path of docker host mapping of root_dir
  cross_seed: '/mnt/data/.torrents/'
  root_dir:  '/mnt/data/.torrents/'
  remote_dir: '/storage/data/.torrents/'

# Category/Pathing Parameters
cat:
  # <Category Name> : <save_path> #Path of your save directory. Can be a keyword or full path
  movies: '/mnt/data/.torrents/movies'
  tv: '/mnt/data/.torrents/tv'

# Tag Parameters
tags:
  # <Tracker URL Keyword>: <Tag Name>
  beyond-hd: Beyond-HD

Thank you

[FR] - cross seed - Apply seed time and ratio limits based on original torrent

For my permaseed torrents, I like to set the share ratio to Set no share limit so they don't stop/pause seeding. I'd like to have the cross_seed function use the original torrent's seeding_time_limit and ratio_limit properties. It looks like the library that this script uses provides the ability to do so:

https://qbittorrent-api.readthedocs.io/en/latest/apidoc/torrents.html#qbittorrentapi.torrents.TorrentsAPIMixIn.torrents_add

Add BHD Unregistered Detection - MASS REMOVAL BY STAFF

[2021-12-23 15:45:21,856] [util.py:219] [INFO] |================================== Removing Unregistered Torrents ==================================|
[2021-12-23 15:45:29,154] [util.py:179] [INFO] | No unregistered torrents found. |
[2021-12-23 15:45:29,154] [util.py:219] [INFO] |================================= Potential Unregistered torrents ==================================|
[2021-12-23 15:45:29,154] [util.py:184] [INFO] | Torrent Name: Its.Always.Sunny.in.Philadelphia.S15E01.2020.A.Year.In.Review.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb.mkv |
| Status: MASS REMOVAL BY STAFF

[FR] Specify recycle bin path per category

#75 is a great addition since the Unraid Recycle Bin plugin names the directory .Recycle.Bin, so now qbit_manage can use the same one.

I would also love the ability to have multiple recycle bins, i.e. one per qBittorrent category. This would make it work with separate shares.
For example, I have one share for movies (/mnt/user/movies) and one for TV (/mnt/user/tv), which both have their own .Recycle.Bin folders.
In qBit and qbit_manage I have a Docker volume mapping like /mnt/user:/data so that qBit can then drill down to the path set for each qBit category (e.g. /data/movies).
So the whole recycle bin feature doesn't really work for this type of setup if there's only one path for it.

[Bug]: Don't delete torrents with "EXPECTED VALUE (LIST, DICT, INT OR STRING) IN BENCODED STRING" status

Describe the Bug

The other day I had a bunch of "unregistered" torrents deleted. The status message was EXPECTED VALUE (LIST, DICT, INT OR STRING) IN BENCODED STRING. This was some temporary issue and it's libtorrent that spits out that message. So, these torrents shouldn't be deleted, just tagged as "issue".

Config

No response

Logs

Screenshots

No response

Installation

Docker

Version Number

3.2.0

What branch are you on?

master

cant get categories anymore

Hi,

Scripts been working for awhile tagging and catting. I want to use it to remove orphaned files but it was clearing out my whole folder.
I'm now getting this when I try to use it normally.

Traceback (most recent call last):
  File "/mnt/user/scripts/qbit/qbit_manage.py", line 629, in <module>
    run()
  File "/mnt/user/scripts/qbit/qbit_manage.py", line 622, in run
    rem_unregistered()
  File "/mnt/user/scripts/qbit/qbit_manage.py", line 354, in rem_unregistered
    torrentdict = get_torrent_info(torrent_list)
  File "/mnt/user/scripts/qbit/qbit_manage.py", line 181, in get_torrent_info
    category = get_category(save_path)
  File "/mnt/user/scripts/qbit/qbit_manage.py", line 140, in get_category
    for i, f in cat_path.items():
AttributeError: 'str' object has no attribute 'items'

Config

directory:
  # Do not remove these
  # Cross-seed var: </downloads/cross-seed/> #Output directory of cross-seed 
  # root_dir var: </downloads/keeps/> #Root downloads directory used to check for orphaned files
  # <OPTIONAL> remote_dir var: </your/path/here/> # Path of docker host mapping of root_dir
  cross_seed: '/mnt/user/Downloads/cross-seed/'
  root_dir: '/mnt/user/Downloads/keeps/'
  remote_dir: '/mnt/user/Downloads/keeps/'

# Category/Pathing Parameters
cat:
  # <Category Name> : <save_path> #Path of your save directory. Can be a keyword or full path
  Cross:'keeps'
  LongTerm:'keeps'
  Refund:'keeps'
  Upload:'keeps'
  radarr:'keeps'
  tv-sonarr:'keeps'

# Tag Parameter
tags:
  # <Tracker URL Keyword>: <Tag Name>
  beyond-hd: Beyond-HD
  animebytes.tv: AnimeBytes
  torrentleech: TorrentLeech
  tleechreload: TorrentLeech
  blutopia: Blutopia
  baconbits: BaconBits
  digitalcore: DigitalCore
  myanonamouse: MyAnonaMouse
  torrentday: TorrentDay
  empirehost: IPTorrents
  td-peers: TorrentDay
  nebulance: Nebulance
  anthelion: Anthelion
  iptorrents: IPTorrents
  torrentseeds: TorrentSeeds
  theempire: TheEmpire
  peerjunkies: PeerJunkies
  torrentdb: TorrentDB
  filelist: FileList
  nyaa: Nyaa

[BUG] - Cross Seed torrents aren't being categorized with correct category

When I get a cross seed for tv or movies, the script used to categorize them as cross-seed-tv or cross-seed-movies. Now they're categorized as tv or movies. This is problematic because the *arrs continually try to keep importing the files. I don't move the torrents into a tv-completed or movies-completed category because I like that the *arrs delete the torrent afterwards. Here's an excerpt of my config:

cat:
  # <Category Name> : <save_path> #Path of your save directory. Can be a keyword or full path
  cross-seed-movies: /data/torrents/movies
  cross-seed-tv: /data/torrents/tv

Is this a bug, since this used to work before, or do I need to configure qbit-manager differently?

[FR]: Allow min_seeding_time

Is your feature request related to a problem? Please elaborate.

Cannot set a minimum value for seeding time

Describe the solution you'd like

Allow a minimum value for seeding time to avoid potential hit and runs if a torrent is trumped/marked as noHL with the max_ratio seed goal met but minimum seed duration for the tracker is not met.

Does your solution involve any of the following?

  • New config option
  • New command option

Describe alternatives you've considered

Adjusting max_ratio to a larger value to try and prevent HnR

Who will this benefit?

all users who utilize hardlinks as well as trackers with minimum seeding time requirements

Additional Information

No response

[FR]: New reasons for "issue" tag, possible attention needed

Is your feature request related to a problem? Please elaborate.

Firstly, I will admit that recently I had some issues due to my own mistakes and ended up deleting a large part of my seeding torrents. To remedy this I restored most of the files by going into the recycle bin as well as the orphaned folder.

All of my library is now restored, but by doing that I had also added many files that were truly orphaned due to radarr/sonarr finding better versions. I expected qbM to fix this, as it had in the first place and it mostly did. However a new problem arose and a few of my torrents are now tagged with "issue".

These are the 3 errors I have found:

  1. 401: You cannot download or seed the same torrents from more than 3 locations

Torrent name: Alone.S02.1080p.AMZN.WEB-DL.DD+2.0.x264-Cinefeel

From what I gather looking at qBittorrent, there are indeed 4 torrents all seeding the same file. Is this a limitation imposed by qBittorrent or by the tracker? If it is by the tracker, would it be possible to add a feature to prioritise trackers? If I may suggest, it would be nice if it worked as such:

original tracker > pre-configured tracker 1 > pre-configured tracker 2 etc etc

  1. You have reached the client limit for this torrent

Torrent name: A.Beautiful.Planet.2016.BluRay.Remux.1080p.AVC.DTS.X.7.1-BMF.mkv

Looking at qBittorrent I can see that this torrent also has 4 torrents, one of them with this issue, another with the first one I mentioned, and another that has its status as "not contacted yet". The original one is fine.

  1. Sorry max peers reached! Redownload torrent from https://hd-torrents.org

Torrent name: Hawkeye.2021.S01E02.Hide.and.Seek.1080p.DSNP.WEB-DL.DDP5.1.Atmos.H.264-TEPES.mkv

I have 2 torrents with this name. One is working fine. Both are tagged with noHL AND cross-seed.

I have zipped up the latest logs to try and give you an understanding of what is happening.

Thank you for your help.

activity.log.zip

Describe the solution you'd like

Hopefully to understand what the errors are and if they are fixable to find a solution.

Does your solution involve any of the following?

  • New config option
  • New command option

Describe alternatives you've considered

I have considered deleting all those affected torrents, but I think that it's important to find all these issues and document them.

Who will this benefit?

Everyone that comes across these issues.

Additional Information

No response

[FR] Docker image

I'd love to consume this as a Docker image. Any plans to create one and publish to Docker Hub or another public image repo?

[FR] Add Number of Issue torrents to Finished Run

|====================================================================================================|
|                                            Finished Run                                            |
|                                  Total noHL Torrents untagged: 4                                   |
|                                         Run Time: 0:00:31                                          |
|====================================================================================================|

Unexpected tag value using Format 2

I'm using the latest develop Docker image. My tags config is as follows:

tags:
  flacsfor.me:
    tag: Redacted
  localhost.stackoverflow.tech:
    tag: IPTorrents    
    max_ratio: 5.0
    max_seeding_time: 30240
  routing.bgp.technology:
    tag: IPTorrents
    max_ratio: 5.0
    max_seeding_time: 30240
  ru.org:
    tag: RuTracker
  ssl.empirehost.me:
    tag: IPTorrents
    max_ratio: 5.0
    max_seeding_time: 30240

For some reason I think the app is parsing this config as if it were tags Format 1. I see this in the logs:

|    Torrent Name: a_torrent                                                                         |
|         New Tag: {'tag': 'IPTorrents', 'max_ratio': 5.0, 'max_seeding_time': 30240}                |
|         Tracker: https://localhost.stackoverflow.tech                                              |

Sure enough, the torrent in qBittorrent is tagged with tag, max_ratio, max_seeding_time, and noHL.

[FR]: New error message

Is your feature request related to a problem? Please elaborate.

Hey,
I recently had a torrent being labelled as "issue".
It must be a new message, and therefore I'm just reporting it here so you can add it to the list for it to be allowed to be deleted.
Here is a screenshot
opera_0udTvayRny

Describe the solution you'd like

I think this error is quite clear and would be OK for your script to delete the torrent.
Not sure if there are reasons for which to keep such a torrent.

Does your solution involve any of the following?

  • New config option
  • New command option

Describe alternatives you've considered

If there is something I haven't considered and such torrents should be kept for the user to review, please let me know.

Who will this benefit?

Everyone that gets this error - not sure how common it is.

Additional Information

No response

Logs output showing errors when values are empty

Hi @bobokun,

This might need changing as these are not errors but empty variables

|                                            Starting Run                                            |
|====================================================================================================|
| Locating config...                                                                                 |
| Using /config/config.yml as config                                                                 |
| Connecting to Apprise...                                                                           |
| Config Error: apprise sub-attribute api_url is blank                                               |
| Apprise Connection Failed                                                                          |
| Connecting to Notifiarr...                                                                         |
| Config Error: notifiarr sub-attribute apikey is blank                                              |
| Notifiarr Connection Failed                                                                        |
| Connecting to BHD API...                                                                           |
| Config Error: bhd sub-attribute apikey is blank                                                    |
| BHD Connection Failed                                                                              |
| Connecting to Qbittorrent...                                                                       |
| Qbt Connection Successful   

Something like that

Config Error: apprise sub-attribute api_url is blank > Apprise is not configured
Apprise Connection Failed > Not output require if its not configured

Same with Notifiarr and BHD

[Bug]: Torrents get hard deleted when they should be soft deleted

Describe the Bug

I've noticed a few times that I have "Errored" torrents in qBittorrent and their status is "Missing files". I check the qbit_manage log and see that these torrents have been hard deleted even though the cross-seeded versions do not meet the share limits. It definitely doesn't happen every time, i.e. I do also get instances of Deleted .torrent but NOT content files. That makes it really hard to troubleshoot and there's nothing in the logs that give any clues.

Log example
[2022-01-21 12:00:04,902] [util.py:251]               [INFO]     |โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Tagging Torrents with No Hardlinks โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€|
[2022-01-21 12:00:07,206] [util.py:206]               [INFO]     |    Torrent Name: Show.Name.S01E01.Episode.Name.2160p.WEB-DL.DDP5.1.H.265-GROUP                                                         |
[2022-01-21 12:00:07,206] [util.py:206]               [INFO]     |         Tracker: https://tracker.domain.tld                                                                                            |
[2022-01-21 12:00:07,206] [util.py:206]               [INFO]     |         Cleanup: True [No hard links found and meets Share Limits.]                                                                    |
[2022-01-21 12:00:07,209] [qbittorrent.py:818]        [INFO]     | Saving Torrent JSON file to /path/to/.Recycle.Bin/torrents_json/Show.Name.S01E01.The.GuardEpisode.Name.2160pDL.DDP5.1.H.264-FLU5.GROUP |
[2022-01-21 12:00:07,223] [qbittorrent.py:844]        [INFO]     | Backing up <HASH>.torrent and .fastresume to /path/to/.Recycle.Bin/torrents                                                            |
[2022-01-21 12:00:07,303] [util.py:206]               [INFO]     |         Deleted .torrent AND content files.                                                                                            |
[2022-01-21 12:00:15,000] [util.py:206]               [INFO]     | No torrents to tag with no hard links.                                                                                                 |
[2022-01-21 12:00:15,000] [util.py:206]               [INFO]     | Deleted 1 .torrent AND content files.                                                                                                  |
[2022-01-21 12:00:15,005] [util.py:247]               [INFO]     |โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€|

Config

qbt:
  host: <IP>:8080
  user: <USERNAME>
  pass: <PASSWORD>
settings:
  force_auto_tmm: false
  tracker_error_tag: issue
  ignoreTags_OnUpdate:
    - noHL
    - issue
    - cross-seed
directory:
  root_dir: /data
  recycle_bin: .Recycle.Bin
  torrents_dir: /data/appdata/binhex-qbittorrentvpn/qBittorrent/data/BT_backup
  remote_dir: /data
  cross_seed:
cat:
  cat1: /data/cat1/dl
  cat2: /data/cat2/dl
  ...
tracker:
  tracker1.domain.tld:
    tag: Tracker1
  tracker2.domain.tld:
    tag: Tracker2
  ...
nohardlinks:
  cat1:
    cleanup: true
    max_ratio: 4.0
    max_seeding_time: 129600
    exclude_tags:
    limit_upload_speed:
  cat2:
    cleanup: true
    max_ratio: 4.0
    max_seeding_time: 129600
    exclude_tags:
    limit_upload_speed:
  ...
recyclebin:
  enabled: true
  save_torrents: true
  split_by_category: true
  empty_after_x_days:

Logs

No error in logs

Screenshots

No response

Installation

Unraid

Version Number

3.2.0

What branch are you on?

master

[FR] Add bigger break between scripts running in logs

Much like:

################################
||                            ||
||  categorizing torrents     ||
||                            ||
################################
################################
||                            ||
||     torrents tagging.      ||
||                            ||
################################
################################
||                            ||
||    Doing Awesome Stuff     ||
||                            ||
################################
ect. etc.

This way it is easier to find each script with a certain run.

These are just ideas, the actual implementation could be very different
Could be as simple as

-------Tagging Torrents-------
-------Cating torrents -------
-------NoHLing Torrents-------
------- Doing Awesome stuff to torrents-------

[BUG] - name 'client' is not defined

On line 344 client.torrents.add(torrent_files=src, save_path=dest, category=category, tags='cross-seed', is_paused=True) in /modules/qbittorrent.py. I believe this should be self.client?

Also it looks like shutil isn't imported in /modules/qbittorrent.py so there's an error thrown on line 345

Python error

I am receiving this error at random times.
[2021-12-05 23:02:46,724] [INFO] |====================================================================================================| [2021-12-05 23:02:46,725] [INFO] | Starting Run | [2021-12-05 23:02:46,725] [INFO] |====================================================================================================| [2021-12-05 23:02:46,725] [INFO] |======================================= Getting Torrent List =======================================| [2021-12-05 23:02:46,742] [INFO] |========================================== Updating Tags ===========================================| [2021-12-05 23:02:46,770] [CRITICAL] | Traceback (most recent call last): | [2021-12-05 23:02:46,770] [CRITICAL] | File "//qbit_manage.py", line 991, in <module> | schedule.run_pending() [2021-12-05 23:02:46,771] [CRITICAL] | File "/usr/local/lib/python3.9/site-packages/schedule/__init__.py", line 780, in run_pending | default_scheduler.run_pending() [2021-12-05 23:02:46,771] [CRITICAL] | File "/usr/local/lib/python3.9/site-packages/schedule/__init__.py", line 100, in run_pending | self._run_job(job) [2021-12-05 23:02:46,771] [CRITICAL] | File "/usr/local/lib/python3.9/site-packages/schedule/__init__.py", line 172, in _run_job | ret = job.run() [2021-12-05 23:02:46,772] [CRITICAL] | File "/usr/local/lib/python3.9/site-packages/schedule/__init__.py", line 661, in run | ret = self.job_func() [2021-12-05 23:02:46,772] [CRITICAL] | File "//qbit_manage.py", line 954, in start | set_tags() [2021-12-05 23:02:46,772] [CRITICAL] | File "//qbit_manage.py", line 465, in set_tags | new_tag,url,max_ratio,max_seeding_time,limit_upload_speed = get_tags([x.url for x in torrent.trackers if x.url.startswith('http')]) [2021-12-05 23:02:46,773] [CRITICAL] | File "//qbit_manage.py", line 215, in get_tags | url = trunc_val(urls[0], '/') [2021-12-05 23:02:46,773] [CRITICAL] | IndexError: list index out of range
My installation is on UnRaid. I have tried to re-deploy the container but get the same error randomly. No set time interval between failure. I am attaching config file and full log file.
activity.log
config.txt
s.

[FR]: Add option for cleanup of dead seeds

Is your feature request related to a problem? Please elaborate.

I usually remove seeds that have been inactive for an extended period of time.

Describe the solution you'd like

Add an option to tag/remove inactive torrents with an option to set a threshold for inactivity. For example, allow an option in the config to set a 90-day threshold and have the script tag/remove any torrents that have been inactive for 90+ days.

Does your solution involve any of the following?

  • New config option
  • New command option

Describe alternatives you've considered

I have not found any way other than manually sorting through the torrents.

Who will this benefit?

Anyone who likes to seed as long as possible but has limited hard drive space to keep inactive torrents indefinitely.

Additional Information

No response

[Bug] - Blank Notification config should not cause errors

#Apprise integration with webhooks
apprise:
  #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
notifiarr:
  #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
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
    rem_orphaned: notifiarr
    tag_nohardlinks: notifiarr
    empty_recyclebin: notifiarr

leaving any of the above attributes blank should not cause errors

blank should mean disabled

FR - Add Exclusion Tags for the No Hardlink checking

Title. Add the ability to exclude certain tags that reside within the category to be checked for no hardlinks

Usecase: Permaseed MAM regardless of hardlink

Reason: *Arrs do not support per indexer post-download categories, and all my downloads get post-import dropped into seeds. This is difficult to do and likely will not be coming ever.

Alt Solution: Add support for per-indexer categories/management

[FR]: Tag Torrents With Trackers That Don't Match Any Configured Trackers

Is your feature request related to a problem? Please elaborate.

It would be useful to be able to control public torrents and their ratio and seeding time via qbit-torrent.

Describe the solution you'd like

Add a "Public Tracker" or maybe "Other Tracker" tag with associated ratio and seeding time settings. Basically it would be a tag added to torrents that don't have a tracker that matches any other configured trackers. Assuming you configured all of the private trackers you use then this would tag public torrents which would allow setting the ratio and seeding time for public torrents via qbit-manage.

Does your solution involve any of the following?

  • New config option
  • New command option

Describe alternatives you've considered

None yet

Who will this benefit?

Anyone who uses private and public torrents.

Additional Information

No response

Mapping issue - not finding torrent folder

Hello!
I'm either not mapping the root_dir correctly, or something is wrong.
I just ran another dry-run and I get this:

Did not move 4602 Orphaned files to /data/torrents/orphaned_data

This makes no sense, since I have about that amount of torrents in qBittorrent. I believe that the script is currently thinking that all my torrents are orphaned.

These are currently my configurations:

Qbit_manage container mapping: /mnt/user/data/torrents/:/data/torrents/
Qbit_manage config.yml

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 and used in RecycleBin
  # <OPTIONAL> remote_dir var: </your/path/here/> # Path of docker host mapping of root_dir. Must be set if you are using docker!
  # cross_seed: "/mnt/user/data/torrents/torrent_files/output"
  root_dir: "/data/torrents/"
  # remote_dir: "/mnt/user/data/torrents/"

NOTE: The cross_seed variable is commented out because I have set my cross_seed container to "inject".

cat:
  # <Category Name> : <save_path> #Path of your save directory. Can be a keyword or full path
  4k-movies-completed: "/data/torrents/4k-movies-completed"
  movies-completed: "/data/torrents/movies-completed"
  4k-tv-completed: "/data/torrents/4k-tv-completed"
  tv-completed: "/data/torrents/tv-completed"
  books-completed: "/data/torrents/books-completed"
  random-completed: "/data/torrents/random-completed"
  sports: "/data/torrents/sports"
  4k-movies: "/data/torrents/4k-movies"
  movies: "/data/torrents/movies"
  4k-tv: "/data/torrents/4k-tv"
  tv: "/data/torrents/tv"
  books: "/data/torrents/books"
  random: "/data/torrents/random"

Qbittorrent container mapping: /mnt/user/data/torrents/:/data/torrents/
Qbittorrent default download path /data/torrents/
Each category is mapped as follows: /data/torrents/4k-movies (4k-movies is changed to whatever is relevant)

[FR]: PTP unregistered API

Is your feature request related to a problem? Please elaborate.

PTP requires a lot of manual input for management of deregistered torrents due to trumps.

I installed this not realising the api script was specific to BHD

Describe the solution you'd like

Updating the unregistered torrent options to include PTP UR API

Does your solution involve any of the following?

  • New config option
  • New command option

Describe alternatives you've considered

I had a look at the script and suspect it would be transferable to PTP API for unregistered torrents. I'm just not clever enough to make a commit myself.

Who will this benefit?

Anyone using qbittorrent via webui knows there's no simple way to filter unregistered torrents, they still appear to be seeding.

There doesn't seem to be an elegant fix currently for Radarr/Sonarr users.

Additional Information

No response

[FR]: enhance Cross Seed Webhook to add the Tracker of the new xseed

Is your feature request related to a problem? Please elaborate.

Title

currently one does not know when a cross seed is added what tracker it is for

Describe the solution you'd like

Add more details to the webhook

Does your solution involve any of the following?

  • New config option
  • New command option

Describe alternatives you've considered

Xseed notifications but don't want those

Who will this benefit?

Xseed users

Additional Information

๐Ÿ‘‹

[FR] Limiting upload speed based on tracker

Hello,
Thanks for the great product you've developed, it is a time saver.
If possible, I'd like to request a feature that I believe could be quite useful and one.
I'm currently using qbit_manage and it does its job perfectly. I am able to cross-seed many torrents on many platforms without having to search for them all individually. I fully believe that if the files are going to be on my hard drives anyway, I might as well share them around.

However, it sometimes happens that some trackers will completely take over my upload bandwidth (they are private, but quite easy to get into and thus have many users). This ends up doing the opposite of what I want: all my dedicated seeding bandwith is going to one ONE tracker instead of, at the very least, a few of them.

This brings me to my request:
Based on the tagging system, would it be possible to set a limited amount of upload speed each tracker can use?

If any further clarification is needed, please do ask.

Thank you.

[FR]: Tag Torrents with Existing Tags

Is your feature request related to a problem? Please elaborate.

I usually add several tags when initially adding torrents and according to the description qbit-manage will only add tracker based tags to torrents without tags. That greatly reduces qbit-manage's usability in my situation and for others with a similar workflow.

Describe the solution you'd like

It would be very helpful to have a configuration setting that would allow qbit-manage to add tags to torrents with already existing tags.

Does your solution involve any of the following?

  • New config option
  • New command option

Describe alternatives you've considered

I've started looking into scripting a solution myself but having this ability in qbit-manage would be preferred.

Who will this benefit?

Anyone who likes to tag their torrents right away but still wants them tagged by qbit-manage.

Additional Information

No response

Create a release?

Hi, I like making packages for the AUR and it'd be nice if there was a release. Would you mind making one? :)

[Bug]: Another BHD status message to ignore: "STREAM TRUNCATED"

Describe the Bug

[2022-03-04 20:55:27,956] [util.py:206]               [INFO]     |    Torrent Name: Movie.Name                                                     |
[2022-03-04 20:55:27,956] [util.py:206]               [INFO]     |          Status: STREAM TRUNCATED                                               |
[2022-03-04 20:55:27,956] [util.py:206]               [INFO]     |         Tracker: https://<BHD>                                                  |
[2022-03-04 20:55:27,958] [qbittorrent.py:840]        [INFO]     | Saving Torrent JSON file to /path/to/.Recycle.Bin/torrents_json/Movie.Name.json |
[2022-03-04 20:55:27,970] [qbittorrent.py:866]        [INFO]     | Backing up <HASH>>.torrent and .fastresume to /path/to/.Recycle.Bin/torrents    |
[2022-03-04 20:55:28,333] [util.py:206]               [INFO]     |         Deleted .torrent AND content files.                                     |

Config

No response

Logs

Screenshots

No response

Installation

Unraid

Version Number

3.2.1

What branch are you on?

master

[FR] Automatic Category Assignment

Basically this: qbittorrent/qBittorrent#5779 (open)

I guess qbit will never have this build in.

When is this useful: for ex. when adding a torrent manually and not category was giving. Instead of manually selecting a category this could be done by simple rules. See issue from above for more.

QBittorrent Version

What is the improvement or update you wish to see?

I'm getting this error message about running the lastest version of qbittorrent:

| Qbittorrent Error: qbit_manage is only comaptible with v4.3.* or lower. You are currently on v4.4.0 |

May want to warn users about this, and will need to downgrade the qbittorrent, unless you are planning on updating qbit_manage to work with v4.4.0?

Is there any context that might help us understand?

Just ask away if that's the case.

Does the docs page already exist? Please link to it.

No response

[FR]: Set seed time / ratio for a specific tag

Is your feature request related to a problem? Please elaborate.

No

Describe the solution you'd like

would it be possible to add the possibility to set a seed-time via qbit-manage for a specific tag? So i could just set the seeding time for "cross-seed" tagged torrents to 6 days for example?

TABLE โ€” Today at 11:21 PM
Something like that would probably suit my issue the other day regarding having a long term seeding tag thats > ignored/permaseed also
Say I want to set a tracker specific seed time/ratio rule, but also have an lts (long term seeding) category I use that I just want > to exclude from automatic pausing so it can remain seeding perpetually even if the torrent is from that tracker.

As far as I can see from the config and some brief digging around github this isnt supported at the tracker tag level and I > would instead need to forego per tracker limits and just set those limits the same across all trackers per category under the > nohardlinks section? So that the lts category isnt being controlled by qbm?

These are two examples for the FR. Having the possibility to define those for tags we can specify in qbit-manage would help some use cases.

Does your solution involve any of the following?

  • New config option
  • New command option

Describe alternatives you've considered

Tried to set a tracker tag as "cross-seed" for my case as discussed in Discord. Didn't do the trick

Who will this benefit?

Everyone that has the need to handle specific tags with specific times/ratios

Additional Information

No response

Not logging all noHL tags for all categories in script log.

Hi Everyone,

Note I'm bad at explaining stuff so hope you understand...

I updated to the latest version with the noHL update, upon adding all my categories to the nohardlink section. I ran a dry run and noticed that only one category would get tagged e.g Movies... even though I had multiple category's setup... but upon removing the --dry-run parameter and letting it actually run it worked with all category's.

So it seems like the script is working but just not logging the activity for all category's

[FR]: Add Ability to Move Seeding Torrents to a Seeding Directory

Is your feature request related to a problem? Please elaborate.

Currently there are only a few possible places for a torrent to reside; in the completed category related directory, or in the incomplete directory. Adding a third option for seeding torrents to reside in would help in sorting large numbers of torrents. It would also help in being able to see at a glance (at the file system) what the current status is of the various torrents without having to log into qBittorrent

For example, if you're seeding lots and lots of torrents it can be a pain to find the one torrent you just downloaded (and aren't seeding permanently) amongst all of the other torrents in the completed directory.

Describe the solution you'd like

I think it would be a great feature to be able to move torrents that are being seeded to a seeding directory. Once there are finished seeding they would then move to the completed directory.

Does your solution involve any of the following?

  • New config option
  • New command option

Describe alternatives you've considered

I've started looking into scripting this myself but a solution built into qbit_manage would be way better.

Who will this benefit?

Anyone who likes to keep their torrents organized or has lots of them in general.

Additional Information

No response

KeyError: 'url' when tagging torrents with no hardlinks

I'm seeing this in the logs:

|====================================================================================================|
|                           _     _ _                                                                |
|                          | |   (_) |                                                               |
|                      __ _| |__  _| |_   _ __ ___   __ _ _ __   __ _  __ _  ___                     |
|                     / _` | '_ \| | __| | '_ ` _ \ / _` | '_ \ / _` |/ _` |/ _ \                    |
|                    | (_| | |_) | | |_  | | | | | | (_| | | | | (_| | (_| |  __/                    |
|                     \__, |_.__/|_|\__| |_| |_| |_|\__,_|_| |_|\__,_|\__, |\___|                    |
|                        | |         ______                            __/ |                         |
|                        |_|        |______|                          |___/                          |
|     Version: 3.1.1                                                                                 |
|====================================================================================================|
|     --run (QBT_RUN): False                                                                         |
|     --schedule (QBT_SCHEDULE): 30                                                                  |
|     --config-file (QBT_CONFIG): config.yml                                                         |
|     --log-file (QBT_LOGFILE): activity.log                                                         |
|     --cross-seed (QBT_CROSS_SEED): False                                                           |
|     --recheck (QBT_RECHECK): False                                                                 |
|     --cat-update (QBT_CAT_UPDATE): False                                                           |
|     --tag-update (QBT_TAG_UPDATE): True                                                            |
|     --rem-unregistered (QBT_REM_UNREGISTERED): False                                               |
|     --rem-orphaned (QBT_REM_ORPHANED): True                                                        |
|     --tag-nohardlinks (QBT_TAG_NOHARDLINKS): True                                                  |
|     --skip-recycle (QBT_SKIP_RECYCLE): True                                                        |
|     --dry-run (QBT_DRY_RUN): False                                                                 |
|     --log-level (QBT_LOG_LEVEL): DEBUG                                                             |
|     --divider (QBT_DIVIDER): =                                                                     |
|     --width (QBT_WIDTH): 100                                                                       |
|     --debug (QBT_DEBUG): False                                                                     |
|     --trace (QBT_TRACE): False                                                                     |
|                                                                                                    |
|     Scheduled Mode: Running every 30 minutes.                                                      |
|====================================================================================================|
|                                            Starting Run                                            |
|====================================================================================================|
| Locating config...                                                                                 |
| Using /config/config.yml as config                                                                 |
| Config Warning: apprise attribute not found                                                        |
| Config Warning: notifiarr attribute not found                                                      |
| Connecting to Qbittorrent...                                                                       |
| Host: qbittorrent:5555, Username: admin, Password: [REDACTED]                                      |
| Qbt Connection Successful                                                                          |
|======================================= Getting Torrent List =======================================|
|========================================== Updating Tags ===========================================|
| No new torrents to tag.                                                                            |
|================================ Tagging Torrents with No Hardlinks ================================|
|    Torrent Name: a torrent                                                                         |
|       Added Tag: noHL                                                                              |
| Traceback (most recent call last):                                                                 |
|                                                                                                    |
|   File "/app/qbit_manage.py", line 283, in <module>                                                |
|     start()                                                                                        |
|                                                                                                    |
|   File "/app/qbit_manage.py", line 201, in start                                                   |
|     num_tagged,num_untagged,num_deleted,num_deleted_contents = cfg.qbt.tag_nohardlinks()           |
|                                                                                                    |
|   File "/app/modules/qbittorrent.py", line 242, in tag_nohardlinks                                 |
|     body += print_line(util.insert_space(f'Tracker: {tags["url"]}',8),loglevel)                    |
|                                                                                                    |
| KeyError: 'url'                                                                                    |
|                                                                                                    |

This occurs when running the latest docker develop tag.

Please let me know if you need a copy of my config or any other data.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.