-
-
Notifications
You must be signed in to change notification settings - Fork 4
Chinese collections cannot fetch theme songs. #389
Comments
Regarding the modification to the quote, I think we'd need something more robust than that. It's unlikely that Chinese characters are the only ones with issues. This is the function we're currently using. https://github.com/squaresmile/Plex-Plug-Ins/blob/fc4ab34d4cb995668abd84b304b57c5bf13cb69d/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/utilkit.py#L229 If we're going to move to a non framework method, we should probably use urllib3 instead of urllib. Regarding why it doesn't work after you adjust the quoting, the reason is the results are returning in English, but your query is in Chinese. for result in tmdb_data['results']:
if result['name'].lower() == search_query.lower() or \
'{} {}'.format(search_query.lower(), end_string).lower() == result['name'].lower():
collection_id = int(result['id']) Your @zdimension didn't you confirm that collections are working for you in French? Is Plex returning the TMDB results in French for you in this case? |
Does Plex's Python version support urllib3? I tried adding a language parameter to the |
We can add it as a dependency. It's already a sub dependency of
This would be nice. I don't know if the service Plex provides for the TMDB lookup supports a language query. As far as I know, it's completely undocumented. I have a note in the code:
This is from the official TMDB api. I don't know if using the plex service, passes through every parameter or if it's sanitized somehow. TMDB language reference: https://developer.themoviedb.org/docs/languages |
Plex staff mentioned that it's not possible to add a language option for Otherwise, the only option is to use the ID of the collection information that ranks first in the returned results as the collection ID. This way, language issues can be ignored, without using precise matching, but it may lead to matching errors in certain cases. |
Unless I'm missing something, I think the service just passes through the entire query. It would seem odd that Plex accepts language for this code, but parse it out for collections. And with that, I got it to work. You have to URL encode the
or locally in a browser
should both work. I tested in my browser and get the following: {
"page": 1,
"results": [
{
"adult": false,
"backdrop_path": "/dOSECZImeyZldoq0ObieBE0lwie.jpg",
"id": 645,
"name": "詹姆斯·邦德(系列)",
"original_language": "en",
"original_name": "James Bond Collection",
"overview": "007是风é�¡å…¨ç�ƒçš„一系列è°�战电影,007ä¸�仅是影片的å��称,更是主人公特工詹姆斯·邦德的代å�·ã€‚詹姆斯·邦德(英è¯:James Bond)是一套å°�说和系列电影的主角å��称。å°�说原作者是英国作家伊æ�©Â·ä½›èŽ±æ˜Žã€‚在故事里,邦德是英国情报机构军情å…处的间è°�,代å�·007,被授予å�¯ä»¥é™¤åŽ»ä»»ä½•å¦¨ç¢�行动的人的æ�ƒåŠ›ï¼Œæ¤å¤–,詹姆斯·邦德总是有美女相伴,那些女士被称为\"邦女郎\"。 他冷酷但多情,机智且勇敢,总能在最å�±éš¾æ—¶åŒ–险为夷,也总能邂逅一段浪漫的爱情。历任007都是大帅哥,å†�åŠ ä¸Šæ€§æ„Ÿæ¼‚äº®çš„é‚¦å¥³éƒŽï¼Œä»¥å�Šæ‰£äººå¿ƒå¼¦çš„精彩剧情,让这部影片直至今天ä»�被广大影迷所çƒçˆ±ã€‚ 第一部007电影于1962å¹´10月5æ—¥å…¬æ˜ å�Žï¼Œ007电影系列风é�¡å…¨ç�ƒï¼Œåˆ°ä»Šå¤©åŽ†ç»�五å��余年长盛ä¸�衰。",
"poster_path": "/oKDxj9E15x3DjSjl4TnSWVUaVSw.jpg"
}
],
"total_pages": 1,
"total_results": 1
} Finally, I'd probably try to avoid talking about this plugin on the Plex forum. For sure we're doing stuff that they won't appreciate, by hacking their TMDB service among other things. They aren't too friendly to third party plugins these days. |
I changed the
Understood, I got it. |
Could you try this build? https://github.com/LizardByte/Themerr-plex/actions/runs/8316419576?pr=395 So far, I didn't do anything special to handle the unicode... but I suspect the framework may handle that automatically. |
I tested it, and the returned data is still in Unicode encoding. It seems like I didn't retrieve the theme song for the collection. If it were successful, what message should appear in the log?
|
Okay, I think we just need to modify this part of the code now. if result['name'].lower() == search_query.lower() or \
'{} {}'.format(search_query.lower(), end_string).lower() == result['name'].lower():
collection_id = int(result['id']) I don't know how to get them to match though. |
I added some code to print the comparison content between the search query and the returned collection name on the console. The code is as follows:
I found that one of the values includes the
I'm not sure at which step the I'm not sure why you defined
After removing You might be adding "Collection" to Plex collection titles that don't already contain it to match the collection titles on TMDB. However, besides English, I'm not sure if other languages also use the "Collection" suffix. In my case, my collection titles already include the Chinese version of "Collection" (系列), so there's no need to add "Collection" as an
|
It's because in english the collections end with that on TMDB. They may or may not do that on Plex, depending on the agent that is used. The new movie agent will just use "James Bond" for example, but the legacy agents will use "James Bond Collection". |
Good catch. I made a small adjustment to strip the query back to the search term, and use that for the comparison. |
Describe the Bug
When using the original version of
tmdb_helper.py
, Chinese titled collections cannot retrieve corresponding TMDB data. Here's an example of the log:After testing, I found that the issue lies with URL encoding. Since collections are searched and matched on TMDB using their titles, the original script uses the
String.Quote
function which utilizes Unicode escape sequence URL encoding. For example, "黑夜传说(系列)" would be encoded as:I made some modifications to the script. Now, when the title is in Chinese, it uses the
urllib.quote
function with UTF-8 encoding for URL encoding. For titles in other languages, the script still uses theString.Quote
function. For example, "黑夜传说(系列)" would now be encoded as:The modified
tmdb_helper.py
is as follows:After the modification, TMDB data for collections with Chinese titles can now be retrieved. For example:
However, collections with Chinese titles still cannot fetch theme songs, while collections with English titles can. For example, I have one collection titled "James Bond Collection" and another titled "詹姆斯·邦德(系列)" in two separate libraries. The collection with the English title successfully fetched the theme song, but the one with the Chinese title did not.
I'm not sure if there are notifications in the logs for fetching theme songs for collections because I haven't seen any "data found for collection" notifications while monitoring the logs. It might be challenging to filter logs based on this. However, in the WebUI, I noticed that only collections in the English library fetched theme songs, while collections in the Chinese library did not. I hope we can find the reason for this discrepancy.
Furthermore, even though we've retrieved data from TMDB, the collection IDs in the logs still show as None. Is this normal? Also, in the WebUI, it displays as "No known ID," despite some collections having successfully matched data from TMDB.
I'm puzzled as well. Both collections with Chinese and English titles have successfully matched with TMDB. So, it's unclear why only collections with English titles are fetching theme songs. There might be a specific issue or limitation in the retrieval process that's causing this discrepancy. It could be worth investigating further to understand the root cause.
How does Themerr search and match collections in ThemerrDB? Is the issue possibly occurring here?
Expected Behavior
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: