hummingbird-me / kitsu-tools

:hammer: The tools we use to build Kitsu, the coolest platform for anime and manga
https://kitsu.app
Apache License 2.0
2.09k stars 265 forks source link

APIv1 anime objects have empty title values #623

Closed gnawf closed 9 years ago

gnawf commented 9 years ago

Some anime objects returned by APIv1 have an empty title value when English is selected as the primary language.

Excerpt from api/v1/anime/durarara?title_language_preference=english

{
  "id": 4696,
  "slug": "durarara",
  "title": "",
  "alternate_title": "Durarara!!",

Other affected titles include aldnoah-zero-2, hunter-x-hunter-2011, psycho-pass, eureka-seven

erengy commented 9 years ago

Can be reproduced by setting the title_language_preference parameter to english: https://hummingbird.me/api/v1/anime/4696?title_language_preference=english

Probably related to 0a3c19a10bb320e73ee8b9658748cadfa75e2a68, or more specifically, this line. I don't know Ruby, but is this because alt_title is empty string rather than nil for these series?

gnawf commented 9 years ago

Ah. I didn't know that you could supply the preference language like that, thanks.

DNA commented 9 years ago

I've looked at this issue and @erengy was right on the exactly problematic line. It happens because there's some titles there is just an empty string on the database, so rails think it's a valid string. Unfortunately this fact slipped though me when I refactored the code, but I'll send a fix for it asap.

z411 commented 9 years ago

Indeed, it appears those are shows that have an empty title in the database, because in the official web site they also appear as empty when searching for them. If that's the case, then the API is not really broken in this regard and should be fixed in the database instead?

be8646bc-53e1-11e5-9fcb-153471bc4ea0

erengy commented 9 years ago

I think there's still an issue with canonical title preference.

URL title
/api/v1/anime/7898 :x:
/api/v1/anime/7898?title_language_preference=canonical :x:
/api/v1/anime/7898?title_language_preference=english :white_check_mark:
/api/v1/anime/7898?title_language_preference=romanized :white_check_mark:

Also, alternate_title should be empty in the third case, rather than returning the same value. But obviously this is a minor issue.