Skip to content

[HUNO] Description and MediaInfo as .txt#1322

Open
azulu wants to merge 1 commit intoAudionut:masterfrom
azulu:huno-desc-txt
Open

[HUNO] Description and MediaInfo as .txt#1322
azulu wants to merge 1 commit intoAudionut:masterfrom
azulu:huno-desc-txt

Conversation

@azulu
Copy link
Copy Markdown

@azulu azulu commented Mar 26, 2026

Addresses the API changes in HUNO 0.7.0.
The torrent description and MediaInfo data are now passed as .txt files.

There still remains the issue of the upload response. The torrent will upload successfully and correctly, but src/trackers/UNIT3D.py is unable to process the response in its current state.
Without essentially replacing upload(), it's not achievable to process the download URL within src/trackers/HUNO.py.
I would propose introducing a hook in src/trackers/UNIT3D.py to handle extracting the downurl that would allow more flexibility.
At the moment, src/trackers/UNIT3D.py is hardcoded with downurl=response_data["data"] that's limited to that specific format.

Summary by CodeRabbit

  • Bug Fixes
    • Updated description and media information handling to be included as separate text files in uploads.

@github-actions
Copy link
Copy Markdown

Thanks for taking the time to contribute to this project. Upload Assistant is currently in a complete rewrite, and no new development is being conducted on this python source at this time.

If you have come this far, please feel free to leave open, any pull requests regarding new sites being added to the source, as these can serve as the baseline for later conversion.

If your pull request relates to a critical bug, this will be addressed in this code base, and a new release published as needed.

If your pull request only addresses a quite minor bug, it is not likely to be addressed in this code base.

Details for the new code base will follow at a later date.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 26, 2026

📝 Walkthrough

Walkthrough

The HUNO tracker implementation has been refactored to move description and mediainfo generation from return values in get_description and get_mediainfo methods to file writing in get_additional_files. Both getter methods now return empty dictionaries, while additional files handling generates and writes description.txt and mediainfo.txt files.

Changes

Cohort / File(s) Summary
HUNO Tracker Refactoring
src/trackers/HUNO.py
Modified get_description and get_mediainfo to return empty dicts; relocated description and mediainfo generation logic to get_additional_files method, which now writes description.txt and mediainfo.txt files with UTF-8 encoding.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • Audionut

Poem

🐰 Files rearranged with care,
Descriptions moved from here to there,
Text files born from hidden seams,
Cleaner code, now living dreams!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: converting description and MediaInfo generation to output as .txt files in the HUNO tracker implementation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/trackers/HUNO.py`:
- Around line 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.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5f86181c-5345-4f6c-999a-cc327667a099

📥 Commits

Reviewing files that changed from the base of the PR and between 1d607db and 483f83b.

📒 Files selected for processing (1)
  • src/trackers/HUNO.py

Comment thread src/trackers/HUNO.py
Comment on lines +163 to +168
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')
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.

@Audionut
Copy link
Copy Markdown
Owner

Probably the easiest method:

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

Successfully merging this pull request may close these issues.

2 participants