gabriel-dehan / dyson-sphere-blueprints

A community website to share dyson sphere program blueprints
47 stars 11 forks source link

Download multiple blueprints as zip file #22

Closed davidakachaos closed 3 years ago

davidakachaos commented 3 years ago

I sometimes find the "need" to download a whole set of blueprints to a folder. Would it be possible to create a function that lets you select multiple blueprints and then press a "Download as zip" button?

Love the site, by the way, keep up the awesome work!

gabriel-dehan commented 3 years ago

Now that's an original suggestion, never thought of this use case. Not sure how this could work or be integrated easily into the UX. The easiest would probably be to allow you to download all your favorites for instance, but not sure if that would solve your problem?

davidakachaos commented 3 years ago

I was thinking either on the search results page or on the collection page.

So you would have a "Download as ZIP" button on the collection page, which packs all the blueprints in a zip that has a [folder]/[blueprints] layout. The folder name would be the name of the collection.

On the search results there are some ways to make it work. There could be a checkbox next to each found blueprint with a button that allows a user to "Download selected as ZIP". Or there could be a button that just reads "Download results as ZIP".

gabriel-dehan commented 3 years ago

Hey @davidakachaos, your change is live, I had to make a few fixes because it failed when there were / in the blueprint name and some of the chinese blueprints names are very very very long, which made the heroku filesystem return an error.

There still is an issue with some blueprints somehow not having any content in the .txt file. Seems to only happen with some blueprints and I have only noticed it with this collection so far (haven't tried them all): https://www.dysonsphereblueprints.com/collections/basicbox

Not sure if it's a problem because of chinese characters or something like that. I tried to find the issue but before writing to the file the encoded_blueprint actually contains data. If you have some time and want to check this, I can't spend my evening on it :)

davidakachaos commented 3 years ago

Hey @gabriel-dehan, I noticed it too. Not sure what is happening there, I'll try to have a look, is there a way I could get some test data maybe? I'll try to reproduce the issue locally without it first, but maybe you have an easy way to get some test data :-)

davidakachaos commented 3 years ago

Never mind, I found a blueprint that had the issue and submitted a fix