applications/luci-minidlna: fix possible nil indexing if album art option is unset, only show one filename in placeholder
This commit is contained in:
parent
dd0fe4e12e
commit
cd456ff616
1 changed files with 9 additions and 2 deletions
|
@ -143,16 +143,23 @@ s:taboption("general", DynamicList, "media_dir", translate("Media directories:")
|
||||||
o = s:taboption("general", DynamicList, "album_art_names", translate("Album art names:"),
|
o = s:taboption("general", DynamicList, "album_art_names", translate("Album art names:"),
|
||||||
translate("This is a list of file names to check for when searching for album art."))
|
translate("This is a list of file names to check for when searching for album art."))
|
||||||
o.rmempty = true
|
o.rmempty = true
|
||||||
o.placeholder = "Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg"
|
o.placeholder = "Cover.jpg"
|
||||||
|
|
||||||
function o.cfgvalue(self, section)
|
function o.cfgvalue(self, section)
|
||||||
local rv = { }
|
local rv = { }
|
||||||
|
|
||||||
local val = Value.cfgvalue(self, section)
|
local val = Value.cfgvalue(self, section)
|
||||||
if type(val) == "table" then val = table.concat(val, "/") end
|
if type(val) == "table" then
|
||||||
|
val = table.concat(val, "/")
|
||||||
|
elseif not val then
|
||||||
|
val = ""
|
||||||
|
end
|
||||||
|
|
||||||
local file
|
local file
|
||||||
for file in val:gmatch("[^/%s]+") do
|
for file in val:gmatch("[^/%s]+") do
|
||||||
rv[#rv+1] = file
|
rv[#rv+1] = file
|
||||||
end
|
end
|
||||||
|
|
||||||
return rv
|
return rv
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue