Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/themes/Theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ module.exports = class Theme {
}

async loadUserImage (userObject, size) {
if (userObject.image[0]['#text']) return loadImage(LastFM.getBestImage(userObject.image, size))
if (userObject.image[0]['#text']) {
try {
return loadImage(LastFM.getBestImage(userObject.image, size))
} catch (e) {
console.error("Failed to fetch user image", e)
}
}

return this.musicorum.cacheFileManager.getImageFromCache('userDefault.png', 'https://lastfm.freetls.fastly.net/i/u/300x300/818148bf682d429dc215c1705eb27b98.png')
}

Expand Down
19 changes: 17 additions & 2 deletions src/themes/pride.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ const flags = {
transgender: {
colors: ['#5BCEFA', '#F5A9B8', '#fff', '#F5A9B8', '#5BCEFA'],
rows: [1, 1, 1, 1, 1]
},
agender: {
colors: ['#000', '#858585', '#fff', '#4eff3b', '#fff', '#858585', '#000'],
rows: [1, 1, 1, 1, 1, 1, 1],
colorsToDraw: ['#000', '#bababa', '#fff', '#b9f484', '#fff', '#bababa', '#000']
},
unlabeled: {
colors: ['#4fff5b', '#fff', '#0fafff', '#ffa947'],
rows: [1, 1, 1, 1],
colorsToDraw: ['#defce0', '#fff', '#d9effa', '#fee0be']
},
aromantic: {
colors: ['#009609', '#b5ff5e', '#fff', '#a9a9a9', '#000'],
rows: [1, 1, 1, 1, 1],
colorsToDraw: ['#3ca542', '#a8d277', '#fff', '#a9a9a9', '#000']
}
}

Expand All @@ -66,7 +81,7 @@ module.exports = class PrideTheme extends Theme {
const CANVAS_SIZE_X = COVER_SIZE * SIZE_X
const CANVAS_SIZE_Y = COVER_SIZE * SIZE_Y

const albums = await lastfm.getList(user, 'albums', 'overall', 100)
const albums = await lastfm.getList(user, 'albums', 'overall', 140)
console.log('request done.')

const canvas = createCanvas(CANVAS_SIZE_X, CANVAS_SIZE_Y)
Expand Down Expand Up @@ -108,7 +123,7 @@ module.exports = class PrideTheme extends Theme {
// // .sort((a, b) => chroma.distance(a.color.hex(), b.color.hex(), 'rgb') - chroma.distance(b.color.hex(), a.color.hex(), 'rgb')))
// return
// }
const invertLightness = selectedFlag === 'transgender' && i > 2
const invertLightness = (selectedFlag === 'transgender' && i > 2) || (selectedFlag === 'agender' && i > 3)
images = images.filter(a => !!a)
.sort((a, b) => differencer(colors[i], a, b))
items.push(...images
Expand Down
Loading