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

Scanner not detecting renamed folder #412

Closed
aziis98 opened this issue Apr 11, 2024 · 2 comments · Fixed by #449
Closed

Scanner not detecting renamed folder #412

aziis98 opened this issue Apr 11, 2024 · 2 comments · Fixed by #449
Assignees
Labels
bug Something isn't working scanner
Milestone

Comments

@aziis98
Copy link

aziis98 commented Apr 11, 2024

Kyoo's version

4.4.0

What happened?

Kyoo had a problem recognizing a folder with a non standard name so I tried to manually clean it up by first symlinking the folder and then by renaming directly the folder. Both times Kyoo didn't detect the change, the only thing I noticed is that the scanner just logs about the deleted folder (I was watching all logs with docker compose logs -t -f to find the problem).

Maybe the watcher just subscribed to a subset of file system events?

P.S. By the way, congrats. Impressive project for just one person!

@aziis98 aziis98 added the bug Something isn't working label Apr 11, 2024
@zoriya zoriya added this to the v4.5.0 milestone Apr 11, 2024
@zoriya zoriya added the scanner label Apr 11, 2024
@zoriya
Copy link
Owner

zoriya commented Apr 11, 2024

The watcher only listens to file changes, so I can understand why the symlink didn't work, no clue for the rename. I'll look into it.

PS: Thanks!

@zoriya
Copy link
Owner

zoriya commented Apr 28, 2024

I looked at it, the fs does not give rename events ; only delete/create. For directories, it does the same.
For a mv video/test video/test2 (with test being a directory):
{(<Change.added: 1>, './video/test3'), (<Change.deleted: 3>, './video/test')}

Matching rename manually is impossible (see samuelcolvin/watchfiles#202 (comment) for more info on why) but basically doing something like mv * test/ will have all added/deleted events on the same list so we have no way of mapping add/delete events for each file/directory.

We can't differentiate file/directory on delete events. I think the easiest fix for this issue will be to check directory add events and trigger a whole fs scan if the directory contains files. If it doesn't, it was probably created by a mkdir, if it does, it might have been a rename. This method might trigger unnecessary fs scan if a directory is created and a file is created/moved inside it quickly.

@zoriya zoriya self-assigned this Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working scanner
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants