ZeroQI / Hama.bundle

Plex HTTP Anidb Metadata Agent (HAMA)
GNU General Public License v3.0
1.21k stars 114 forks source link

Naming Scheme "Show Title (year)" (according to Anidb) is not being recognized properly #575

Open Hidara1904 opened 3 months ago

Hidara1904 commented 3 months ago

LOGS

Re:Zero kara Hajimaru Isekai Seikatsu (2018) Re Zero kara Hajimeru Isekai Seikatsu (2018).filelist.log Re Zero kara Hajimeru Isekai Seikatsu (2018).scanner.log Re Zero kara Hajimeru Isekai Seikatsu (2018).agent-update.log Re Zero kara Hajimeru Isekai Seikatsu (2018).agent-search.log Re:Zero kara Hajimaru Isekai Seikatsu (2020) Re Zero kara Hajimeru Isekai Seikatsu (2020).scanner.log Re Zero kara Hajimeru Isekai Seikatsu (2020).filelist.log Re Zero kara Hajimeru Isekai Seikatsu (2020).agent-update.log Re Zero kara Hajimeru Isekai Seikatsu (2020).agent-search.log Re:Zero kara Hajimaru Isekai Seikatsu (2021) Re Zero kara Hajimeru Isekai Seikatsu (2021).filelist.log Re Zero kara Hajimeru Isekai Seikatsu (2021).scanner.log Re Zero kara Hajimeru Isekai Seikatsu (2021).agent-search.log *.agent-update.log is not created for this

Note:.agent-update.log is sometimes created and sometimes not. Mostly not.

First of all I'll say, I just posted an issue before this. #574 . This may or may not be related to that issue.

Summary:

Anime Title (year) is not being given the correct anidb-id. Many animes on AniDB have titles with year. It is usually with titles that have two parts for a single season. This issue does not occur with animes that get a 100% score (meaning if they satisfy the condition if orig_title == title in the search function in AniDB.py). For Example:

This only happens if the title has to go through the "keyword search". Specifically if they go through cleanse_title(string) function in common.py. For Example:

Reasons:

This is happening because in the cleanse_title(string) function, the (year) gets stripped from the title. And then the cleansed title is left with "shingeki no kyojin the final season". Then both the first part and the second part get a 98 score. And the last anidb entry is chosen which is "Shingeki no Kyojin: The Final Season (2022)". Image: Capture As you can tell, the two parts got merged together in the same show.

My Temporary Solution

I managed to solve this by changing the regex in the common.py (local copy) cleanse_title(string) for replacing the parentheses with ' '. Before: while re.search(r'\([^\(\)]*?\)', string): string = re.sub(r'\([^\(\)]*?\)', ' ', string) After: while re.search(r'\([^\(\)]{5,}\)', string): string = re.sub(r'\([^\(\)]{5,}\)', ' ', string) So it only replaces it with a ' ', if there are more than 4 characters in the parentheses. Now I know this is not a good solution to the problem, but I'm don't know python and did not want to risk writing a new function.

NOTE

I noticed a year variable in the code files. I would assume that the variable was there to check for the year. Was that supposed to trigger for TV shows as well? Or is it just supposed to be for movies. Because it is not showing anything for me.

ZeroQI commented 4 days ago

orig_title: 'Re Zero kara Hajimeru Isekai Seikatsu (2018)', orig_title_cleansed: 're zero kara hajimeru isekai seikatsu' [-] score: 98, aid: 11370, title: "Re:Zero kara Hajimeru Isekai Seikatsu" [-] score: 98, aid: 13430, title: "Re:Zero kara Hajimeru Isekai Seikatsu (2018)"

http://api.anidb.net:9001/httpapi?request=anime&client=hama&clientver=1&protover=1&aid=13430

<titles>
<title xml:lang="x-jat" type="main">Re:Zero kara Hajimeru Isekai Seikatsu (2018)</title>
<title xml:lang="en" type="synonym">Re:ZERO -Starting Life in Another World- OVAs</title>
<title xml:lang="ru" type="synonym">Re: Жизнь в другом мире с нуля - Снежные воспоминания</title>
<title xml:lang="ko" type="synonym">Re: 제로부터 시작하는 이세계 생활 (2018)</title>
<title xml:lang="x-jat" type="short">rezero movie</title>
<title xml:lang="x-jat" type="short">re:zero ova</title>
<title xml:lang="ja" type="official">Re:ゼロから始める異世界生活 (2018)</title>
<title xml:lang="en" type="official">Re:Zero - Starting Life in Another World (2018)</title>
<title xml:lang="de" type="official">Re:ZERO -Starting Life in Another World- OVAs</title>
<title xml:lang="ru" type="official">Re:Zero — жизнь с нуля в другом мире OVA</title>
<title xml:lang="zh-Hant" type="official">Re:從零開始的異世界生活 OVA</title>
</titles>

Please have root/Grouping folder/Series folder:

For the screen capture:

It might not change much here though, the agent handles years ok as long as the title doesn't have a weird character like semicolon preventing the 100% match. I would use the forced ID in the sequel there to be fair...

I am not sure if no space instead of a space when replacing the semicolon makes a difference