m13253/danmaku2ass

Current comment file format probe algorithm is not robust

Closed this issue · 6 comments

Currently, Danmaku2ASS probes comment file format by prefetching the first bytes.

However, this may fail because there may be some <!-- XML comments --> (#8) or the JSON object may be reordered.

I am considering a robust algorithm which look into the XML or JSON format to figure out which file format is used.

I am too lazy to gather sample from each site, but by looking into the code I think different site has by no mean robust format which makes friendly for library, so I suggest that there MUST be an option let the user manually declare where the danmaku is coming from, regardless how robust the library automatically handles.

I have added 5 lines of if-else to support NicoFox because I am using it. Feel free to pull or not to. Thanks.

I have added 5 lines of if-else to support NicoFox because I am using it. Feel free to pull or not to. Thanks.

Pulled. Thanks for your improvements.

Maybe I will do a complete refactor this summer, introducing a better algorithm at that time.
It's hard to say whether I will have time then. 😄

Maybe also doing a reformat if have time? The 79 column rule :P

Maybe also doing a reformat if have time? The 79 column rule :P

Yeah. I can't even face the source code I have written before. So ugly.
I need some reformat this summer vacation.

Fixed in #38