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

Suicide Squad Isekai is pulling the Japanese episode summaries from TVDB #576

Open
Jinra opened this issue Aug 22, 2024 · 8 comments
Open

Comments

@Jinra
Copy link

Jinra commented Aug 22, 2024

Problem

Oddly enough, the series summary is in english, but episode summaries are pulling from the Japanese version. I've done quite a bit of testing in the bundle, but can't figure out why it only wants to pull Japanese.

I've tested on another anime that's inheriting from TVDB (Berserk 1997), but that pulls both series and episode summaries in English as expected. Any API calls either from CLI or browser, both pull summaries in english, even when copying the exact headers and token the bundle is using.

Here's a python snippet I've been using for testing. The only way I can get it to pull in Japanese is to change the Accept-Language key value to ja

import requests

url = 'https://api.thetvdb.com'
test_ep = '/series/436846/episodes?page=1'
token = 'A27AD9BE0DA63333'
login_ep = '/login'
headers = {
    'User-agent': 'Plex/HAMA',
    'Content-type': 'application/json',
    'Accept-Language': 'en'
}
bearer_token = ''

data = {
    'apikey': token
}

if not bearer_token:
    r = requests.post(url+login_ep, headers=headers, json=data)
    bearer_token = r.json()['token']

headers['Authorization'] = f'Bearer {bearer_token}'
r = requests.get(url+test_ep, headers=headers)

Log Snippet

[X]    s1e1 s01e001 anidbid:   18098 air_date: 2024-06-27 abs_number: 1, title: 第1話
 - [1] title:   [en] 第1話
 - [1] summary: [en] ″新しい世界″。狂気に満ちた理想を掲げ毎夜ゴッサム・シティを暴れ回るハーレイ・クインとジョーカーだったが、カタナの襲撃により、ハーレイは監獄にブチ込まれてしまう。収監の半年後、A.R.G.U.S長官のアマンダはハーレイを気絶させ監獄から連れ出し、ヘリコプターへと乗せる。目を覚ましたハーレイの目の前にいたのは、悪党面したおっさん=デッドショット、お調子者のナルシスト=クレイフェイス、ズタ袋を被ったマッチョマン=ピースメイカー!!意味不明な状況下、モニター越しのアマンダから告げられたのは、爆弾付きの極秘ミッションだった!!
common.SaveFile() - CachePath: '/config/Library/Application Support/Plex Media Server/Plug-in Support/Data/com.plexapp.agents.hama/DataItems', file: 'TheTVDB/json/436846/episode_9879316_ja.json'

Root Agent Log

2024-08-22 00:20:16,149 - 15151ea57b38 - Fetching 'https://api.thetvdb.com/series/436846/episodes?page=1' from the HTTP cache
2024-08-22 00:20:16,171 - 15151ea57b38 - Downloaded URL 'https://api.thetvdb.com/series/436846/episodes?page=1'
@ZeroQI
Copy link
Owner

ZeroQI commented Aug 22, 2024

Plex library language is the one used for the summaries, whether series or episodes.
Metadata source for each is not indicated.

I've done quite a bit of testing in the bundle, but can't figure out why it only wants to pull Japanese.

If you did look in the series specific logs, it tells the metadata source priority for each field AND which source provided which value... Logs location is in the troubleshooting section of the readme

@Jinra
Copy link
Author

Jinra commented Aug 22, 2024

If you did look in the series specific logs, it tells the metadata source priority for each field AND which source provided which value

Yes and it is as I mentioned, they're both pulling from TVDB. I'm just not sure why it's pulling the Japanese version

Plex library language is the one used for the summaries, whether series or episodes.

Library is set to English, and language priorities are only en

Source Log

metadata.seasons[ 1].episodes[  1]
[?] rank: 0, source_title:   AniDB, title: "Episode 1"
[!] title: Episode 1, language_rank 0, rank: 0, len(languages): "3"
[=] title                          Sources: (AniDB), TheTVDB                                              Inside: '['TheTVDB', 'AniDB']'  Value: 'Episode 1'
[=] summary                        Sources: (TheTVDB)                                                     Inside: '['TheTVDB']'  Value: '″新しい世界″。狂気に満ちた理想を掲げ毎夜ゴッサム・シティを暴れ回るハーレイ・クインとジョーカーだったが、カタナの襲撃により、ハーレイは監獄にブチ込まれてしまう..'
[=] originally_available_at        Sources: (AniDB), TheTVDB                                              Inside: '['TheTVDB', 'AniDB']'  Value: '2024-06-27'
[=] directors                      Sources: (AniDB),TheTVDB                                               Inside: '['AniDB']'  Value: 'Osada Eri'
[=] producers                      Sources: (AniDB),TheTVDB                                               Inside: '['AniDB']'  Value: 'Umehara Eiji,Nagatsuki Tappei'
[=] rating                         Sources:  TheTVDB, AniDB| TheTVDB, (AniDB)                             Inside: '['AniDB']'  Value: '3.20'
[=] thumbs                   ( 1)  Sources: (TheTVDB)                                                     Inside: '['TheTVDB']'  Value: '{'https://thetvdb.plexapp.com/banners/v4/episode/9879316/screencap/667c2935936db.jpg': ('TheTVDB/episodes/667c2935936db.jpg', 1, None)}'
[=] duration                       Sources: (TheTVDB), AniDB, MyAnimeList, TheMovieDb, OMDb               Inside: '['TheTVDB', 'AniDB']'  Value: '1440000'
[=] content_rating                 Sources: AniDB, (TheTVDB)                                              Inside: '['TheTVDB']'  Value: 'TV-MA'

@ZeroQI
Copy link
Owner

ZeroQI commented Aug 22, 2024

https://api.thetvdb.com/series/436846/episodes?page=1 doesn't have japanese summary, title pulled from AniDB.

Cached file japanese indeed
TheTVDB/json/436846/episode_9879316_ja.json

Don't have logs so cannot check the json for each episode by clicking on it to identify the issue...

@Jinra
Copy link
Author

Jinra commented Aug 22, 2024

https://api.thetvdb.com/series/436846/episodes?page=1 doesn't have japanese summary, title pulled from AniDB.

Yea I'm only talking about the summaries. There is a Japanese summary which is what Hama is pulling for episodes_page1-en.json attached here episodes_page1_en.json

Don't have logs so cannot check the json for each episode by clicking on it to identify the issue...

Here are the full logs
Suicide Squad ISEKAI {imdb-tt28279848}.agent-update.log

@Jinra
Copy link
Author

Jinra commented Aug 23, 2024

After some more digging and testing. I think the problem is the line here

lang2 = 'en' if len(language_episodes)<=1 else language_episodes[1]

This seems to determine the search language. I have my priority setup as en, x-jat, ja. Since line 71 defining language_episodes seems to ignore x-jat, the remaining array is just ['en', 'ja']. The logic in line 234 seems to ignore the first priority item entirely and use the language at index 1 which is ja for me.

@ZeroQI
Copy link
Owner

ZeroQI commented Oct 21, 2024

common.SaveFile() - CachePath: '/config/Library/Application Support/Plex Media Server/Plug-in Support/Data/com.plexapp.agents.hama/DataItems', file: 'TheTVDB/json/436846/episodes_page1_en.json'
=> the file says english but contain Japanese summaries, is loaded at that line, and use lang variable (the library language which is set to english)

episodes_json_page = LoadFileTVDB(id=TVDBid, filename='episodes_page{}_{}.json'.format(next_page, lang), url=TVDB_EPISODE_PAGE_URL.format(id=TVDBid, page=next_page), headers={'Accept-Language': lang})

delete the cached file, metadata search for series and modify title searched to "clear-cache", cancel, and refresh metadata and check this json file content for english summary

@ZeroQI
Copy link
Owner

ZeroQI commented Nov 11, 2024

Issue still present ?

@Jinra
Copy link
Author

Jinra commented Nov 12, 2024

it might be, but I've adjusted my language to only have en as a workaround

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

No branches or pull requests

2 participants