Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
samhippo authored May 13, 2020
1 parent c56ff6b commit 6e8d0fe
Showing 1 changed file with 18 additions and 25 deletions.
43 changes: 18 additions & 25 deletions clean-playlist.lua
Original file line number Diff line number Diff line change
@@ -1,33 +1,26 @@
local ext = {
"mkv","mp4","webm","wmv","avi","3gp","ogv","mpg","mpeg","mov","vob" ,"ts","m2ts","divx","flv","asf","m4v","h264","h265","rmvb","rm","ogm"
}

local valid = {}
for i = 1, #ext do
valid[ext[i]] = true
end

local function main()
local playlist = mp.get_property_native('playlist')
local skipCurrent = false
for i = #playlist, 1, -1 do
local ext = string.match(playlist[i].filename, "%.([^.]+)$")
if(ext ~= nil) then
ext = ext:lower()
if( ext ~= "mkv"
and ext ~= "mp4"
and ext ~= "webm"
and ext ~= "wmv"
and ext ~= "avi"
and ext ~= "mpg"
and ext ~= "mpeg"
and ext ~= "mov"
and ext ~= "vob"
and ext ~= "ts"
and ext ~= "m2ts"
and ext ~= "divx"
and ext ~= "flv"
and ext ~= "asf"
and ext ~= "m4v"
and ext ~= "h264"
and ext ~= "rmvb"
and ext ~= "ogm") then
if(playlist[i].current) then
skipCurrent = true
else
mp.commandv('playlist-remove',i-1)
end
if(ext == nil) then ext = '' end
ext = string.lower(ext)
if(valid[ext]) then
--do nothing
else
if(playlist[i].current) then
skipCurrent = true
else
mp.commandv('playlist-remove',i-1)
end
end
end
Expand Down

0 comments on commit 6e8d0fe

Please sign in to comment.