Simplify function and align table values
This commit is contained in:
parent
fdb2fa92b0
commit
648f33d059
|
@ -123,11 +123,11 @@ function mpd_all.async(format, warg, callback)
|
||||||
["{random}"] = 0,
|
["{random}"] = 0,
|
||||||
["{state}"] = "N/A",
|
["{state}"] = "N/A",
|
||||||
["{Artist}"] = "N/A",
|
["{Artist}"] = "N/A",
|
||||||
["{Artists}"] = "N/A",
|
["{Artists}"] = "N/A",
|
||||||
["{Title}"] = "N/A",
|
["{Title}"] = "N/A",
|
||||||
["{Album}"] = "N/A",
|
["{Album}"] = "N/A",
|
||||||
["{Genre}"] = "N/A",
|
["{Genre}"] = "N/A",
|
||||||
["{Genres}"] = "N/A",
|
["{Genres}"] = "N/A",
|
||||||
}
|
}
|
||||||
|
|
||||||
local separator = warg and (warg.separator or warg[4]) or ", "
|
local separator = warg and (warg.separator or warg[4]) or ", "
|
||||||
|
@ -152,22 +152,14 @@ function mpd_all.async(format, warg, callback)
|
||||||
mpd_state[key] = helpers.capitalize(v)
|
mpd_state[key] = helpers.capitalize(v)
|
||||||
elseif k == "Artist" or k == "Title" or
|
elseif k == "Artist" or k == "Title" or
|
||||||
k == "Album" or k == "Genre" then
|
k == "Album" or k == "Genre" then
|
||||||
if k == "Artist" then
|
if k == "Artist" or k == "Genre" then
|
||||||
local current_artists = mpd_state["{Artists}"]
|
local current_key = "{" .. k .. "s}"
|
||||||
if current_artists == "N/A" then
|
local current_state = mpd_state[current_key]
|
||||||
mpd_state["{Artists}"] = v
|
if current_state == "N/A" then
|
||||||
|
mpd_state[current_key] = v
|
||||||
else
|
else
|
||||||
mpd_state["{Artists}"] = append_with_separator(
|
mpd_state[current_key] = append_with_separator(
|
||||||
current_artists, v)
|
current_state, v)
|
||||||
end
|
|
||||||
end
|
|
||||||
if k == "Genre" then
|
|
||||||
local current_generes = mpd_state["{Generes}"]
|
|
||||||
if current_generes == "N/A" then
|
|
||||||
mpd_state["{Generes}"] = v
|
|
||||||
else
|
|
||||||
mpd_state["{Generes}"] = append_with_separator(
|
|
||||||
current_generes, v)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
mpd_state[key] = v
|
mpd_state[key] = v
|
||||||
|
|
Loading…
Reference in New Issue