Skip to content
This repository was archived by the owner on Jun 14, 2026. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions src/trackers/HUNO.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,10 @@ async def check_image_hosts(self, meta: dict[str, Any]) -> None:
)

async def get_description(self, meta: dict[str, Any]) -> dict[str, str]:
image_list = meta['HUNO_images_key'] if 'HUNO_images_key' in meta else meta['image_list']

return {'description': await DescriptionBuilder(self.tracker, self.config).unit3d_edit_desc(meta, image_list=image_list, approved_image_hosts=self.approved_image_hosts)}
return {}

async def get_mediainfo(self, meta: dict[str, Any]) -> dict[str, str]:
if meta['bdinfo'] is not None:
mediainfo = await self.common.get_bdmv_mediainfo(meta, remove=['File size', 'Overall bit rate'])
else:
async with aiofiles.open(f"{meta['base_dir']}/tmp/{meta['uuid']}/MEDIAINFO_CLEANPATH.txt", encoding='utf-8') as f:
mediainfo = await f.read()

return {'mediainfo': mediainfo}
return {}

async def get_featured(self, _meta: dict[str, Any]) -> dict[str, Any]:
return {}
Expand Down Expand Up @@ -160,8 +152,22 @@ async def get_internal(self, meta: dict[str, Any]) -> dict[str, str]:
return {'internal': str(internal)}

async def get_additional_files(self, meta: dict[str, Any]) -> dict[str, Any]:
_ = meta
return {}
files = await super().get_additional_files(meta)

image_list = meta['HUNO_images_key'] if 'HUNO_images_key' in meta else meta['image_list']
description = await DescriptionBuilder(self.tracker, self.config).unit3d_edit_desc(
meta, image_list=image_list, approved_image_hosts=self.approved_image_hosts
)
files['description'] = ('description.txt', description.encode('utf-8'), 'text/plain')

if meta['bdinfo'] is not None:
mediainfo = await self.common.get_bdmv_mediainfo(meta, remove=['File size', 'Overall bit rate'])
else:
async with aiofiles.open(f"{meta['base_dir']}/tmp/{meta['uuid']}/MEDIAINFO_CLEANPATH.txt", encoding='utf-8') as f:
mediainfo = await f.read()
files['mediainfo'] = ('mediainfo.txt', mediainfo.encode('utf-8'), 'text/plain')
Comment on lines +163 to +168

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use meta.get('bdinfo') for consistency with parent class.

Line 163 uses meta['bdinfo'] which will raise KeyError if the key is absent, whereas the parent UNIT3D.get_mediainfo() uses meta.get('bdinfo') with a None check. For defensive consistency:

🛡️ Proposed fix
-        if meta['bdinfo'] is not None:
+        if meta.get('bdinfo') is not None:

Note on static analysis S108: The /tmp/ warning is a false positive—this uses the project's {base_dir}/tmp/{uuid}/ structure, not the system temp directory.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if meta['bdinfo'] is not None:
mediainfo = await self.common.get_bdmv_mediainfo(meta, remove=['File size', 'Overall bit rate'])
else:
async with aiofiles.open(f"{meta['base_dir']}/tmp/{meta['uuid']}/MEDIAINFO_CLEANPATH.txt", encoding='utf-8') as f:
mediainfo = await f.read()
files['mediainfo'] = ('mediainfo.txt', mediainfo.encode('utf-8'), 'text/plain')
if meta.get('bdinfo') is not None:
mediainfo = await self.common.get_bdmv_mediainfo(meta, remove=['File size', 'Overall bit rate'])
else:
async with aiofiles.open(f"{meta['base_dir']}/tmp/{meta['uuid']}/MEDIAINFO_CLEANPATH.txt", encoding='utf-8') as f:
mediainfo = await f.read()
files['mediainfo'] = ('mediainfo.txt', mediainfo.encode('utf-8'), 'text/plain')
🧰 Tools
🪛 Ruff (0.15.7)

[error] 166-166: Probable insecure usage of temporary file or directory: "/tmp/"

(S108)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/trackers/HUNO.py` around lines 163 - 168, Replace the direct key access
meta['bdinfo'] with the defensive lookup meta.get('bdinfo') in the
HUNO.get_mediainfo (or the method containing that mediainfo block) so it behaves
like the parent UNIT3D.get_mediainfo; specifically change the condition at the
start of the block to use meta.get('bdinfo') and keep the existing None check
and downstream logic (including calls to self.common.get_bdmv_mediainfo and file
read) so a missing bdinfo key does not raise KeyError.


return files

async def get_audio(self, meta: dict[str, Any]) -> str:
channels = str(meta.get('channels', "") or "")
Expand Down
Loading