I emailed him yesterday offering to take over. I think it's a great resource and it'd be a shame to see it go unattended.
Currently I'm just working out how to get it up and running on my machine. It seems like before anyone will be able to take it over, it might need to be cleaned up a little around the edges. I'm currently fighting through node package errors..
I wanted to let everyone know that I am in the process of transferring mtgjson over to another individual. There shouldn't be any downtime at all and the website address will stay the same and everything. I'll update the the thread here once the process is complete.
I'll keep it as up-to-date as possible.
I don't plan to make any app-breaking changes anytime soon, but I'll try to resolve the issues over github (new and old).
If I come up with something that may break current apps (like version 3.0.0), I'll try to keep the 'old' version around for a while, after the announcement.
I'm already on the lookout for the cards of Oath of the Gatewatch and the announced commander sets (one card was already leaked, but is not on any database anywhere).
I'm going to take a look at the App on your signature. What other app(s?) do you have about Magic: The Gathering?
If you have any tips or requests about mtgjson, I'll take a look if it's feasible.
Feature request: create a history of scanned cards and a button on the main view that you can refer to such list (and display the card information when selecting a item from the list).
Hi @Andarilhomtg Thanks for taking on this responsibility
Small question about the cardId field, since I'm working on a new database structure for my site - I've noticed that the SHA1 hashes used for cardIds in MTGJSON aren't necessarily unique. Is it possible to refine the cardId field a bit going forward?
Private Mod Note
():
Rollback Post to RevisionRollBack
Minouris's Library - Collection manager and deck builder. It's nifty - Check it out!
@cyclotis04 Basically, I did a bunch of database inserts using cardId as a primary key, and got duplcate primary key clashes.
Unfortunately, SHA is a hash, not a UUID, so it can't guarantee uniqueness. The bigger the dataset, the bigger the chance of a duplicate.
I've tried a couple of different solutions, but haven't managed to find one yet that passes my basic criteria (must be unique, must be able to be used in a URL / XML without requiring encoding, preferably fixed width, and able to be reproduced predictably from card data, or the same across multiple updates).
The best solution I can come up with from the source data end would be if each card record in MTGJSON were assigned a UUID at initial creation time, but that updates to the file used the fields used to generate the cardId hash when identifying which record to update, so that the ID stays constant.
Edit: It'd actually be handy if each entity described in a record had its own ID, now that I think about it - each record basically describes a single printing of a single playable (of which there can be more than one on a split, flip or double-faced card) on a card. Card, Printing and Playable can all be considered separate entities, potentially needing their own ids for linking purposes.
@cyclotis04 Basically, I did a bunch of database inserts using cardId as a primary key, and got duplcate primary key clashes.
Not sure what this 'cardId' you are referring to. The card objects in mtgjson have an 'id' field. Did you mean that?
Because on that field, there are no duplicate id's.
The mtgjson code checks for this every time the JSON files are generated and I also just tested them again just to be sure. The point of this field is to be unique and it is indeed, unique.
Unfortunately, SHA is a hash, not a UUID, so it can't guarantee uniqueness. The bigger the dataset, the bigger the chance of a duplicate
Yes, it is technically possible for there to be a collision with a SHA1 hash. However is is EXTREMELY unlikely. See: http://crypto.stackexchange.com/questions/2583/is-it-fair-to-assume-that-sha1-collisions-wont-occur-on-a-set-of-100k-strings
That URL talks about how hashing 100,000 strings and even over 1 million strings, produced no collisions. It goes on to talk about really big numbers before generating any collisions in theory. There are only 29,416 cards in the MTGJSON files. Even with 100 more years of MTG cards, it is unlikely to have a collision, but as I said, this is checked automatically when the JSON is generated to ensure there are no collisions, just in case.
id is the one I mean, yes - sorry, getting my terminology mixed up.
I'll stick some more checks in my code, to be sure, and try to run an independent simulation (without so may moving parts), to see if I can come up with some concrete examples.
Not trying to ruffle any feathers here
Private Mod Note
():
Rollback Post to RevisionRollBack
Minouris's Library - Collection manager and deck builder. It's nifty - Check it out!
SHA1 does generate duplicates in some cases. The unique id problem was solved a couple of months ago, though. I believe one has to use a string which contains (english card name + expansion name + image name) to generate an unique SHA1.
Aye, you are correct, it is indeed unique and the SHA1 card 'id' is made up of (setCode + cardName + cardImageName). It's mentioned in the mtgjson docs.
Sorry folks, my face is covered in egg (bonus: it's covering up that embarassed red hue). I did some tests, and couldn't reproduce the duplicate IDs I saw before. I'll just be crawling back to my hole
Private Mod Note
():
Rollback Post to RevisionRollBack
Minouris's Library - Collection manager and deck builder. It's nifty - Check it out!
For some bizarro reason, in the Clash Pack both Temple of Mystery and Courser of Kruphix are numbered as #6 in the set. I've checked the card art, and this is on the card as well (card printing error, maybe?).
Technically correct, but obviously causes some issues when getting the image from MagicCards.info, which has Courser as #12. Not sure whether this is the place to fix it, or whether ths should just be here as an FYI for the people who need to be aware of it.
Private Mod Note
():
Rollback Post to RevisionRollBack
Minouris's Library - Collection manager and deck builder. It's nifty - Check it out!
I'm going to put together some loops and insert it all into a MySQL database. Woo.
Note that not all fields are set for each record, as well (or at least that used to be the case) - the following saved me a lot of grief when I first started using this with PHP:
function ifPropertyExists($object, $propertyName, $altValue) {
if (is_object($object)) {
if (property_exists($object, $propertyName)) {
return $object->{$propertyName};
} else {
return $altValue;
}
} else if ((array) $object === $object) {
if (isset($object[$propertyName])) {
return $object[$propertyName];
} else {
return $altValue;
}
}
}
Works for both object and array decided versions of the data
Private Mod Note
():
Rollback Post to RevisionRollBack
Minouris's Library - Collection manager and deck builder. It's nifty - Check it out!
To post a comment, please login or register a new account.
Currently I'm just working out how to get it up and running on my machine. It seems like before anyone will be able to take it over, it might need to be cleaned up a little around the edges. I'm currently fighting through node package errors..
I have a quick question...why the All cards doesn't have multiversid field?
Am i missing something at json files?
Thanks in advance
AllCards takes data from multiple sets and creates a single card entry. So anything that is set specific (like multiverseid) is excluded.
Best to use AllSets if you need the multiverseid.
Thanks Sembiance - you've been amazing
Minouris's Library - Collection manager and deck builder. It's nifty - Check it out!
I'm the one who took over the project. I hope to exceed your expectations!
If you want to know anything, just ask away!
I'll keep it as up-to-date as possible.
I don't plan to make any app-breaking changes anytime soon, but I'll try to resolve the issues over github (new and old).
If I come up with something that may break current apps (like version 3.0.0), I'll try to keep the 'old' version around for a while, after the announcement.
I'm already on the lookout for the cards of Oath of the Gatewatch and the announced commander sets (one card was already leaked, but is not on any database anywhere).
I'm going to take a look at the App on your signature. What other app(s?) do you have about Magic: The Gathering?
If you have any tips or requests about mtgjson, I'll take a look if it's feasible.
You did a very good job on reading the card info using the camera... Is the project open source? Or is the "retrieving the card name" part?
Small question about the cardId field, since I'm working on a new database structure for my site - I've noticed that the SHA1 hashes used for cardIds in MTGJSON aren't necessarily unique. Is it possible to refine the cardId field a bit going forward?
Minouris's Library - Collection manager and deck builder. It's nifty - Check it out!
Unfortunately, SHA is a hash, not a UUID, so it can't guarantee uniqueness. The bigger the dataset, the bigger the chance of a duplicate.
I've tried a couple of different solutions, but haven't managed to find one yet that passes my basic criteria (must be unique, must be able to be used in a URL / XML without requiring encoding, preferably fixed width, and able to be reproduced predictably from card data, or the same across multiple updates).
The best solution I can come up with from the source data end would be if each card record in MTGJSON were assigned a UUID at initial creation time, but that updates to the file used the fields used to generate the cardId hash when identifying which record to update, so that the ID stays constant.
Edit: It'd actually be handy if each entity described in a record had its own ID, now that I think about it - each record basically describes a single printing of a single playable (of which there can be more than one on a split, flip or double-faced card) on a card. Card, Printing and Playable can all be considered separate entities, potentially needing their own ids for linking purposes.
Minouris's Library - Collection manager and deck builder. It's nifty - Check it out!
Not sure what this 'cardId' you are referring to. The card objects in mtgjson have an 'id' field. Did you mean that?
Because on that field, there are no duplicate id's.
The mtgjson code checks for this every time the JSON files are generated and I also just tested them again just to be sure. The point of this field is to be unique and it is indeed, unique.
Yes, it is technically possible for there to be a collision with a SHA1 hash. However is is EXTREMELY unlikely. See: http://crypto.stackexchange.com/questions/2583/is-it-fair-to-assume-that-sha1-collisions-wont-occur-on-a-set-of-100k-strings
That URL talks about how hashing 100,000 strings and even over 1 million strings, produced no collisions. It goes on to talk about really big numbers before generating any collisions in theory. There are only 29,416 cards in the MTGJSON files. Even with 100 more years of MTG cards, it is unlikely to have a collision, but as I said, this is checked automatically when the JSON is generated to ensure there are no collisions, just in case.
I'll stick some more checks in my code, to be sure, and try to run an independent simulation (without so may moving parts), to see if I can come up with some concrete examples.
Not trying to ruffle any feathers here
Minouris's Library - Collection manager and deck builder. It's nifty - Check it out!
Aye, you are correct, it is indeed unique and the SHA1 card 'id' is made up of (setCode + cardName + cardImageName). It's mentioned in the mtgjson docs.
Minouris's Library - Collection manager and deck builder. It's nifty - Check it out!
However, there's an error with Beatdown:
Sengir Vampir and Erhnam Djinn need "border":"black"
Technically correct, but obviously causes some issues when getting the image from MagicCards.info, which has Courser as #12. Not sure whether this is the place to fix it, or whether ths should just be here as an FYI for the people who need to be aware of it.
Minouris's Library - Collection manager and deck builder. It's nifty - Check it out!
This works:
$jsondata = file_get_contents('BFZ.json');
$data = json_decode($jsondata, true);
$id = $data['name'];
echo $id;
This doesn't:
$jsondata = file_get_contents('BFZ.json');
$data = json_decode($jsondata, true);
$id = $data['cards']['name'];
echo $id;
Any ideas before I head over to Stack Exchange?
$jsondata = file_get_contents('BFZ.json');
$data = json_decode($jsondata, true);
$cards = $data['cards'][0]['name'];
echo $cards;
I'm going to put together some loops and insert it all into a MySQL database. Woo.
Note that not all fields are set for each record, as well (or at least that used to be the case) - the following saved me a lot of grief when I first started using this with PHP:
Works for both object and array decided versions of the data
Minouris's Library - Collection manager and deck builder. It's nifty - Check it out!