fireattack / chapter_converter

Convert between different video chapter file formats
MIT License
37 stars 5 forks source link

[Feature Request]Add support for taking space as delimiter or no specific delimiter characters #7

Closed Ethkuil closed 1 year ago

Ethkuil commented 1 year ago

Accept input with spaces or no specific characters as delimiter. eg:

17:02  Eternal Harmony  平山笑美, 雨宮天, 麻倉もも, 阿部里果, 村川梨衣
42:19 Princess Be Ambitious!!   山崎はるか, 郁原ゆう, 原嶋あかり, 伊藤美来, 村川梨衣, 木戸衣吹
58:10Angelic Parade♪    平山笑美, 香里有佐, 近藤唯, 末柄里恵, 小笠原早紀, 麻倉もも, 高橋未奈美
1:11:00.942  Come on a Tea Party!   麻倉もも
1:42:10.255FairyTaleじゃいられない 雨宮天, 南早紀, 渡部恵子, 戸田めぐみ, 阿部里果, 中村温姫
1:46:02 ZETTAI×BREAK!! トゥインクルリズム    トゥインクルリズム (原嶋あかり, 伊藤美来, 村川梨衣)
1:50:32  Marionetteは眠らない    山崎はるか, 郁原ゆう, 末柄里恵, 木戸衣吹, 中村温姫
2:30:41.155 Melty Fantasia  EScape (阿部里果, 南早紀, 雨宮天)
2:35:11.696はなしらべ    郁原ゆう
2:45:42 ココロがかえる場所   郁原ゆう, 香里有佐, 近藤唯, 戸田めぐみ
2:55:24  瑠璃色金魚と花菖蒲  南早紀

It's just the way people usually input timeline. For example, people usually type a timeline with such a format in comment zone. Human can recognize chapter with this format and so does program.

And with some little change, we can get a format that also contains tab format and simple format. A regex pattern can be

r"(?P<time>[0-9]+:[0-9]{1,2}[0-9:.]*)([\s,]+(?P<name1>.+)|(?P<name2>[^\d:.\s,].+))"  # only one of name1 and name2 will be matched