feat: add translated logo with tmdb#118
feat: add translated logo with tmdb#118chaffy999 wants to merge 1 commit intoTimilsinaBimal:mainfrom
Conversation
|
@chaffy999 is attempting to deploy a commit to the Bimal Timilsina's projects Team on Vercel. A member of the Team first needs to authorize it. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces significant enhancements to how media metadata, specifically logos, posters, and backgrounds, are handled by integrating with The Movie Database (TMDB) for language-specific assets. A new API endpoint has been added to expose this functionality, allowing clients to request media images tailored to a specific language. The existing metadata processing has been updated to leverage these new TMDB capabilities, ensuring that translated logos are prioritized and displayed when available, improving the localization and user experience. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new feature to fetch translated logos, posters, and backgrounds from TMDB, exposing them through a new API endpoint and integrating them into the recommendation catalog. The implementation is mostly solid, but I've found a significant logical bug in the batch processing of metadata that would prevent the feature from working correctly in all cases. I've also included a minor suggestion to improve code readability in the image selection logic. Addressing the bug is important for the feature's correctness.
| image_tasks = [_images_one(d) for d in details_list if d] | ||
| images_list = await asyncio.gather(*image_tasks, return_exceptions=True) | ||
|
|
||
| format_task = [] | ||
| for i, details in enumerate(details_list): | ||
| if not details: | ||
| continue | ||
| logo_url = None | ||
| if i < len(images_list): | ||
| imgs = images_list[i] | ||
| if isinstance(imgs, dict): | ||
| logo_url = imgs.get("logo") or None | ||
| format_task.append(cls.format_for_stremio(details, media_type, user_settings, logo_url=logo_url)) |
There was a problem hiding this comment.
There is a logic error in how details_list is correlated with images_list. images_list is created from a filtered version of details_list (where details is not None), making it potentially shorter. The current loop iterates over details_list with an index i, and uses i to access images_list. This will fail to assign logos for items that appear after a failed detail fetch in the details_list.
To fix this and improve readability, it's better to create a list of successful details first, fetch images for them, and then use zip to iterate over both lists together.
successful_details = [d for d in details_list if d]
image_tasks = [_images_one(d) for d in successful_details]
images_list = await asyncio.gather(*image_tasks, return_exceptions=True)
format_task = []
for details, imgs in zip(successful_details, images_list):
logo_url = None
if isinstance(imgs, dict):
logo_url = imgs.get("logo")
format_task.append(cls.format_for_stremio(details, media_type, user_settings, logo_url=logo_url))| for lang in preferred_lang_codes: | ||
| for img in images_list: | ||
| iso = img.get("iso_639_1") | ||
| if (iso or None) == (lang if lang else None): |
There was a problem hiding this comment.
The condition to check for language equality can be simplified for better readability. The expressions (iso or None) and (lang if lang else None) are redundant. iso (from img.get(...)) and lang are already effectively str | None, so a direct comparison iso == lang is sufficient and clearer.
| if (iso or None) == (lang if lang else None): | |
| if iso == lang: |
No description provided.