Skip to content

[WIP] Adds MusicBrainz IDs optionally#27

Open
luiseduardobrito wants to merge 5 commits into
benfoxall:gh-pagesfrom
luiseduardobrito:adds_mbid
Open

[WIP] Adds MusicBrainz IDs optionally#27
luiseduardobrito wants to merge 5 commits into
benfoxall:gh-pagesfrom
luiseduardobrito:adds_mbid

Conversation

@luiseduardobrito

Copy link
Copy Markdown

Resolves #23

@luiseduardobrito luiseduardobrito changed the title Adds MusicBrainz IDs optionally [WIP] Adds MusicBrainz IDs optionally Oct 3, 2021
@luiseduardobrito

Copy link
Copy Markdown
Author

Found a bug in pagination handling, I'll update with a fix soon.

Updated the PR with the [WIP] prefix to prevent merging.

@benfoxall benfoxall left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @luiseduardobrito! Thank you so much for raising this PR. It's looking great!

I've got a single change: it looks like the headers might be repeated throughout the generated csv file. Other than that, I've added a couple of comments & suggestions.

Thanks again!

Comment thread index.html
Comment on lines +203 to +206
if(includeMBID) {
return row(headers, d)
}
return row(headers, d)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if statement doesn't seem necessary here now that headers is pulled out above.

Suggested change
if(includeMBID) {
return row(headers, d)
}
return row(headers, d)
return row(headers, d)

Comment thread index.html
return row(['artist', 'album', 'name', 'date'], d)
})
.map(csv).join('\n') + '\n']);
includeHeaders ? (headers.join(',') + '\n' + r) : r

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 will this add the headers for every page of the output?

It might be easier to add the headers at the download handler instead:

var b = new Blob(data, {type: 'text/csv'})

⬆️ , could be something along the lines of ⬇️

const header = includeHeaders ? [headers.join(',') + '\n'] : [];
var b = new Blob(header.concat(data), {type: 'text/csv'})

(though maybe there's a neater way to do it…)

Comment thread js/lastfm-export.js
if (mbid) {
obj[`${child.tagName}_mbid`] = mbid;
}
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎 cool!

Comment thread index.html
<p class="help-block">(milliseconds, default 0) how long to wait between making requests</p>
</div>
<div class="form-group form-inline">
<input type="checkbox" class="form-control" name="lastfm-include-headers" id="lastfm-include-headers" checked="false">

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(just a suggestion, feel free to ignore)

It may be possible to use Rivets rv-checked, to automatically bind this value.

Suggested change
<input type="checkbox" class="form-control" name="lastfm-include-headers" id="lastfm-include-headers" checked="false">
<input type="checkbox" class="form-control" name="lastfm-include-headers" rv-checked="include_headers">

Then in the code later you could access this value through the state:

var includeHeaders = state.include_headers;

……… However, I've no idea what version of Rivets this is using, and if there are any issues with the different options, so feel free to ignore this and I could take a look later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

musicbrainz ID

2 participants