feat: add AllDebrid slot management strategies#199
Conversation
|
can we Merge this ? it would be very helpful for AllDebrid users |
|
Can you fix the conflicts? This is an interesting PR that might help a lot for AD users |
|
note that i was able to cap my AD with 5000 magnets, not 1000, using decypharr |
8cedd23 to
1c3273e
Compare
Yes, you’re right. I ran some tests using a script that uploads thousands of magnets to Alldebrid in batches of 100, and based on my testing, the supposed limit of 1,000 magnets doesn’t actually seem to be enforced. A few weeks ago, however, I was still capped at 1,000 magnets on Alldebrid during my tests. I currently have 5,041 magnets on my Alldebrid account. I believe I was able to reach that number (≥ 5,000 magnets) because I uploaded them in batches of 100, and their API doesn’t check the total number of torrents being added per request (endpoint POST /v4/magnet/upload). The limit is still documented as 1,000 torrents in their API and in the API responses. They likely introduced this “limit” because pagination isn’t implemented on their magnet listing endpoint. So in practice, the limit seems to be around 5,000 torrents on Alldebrid. |
It seems that they increased their limit without updating the docs yet. |
Summary
AllDebrid has a ~1000 torrent slot limit. This PR adds two configurable strategies to manage slots automatically via the
slot_strategyconfig field (AllDebrid only):remove_after_add: Removes the torrent from AllDebrid immediately after it's been downloaded/processed, freeing the slot. Links remain functional via/link/unlock.remove_oldest: Before adding a new torrent, removes the oldest magnet if the configuredlimitis reached.Torrents removed by a slot strategy are marked with
RemovedAtso they are not treated as unexpected deletions bydetectTorrentChanges. If a torrent reappears on the remote (e.g. re-added by Fixer),RemovedAtis cleared.Changes
internal/config/debrid.go—slot_strategyfield + validation (alldebrid only)pkg/debrid/providers/alldebrid/alldebrid.go—countMagnets(),enforceSlotLimit(), updatedGetAvailableSlots()andSubmitMagnet()pkg/manager/processor.go—applySlotStrategy()forremove_after_addpkg/manager/torrent.go—detectTorrentChanges()respectsRemovedAtpkg/server/assets/js/config.js— UI dropdown (visible only for alldebrid)Configuration example
{ "debrids": [ { "provider": "alldebrid", "api_key": "...", "slot_strategy": "remove_after_add", "limit": 1000 } ] }Closes #196