-
Notifications
You must be signed in to change notification settings - Fork 8
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
Detection of deleted files and folders #61
Comments
Detecting changes in the filesystem is definitely out of scope for this script. You can of course manually refresh the directory with the |
If that isn't enough I could maybe add another script message that refreshes the directory even when the browser is closed. |
In the meantime you can just add this as an addon: local mp = require "mp"
local fb = require "file-browser"
mp.register_script_message("refresh-directory", function(directory)
local browser_directory = fb.get_directory()
directory = fb.fix_path(directory, true)
-- if the directory is already open then rescan, if it is a higher level directory then clear the cache
if directory == browser_directory then
fb.rescan()
elseif browser_directory:find(directory, 1, true) == 1 then
fb.clear_cache()
end
end)
return {} Send a script message with the absolute path of the directory you want to refresh and it will handle it. Edit: fixed up a few small bugs |
Thank you for the support. What also seem to work is an input command: Ctrl+F script-message osc-idlescreen no no_osd; script-binding file_browser/open-browser; show-text ' '; script-binding file_browser/dynamic/reload |
If that works too then great. |
Deleting files might be a common use case. I download everything with a Chrome extension called External Application Launcher and yt-dlp.
I have my own script for file deletion and found two other.
https://github.com/jonniek/mpv-scripts/blob/master/trashfileonend.lua
https://github.com/zenyd/mpv-scripts/blob/master/delete_file.lua
https://github.com/stax76/mpv-scripts/blob/main/delete-current-file.lua
If you like the idea, and it's easy to do, maybe you could detect deletions by checking all files if the folder hasn't too many files (people often have fast SSD drives). Or react to a script message from my script. What do you think?
The text was updated successfully, but these errors were encountered: