-
-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: detecting multiple episodes in symlink library #862
fix: detecting multiple episodes in symlink library #862
Conversation
WalkthroughThe pull request introduces substantial modifications to the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Outside diff range and nitpick comments (2)
src/program/services/libraries/symlink.py (2)
176-181
: Simplifysymlinked
andupdate_folder
assignmentsThe
symlinked
attribute is set toTrue
in both branches of the condition, andupdate_folder
is assigned in both branches with only the value differing. Simplify the code by consolidating these assignments to reduce redundancy and enhance readability.Apply this diff to streamline the code:
episode_item.set("symlinked", True) - if settings_manager.settings.force_refresh: - episode_item.set("update_folder", str(Path(directory) / show / season / episode)) - else: - episode_item.set("update_folder", "updated") + update_folder_value = ( + str(Path(directory) / show / season / episode) + if settings_manager.settings.force_refresh + else "updated" + ) + episode_item.set("update_folder", update_folder_value)
183-184
: Ensureis_anime
attribute is correctly set onepisode_item
The
is_anime
attribute is being set within the loop for episodes. Confirm that this attribute is meant to be set on eachepisode_item
. Ifshow_item.is_anime
is already set, this assignment might be redundant.
Have you tested this? We also need to verify that the downloaders are downloading episodes appropriately too. e.g. setting the same file for both episode items. |
I have tested it, I've been manually loading these changes up every time I've had to reset my db for the past few months lol. The symlinker seems handles these types of files well. The downloaders (at least RD) also handle them fine now too, the last refactor broke them but the refactor from today doesn't have that issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (1)
src/program/services/libraries/symlink.py (1)
163-182
: Add logging for multiple episode detectionSince this PR specifically addresses the detection of multiple episodes, it would be helpful to log when multiple episodes are successfully detected from a single file.
Add logging before the episode processing loop:
episode_numbers: list[int] = parse_title(episode).get("episodes", []) +if len(episode_numbers) > 1: + logger.info(f"Detected multiple episodes {episode_numbers} in file {episode}")
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
src/program/services/libraries/symlink.py
(2 hunks)
🔇 Additional comments (1)
src/program/services/libraries/symlink.py (1)
10-10
: LGTM! Good choice using PTT for title parsing.
The addition of PTT for title parsing aligns with the recommended approach and provides a more robust solution for episode detection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good now!
Ensures that all episodes are found from symlink titles when ingesting symlinks into the db. Fixes an issue with symlink ingestion where files containing multiple episodes would only have one of the episodes added to the db, which causes the missing episodes to be submitted for scraping again after every db reset.
Summary by CodeRabbit
New Features
Bug Fixes
Chores