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
743 stars 45 forks source link

Fix min_seeding_time tag removal when max_seeding_time is -1 #598

Closed ineednewpajamas closed 3 months ago

ineednewpajamas commented 3 months ago

Description

Add logic for when max_seed_time is -1 to _has_reached_seeding_time_limit.

Fixes #597

Type of change

Please delete options that are not relevant.

Checklist:

bobokun commented 3 months ago

I've added an additional check similar for max_ratio. In your original test did you do a test to see if min_seeding_time was reached that it did delete the torrent correctly? Can you test with one torrent for this use case?

ineednewpajamas commented 3 months ago

Yep, here are the partial logs of when it got cleaned up while I was sleeping

|===================== Updating Share Limits for [Group default] [Priority 999] =====================|
|    Torrent Name: Mayor Of Kingstown S03E05 Iris 1080p AMZN WEB-DL DDP5 1 H 264-NTb[EZTVx.to].mkv[eztvx.to] |
|         Tracker: udp://tracker.opentrackr.org:1337                                                 |
|         Added Tag: ~share_limit_999.default                                                        |
|     Share Limit: Max Ratio = 1.0                                                                   |
|    Torrent Name: mayor.of.kingstown.s03e05.1080p.web.h264-successfulcrab[EZTVx.to].mkv[eztvx.to]   |
|         Tracker: udp://tracker.opentrackr.org:1337                                                 |
|         Added Tag: ~share_limit_999.default                                                        |
|     Share Limit: Max Ratio = 1.0                                                                   |
|======== Cleaning up torrents that have reached ratio/seed limit for default. Priority 999 =========|
|    Torrent Name: Mayor Of Kingstown S03E05 Iris 1080p AMZN WEB-DL DDP5 1 H 264-NTb[EZTVx.to].mkv[eztvx.to] |
|         Tracker: udp://tracker.opentrackr.org:1337                                                 |
|         Ratio vs Max Ratio: 1.34 >= 1.00                                                           |
|         Cleanup: True [Meets Share Limits]                                                         |
| Saving Torrent JSON file to /data/torrents/tv/.RecycleBin/torrents_json/Mayor Of Kingstown S03E05 Iris 1080p AMZN WEB-DL DDP5 1 H 264-NTb[EZTVx.to].mkv[eztvx.to].json |
| Backing up 8b83ade11f29fdc3ffb0b5c997aef715cbdc9273.torrent and .fastresume to /data/torrents/tv/.RecycleBin/torrents |
|         Deleted .torrent AND content files.                                                        |
|    Torrent Name: mayor.of.kingstown.s03e05.1080p.web.h264-successfulcrab[EZTVx.to].mkv[eztvx.to]   |
|         Tracker: udp://tracker.opentrackr.org:1337                                                 |
|         Ratio vs Max Ratio: 1.75 >= 1.00                                                           |
|         Cleanup: True [Meets Share Limits]                                                         |
| Saving Torrent JSON file to /data/torrents/tv/.RecycleBin/torrents_json/mayor.of.kingstown.s03e05.1080p.web.h264-successfulcrab[EZTVx.to].mkv[eztvx.to].json |
| Backing up 23574cf6c6095e70de486ece4d7b5373cfe73276.torrent and .fastresume to /data/torrents/tv/.RecycleBin/torrents |
|         Deleted .torrent AND content files.                                                        |
|====================================================================================================|

I'll have the next torrent to cleanup in about 15 hours if you wanted a second test.

ineednewpajamas commented 3 months ago

Can you test with one torrent for this use case?

Are you referring to the use case for the code you added or just my original use case?

bobokun commented 3 months ago

Are you referring to the use case for the code you added or just my original use case?

Just the original use case. I also realized the max_ratio != -1 is not really necessary since it wouldn't ever satisfy any of the if conditions underneath. Either way it's probably better to add in to make things easier to read.

ineednewpajamas commented 3 months ago

Sounds good. Is what I provided good enough? otherwise the next test would be in around 14 hours or so.

bobokun commented 3 months ago

Oops I linked to the wrong bug. It should be #597