Add "seconds" support in anime duration

Issue #120 new
sugar created an issue

Some anime has duration in seconds.

https://myanimelist.net/anime/29347/20-dai_no_Heya-hen (15 sec) https://myanimelist.net/anime/4966/Jigazou (12 sec) https://myanimelist.net/anime/31634/Kokuhaku (40 sec)

Please add support for those format.

Thanks.

Comments (6)

  1. Michael Johnson

    Probably not going to happen until API3 due to breaking changes needed to handle either a change to report in seconds or change to a float to allow partial minutes.

  2. sugar reporter

    alright. i could modify the code myself.

    do you guys have a roadmap? so we know what's going to add/fix/remove in next version.

  3. Michael Johnson

    I'm thinking about how to best format this. Rather than converting all times to seconds, I'd rather give richer data if possible.

    I was thinking of possibly using the ISO 8601 duration format (see https://en.wikipedia.org/wiki/ISO_8601#Durations). It's a bit odd looking, but we're talking about machine-consumable information anyway. Since it's a standard, there should be decent support for various languages. I see native support with .NET, PHP, and Ruby on Rails. I can imagine other languages also have support in some manner.

    As an example, a show with 24 minute episodes would have a duration returned of "PT24M". A movie of 1 and a half hours would be "PT1H30M". Likewise, 45 seconds would be "P45S". Since we'd be using MAL's data, we may also return values like "PT90M" which is also valid.

    Alternately, we could define an alternate format like "hh:mm:ss" (which is actually a variation of the "Alternate format" for durations in ISO 8601). Note that this may require additional processing in the API so we properly "roll over" the values (this may work okay by using the 8601 format internally and using the format function to push to our custom format). The problem with a custom format is that API consumers may need to write their own parser and we're not relying on a standard format. Where possible, I've been trying to rely on defined standards to avoid this.

    I know this isn't going to go in until API 3, so it gives time to think about and get it right. Any thoughts on this?

  4. Log in to comment