wrap up initial discogs work
This commit is contained in:
parent
8cff0ec6ab
commit
781d96ca14
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
||||
*.properties
|
||||
.DS_Store
|
||||
*.csv
|
||||
/vendor
|
@ -66,6 +66,21 @@ function renderTable(records, sortField) {
|
||||
|
||||
function apiResponseParsing(record) {
|
||||
record.sortName = titleCleaner(record.name);
|
||||
record.artists = record.artists.map((artist) => {
|
||||
return artist.replace(/ \([0-9]+\)$/, "");
|
||||
});
|
||||
record.sortArtist = record.artists.reduce((acc, curr) => {
|
||||
return (
|
||||
acc +
|
||||
curr
|
||||
.replace(/^(An?|The)\s/i, "")
|
||||
.toLowerCase()
|
||||
.replaceAll('"', "")
|
||||
.replaceAll(":", "")
|
||||
.replaceAll("'", "")
|
||||
.replaceAll(" ", "")
|
||||
);
|
||||
}, "");
|
||||
return record;
|
||||
}
|
||||
|
||||
@ -101,28 +116,16 @@ function searchCleaner(str) {
|
||||
.replaceAll(" ", "");
|
||||
}
|
||||
|
||||
// AlbumName string `json:"name"`
|
||||
// Artists []string `json:"artists"`
|
||||
// SortArtist string `json:"sortArtist"`
|
||||
// Identifier string `json:"identifier"`
|
||||
// Format string `json:"format"`
|
||||
// Genre string `json:"genre"`
|
||||
// Label string `json:"label"`
|
||||
// Year string `json:"year"`
|
||||
// Description string `json:"description"`
|
||||
// CoverURL string `json:"coverURL"`
|
||||
// DiscogsURL string `json:"discogsURL"`
|
||||
|
||||
function RecordTemplate({
|
||||
name,
|
||||
artists,
|
||||
coverURL,
|
||||
description,
|
||||
format,
|
||||
genre,
|
||||
identifier,
|
||||
label,
|
||||
year,
|
||||
discogsURL,
|
||||
}) {
|
||||
return `${coverURL ? `<img src="${coverURL}"/>` : ""}
|
||||
<h1>${name}</h1>
|
||||
@ -130,8 +133,13 @@ function RecordTemplate({
|
||||
<span>${identifier}</span><br/>
|
||||
<span>${genre}, ${label}, ${year}</span><br/>
|
||||
<span>${format}</span>
|
||||
<div class="description">
|
||||
<p>${description}</p>
|
||||
<div>
|
||||
<a
|
||||
target="_blank"
|
||||
href="${discogsURL}"
|
||||
>
|
||||
Data provided by Discogs.
|
||||
</a>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user