dedupe: do not treat split library folders as already filed - #14
Merged
Merged
Conversation
alreadyFiled returned the first inode's folder whenever every file of a release appeared somewhere under dedupe_roots. Discs left in two different matches (a prior multibook run, or a file moved in the library) were skipped, then cacheMe hid the rest of the files on later runs. Require every file to live in the same folder so hardlinkUnlessFiled can complete the release. Co-authored-by: Mancolt <Mancolt@users.noreply.github.com>
…t as filed The same-folder rule would have reported every multi-disc book booktree filed itself (Config/target_path/disc_folder) as not filed, switching dedupe_roots off for exactly the releases that #15 now groups. Collapse a disc subfolder to its parent before comparing; a split filing across two titles still fails the check. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug and impact
Config/dedupe_rootstreated a multi-file release as already filed whenever every source inode appeared somewhere under the library, even if those files lived in different folders.hardlinkUnlessFiledthen skipped, printedAlready in the library at <first folder>, andcacheMewrote the processed marker — so later runs never completed the book.Trigger: a two-disc release whose files were previously hardlinked under two different matches (a prior
multibookrun, or one disc moved in Audiobookshelf). The next unpinned run withdedupe_rootsset never created the unified folder.Root cause
alreadyFiledcollected a folder per inode and returnedfolders[0]without checking they were the same directory. That violated its own contract ("the library folder that already holds every one offiles").Fix
Return
Noneunless every file maps to the same library folder, sohardlinkUnlessFiledcompletes the release (hardlinkFilestill skips dests that already exist). Sibling{title} {disc}directories are a conservative false-negative (re-link, skip-if-exists) rather than a skip-forever.Validation
LibraryTest.test_files_in_different_library_folders_are_not_already_filedpython3 -m unittest discover -s tests -p 'test_*.py': 189 tests, OK