Skip to content

refactor(backend): extract a shared ffmpeg-gate helper for the extract* RPCs#96

Merged
twangodev merged 3 commits into
mainfrom
refactor/mediaaccessor-extract-helper
Jun 30, 2026
Merged

refactor(backend): extract a shared ffmpeg-gate helper for the extract* RPCs#96
twangodev merged 3 commits into
mainfrom
refactor/mediaaccessor-extract-helper

Conversation

@twangodev

@twangodev twangodev commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Collapse the identical ffmpeg-availability + file-resolve + runCatching shell shared by extractWaveform/extractMediaInfo/extractSpectrogram into one private generic helper.

Summary by CodeRabbit

  • Bug Fixes
    • Improved media extraction reliability by handling missing files, unavailable media tools, and extraction errors more gracefully.
    • Media details, waveform data, and spectrogram generation now return safe fallback values instead of failing unexpectedly.

Copilot AI review requested due to automatic review settings June 29, 2026 23:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: eac7b8b3-0e6f-4c2f-961f-641ad327be33

📥 Commits

Reviewing files that changed from the base of the PR and between 3d3a088 and 733a7f5.

📒 Files selected for processing (1)
  • backend/src/main/kotlin/dev/twango/jetplay/rpc/MediaAccessorImpl.kt

📝 Walkthrough

Walkthrough

A private generic suspend helper withFfmpegResolvedFile is added to MediaAccessorImpl, centralizing ffmpeg availability checking, file resolution, and runCatching error handling. The three existing RPC methods (extractWaveform, extractMediaInfo, extractSpectrogram) are refactored to delegate to this helper with their respective defaults.

MediaAccessorImpl Refactor

Layer / File(s) Summary
Shared helper and method delegation
backend/src/main/kotlin/dev/twango/jetplay/rpc/MediaAccessorImpl.kt
Adds withFfmpegResolvedFile generic suspend helper that gates on ffmpeg availability, resolves the source file, and wraps the extractor in runCatching; refactors all three extract* methods to use it with their respective defaults.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

A helper hops in, swift and neat,
Three methods now share the same beat.
Check ffmpeg, resolve the file,
Catch errors with rabbit-like guile.
🐇 Less duplication — oh, what a treat!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main refactor: sharing ffmpeg-gate logic across the extract* RPCs.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/mediaaccessor-extract-helper

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.

@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Qodana for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked

View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/qodana-action@v2026.1.3
        with:
          upload-result: true
Contact Qodana team

Contact us at qodana-support@jetbrains.com

…er calls

The override return type drives inference, so <MediaInfo?>/<Spectrogram?>
were unnecessary (Qodana notice).
Copilot AI review requested due to automatic review settings June 30, 2026 00:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@twangodev twangodev merged commit 7f77b42 into main Jun 30, 2026
15 checks passed
@twangodev twangodev deleted the refactor/mediaaccessor-extract-helper branch June 30, 2026 00:41
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