Skip to content

Commit

Permalink
Fix: write placeholder image #22
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorporation committed Jul 15, 2024
1 parent 3aa9dd1 commit d56e62d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Covercache/CovercachePrepopulate.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- {"name": "CovercachePrepopulate", "file": "Covercache/CovercachePrepopulate.lua", "version": 4, "desc": "Prepopulates the myMPD covercache.", "order":1,"arguments":[]}
-- {"name": "CovercachePrepopulate", "file": "Covercache/CovercachePrepopulate.lua", "version": 5, "desc": "Prepopulates the myMPD covercache.", "order":1,"arguments":[]}

mympd.init()

Expand All @@ -12,9 +12,9 @@ local extensions = {
}

local function file_exists(name)
local f = io.open(name,"r")
if f ~= nil then
io.close(f)
local file = io.open(name,"r")
if file ~= nil then
io.close(file)
return true
end
return false
Expand All @@ -31,12 +31,12 @@ local function check_image(base)
end

local function create_placeholder(filename)
local f = io.open(filename, "w")
if f == nil then
local file = io.open(filename, "w")
if file == nil then
return false
end
io.write(f, '<?xml version="1.0" encoding="UTF-8"?><svg width="63.5mm" height="63.5mm" version="1.1" viewBox="0 0 63.5 63.5" xmlns="http://www.w3.org/2000/svg"><g transform="translate(21.167 -117.08)"><rect x="-21.167" y="117.08" width="63.5" height="63.5" fill="#b3b3b3"/><path d="m29.674 133.99v13.978l-6.3634-6.3846-8.4845 8.5057-8.4845-8.4845-8.4845 8.4845-6.3634-6.3846v-9.7148c0-2.3332 1.909-4.2423 4.2423-4.2423h29.696c2.3332 0 4.2423 1.909 4.2423 4.2423zm-6.3634 13.618 6.3634 6.3846v9.6936c0 2.3332-1.909 4.2423-4.2423 4.2423h-29.696c-2.3332 0-4.2423-1.909-4.2423-4.2423v-13.957l6.3634 6.3422 8.4845-8.4845 8.4845 8.4845z" fill="#fff" stroke-width=".26458"/></g></svg>')
io.close(f)
file:write('<?xml version="1.0" encoding="UTF-8"?><svg width="63.5mm" height="63.5mm" version="1.1" viewBox="0 0 63.5 63.5" xmlns="http://www.w3.org/2000/svg"><g transform="translate(21.167 -117.08)"><rect x="-21.167" y="117.08" width="63.5" height="63.5" fill="#b3b3b3"/><path d="m29.674 133.99v13.978l-6.3634-6.3846-8.4845 8.5057-8.4845-8.4845-8.4845 8.4845-6.3634-6.3846v-9.7148c0-2.3332 1.909-4.2423 4.2423-4.2423h29.696c2.3332 0 4.2423 1.909 4.2423 4.2423zm-6.3634 13.618 6.3634 6.3846v9.6936c0 2.3332-1.909 4.2423-4.2423 4.2423h-29.696c-2.3332 0-4.2423-1.909-4.2423-4.2423v-13.957l6.3634 6.3422 8.4845-8.4845 8.4845 8.4845z" fill="#fff" stroke-width=".26458"/></g></svg>')
file:close()
return true
end

Expand Down

0 comments on commit d56e62d

Please sign in to comment.