nanozuki / dantalian

A nfo file generator for your anime. Source from Bangumi.
GNU General Public License v3.0
86 stars 7 forks source link

Use template string to replace regex #36

Open nanozuki opened 3 years ago

nanozuki commented 3 years ago

Regular expression is too hard to write, use and debugging, even to exprienced developers! So I want to use template string to configure episode to replace reguar expression.

episode = ひぐらしのなく頃に 業 EP{ep}.mp4

for more complex example:

episode = [dantalian字幕组][化物語][{ep}][1080p].mp4

for sp:

odd taxi SP{sp}.mkv
nanozuki commented 3 years ago

@laxect Do we need user to write whole name string, include extension name? (or just filename or just substring)

exoticknight commented 3 years ago

is ep or sp some sort of predefined syntax?

nanozuki commented 3 years ago

is ep or sp some sort of predefined syntax?

ep for episode number, sp for special episode number.

For example, episode = ひぐらしのなく頃に 業 EP{ep}.mp4 will match ひぐらしのなく頃に 業 EP01.mp4, ひぐらしのなく頃に 業 EP05.mp4.

exoticknight commented 3 years ago

is ep or sp some sort of predefined syntax?

ep for episode number, sp for special episode number.

For example, episode = ひぐらしのなく頃に 業 EP{ep}.mp4 will match ひぐらしのなく頃に 業 EP01.mp4, ひぐらしのなく頃に 業 EP05.mp4.

well then consider using episode instead of ep, special instead of sp?

nanozuki commented 3 years ago

well then consider using episode instead of ep, special instead of sp?

"ep" and "sp" is common abbr in this situation and already used in dantalian.

laxect commented 3 years ago

What about support template without droping regex support?

nanozuki commented 3 years ago

What about support template without dropping regex support?

Considering backward compatibility, the support of regex will continue. I am thinking what is the priority if template string and regex are configured both? To report an error is also a choice in this case.

laxect commented 3 years ago

What about support template without dropping regex support?

Considering backward compatibility, the support of regex will continue. I am thinking what is the priority if template string and regex are configured both? To report an error is also a choice in this case.

Just use regex and print a warn?