Closed KnifeFed closed 2 years ago
Thanks for the feedback! When I originally implemented the Recycle Bin feature I intentionally did not name it as .Recycle.Bin
because I didn't want qbit_manage
to interfere with Unraids Recycle Bin plugin. I suggest you do not combine the recycle bins as you could run into issues. Qbit manage will actually delete any files in that folder regardless of whether or not they came from Qbittorrent. So I would caution keeping them the same.
I also use the same docker volume mapping as you do and I don't see it necessary to have multiple recycle bin folders as each category should have its own save path and when the torrent files get moved to the recycle bin folder it keeps that save path directory. In your example the /movies
and /tv
directories will end up being created in your recyclebin folder making it easy to distinguish which category your files are in.
Here's an example of how my Recyclebin folder looks like:
Qbit manage will actually delete any files in that folder regardless of whether or not they came from Qbittorrent. So I would caution keeping them the same.
This wouldn't be an issue since I would have qbit_manage configured to never empty the trash and just let the Unraid plugin handle it. This is what I'm doing currently with Sonarr/Radarr and the recycle bins for the movies/tv shares and it works great.
In your example the
/movies
and/tv
directories will end up being created in your recyclebin folder making it easy to distinguish which category your files are in.
It's not so much an issue of distinguishing the files, but rather a mount/share issue.
Since /data
is /mnt/user
, if I specify the recycle bin path as e.g. /data/.Recycle.Bin
or /data/<something>/.Recycle.Bin
it would create a directory in /mnt/user
, which Unraid will treat as a user share and a different filesystem, breaking hardlinks.
That's why it would be optimal if I could do:
cat:
movies:
path: /data/movies
recycle_bin: /data/movies/.Recycle.Bin
tv:
path: /data/tv
recycle_bin: /data/tv/.Recycle.Bin
This wouldn't be an issue since I would have qbit_manage configured to never empty the trash and just let the Unraid plugin handle it.
Okay yes it would be fine if you aren't planning on using qbit_manage to empty the recycle bin.
In terms of implementing this, let me think about this some more and I'll get back to you.
Seeing as how both @bobokun and I run unraid and both use containers for our setups. We've never run into an instance where there would be a need for a per-category recycling bin. I understand that you use a separate share for each of your movies and tv shows however this is actually sub-optimal (proven here). I'd highly suggest setting yourself up something similar to what bobo and I have set up. TRaSH's Guides has to be the most optimal setup to ensure everything runs smoothly this is what we both use.
Personally, I find this request to be a very niche use case, and as most people do not follow a path such as yours.
The reason I have separate shares is because of how Unraid's split levels work.
For movies, I've set it up so that a single movie directory and the directory it's hard-linked from, e.g. /mnt/user/movies/library/Movie Name (2022)
and /mnt/user/movies/downloads/Movie.Name.2022…
, are never split across multiple disks.
For TV, I have it so that a single season directory is never split. This requires two different split levels and hence two different shares.
TRaSH's guides are great but they don't account for this Unraid-specific scenario.
Okay. I can see what you're doing now. You have thought this out quite thoroughly.
I agree with @Drazzilb08 in that this seems to be a very niche feature that not many will use. I don't want to add additional complexity to the cat
section of the config but I have thought of a solution that might work. How about I add something like
split_by_category: true
under the recyclebin
attribute and that will take whatever your save path you have defined in your category and add the base recyclebin folder (which you defined in the recycle_bin
attribute under directory)
Here's one of my actual categories:
cat:
radarr: /data/movies/dl
With your suggestion, that would create /data/movies/dl/<recycle_bin>
, right?
It wouldn't be at the root of the share (/data/movies
), so I can't use the recycle bin plugin, but I can live with that.
With your suggestion, that would create /data/movies/dl/
, right?
Yes that's how it would work
Yeah, that would be awesome if it's not too much of a hassle.
@KnifeFed Can you please switch over to develop branch and test, let me know if you find any bugs
Hey. Sorry for the late reply, I've been away all week. Thanks so much for implementing this!
I just tested version 3.1.5 and in my config, I have:
directory:
root_dir: /data
recycle_bin: .Recycle.Bin
torrents_dir: /data/appdata/binhex-qbittorrentvpn/qBittorrent/data/BT_backup
remote_dir: /data/
cross_seed:
...
recyclebin:
enabled: true
save_torrents: true
split_by_category: true
empty_after_x_days:
It did add a recycle bin per category path but it's named .RecycleBin
so the recycle_bin
option doesn't seem to do anything in this case. Also, it still created an empty .RecycleBin
directory in /data
(/mnt/user
).
try changing your recycle_bin
var to a directory like /.Recycle.Bin
I tried recycle_bin: /.Recycle.Bin
and it didn't make a difference. They still get named .RecycleBin
. Also, as I mentioned, an empty one is created in /data
and that happens even when just running the script with --run --dry-run
, i.e. no actual task.
can you try a path that actually exists? Maybe recycle_bin: /data/.Recycle.Bin
It will automatically create the folder with the default .RecycleBin
if the recycle_bin path does not exist.
That didn't help either, unfortunately. Is there a way to see where the file would have ended up when doing a dry-run? --debug --trace
doesn't give any info regarding this, nor any messages alluding to there not being a recycle bin specified. It's a pretty slow process reproducing this with actual runs.
Yes --debug
would tell you where the file is being moved to if you did have any unregistered torrents, it should show up in the logs. Can you do one more thing and update to the latest develop branch and try again?
Yes
--debug
would tell you where the file is being moved to if you did have any unregistered torrents
It doesn't do that during a dry-run. With --run --skip-recycle --rem-unregistered --dry-run --debug --trace
, this is what I get:
| Torrent Name: Torrent.Name |
| Status: TORRENT NOT REGISTERED WITH THIS TRACKER |
| Tracker: https://tracker.domain.tld |
| Deleted .torrent AND content files. |
| |
| JSON: {'function': 'rem_unregistered', 'title': 'Removing Unregistered Torrents', 'torrent_name': 'Torrent.Name', 'torrent_category': '<CATEGORY_NAME>', 'torrent_status': 'TORRENT NOT REGISTERED WITH THIS TRACKER', 'torrent_tracker': 'https://tracker.domain.tld', 'notifiarr_indexer': None, 'torrents_deleted_and_contents': True, 'body': ' Torrent Name: Torrent.Name\n Status: TORRENT NOT REGISTERED WITH THIS TRACKER\n Tracker: https://tracker.domain.tld\n Deleted .torrent AND content files.'} |
| Webhook: None
What should I set recycle_bin
to in the dev build?
Alright, I ran the dev build with:
directory:
root_dir: /data/
recycle_bin: .Recycle.Bin
torrents_dir: /data/appdata/binhex-qbittorrentvpn/qBittorrent/data/BT_backup/
remote_dir: /data/
cross_seed:
…and now it correctly created /category/path/.Recycle.Bin
. That's great! It also created an empty .Recycle.Bin
in /data
though.
Okay try updating again, it shouldn't create it anymore.
Yup, now it works great! Thanks!
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.