Skip to content
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

[FR]: Include orphaned files and recycle bin in the list of folders to ignore when looking for noHL #660

Closed
2 tasks
ColinHebert opened this issue Sep 30, 2024 · 5 comments · Fixed by #666
Closed
2 tasks
Assignees
Labels
feature request New feature or request status:added-to-develop Feature Request or Bug Fix is in Develop

Comments

@ColinHebert
Copy link

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

Currently if a file is in the recycle bin, or in the orphaned directory, it does not get included in the list of files to deduct from the Hardlink count, meaning that files can flip/flop in noHL depending on whether there is some content in the recycle bin or not

Describe the solution you'd like

When doing a lookup for get_inode_count https://github.com/StuffAnThings/qbit_manage/blob/master/modules/util.py#L536 include the folders recycle_bin and orphaned_dir

Does your solution involve any of the following?

  • New config option
  • New command option

Describe alternatives you've considered

Who will this benefit?

Anyone using noHL and Orphaned or RecyleBin features

Additional Information

No response

@ColinHebert ColinHebert added the feature request New feature or request label Sep 30, 2024
@bobokun
Copy link
Collaborator

bobokun commented Oct 5, 2024

I don't think I understand this use case. Any files that are put in Recyclebin or Orphaned folder should not be referenced by any existing torrent.

@ColinHebert
Copy link
Author

ColinHebert commented Oct 5, 2024

Here's the scenario:

1st Torrent (TorrentA) has "MyFile.mp4"
2nd Torrent (TorrentB) has "path/MyFile.mp4" and "path/MyFile.nfo"

The two "MyFile.mp4" are identical, therefore we have them hardlinked the same content (inode).
We also hardlink "MyFile.mp4" into a Jellyfin instance outside of any qbittorrent/qbit_manage folders.

"MyFile.mp4" has one external hardlink (in Jellyfin external to my torrents folder), therefore neither TorrentA nor TorrentB are tagged with NoHL.


Two days after downloading "MyFile.mp4", I delete it from Jellyfin.

Both TorrentA and TorrentB are tagged with NoHL


Either of these scenarios happen:

  • I delete TorrentB from Qbittorent, therefore qbit_manage moves "path/MyFile.mp4" and "path/MyFile.nfo" into the orphan folder
  • I scheduled TorrentB to be cleaned up automatically after two days (which have passed already), but not TorrentA, therefore qbit_manage moves "path/MyFile.mp4" and "path/MyFile.nfo" into the recycle_bin folder

TorrentA is no longer marked as NoHL (because MyFile.mp4 has a hardlink to orphan/path/MyFile.mp4 or recycle_bin/path/MyFile.mp4)

After a few days (waiting on empty_after_x_days) qbit_manage purges the orphaned/recycle_bin folder.

TorrentA is tagged as NoHL again.


When looking for NoHL, the logic introduced in #291 we moved from the logic

no_hl means there are no hard links to that file (at all)

To

no_hl means that there are no hard links to that file outside of the folder qbitmanage already manages

Unfortunately, we only considered root_dir when recycle_bin and orphaned_dir are both folders managed by qbit_manage

@bobokun
Copy link
Collaborator

bobokun commented Oct 5, 2024

Ah okay, that makes sense. My recycle_bin and orphaned_dir are within my root_dir which is why I haven't noticed this problem. I assume yours is oustide of your root_dir.

@ColinHebert
Copy link
Author

Oh god, now I do feel dumb. Yes you are 100% correct. This is because I've been for a long time on a weird config where my root_dir is actually the "completed" folder for qbittorrent...

I suspect at the initial setup time, I was thrown off by https://github.com/StuffAnThings/qbit_manage/blob/master/config/config.yml.sample#L54-L59 (yeah I'm making excuses now).

I changed my root_dir and what do you know, everything's working fine.

@bobokun bobokun added the status:added-to-develop Feature Request or Bug Fix is in Develop label Oct 5, 2024
@bobokun
Copy link
Collaborator

bobokun commented Oct 5, 2024

No worries, I still think it's a valid use case for those that have recyclebin/orphaned_dir outside of root directory. If you could please test this out I've pushed a fix in develop branch if you want to try going back to your previous setup.

@bobokun bobokun mentioned this issue Oct 6, 2024
@bobokun bobokun closed this as completed in 6e2fc39 Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request status:added-to-develop Feature Request or Bug Fix is in Develop
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants