Giter VIP home page Giter VIP logo

Comments (18)

bberna avatar bberna commented on September 6, 2024

Hello,

I started to implement the price data fetching from MKM but it seems to use specific ids for identifying cards. I think that adding them to the bdd would be a good idea, but it is also possible to get the price by the name and set. However this latter solution require to search among all cards that have the same name, therefore that can be longer for cards with many reprints. In addition, a request can't return more than 100 cards, then it can require more than one request for cards like basic lands.

I didn't find many information about the card database. I thought about adding a new column to the cards table, and modifying every "patch" file. About those files, do you have some tools to edit them easily?

Also for now I don't know how to to browse MKM marketplace without an acount, I'm waiting for a response from them. It's likely that it will not be possible until the API v1.1 then I asked them if it was ok to create a dummy account for the application, I'm still waiting for a response.

from mtg-familiar.

AEFeinstein avatar AEFeinstein commented on September 6, 2024

Price lookups through the TCGPlayer API are already done by name and set, and basic land lookups aren't any slower than other searches. With a set + name search, at most four basic lands would be returned, far short of 100. Where would you get the MKM ids anyway?

I am generally averse to adding columns to the database. Not that it can't be done, it's just a hassle. I have a tool to make new patch files, but it's not checked into GitHub. I should fix that.

After reading some documentation, waiting for v1.1 of the API with widget applications, seems like the best way of going about things, for now.

from mtg-familiar.

bberna avatar bberna commented on September 6, 2024

With a set + name search, at most four basic lands would be returned, far short of 100.

I didn't explained correctly, sorry. It's not possible to make a request with name and set. You can only give name, and the response contain information about every cards with this name in a XML form, including their set and productId. You have then to look through this XML to find the entry that match with your set name. It is documented here : https://www.mkmapi.eu/ws/documentation/API_1.0:Products (please take a look at the example at the end) and it's the same in the v1.1.
Then you can only request for example for "Forest" and it give you a response composed of an entry by forest by set containing one (about 450 cards so 5 requests). Not that the cards are actually sorted by set, and the most recent set are the lasts.
The other way to get product information is by the ProductId. I already wrote a script that get the productId given a card name and a set. Stocking those Id in the db allow to make all those search
a priori and access very quickly to the card in the app. However, for most card the search process will be very short so both solution are OK I think. I personally prefer the DB one because I reduce the need to network bandwidth and is IMO more elegant, but please tell me what you prefer.

I have a tool to make new patch files, but it's not checked into GitHub. I should fix that.

Thank you :)

After reading some documentation, waiting for v1.1 of the API with widget applications, seems like the best way of going about things, for now.

Yes, i'll just work with my account for finishing the implementation and I'll make the pull request when the v1.1 version will be fully available. (Please don't hesitate to tell me if my code is bad, event if the amount of code to actually write is small)

from mtg-familiar.

AEFeinstein avatar AEFeinstein commented on September 6, 2024

Ah, I understand now, I find it a shortcoming that you can only search by name and not name+set. If you ever get a response from them, you should propose a name+set search.

A good middle ground for product IDs would be to build the script into the app, and then save the ID into the database so that it doesn't have to be recalculated each time. How does your script work anyway?

And don't worry, I'll check your code :)

from mtg-familiar.

bberna avatar bberna commented on September 6, 2024

I received a response yesterday about the API. The "widget app" will be available both for the v1.0 and v1.1 which change only by using OAuth instead of an apikey. It will be deployed on the beta test server this week, but there is no date for the deployment on the real server.

My scripts does request with the name of the card and search through all the version of this card the one with the good set. I began to modify all the patches too add the id (that also allowed me to see how MKM handle special names, split cards, etc., which is not precised in the documentation) and it appears that only one request is needed for every cards but basic lands so yes we can insert the ids in the db in a lazy way (or I could finish to modify the patches but the "upToM14" one seems to fail, maybe I make too much request in a row). It also showed me that some special cards like plans from planshase 2012 are associated with a special set that is not Planeshase 2012, and it seems that it doesn't work with TCGplayer with the current code either (try for example to add "Stairs to Infinity" to your whishlist).

Another concern is that there are and there will be some duplicated code for currency management and price engine option between the Trade fragment and the Wishlist fragment (for example for price option you used translated string in the trade fragment but not in the whishlist fragment). I thought about an abstract class for example "PriceFragment" that could be a parent class of TradeFragment and WishlistFragment and would manage the price engine and currency work but maybe it is not desirable to have too many inheritance.

from mtg-familiar.

AEFeinstein avatar AEFeinstein commented on September 6, 2024

I think we'll have to add some fields to the PriceInfo class, and then add the MKM code to loadDataFromNetwork() in the PriceFetchRequest class. There shouldn't be much duplicated code there, although someone will have to change the preference to add MKM to the current list of TCGPlayer Hi/Med/Low/Foil.

"Stairs to Infinity" does not appear to exist on TCGPlayer.com, which is likely the problem there. We can only be as good as our data sources, not better. Is it possible to do multiple queries for basic land prices, and then cache the ID? I would still be happy with a slow initial lookup and a fast one afterwards.

If you look in the database table for card sets, there is a column for TCGPlayer.com names, since they can differ for old sets ("Alpha Edition" for TCGPlayer.com, "Limited Edition Alpha" on Gatherer). Will we need another column for MKM name?

from mtg-familiar.

bberna avatar bberna commented on September 6, 2024

I think we'll have to add some fields to the PriceInfo class, and then add the MKM code to loadDataFromNetwork() in the PriceFetchRequest class. There shouldn't be much duplicated code there, although someone will have to change the preference to add MKM to the current list of TCGPlayer Hi/Med/Low/Foil.

In the code I pushed I added the currency management to the Tradefragment but yeah it could be better to move everything in the PriceInfo objetcs. MKM does not provide High price so I removed it from the choices when MKM is chosen (still in the code I pushed).

Is it possible to do multiple queries for basic land prices, and then cache the ID? I would still be happy with a slow initial lookup and a fast one afterwards.
If you look in the database table for card sets, there is a column for TCGPlayer.com names, since they can differ for old sets ("Alpha Edition" for TCGPlayer.com, "Limited Edition Alpha" on Gatherer). Will we need another column for MKM name?

I already have a PriceFetchRequest that almost work (still some problem with certain cards) with MKM, the set name used are the fullname that is in the database so we won't need other column.

from mtg-familiar.

AEFeinstein avatar AEFeinstein commented on September 6, 2024

Sounds good. I'll take a peek at your fork later.

from mtg-familiar.

bberna avatar bberna commented on September 6, 2024

Hello,

I'm still implementing the feature of adding the mkmid after the first request (note that the rest is pushed, the tests are done from my account so I removed my apikey from the sources). I didn't have a lot of time these days but MKM seems to take time to deploy their API also :p. Unfortunately, I discovered that some set names in the database don't match with the set names used by MKM. I'll make a full comparison, and if it's only some set I can hardcode the transformation (for example it seems that for core set I only have to remove "core set" from the name stored in the database). If there are to many differences in names i'll add a column in the database (something like "MKM set name"). You wrote the comment "why can't everything be consistent?", I can't agree more :p

EDIT: done : http://pastebin.com/5JAFDf1z So there are 16 set that are not consistent with MKM on 122 stored in the database (there are a lot more in MKM but most of them are non-relevant). Don't know if it deserve a new column in the database. I admit that the idea to modify every patch seems boring (althought it should be quite fast now that I have python script to manage them).

from mtg-familiar.

bberna avatar bberna commented on September 6, 2024

HI

I was very busy thoses days, but now I have time and I pushed a version that fetch price as a widget app from the version 1.1 of the API. I used signpost library to manage the OAuth part, since it's very lightweight and already used in some android applications. I had to slightly modify the signing part however, because normal OAuth provider seems to require a percent-encoded signature and MKM don't. This is the reason of the new class. For now the request is on the beta test server of MKM.

I still need to care of the few different set names between the database and MKM, so if I add a field in the set table (like "mkm_setname") I need to modify all the patches. While I have some python script that could do that, maybe it would be better to modify the tools you use for building patches?

from mtg-familiar.

AEFeinstein avatar AEFeinstein commented on September 6, 2024

We're all pretty busy these days. I'm a little ashamed to admit, but I still build the TCG names patch file by hand. I believe we'll have to add a similar file for MKM names. If you have a python script to generate it, we'll use that.

Separately, I did start making a tool to generate patches, but I was sidetracked before I finished. One day.

from mtg-familiar.

AEFeinstein avatar AEFeinstein commented on September 6, 2024

My patch building tool is nearing completion. Do you have a list of MKM names which I can put into the config file?

from mtg-familiar.

AEFeinstein avatar AEFeinstein commented on September 6, 2024

I received a notification about a CSV, but don't see it posted here. Can you upload it again?

from mtg-familiar.

bberna avatar bberna commented on September 6, 2024

Yes it seems it's impossible to attach a CSV so I sended an email but it seems the adress was wrong, sorry. So here http://pastebin.com/SRYEdQ2J is the correspondance between MTGFamiliar database setnames and MKM setnames in CSV (id,code,MTGFname,MKMname). And here http://pastebin.com/8B9j6Zvp is the complete MKM setnames list, which is larger.

Brice

from mtg-familiar.

AEFeinstein avatar AEFeinstein commented on September 6, 2024

The full MKM setname list includes cards which are not listed on Gatherer. I plugged those values into my patch generator, and you can find the result here: mkmnames.json. It'll have to be processed similarly to how TCGnames.json is processed.

from mtg-familiar.

fenfir avatar fenfir commented on September 6, 2024

Has there been any more work done on this? I was trying to trade cards earlier and MKM is terrible on mobile. I can't seem to find any options to enable on mtg familliar. I was about to start my own when i stumbled across this thread.

from mtg-familiar.

AEFeinstein avatar AEFeinstein commented on September 6, 2024

I haven't done any work on it, and it looks like bberna's fork hasn't been touched since last July. You are more than welcome to give it a shot, and I'll help if you need. I'd recommend forking from master, not bberna's attempt, as a starting point.

from mtg-familiar.

AEFeinstein avatar AEFeinstein commented on September 6, 2024

New documentation URL: https://api.cardmarket.com/ws/documentation

from mtg-familiar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.