-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Adding more Card-Sets from CrCast #342
Comments
Sounds like a good source, and the API is set up to mimic CardCast's, so it should be pretty simple to port across the old CardCast code to their site. I jumped onto their Discord and checked this would be OK with them, they gave the green light, only point of note being:
I don't know when I'd get a chance to implement this, but it should be pretty simple to do, so if someone wants to pick it up, please feel free. |
Working on it in f012004. Making good progress, just need to do some code clean-up etc. Problems so far:
|
We've changed domains to crcast.cc domains. The old ones still work for everything that is still using them. And i * think * we don't really format the text of cards, but i've noticed the issue with newlines. When requesting a deck from the API the text is fine, but the frontend doesn't show the newlines for some reason. |
As far as I can tell, none of the decks on CrCast actually have newlines? My memory is a bit foggy now as to whether or not the json format had support for multiple lines. I couldn't find any example decks that had them. This is the CrCast example API deck's cards in json: https://api.crcast.cc/cc/decks/VD5MM/cards Would you be able to explain the format? {
"error": 0,
"calls": [
{
"text": [
"Black Card",
"with",
"multiple underscores",
""
]
},
{
"text": [
"Black Card without underscore",
""
]
},
{
"text": [
"Black Card with underscore",
""
]
}
],
"responses": [
{
"text": [
"White Card 1"
]
},
. . .
]
} I'm assuming that each text element in the calls text arrays should have an underscore after it, and the empty string is there to show an underscore is needed? So how is a new line signified? Also should I make any assumptions about formatting (punctuation, capitals etc), or just trust the json and only put a space and then an underline after each element in the calls text array? For the responses, there's a text array that I don't think I saw utilised. Is the array for multiple lines? I've only really seen single element arrays when looking at decks. |
The endpoints starting with /cc are there to imitate the old cardcast api. We then added another endpoint, which just combines the output of the 2 above in one single endpoint: https://api.crcast.cc/v1/cc/decks/VD5MM/all
The array "calls" contains all black cards. Every black card is an object with a text array. Underscores should be between every string in the text array and empty strings are just there to indicate an underscore at the end of a text. In the end the text of a black card can be merged by this example javascript code: var card = { text: ["Black Card", "with", "multiple underscores", ""] };
var bcText = card.text.join(" ___ ");
console.log(bcText);
// Black Card ___ with ___ multiple underscores ___ The "responses" array contains all white cards. White cards only have one element in the text array because they don't have "spaces for cards". So the array always contains only one string.
Newlines are just "\n" in the strings. I have updated the test deck to include cards with multiple lines.
We generally don't format texts. So they should be like a user has put them in. We also have another endpoint next to the cardcast endpoints, which uses a different json format: https://api.crcast.cc/v1/VD5MM This endpoint returns information about a deck and the cards it contains in one endpoint but formatted differently. Instead of splitting it and returning it as an array it just returns it as a single string. Underscores are just single underscores in the string and newlines are indicated by "\n". Example response from https://api.crcast.cc/v1/VD5MM{
"error": 0,
"deck": {
"deckcode": "VD5MM",
"name": "Test Deck",
"description": "This is a Deck to test the API Endpoints",
"language": "en",
"nsfw": 0,
"blacks": [
{
"text": "Black Cards _ with underscores _ and newlines:\nsecond line\nthird line with underscore _"
},
{
"text": "Black Card _ with _ multiple underscores _"
},
{
"text": "Black Card without underscore"
},
{
"text": "Black Card with underscore _"
}
],
"whites": [
{
"text": "White Card with multiple lines:\nsecond line\nthird line"
},
{
"text": "White Card 1"
},
{
"text": "White Card 2"
},
{
"text": "White Card 3"
}
]
}
} I know that our documentation is "not good", but we are working on it to include more details about possible responses and so on. |
Also worth looking at the old code from when CardCast was up, as it was working with that format so a lot of it should be reusable. |
Describe the feature
Hi, it would be nice if you could add CrCast (https://cast.clrtd.com/) to the list of deck sources. They also feature a JSON API (see https://cast.clrtd.com/api) with seems not so different from Many Decks, so i hope it would be not so complicated.
Greets,
Sebastian.
The text was updated successfully, but these errors were encountered: