Skip to content

Commit

Permalink
autofill vinyl formatting data when available from discogs
Browse files Browse the repository at this point in the history
  • Loading branch information
agrathwohl committed Jul 31, 2020
1 parent df17caa commit 4f7cb88
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions release.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ class Release {
const releaseFormat = data.formats.filter(df => df.name === 'Vinyl')
if (releaseFormat.length > 0) {
this.dbData = data

if (this.dbData.formats) { // auto-fill vinyl format data if avail
const formatDesc = this.dbData.formats[0].descriptions
for (const desc of formatDesc) {
if (desc.includes('"')) {
this.size = Number(desc.replace('"', ''))
} else if (desc.includes('RPM')) {
this.speed = Number(desc.replace('RPM', '').replace(' ', ''))
}
}
}
}
} else if (this instanceof CD) {
const releaseFormat = data.formats.filter(df => df.name === 'CD')
Expand Down

0 comments on commit 4f7cb88

Please sign in to comment.