add comments, change formatting on powerwash logging, ...
only remove log if logging is enabled
This commit is contained in:
@ -18,10 +18,11 @@ GNU General Public License for more details.
|
||||
-- after being called with dofile()
|
||||
|
||||
plugins = { -- the plugins you want to load
|
||||
{ 'https://git.squi.bid/eat-it',
|
||||
file = 'eatit.lua',
|
||||
dir = 'scripts',
|
||||
cfg = function()
|
||||
{ 'https://git.squi.bid/eat-it', -- required, specifies the git repo
|
||||
file = 'eatit.lua', -- required, specifies the desired file
|
||||
dir = 'scripts', -- optional, sets the dest dir
|
||||
branch = 'master', -- optional, sets the desired branch
|
||||
cfg = function() -- optional, runs code on mpv startup
|
||||
print('this is an example')
|
||||
end
|
||||
},
|
||||
|
10
eatit.lua
10
eatit.lua
@ -97,13 +97,17 @@ end
|
||||
|
||||
-- start install
|
||||
local function startinstall()
|
||||
-- let the user know that we are starting install
|
||||
logwrite('Starting Download...')
|
||||
mp.osd_message('Downloading plugins!')
|
||||
|
||||
-- start iterating through plugins
|
||||
for i = 1, tablelength(plugins) do
|
||||
-- check if the user has defined a file for the current plugin
|
||||
if not plugins[i]['file'] then
|
||||
logwrite('WARNING! Git repo "' .. plugins[i][1] ..
|
||||
'" doesn\'t have a specified file. Skipping download')
|
||||
|
||||
-- FIXME: this results in the last plugin being downloaded & copied twice
|
||||
i = i + 1 -- if not we go to the next plugin
|
||||
end
|
||||
@ -153,7 +157,7 @@ local function initupdate()
|
||||
|
||||
-- closing/removing everything
|
||||
if opts.dl.powerwash == true then
|
||||
logwrite('powerwashing the tmp dir (' .. opts.dl.dir .. ')')
|
||||
logwrite('powerwashing the tmp dir "' .. opts.dl.dir .. '"')
|
||||
os.execute('rm -rf ' .. opts.dl.dir)
|
||||
end
|
||||
|
||||
@ -161,6 +165,8 @@ local function initupdate()
|
||||
end
|
||||
|
||||
-- run any user defined configs at startup
|
||||
-- NOTE: This is kinda useless and might be removed if there is no way to make
|
||||
-- it run in the desired plugin's thread
|
||||
local function runopts()
|
||||
openlog()
|
||||
for i = 1, tablelength(plugins) do
|
||||
@ -173,9 +179,11 @@ local function runopts()
|
||||
end
|
||||
|
||||
-- remove logfile on startup
|
||||
if opts.logging.log then
|
||||
openlog()
|
||||
os.remove(fn)
|
||||
closelog()
|
||||
end
|
||||
|
||||
runopts()
|
||||
mp.add_key_binding(opts.bind, 'UpdatePlugins', initupdate)
|
||||
|
Reference in New Issue
Block a user