-
Notifications
You must be signed in to change notification settings - Fork 57
/
playlistnoplayback.lua
46 lines (36 loc) · 1.33 KB
/
playlistnoplayback.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
--此lua脚本由软件No1编写并提供支持
--This lua script is written by www.rjno1.com
local opts = require 'mp.options'
--local assdraw = require 'mp.assdraw'
--local msg = require 'mp.msg'
--local utils = require 'mp.utils'
local settings = {
noplayback = "yes" ,
}
--此function针对自动加载为播放列表,file-loaded是autoload使用start-file之后的行为
--针对直接播放m3u文件的行为不由此lua脚本处理
function file_loaded(event)
local plen = mp.get_property_number("playlist-count", 0)
if plen >= 2 then
mp.set_property("resume-playback", "no")
--mp.command("show-text 1" .. plen)
else
--mp.command("show-text 2" .. plen)
end
end
--此function针对拖放、手动添加为播放列表及播放列表的删减行为
function resume_playback_change(name, param)
if param >= 2 then
mp.set_property("resume-playback", "no")
--mp.command("show-text 3" .. param)
else
--mp.command("show-text 4" .. param)
end
end
opts.read_options(settings, "playlistnoplayback")
local save_position_on_quit_value = mp.get_property("save-position-on-quit")
if settings.noplayback =="yes" and save_position_on_quit_value == "yes" then
mp.register_event("file-loaded", file_loaded)
mp.observe_property( "playlist-count", "number", resume_playback_change)
else
end