-
Notifications
You must be signed in to change notification settings - Fork 0
/
Delete Current File.lua
48 lines (42 loc) · 1.16 KB
/
Delete Current File.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function descriptor()
return {
title = "Delete Current File";
version = "0.9";
author = "CIIDMike";
shortdesc = "Delete file from disk and playlist";
description = [[
<h1>Delete Current File</h1>"
Delete Current File from disk and remove from playlist.
When the extension is run, a persistent button will show that runs the delete action.
Please use at your own discretion, the author is not responsible for any damage or lost files.
]];
}
end
function click_delete()
local item = vlc.input.item()
local uri = item:uri()
uri = string.gsub(uri, '^file:///', '')
uri = vlc.strings.decode_uri(uri)
vlc.msg.info("[Delete Current File] deleting: " .. uri)
os.execute("rm -f \"" .. uri .. "\"")
removeItem()
end
function removeItem()
local id = vlc.playlist.current()
vlc.playlist.delete(id)
vlc.playlist.gotoitem(id + 1)
-- vlc.deactivate()
end
function activate()
d = vlc.dialog( "Delete Current File" )
d:add_button( "DEL", click_delete, 1, 1, 1, 1)
d:show()
end
function deactivate()
vlc.deactivate()
end
function close()
deactivate()
end
function meta_changed()
end