abrakam / Faeria_Cards

Faeria Cards for community purposes
30 stars 15 forks source link

width of card image names #4

Open HendrikD opened 8 years ago

HendrikD commented 8 years ago

Hi,

i see a little bit of a problem here with the width of the card image names. There will be a release where you introduce your 1000th card. Then you probably update all your filenames and all links will break. Would it be possible to write the ids in the merlin_shortened.csv or the cards.csv exactly the way, they are used for the filenames? Or do you have another idea how to solve this?

Greetings

networkjanitor commented 8 years ago

As far as I know this is only a content dump and not supposed to be a hosting service for images. What do you plan on doing ? One way to solve this in a dynamic fashion, would be to check the csv files for ids over 1000.

HendrikD commented 8 years ago

I want to build an JSON API with the here provided data to maybe build some kind of faeria database site on top of it or just provide such an API for others to build their own websites. However, i would like to do it as stable as possible.

Checking if there are ids over 1000 in the csvs would indeed do the trick, if and only if abrakam will rename the lower files to have the new file name width as well. This is not guaranteed and that's why i opened this issue. For now it's good enough i think, but an "official" statement would be nice.

Greetings

networkjanitor commented 8 years ago

You might want to host the image files yourself in this scenario. Because you can then rename the files in your update process to remove all leading zeros or adjust the leading zeros of all files to be consistent.

Also I dont think they will hit the 1000 mark that soon.

Tidwell commented 8 years ago

For faeriadecks and the discord bot I ended up parsing the data source ids as a num for the data and dealing with the id->image number padding in the client apps. Leads to a bit more redundant code across projects, but I find it easier to deal with it there than breaking a data source. Might be useful:

csv parsing: https://github.com/Tidwell/faeria-cards/blob/master/parse-csv.js

client img padding: https://github.com/Tidwell/faeria-discord-bot/blob/master/src/commands/cards.js#L12

And definitely rehost and recompress the images - they are freaking huge. I'm pretty sure they can all be dropped down to something like 5 megs with good compression and a sprite sheet, but I haven't had a chance to try that out - faeriadecks still loads 25 megs of images on the deckbuilder :(