Skip to content

Add more export data #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 22, 2020
Merged

Add more export data #80

merged 2 commits into from
Nov 22, 2020

Conversation

watsonbox
Copy link
Owner

@watsonbox watsonbox commented Nov 20, 2020

See #67.

This PR introduces the additional data requested in #67 as well as that included in #70. I've marked that specific commit as co-authored since I drew inspiration from that code, though wasn't able to merge it as-is. @pavel-aicradle let me know if that's okay for you 🙂 .

This PR also introduces a lightweight configuration interface so that we don't include data requiring many extra requests by default. This should keep any unnecessary API calls to a minimum, while leaving the option there for more advanced users. It looks like this:

additional-data

watsonbox and others added 2 commits November 20, 2020 21:03
- Album release date, explicit, and popularity to base tracks data
- Optional: Artist data (genres)
- Optional: Audio features

Thanks to Pavel Komarov for his contribution in https://github.com/pavel-aicradle/exportify/blob/master/exportify.js

Co-authored-by: pavel-aicradle <pavel@safex.ai>
@watsonbox watsonbox self-assigned this Nov 20, 2020
Copy link
Contributor

@pavelkomarov pavelkomarov left a comment

Choose a reason for hiding this comment

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

You've gone way beyond where I was. I'm happy for whatever credit you'll give me.

- Added By
- Added At

Additionally, by clicking on the cog and selecting "Include artists data", the following fields will be added:
Copy link
Contributor

Choose a reason for hiding this comment

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

The cog is a really neat UI feature.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Thanks, glad you like it. Yep I think it works well and doesn't get in the way.

@@ -0,0 +1,54 @@
import './ConfigDropdown.scss'
Copy link
Contributor

Choose a reason for hiding this comment

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

What is tsx? A quick Google is only returning cars.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Haha. tsx is ts with JSX support (React). And ts is TypeScript.

The idea is that introducing typing is the front-line of defence against introducing bugs.


render() {
return (
<Dropdown>
Copy link
Contributor

Choose a reason for hiding this comment

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

So much less verbose than React javascript calls.


if (this.config.includeArtistsData) {
const tracksArtistsData = new TracksArtistsData(this.accessToken, tracks)
await tracksCsvFile.addData(tracksArtistsData)
Copy link
Contributor

Choose a reason for hiding this comment

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

love that async/await

})
})

test("including additional artist data", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you elaborate for me what this testing framework is about and how to use it?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I'm actually going to write something (possibly a blog article) on working with the specifics of working with Jest and MSW for the first time. Overally it's been great though with a few caveats.

I'm not sure if that's what you were asking or if you were asking a more general question. Just in case, in a more general sense, the test suite is there to validate the behavior of the app. It's mostly about guarding against regressions so I'm free to refactor without worrying too much about breaking things.

In this particular case, most of my tests take the form of mocking out the API calls as close to the HTTP transport layer as possible (so as to be client-agnostic), and then asserting that the app behaves in the expected way given a particular set of responses.

The tests don't actually call the API, so it wouldn't help in the case of breaking changes to the Spotify API. For that I have to rely on user feedback but I also have a last line of defence: exception monitoring with Bugsnag.

track.artists.map((a: any) => {
return artistsById.has(a.id) ? artistsById.get(a.id)!.genres.filter((g: string) => g).join(',') : ""
}).filter((g: string) => g).join(",")
]
Copy link
Contributor

Choose a reason for hiding this comment

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

This method rhymes with mine, but a lot more OOP and breaking up the code going on here. Amazing how much better the tools have gotten in the last few years.

audioFeatures.liveness,
audioFeatures.valence,
audioFeatures.tempo,
audioFeatures.time_signature
Copy link
Contributor

Choose a reason for hiding this comment

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

I like seeing them all arrayed like this.

"href" : null,
"total" : 2541
},
"genres" : [ "nottingham indie" ],
Copy link
Contributor

Choose a reason for hiding this comment

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

love the genre names

@pavelkomarov
Copy link
Contributor

With so many interacting files, some kind of system map might be helpful for future contributors.

@watsonbox watsonbox merged commit 7d0b182 into master Nov 22, 2020
@watsonbox
Copy link
Owner Author

@pavel-aicradle Thanks a lot for the review 🙏

@watsonbox watsonbox mentioned this pull request Nov 22, 2020
@watsonbox watsonbox deleted the feature/add-more-export-data branch July 15, 2022 16:41
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.

2 participants