-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Add option to set 'obsolete'-tag to private torrents that are not needed but kept anyway. #194
base: dev
Are you sure you want to change the base?
Conversation
hi @Dark3clipse, thanks for your contribution. The behavior is not entirely clear to me, here are a few thoughts.
|
Thank you for the feedback, I will rework the code. |
It is not clear to me what you mean with: We have no knowledge of what other tools are managing/using qbit (such as qbitmanage). Also, I think decluttarr should not have to know. You just set the feature to True if you want to use it imo. qbit itself is not 'using' the tags. I do check the existence of the tag in qbittorrent (see loadScripts.py) and create it if the feature is enabled and the tag string is not empty. |
Except for your 3rd point, the code should be reworked now. Could you have another look to see if your concerns have been addressed? Thank you :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey!
Almost there I think.
Please can you have a look at my comments.
Also, I saw the unit tests failed in the github actions, pls can you check?
logger.info('Downloads with this tag will be skipped: \"%s\"', settingsDict['NO_STALLED_REMOVAL_QBIT_TAG']) | ||
logger.info('Private Trackers will be skipped: %s', settingsDict['IGNORE_PRIVATE_TRACKERS']) | ||
logger.info('Downloads with this tag will be skipped: \"%s\"', settingsDict['NO_STALLED_REMOVAL_QBIT_TAG']) | ||
if settingsDict['SET_OBSOLETE_QBIT_TAG'] and settingsDict['OBSOLETE_QBIT_TAG']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and settingsDict['OBSOLETE_QBIT_TAG']:
isn't that check redundant? this value will always be true, since you are setting a default in the definitions.py?
@@ -317,6 +328,13 @@ If it you face issues, please first check the closed issues before opening a new | |||
- Type: String | |||
- Is Mandatory: No (Defaults to `Don't Kill`) | |||
|
|||
**OBSOLETE_QBIT_TAG** | |||
- Downloads in qBittorrent will receive this tag when: (1) `SET_OBSOLETE_QBIT_TAG==True`, (2) `IGNORE_PRIVATE_TRACKERS==True`, (3) torrent is private, (4) torrent is due for removal. | |||
- Note: the tag can be used by third-party tools to remove these torrents after required seeding time has passed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: the tag can be used by third-party tools (such as qbit_manage)to remove these torrents after required seeding time has passed.
would it make sense to add qbit_manage as example?
**SET_OBSOLETE_QBIT_TAG** | ||
- Set a tag on torrents in qBittorrent that can be removed, but are kept because they are private torrents. | ||
- Note: Has no effect when `IGNORE_PRIVATE_TRACKERS==False`. | ||
- The tag can be used by third-party tools to remove these torrents after required seeding time has passed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tag can be used by third-party tools (such as qbit_manage) to remove these torrents after required seeding time has passed.
would it make sense to add qbit_manage as example?
@@ -259,6 +261,15 @@ Steers which type of cleaning is applied to the downloads queue | |||
- Permissible Values: True, False | |||
- Is Mandatory: No (Defaults to False) | |||
|
|||
**SET_OBSOLETE_QBIT_TAG** | |||
- Set a tag on torrents in qBittorrent that can be removed, but are kept because they are private torrents. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- If this feature is turned on, private torrents in qBittorrent are not removed once the conditions for removal are met; instead, they are tagged with the obsolete-tag
I would formulate it like this - if you are OK
@@ -56,6 +56,9 @@ async def main(settingsDict): | |||
# Create qBit protection tag if not existing | |||
await createQbitProtectionTag(settingsDict) | |||
|
|||
# Create qBit obsolete tag if not existing | |||
await createQbitObsoleteTag(settingsDict) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. The tag should only be created if the feature is being used in qbit
My point was referring to this line. In my mind you should only create a obsolete tag in qbit if this feature is even used.
if settingsDict['SET_OBSOLETE_QBIT_TAG']
await createQbitObsoleteTag(settingsDict)
@@ -92,6 +92,7 @@ def showSettings(settingsDict): | |||
logger.info('%s | Removing slow downloads (%s)', str(settingsDict['REMOVE_SLOW']), 'REMOVE_SLOW') | |||
logger.info('%s | Removing stalled downloads (%s)', str(settingsDict['REMOVE_STALLED']), 'REMOVE_STALLED') | |||
logger.info('%s | Removing downloads belonging to unmonitored items (%s)', str(settingsDict['REMOVE_UNMONITORED']), 'REMOVE_UNMONITORED') | |||
logger.info('%s | Setting obsolete tag on private torrents that are due for removal (%s)', str(settingsDict['SET_OBSOLETE_QBIT_TAG']), 'SET_OBSOLETE_QBIT_TAG') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.info("%s | Keeping private torrents in qBit due for removal and tagging instead (tag: '%s')", str(settingsDict['SET_OBSOLETE_QBIT_TAG']), 'SET_OBSOLETE_QBIT_TAG')
Proposal above.
failType, | ||
affectedItem["title"], | ||
) | ||
if settingsDict['SET_OBSOLETE_QBIT_TAG'] and settingsDict['OBSOLETE_QBIT_TAG']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
settingsDict['OBSOLETE_QBIT_TAG'] - same as above. isnt this obsolete due to default value?
) | ||
if settingsDict['SET_OBSOLETE_QBIT_TAG'] and settingsDict['OBSOLETE_QBIT_TAG']: | ||
logger.info( | ||
">>> Removing %s download (without removing from torrent client but with setting obsolete tag): %s", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
">>> Removing %s download (keeping it in torrent client and adding tag '%s'
where %s is settingsDict['OBSOLETE_QBIT_TAG']
proposal above.
@@ -326,6 +333,9 @@ async def remove_download( | |||
API_KEY, | |||
{"removeFromClient": removeFromClient, "blocklist": addToBlocklist}, | |||
) | |||
if not removeFromClient and settingsDict['QBITTORRENT_URL'] and settingsDict['SET_OBSOLETE_QBIT_TAG'] and settingsDict['OBSOLETE_QBIT_TAG'] and affectedItem["downloadId"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
settingsDict['OBSOLETE_QBIT_TAG'] -> redundant?
Description
This feature introduces an option to tag torrents in qBittorrent that are determined to no longer be needed by the *arrs. This allows third-party tools to remove these torrents at a later stage when seeding requirements are met.
Use case
You have private trackers and want to make sure that you meet the seeding requirements before removing these torrents. Sometimes, torrents are no longer needed by the *arrs. You would like to remove these torrents after the seeding requirements are met. A tool like qbit_manage can do this for you.
However, such tools would need to know which torrents are no longer needed (obsolete) by the *arrs. By making decluttarr tag these torrents, third party tools such as qbit_manage can be used to cleanup these torrents after seeding requirements are met.
Changes