mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-31 22:14:09 +00:00
Handle corrupt PLEDIT.txt files
This commit is contained in:
parent
76cf5612ad
commit
d86f20705c
1 changed files with 8 additions and 3 deletions
|
|
@ -149,14 +149,19 @@ const defaultPlaylistStyle = {
|
|||
|
||||
async function genPlaylistStyle(zip) {
|
||||
const pleditContent = await genFileFromZip(zip, "PLEDIT", "txt", "text");
|
||||
const data = pleditContent
|
||||
? parseIni(pleditContent).text
|
||||
: defaultPlaylistStyle;
|
||||
const data = pleditContent && parseIni(pleditContent).text;
|
||||
if (!data) {
|
||||
// Corrupt or missing PLEDIT.txt file.
|
||||
return defaultPlaylistStyle;
|
||||
}
|
||||
|
||||
// Winamp seems to permit colors that contain too many characters.
|
||||
// For compatibility with existing skins, we normalize them here.
|
||||
["normal", "current", "normalbg", "selectedbg"].forEach(colorKey => {
|
||||
let color = data[colorKey];
|
||||
if (!color) {
|
||||
return;
|
||||
}
|
||||
if (color[0] !== "#") {
|
||||
color = `#${color}`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue