-
Notifications
You must be signed in to change notification settings - Fork 41
Refactor repair.py : Improved Logging and Added Async Search Status Monitoring #60
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
Refactor repair.py : Improved Logging and Added Async Search Status Monitoring #60
Conversation
…g. Add automatic search status check in Arr.
Co-authored-by: westsurname <155189104+westsurname@users.noreply.github.com>
Changed to camelCase Other Minor changes Season Packs Optimized section Added empty prints for style Fixed dry run not applied checkAutomaticSearchStatus Removed discordUpdate on search succesful as it's misleading since it doesn't really tell if media was grabbed. Add 0 reports downloaded in message detection, if True send ErrorUpdate to discord.
…her minor changes
… were deleted in media folder but were still in mount
Co-authored-by: westsurname <155189104+westsurname@users.noreply.github.com>
…ion for season id/movie id, changed parentFolders to use realpath
…ature/repair-logging-refactor
| if not args.dry_run and (args.no_confirm or input("Do you want to initiate a search for a season-pack? (y/n): ").lower() == 'y'): | ||
| results = arr.automaticSearch(media, childId) | ||
| runAsyncInThread(checkAutomaticSearchStatus(arr, results['id'], media.title, childId)) | ||
| elif args.mode == 'symlink' and childId in media.fullyAvailableChildrenIds and len(parentFolders) > 1: |
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.
Just as an fyi, sometimes I keep ifs nested for separation of interest purposes
| return | ||
| elif searchSuccessful is False: | ||
| errorMsg = f"Search for {mediaTitle} {seasonNumber} failed: {message}" | ||
| if status == "failed" or "0 reports downloaded." in message: |
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.
The 0 reports downloaded discord messaging might become an issue long term, especially for season upgrade cases. Let's keep an eye on it after the merge before release.
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.
@kw6423 This is definitely an issue
🚀 Refactor
repair.py: Improved Logging and Async Search Status Monitoring📌 Summary
This PR focuses on enhancing the logging experience within
repair.pyand integrating non-blocking async monitoring of Radarr/Sonarr search tasks.Key goals:
✅ What's Changed
🔹 Logging Enhancements
print()wrapper:level=log levels (e.g.INFO,ERROR)print_section(title)helper for clearly labeled output sections[mode]-prefixed Discord messages into wrapper functions:discordUpdate(title, message)discordError(title, message)[args.mode]to match existing message format in a reusable way🔹 Async Search Monitoring
check_automatic_search_status():/command/{id}APIrun_async_in_thread()to execute the coroutine in a separate thread without blocking the repair loop🔹 Minor Cleanups
🗂 Affected Files
repair.pyshared/arr.py📝 Notes
📣 Example Output