Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom mapping: reorder/multiple lines/save Examples for each pattern/enable button #902

Open
Fmajor opened this issue Nov 24, 2023 · 5 comments

Comments

@Fmajor
Copy link

Fmajor commented Nov 24, 2023

I'm a Chinese user, I use nzbhydra2 to remap the titles so that sonarr can parse the title.

50% of the title from my Indexers (like dmhy,mikan in zh-CN) can not be parsed by sonarr, the are like

【喵萌奶茶屋】★10月新番★[星灵感应星屑テレパスHoshikuzu Telepath][07][1080p][简日双语][招募翻译校对]
[千夏字幕组][某科学的一方通行Toaru Kagaku no Accelerator][第01-12话][BDRip_1080p_AVC][简体][合集][千夏15周年] 
[千夏字幕组][月亮与莱卡与吸血公主Tsuki to Laika to Nosferatu][第01-12话][BDRip1080pHEVC][简繁内封][合集]
[离谱Sub] 星灵感应 星屑テレパス Hoshikuzu Telepath [07][AVC AAC][1080p][简体内嵌][招募翻校轴]
[LoliHouse] 关于我转生变成史莱姆这档事 彩叶草之梦/柯里乌斯之梦 / Tensei shitara Slime Datta Ken - Coleus no Yume [01-03 合集][WebRip 1080p HEVC-10bit AAC][简繁内封字幕][Fin]

So to write a workable regexp, I have to test it agains more than 10 patterns(each time I make some changes). I want this procedure to be more efficient.

  • What do you want to happen?
  1. make the Example query/title field for custom query to be multiple lines. And also save it when we submit it.
    we will always need examples to test the regexp, so we really need to save them.
  2. make enable button for them.
  3. give ways to reorder the regexp maps. Currently I assume that upper ones have the highest priority and the map will stop if the upper one is matched (If not, please make it.)
  4. make a name field for them so I can make notes on what is this regexp doing
  • Do you think it's something only you need or something that might be popular?
    Since the sonnar team has clearly refused to add a custom parser for series link (and people have been complaining about this for a long time), the only way to make it work for BT seeds in Chinese (and may also for other languages) is to remap the title by nzbhydra2.
    To wirte regexps, we need tests and trials, so the test examples is as important as the regexp itself, we need to test multiple of them to save time. And we also need other features above to speed up.
@theotherp
Copy link
Owner

Do you have examples for patterns you use and need to test?

Does https://regex101.com/ help? I use it every time I need to write regexes.

@Fmajor
Copy link
Author

Fmajor commented Nov 24, 2023

this is an example that I'm testing

INPUT: {G:^\[[^\]]*\]}{preT:[\[ ]}{T:[^\]]*}{postT:[\] ]}{preE:\[}{preEDrop:第?}{Es:\d\d?\d?\d?}{Em:\s?[-~~]\s?}{Ee:\d\d?\d?\d?}{postEDrop:[话話]?}{extra:(\s?END)?(\+SP)?(\+OVA)?}{heji:\s*(精校|修正)?(合集)?}{postE:\]}{post:.*$}
OUTPUT: {G} {T} {preE}{Es}-{Ee}{postE}{post}{heji}{extra}
Examples:
[G][T][01-12合集][others] 
[G][T][01 - 12合集][others] 
[G][T][01-12 合集][others] 
[G][T][01-12修正合集][others] 
[G][T][第01-12话][others] 
[G][T][第01-12话 合集][others] 
[G][T][第01 - 12话 合集][others] 
[G][T][第01-12+SP+OVA][others] 
[G][T][第01-12+SP][others] 
[G][T][第01-12+OVA][others] 

It will handle the 合集(season pack) characters and other patterns, which will be used by different people...
I want to see all the results in a single test

And also, we have to use the special type of named groups, like {title:.*}, not the common ones, like (?<named>.*),can we directly test our INPUT, like the above one, in https://regex101.com/ ? Or we have to first make a workable regexp, and the convert it into our special regexp syntax?

And also, how can we make more complex regexp, like nested named groups (?<named>(?<subname1>[abc])(?<subname2>[def]).*)?

@Fmajor
Copy link
Author

Fmajor commented Nov 24, 2023

I'd like to share what I have done

# name: Specials 73ACG
{G:\[[^\]]*\]}{alias:.+}/{title:[^\|]+?}{S:(S\d\d)?}{skip:\s?\|\s?}{Es:\d\d}{Edrop:-}{Ee:\d\d}{suffix:.*$}
{G}{title}[{S}E{Es}-E{Ee}]{suffix}[{alias}]
[桜都字幕组7³ACG] 关于我在无意间被隔壁的天使变成废柴这件事/お隣の天使様にいつの間にか駄目人間にされていた件/Otonari no Tenshi-sama S01 | 01-12 [简繁字幕] BDrip 1080p x265 FLAC 2.0(repack)
[桜都字幕组7³ACG] 为美好的世界献上爆焰!/この素晴らしい世界に爆焔を!/Kono Subarashii Sekai ni Bakuen o S01 | 01-12 [简繁字幕] BDrip 1080p x265 FLAC 2.0 
[桜都字幕组7³ACG] 百合是我的工作!/私の百合はお仕事です!/Watashi no Yuri wa Oshigoto Desu! S01 | 01-12 [简繁字幕] BDrip 1080p x265 FLAC 2.0
[桜都字幕组7³ACG] 总之就是非常可爱 第二季/トニカクカワイイ 2nd Season/Tonikaku Kawaii S02 | 01-12+OVA制服 [简繁字幕] BDrip 1080p x265 FLAC 2.0

# name: [G][T][EXX], add / and handle season pack
{G:^\[[^\]]*\]}{preT:[\[ ]}{T0:(?![^/_]*[/_])[^\]]*}{T1:[^\x00-\x7F]}{T2:[^\]]*}{postT:[\] ]}{preE:\[}{preEDrop:第?}{E:\d\d?\d?\d?}{postEDrop:[话話]?}{extra:(\s?END)?}{postE:\]}{post:.*$}
{G} {T0}{T1}/{T2} {preE}{E}{postE}{post}{extra}
[离谱Sub] 星灵感应 星屑テレパス Hoshikuzu Telepath [07][AVC AAC][1080p][简体内嵌][招募翻校轴]
[喵萌奶茶屋][星灵感应星屑テレパスHoshikuzu Telepath][07][720p][简日双语][招募翻译校对]
[喵萌奶茶屋][家里蹲吸血姬的苦闷ひきこまり吸血姫の闷々Hikikomari Kyuuketsuki no Monmon][06][1080p][简体][招募翻译校对]

【喵萌奶茶屋】★10月新番★[星灵感应星屑テレパスHoshikuzu Telepath][07][720p][简日双语][招募翻译校对]
【喵萌奶茶屋】★10月新番★[家里蹲吸血姬的苦闷ひきこまり吸血姫の闷々Hikikomari Kyuuketsuki no Monmon][06][1080p][简体][招募翻译校对]

# name: [G][T][EXX-XX], add / and handle season pack
{g1:(?![^/]*/)(.*)}{g2:([^\x00-\x7F])}{g3:(.*)}
{G:^\[[^\]]*\]}{preT:[\[ ]}{T0:(?![^/_]*[/_])[^\]]*}{T1:[^\x00-\x7F]}{T2:[^\]]*}{postT:[\] ]}{preE:\[}{preEDrop:第?}{Es:\d\d?\d?\d?}{Em:\s?[-~~]\s?}{Ee:\d\d?\d?\d?}{postEDrop:[话話]?}{extra:(\s?END)?(\+SP)?(\+OVA)?}{heji:\s*(精校|修正)?(合集)?}{postE:\]}{post:.*$}
{G} {T0}{T1}/{T2} {preE}{Es}-{Ee}{postE}{post}{heji}{extra}
[千夏字幕组][月亮与莱卡与吸血公主Tsuki to Laika to Nosferatu][第01-12话][BDRip1080pHEVC][简繁内封][合集]
[千夏字幕组][某科学的一方通行_Toaru Kagaku no Accelerator][第01-12话][BDRip_1080p_AVC][繁体][合集][千夏15周年]


# [G][T][EXX-XX], only handle season pack
{G:^\[[^\]]*\]}{preT:[\[ ]}{T:[^\]]*}{postT:[\] ]}{preE:\[}{preEDrop:第?}{Es:\d\d?\d?\d?}{Em:\s?[-~~]\s?}{Ee:\d\d?\d?\d?}{postEDrop:[话話]?}{extra:(\s?END)?(\+SP)?(\+OVA)?}{heji:\s*(精校|修正)?(合集)?}{postE:\]}{post:.*$}
{G} {T} {preE}{Es}-{Ee}{postE}{post}{heji}{extra}
[G][T][01-12合集][others] 
[G][T][01-12 合集][others] 
[G][T][01-12修正合集][others] 
[G][T][第01-12话][others] 
[G][T][第01-12话 合集][others] 
[G][T][第01-12+SP+OVA][others] 
[G][T][第01-12+SP][others] 
[G][T][第01-12+OVA][others] 
[动漫国字幕组LoliHouse] 为美好的世界献上爆焰! / Kono Subarashii Sekai ni Bakuen wo! [01-12 精校合集][WebRip 1080p HEVC-10bit AAC][简繁内封字幕][Fin]
[LoliHouse] 关于我转生变成史莱姆这档事 彩叶草之梦/柯里乌斯之梦 / Tensei shitara Slime Datta Ken - Coleus no Yume [01-03 合集][WebRip 1080p HEVC-10bit AAC][简繁内封字幕][Fin]
[LoliHouse] 蓝眼武士 / Blue Eye Samurai [01-08 合集][WebRip 1080p HEVC-10bit AAC][简繁英内封字幕][Fin]
[喵萌ProductionLoliHouse] BanG Dream! It's MyGO!!!!! [01-12 合集][WebRip 1080p HEVC-10bit AAC][简繁日内封字幕][Fin]
[LoliHouse] 主宰七魔剑 / 七魔剑支配天下 / Nanatsu no Maken ga Shihai suru [01-15 合集][WebRip 1080p HEVC-10bit AAC][简繁内封字幕][Fin]
[北宇治字幕组] 不死少女・杀人笑剧 / Undead Girl・Murder Farce [01-13 合集][v2][WebRip][1080p][HEVC_AAC][简体内嵌]
[Lilith-Raws] 炎炎消防队 贰之章 / Enen no Shouboutai S02 - 24 [BiliBili][WEB-DL][1080p][AVC AAC][CHT][MKV]
  • I made 4 Custom mappings, and each of them do different things. (the name field is needed, I need some where to make comments)
  • They must be this order to work properly (reorder function is needed, or I will have to delete and recreate to reorder)
  • I need to make share that the example is mapped as I thought, and I need also confirm that some example is not matched (so I need the multiple line function to test them in one click, currently I need to copy and paste all of them every time when I change the regexp)

Now I have make many entries back to work for my sonarr, the custom mapping function is really helpful
As I need to add more rules in the future, I really need the new features mentioned above

Thanks!

@theotherp
Copy link
Owner

Sorry, I'm a bit busy righ now. Don't know when I'll have time to look further into this.

@Fmajor
Copy link
Author

Fmajor commented Dec 1, 2023

ok, that's only feature requests, take your time~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants