Comments (15)
Maybe
function file_exists(file)
retval, err = os.execute("if exist \"" .. file .. "\" (exit 0) else (exit 1)")
return type(retval) == "number" and retval == 0
end
works. At least my wine test gets the right exitcode.
from vlc-delete.
Thanks for your report. Was there anything special with the filename? Unicode letters, network drive, etc?
from vlc-delete.
Initially yes. Then I renamed it to something like "abc.mp4" on a normal drive (no UNC etc..) and it still failed.
Even when running it as administrator.
So that's when I decided to report it with the full vlc debug log.
You can see the filename there also.
from vlc-delete.
lua info: [vlc-delete] removing: G:/file.mp4
Can you try to get some more information/debug the script please? Maybe my windows detection is not working for Win10.
I'm using Linux since 2004, and I never had something newer than Win 7 to test.
from vlc-delete.
The output message "File does not exist" only exists in function windowsDelete so it seems to detect windows.
Perhaps the gsub, translating / into \ does not work?
lua info: [vlc-delete] removing: G:/file.mp4
main info: playlist is empty
lua info: [vlc-delete] error: File does not exist
from vlc-delete.
I've tried hardcoding the filename:
function windowsDelete()
vlc.msg.info("[vlc-delete] before")
local file = "G:\file.mp4"
os.remove(file)
vlc.msg.info("[vlc-delete] after")
end
That results in:
qt debug: activating or triggering extension 'VLC Delete'
lua debug: Activating extension 'VLC Delete'
lua info: [vlc-delete] removing: G:/file.mp4
main debug: deleting item `file.mp4'
lua info: [vlc-delete] before
main debug: incoming request - stopping current input
lua info: [vlc-delete] after
lua warning: Error while running script C:\Apps\vlc-3.0.18\lua\extensions\vlc-delete.lua, function activate(): C:\Apps\vlc-3.0.18\lua\extensions\vlc-delete.lua:106: attempt to concatenate global 'err' (a nil value)
lua error: Could not activate extension!
lua debug: Deactivating 'VLC Delete'
lua debug: Deactivating 'VLC Delete'
from vlc-delete.
Also tried this:
function windowsDelete()
vlc.msg.info("[vlc-delete] before")
local file = "G:\\file.mp4"
os.remove(file)
vlc.msg.info("[vlc-delete] after")
end
That results in:
qt debug: activating or triggering extension 'VLC Delete'
lua debug: Activating extension 'VLC Delete'
lua info: [vlc-delete] removing: G:/file.mp4
main debug: deleting item `file.mp4'
lua info: [vlc-delete] before
main debug: incoming request - stopping current input
lua info: [vlc-delete] after
lua warning: Error while running script C:\Apps\vlc-3.0.18\lua\extensions\vlc-delete.lua, function activate(): C:\Apps\vlc-3.0.18\lua\extensions\vlc-delete.lua:106: attempt to concatenate global 'err' (a nil value)
lua error: Could not activate extension!
lua debug: Deactivating 'VLC Delete'
lua debug: Deactivating 'VLC Delete'
from vlc-delete.
Also tried this:
function windowsDelete()
vlc.msg.info("[vlc-delete] before")
local file = "G:/file.mp4"
os.remove("G:/file.mp4")
vlc.msg.info("[vlc-delete] after")
end
That results in:
lua debug: Activating extension 'VLC Delete'
lua info: [vlc-delete] removing: G:/file.mp4
main debug: deleting item `file.mp4'
lua info: [vlc-delete] before
main debug: incoming request - stopping current input
main debug: incoming request - stopping current input
lua info: [vlc-delete] after
lua warning: Error while running script C:\Apps\vlc-3.0.18\lua\extensions\vlc-delete.lua, function activate(): C:\Apps\vlc-3.0.18\lua\extensions\vlc-delete.lua:106: attempt to concatenate global 'err' (a nil value)
lua error: Could not activate extension!
lua debug: Deactivating 'VLC Delete'
lua debug: Deactivating 'VLC Delete'
from vlc-delete.
Alsot tried this:
function windowsDelete()
local file = "G:/file.mp4"
f = io.open(file, "r")
vlc.msg.info("[vlc-delete] before")
f:close()
vlc.msg.info("[vlc-delete] after io.close")
os.remove(file)
vlc.msg.info("[vlc-delete] after os.remove")
end
That results in:
lua debug: Activating extension 'VLC Delete'
lua info: [vlc-delete] removing: G:/file.mp4
main debug: deleting item `file.mp4'
main debug: incoming request - stopping current input
lua info: [vlc-delete] before
lua info: [vlc-delete] after io.close
lua info: [vlc-delete] after os.remove
lua warning: Error while running script C:\Apps\vlc-3.0.18\lua\extensions\vlc-delete.lua, function activate(): C:\Apps\vlc-3.0.18\lua\extensions\vlc-delete.lua:108: attempt to concatenate global 'err' (a nil value)
lua error: Could not activate extension!
lua debug: Deactivating 'VLC Delete'
lua debug: Deactivating 'VLC Delete'
Which indicates that something is (also) wrong in:
if (retval == nil) then
vlc.msg.info("[vlc-delete] error: " .. err)
from vlc-delete.
I've put this complete code in a lua file: #11 (comment)
But because I don't like /f
and /a
I replaced:
os.execute("del /f /a /q ".."\""..path.."\"")
with:
os.execute("del /q ".."\""..path.."\"")
And then tested it.
Then the file is deleted. (and always shows two "dos box" popups for a single delete action)
So please "just" "merge" that with your main version 🙏
from vlc-delete.
Thanks a lot for your work @fun29, merged with 539dc60. Please check if it's working and don't hesitate to write feedback.
I will make a few more minor changes, not related to this issue.
from vlc-delete.
I've tried your new version from main
branch.
Output:
lua debug: Activating extension 'VLC Delete'
lua info: [vlc-delete] removing: G:\file.mp4
lua info: [vlc-delete] error: File does not exist
lua debug: Creating dialog 'VLC Delete'
qt debug: Creating a new dialog: 'VLC Delete'
lua debug: Clicking 'C:\Apps\vlc-3.0.18\lua\extensions\vlc-delete-prerelease.lua': 'OK'
lua debug: Deleting dialog 'VLC Delete'
lua debug: Waiting for the dialog to be deleted...
qt debug: Deleting extension dialog 'VLC Delete'
lua debug: Deactivating 'VLC Delete'
lua debug: Deactivating 'VLC Delete'
from vlc-delete.
Could you check the result of if exists
here?
I included this function to test the result of the del
command. del
always returns 0 / no error.
from vlc-delete.
The if exists
is there.
When I replace the file_exists function with your suggestion, deleting the file works 🙏
I do see 3 cmd.exe popups when it deletes the file. The other working solution "only" has 2.
The ideal solution does not have any popups. But obviously that's just a nice-to-have.
from vlc-delete.
Included in 6f5f276
3 popups are perfect, if it's not from 3 attempts to delete the file.
Normally the popups are
- check if the file exists before (e.g. not working for unicode files)
- the
del
command - check if the file exists after
It would be much easier if del
would return a proper exitcode. On Linux you don't see popups at all. The best solution would be to use Lua's os.remove()
command - but unfortunately it can't handle unicode filenames.
from vlc-delete.
Related Issues (18)
- Windows fix HOT 5
- Shortcut key HOT 4
- Don't know if this plugin works in other OSes, but in Windows (10/11) it surely didn't work, so I had to do many fixes and turn this plugin into Windows only using only core Windows batch functions for operations HOT 5
- keyboard shortcut HOT 1
- Restarts playlist (Ubuntu) HOT 3
- Nothing on view menu (windows 10, VLC 3.0.18) HOT 8
- Playlist not saved after delete HOT 1
- Stopped working suddenly after update
- My way Implement fixed key
- Not working on OSX w/ VLC 3.0.8 HOT 5
- Here You Go - Alternate Script (Autohotkey v2+) -- Press DEL (or SHIFT+DEL) to Delete Videos + Move
- add Hotkey to vlc-delete HOT 3
- add a hotkey HOT 3
- Video not deleted if file name contains an emoji (windows) HOT 2
- bind key HOT 4
- Does not work with Windows UNC paths HOT 3
- mac os shows as installed but is not in view menu HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vlc-delete.