Skip to content
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!:drop OCP #115

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft

refactor!:drop OCP #115

wants to merge 2 commits into from

Conversation

JarbasAl
Copy link
Member

@JarbasAl JarbasAl commented Dec 30, 2024

completely remove OCP integration, leave only the legacy audio system around

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a new method put to PlaybackThread for queuing audio playback
  • Improvements

    • Enhanced error handling in audio playback methods
    • Simplified audio service initialization process
  • Changes

    • Removed disable_ocp parameter from audio service constructors
    • Streamlined OCP (Open Common Play) functionality
  • Dependency Updates

    • Updated ovos-utils package version requirement
    • Removed ovos_plugin_common_play[extractors] dependency

completely remove OCP integration, leave only the legacy audio system around
Copy link
Contributor

coderabbitai bot commented Dec 30, 2024

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This pull request introduces significant changes to the audio handling components in the OVOS project. The modifications primarily focus on simplifying the Open Common Play (OCP) functionality by removing the disable_ocp parameter across multiple files. The changes streamline the audio service initialization, improve error handling in playback methods, and update dependency requirements. The overall goal appears to be reducing complexity and enhancing the robustness of audio-related services.

Changes

File Change Summary
ovos_audio/audio.py - Removed disable_ocp parameter from __init__ method
- Eliminated find_ocp method
- Enhanced error handling in _perform_stop and play methods
ovos_audio/playback.py - Added new put method to PlaybackThread class for queuing audio playback
ovos_audio/service.py - Removed disable_ocp parameter from PlaybackService constructor
requirements/extras.txt - Removed ovos_plugin_common_play[extractors] dependency
requirements/requirements.txt - Updated ovos-utils version constraint to >=0.1.0,<1.0.0

Possibly related PRs

Suggested labels

bug

Poem

🎵 In the realm of audio's dance,
Complexity fades with each new glance
OCP simplified, errors caught with care
A rabbit's melody floating through the air! 🐰🎧
Streamlined code, a musical delight


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added breaking breaking change and removed breaking breaking change labels Dec 30, 2024
Copy link
Contributor

@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

🧹 Nitpick comments (3)
ovos_audio/audio.py (1)

353-353: Correct the spelling of “prefered_service”
Suggest renaming the parameter to “preferred_service” for clarity.

- def play(self, tracks: Union[List[str], List[Tuple[str, str]]],
-          prefered_service: Optional[str], repeat: bool = False):
+ def play(self, tracks: Union[List[str], List[Tuple[str, str]]],
+          preferred_service: Optional[str], repeat: bool = False):
ovos_audio/playback.py (1)

123-133: Add docstring to the new put method
The method is clear, but adding a docstring can improve maintainability and clarify usage, e.g.:

+    def put(self, wav: str,
+            visemes: Optional[List[str]]=None,
+            listen: bool = False,
+            tts_id: Optional[str] = None,
+            message: Optional[Message] = None):
+        """
+        Enqueue an audio file for future playback.
+        :param wav: Path to the WAV file for playback
+        :param visemes: Sequence of visemes for lip-sync (optional)
+        :param listen: Set to True if the system should listen subsequently
+        :param tts_id: Identifier for the TTS engine
+        :param message: Original message context
+        """
         message = message or Message("")
         ...
ovos_audio/service.py (1)

106-106: enable_old_audioservice remains set to True
Since OCP is being dropped, consider defaulting this to False if legacy audio is truly optional.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 09c1de9 and a26ef1b.

📒 Files selected for processing (5)
  • ovos_audio/audio.py (6 hunks)
  • ovos_audio/playback.py (2 hunks)
  • ovos_audio/service.py (2 hunks)
  • requirements/extras.txt (0 hunks)
  • requirements/requirements.txt (1 hunks)
💤 Files with no reviewable changes (1)
  • requirements/extras.txt
🔇 Additional comments (11)
requirements/requirements.txt (1)

2-4: LGTM: Unchanged dependencies maintain stability

The version constraints for other core dependencies remain unchanged, which helps maintain stability during this significant refactor.

ovos_audio/audio.py (7)

25-25: Consider removing the MediaState import if OCP is fully dropped
MediaState is still referenced at line 316 for INVALID_MEDIA, but if the broader goal is to remove all OCP features, ensure this import remains strictly necessary.


28-28: Confirmed usage of require_native_source
The decorator is used across multiple handlers (pause, resume, queue, etc.) and appears necessary.


39-39: Removal of disable_ocp parameter aligns well with PR objectives
Streamlines the constructor and removes unnecessary logic linked to OCP.


49-49: No functional change at line 49
No issues observed here; it appears to be spacing or a minor structural adjustment.


55-55: Minor reorganization of fields
Declaring volume_is_speaking here is fine; no issues or conflicts detected.


222-227: Improved error handling on stopping current track
Wrapping self.current.stop() in a try-except block and setting stopped = False upon failure avoids unhandled exceptions and unexpected state. Good defensive coding.


238-242: Robust approach to restoring volume
Using try-except for self.current.restore_volume() prevents crashes if volume restoration fails.

ovos_audio/playback.py (1)

4-4: New type annotations
Adding List to the imports is consistent and supports the added parameter typing.

ovos_audio/service.py (2)

57-57: Removal of disable_ocp parameter
This change removes outdated OCP logic, making the constructor more concise.


110-110: Constructor usage clarifies OCP removal
This instantiation without disable_ocp aligns with the simplified audio service.

requirements/requirements.txt Outdated Show resolved Hide resolved
@JarbasAl JarbasAl marked this pull request as draft December 30, 2024 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant