refactor(aither): AKA formatting - #1376
Conversation
|
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. |
📝 WalkthroughWalkthroughAITHER.get_name now derives a computed year (honoring no_year, TV search_year, and manual_year) and uses it for REMUX+DVD foreign-language suffixes; it also extracts alt_title from metadata and reorders the first "{year} {alt_title}" substring to "{alt_title} {year}" before returning the final name. ChangesAITHER Tracker Naming Enhancements
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/trackers/AITHER.py`:
- Line 68: The assignment to year in the AITHER tracker is inconsistent: change
the branch that sets year = meta["year"] when meta["search_year"] != "" to
convert the value to a string (e.g., year = str(meta["year"])) so year is always
a string like the other branch; update the assignment in the block that
references meta["search_year"] and ensure subsequent string operations in the
same function (the code around lines using year on lines ~79 and ~98) will
receive a consistent str type.
- Line 79: The code calls aither_name.replace(year, f"{year} {foreign_lang}", 1)
without guarding for an empty year, which causes unwanted insertion when year ==
""; update the logic around the aither_name replacement to first check that year
is truthy/non-empty (and optionally that no_year is False) before performing
aither_name.replace(...), so skip the replacement entirely when year is empty;
refer to the variables aither_name, year, foreign_lang and any no_year flag in
the surrounding function in AITHER.py to locate and fix the code.
- Around line 66-71: The year computation in src/trackers/AITHER.py currently
applies the no_year flag first but then overwrites it with TV-specific logic and
manual_year; update the logic so that meta["no_year"] takes final precedence
(mirror upstream get_name.py behavior): compute year from meta["year"], TV
branch (meta["category"] == "TV" and meta["search_year"] != ""), and
manual_year_value as now, but after those steps check meta.get("no_year", False)
and if True set year = "" (or otherwise ensure no_year cannot be overridden);
reference the variables/year assignment and the branches handling
meta["category"] == "TV", manual_year_value, and meta["no_year"] to locate where
to reorder the checks.
🪄 Autofix (Beta)
✅ Autofix completed
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Fixes Applied SuccessfullyFixed 1 file(s) based on 3 unresolved review comments. Files modified:
Commit: The changes have been pushed to the Time taken: |
Fixed 1 file(s) based on 3 unresolved review comments. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/trackers/AITHER.py (1)
100-101:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winGuard against empty year in alt_title reordering.
When
yearis empty (e.g., whenno_year=Trueafter line 73), the replace pattern becomesf" {alt_title}"(space + alt_title). This could incorrectly match and reorder a space-prefixed alt_title elsewhere in the name, even though no year is present. This is analogous to the issue fixed on line 81.🛡️ Proposed fix to skip reordering when year is empty
- if alt_title: + if alt_title and year: aither_name = aither_name.replace(f"{year} {alt_title}", f"{alt_title} {year}", 1)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/trackers/AITHER.py` around lines 100 - 101, The current alt_title reorder uses a replace with f"{year} {alt_title}" which will misfire when year is empty; update the block that mutates aither_name (the if alt_title: branch) to skip the replace unless year is non-empty (or !no_year) so you only call aither_name.replace(f"{year} {alt_title}", ...) when year is truthy; reference the variables aither_name, alt_title and year (and the existing no_year flag) to locate and gate the operation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/trackers/AITHER.py`:
- Around line 100-101: The current alt_title reorder uses a replace with
f"{year} {alt_title}" which will misfire when year is empty; update the block
that mutates aither_name (the if alt_title: branch) to skip the replace unless
year is non-empty (or !no_year) so you only call aither_name.replace(f"{year}
{alt_title}", ...) when year is truthy; reference the variables aither_name,
alt_title and year (and the existing no_year flag) to locate and gate the
operation.
Summary by CodeRabbit