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

fix/playlist_handling #122

Merged
merged 5 commits into from
Aug 3, 2024
Merged

fix/playlist_handling #122

merged 5 commits into from
Aug 3, 2024

Conversation

JarbasAl
Copy link
Member

@JarbasAl JarbasAl commented Aug 3, 2024

fix position of "now playing" handling

fix PluginStream to MediaEntry extraction

fix Playlist of PluginStream

Summary by CodeRabbit

  • New Features

    • Updated track management for improved handling of playlists and currently playing tracks.
    • Introduced default URI assignment for better synchronization from MPRIS.
  • Deprecation Notices

    • Added a deprecation notice for the extract_stream method to inform users of its phasing out.
  • Bug Fixes

    • Enhanced error handling and logic in the validate_stream method.
  • Tests

    • Removed outdated test methods to streamline testing coverage and focus on essential behaviors.

fix position of "now playing" handling

fix PluginStream to MediaEntry extraction

fix Playlist of PluginStream
@JarbasAl JarbasAl added the bug Something isn't working label Aug 3, 2024
Copy link

coderabbitai bot commented Aug 3, 2024

Walkthrough

The recent changes involve deprecating the extract_stream method in the MediaEntry class and enhancing the set_now_playing method in the Player class for better track management. Additionally, updates to the requirements.txt file reflect a newer version of the ovos-workshop dependency. Some unit tests have been removed or modified, indicating a shift in testing strategies and coverage for the AudioService functionality.

Changes

File Change Summary
ovos_plugin_common_play/ocp/media.py extract_stream method in MediaEntry is now deprecated; docstring updated.
ovos_plugin_common_play/ocp/player.py Improved set_now_playing method for better track handling; refined logic for updating playlists and tracks. Updated validate_stream method to simplify error handling.
requirements/requirements.txt Updated ovos-workshop version from >=0.0.16a39, < 0.1.0 to >=0.0.16a48, < 0.1.0.
test/unittests/test_audio_backends.py Removed test_native_ocp method, indicating a potential refactoring of audio backend tests.
test/unittests/test_external_ocp.py Removed test_external_ocp method, reflecting changes in how AudioService configuration is tested.
test/unittests/test_ocp_player.py Modified test_set_now_playing to avoid calling reset on now_playing; updated preferred audio backends.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Player
    participant MediaEntry
    participant PluginStream

    User->>Player: set_now_playing(track)
    Player->>MediaEntry: extract_stream()
    MediaEntry-->>Player: return media info
    Player->>PluginStream: update playlist
    Player->>User: now playing updated
Loading

🐰 Change is here, oh what delight,
With deprecations shining bright!
The player's tunes now flow with grace,
As rabbits hop in joyful race.
Let's celebrate with a happy cheer,
For every change, we hold so dear! 🎶✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

@JarbasAl JarbasAl force-pushed the fix/playlist_handling branch from 3932ae9 to 9f84118 Compare August 3, 2024 20:18
@JarbasAl
Copy link
Member Author

JarbasAl commented Aug 3, 2024

@coderabbitai review

Copy link

coderabbitai bot commented Aug 3, 2024

Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@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: 0

Outside diff range, codebase verification and nitpick comments (1)
ovos_plugin_common_play/ocp/media.py (1)

197-197: Deprecation notice approved.

The extract_stream method is marked as deprecated. Consider adding a warning log to inform users when this method is used.

def extract_stream(self):
    """
    DEPRECATED: Get metadata from ocp_plugins and add it to this MediaEntry
    """
+   LOG.warning("The `extract_stream` method is deprecated and will be removed in a future release.")
    uri = self.uri
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between dad9e43 and 0da91a0.

Files selected for processing (6)
  • ovos_plugin_common_play/ocp/media.py (1 hunks)
  • ovos_plugin_common_play/ocp/player.py (2 hunks)
  • requirements/requirements.txt (1 hunks)
  • test/unittests/test_audio_backends.py (1 hunks)
  • test/unittests/test_external_ocp.py (1 hunks)
  • test/unittests/test_ocp_player.py (5 hunks)
Files skipped from review due to trivial changes (2)
  • test/unittests/test_audio_backends.py
  • test/unittests/test_external_ocp.py
Additional comments not posted (10)
requirements/requirements.txt (1)

4-4: Dependency version update approved.

The version of ovos-workshop has been updated to >=0.0.16a48, < 0.1.0. Ensure compatibility with the rest of the codebase.

ovos_plugin_common_play/ocp/player.py (6)

253-255: Handling dictionary track approved.

The handling of dictionary tracks has been refined, with clearer logging and a default URI assignment when syncing from MPRIS.


260-263: Playlist index handling approved.

The logic for finding the entry in the playlist has been improved.


265-269: PluginStream extraction approved.

The extraction of media entries from PluginStream has been handled correctly, with appropriate logging.


273-284: Playlist position update approved.

The logic for updating the playlist position and adding new tracks has been improved.


291-301: New playlist handling approved.

The handling of new playlists and updating the now_playing state has been improved.


327-330: Stream validation simplification approved.

The error handling for extracting the stream from now_playing has been removed, simplifying the flow.

test/unittests/test_ocp_player.py (3)

Line range hint 207-209:
Ensure proper handling of invalid strings in set_now_playing.

The test case correctly asserts that self.player.set_now_playing raises a ValueError for invalid strings. This ensures robustness against invalid inputs.


417-418: Verify inclusion of "mpv" in preferred audio backends.

The inclusion of "mpv" in the list of preferred audio backends broadens the scope of valid audio backends. Ensure this change is intentional and aligns with the supported backends.


Line range hint 210-212:
Verify removal of reset method call.

The removal of the reset method call indicates a change in how the state of now_playing is managed. Ensure this change is intentional and does not affect other parts of the code.

@JarbasAl JarbasAl merged commit 984710a into dev Aug 3, 2024
5 checks passed
@JarbasAl JarbasAl deleted the fix/playlist_handling branch August 3, 2024 20:43
@github-actions github-actions bot mentioned this pull request Sep 2, 2024
JarbasAl added a commit that referenced this pull request Sep 3, 2024
* refactor/utils_0.1.0 (#108)

* refactor/utils_0.1.0

* opm imports

* no create .desktop file

* no create .desktop file

* requirements

* requirements

---------

Co-authored-by: JarbasAi <[email protected]>

* Increment Version to 0.0.7a1

* Update Changelog

* refactor/dry_ocp_imports (#109)

* refactor/dry_ocp_imports

import Playlist and MediaEntry objects from utils 0.1.0

* tests

* tests

* fix/ocp_playlist

allow initing Playlist object as a regular list

---------

Co-authored-by: JarbasAi <[email protected]>

* Increment Version to 0.0.7a2

* Update Changelog

* feat/experimental_ocp_pipeline (#112)

allow using Classic OCP with the new pipeline

companion to OpenVoiceOS/ovos-core#456

* Increment Version to 0.0.7a3

* Update Changelog

* fix/coexistence_with_pipeline (#115)

* fix/coexistence_with_pipeline

intents were being registered even if pipeline enabled, only the media matchers were taking into account the new flag

this commit moves the check to init instead

* port/SEI report event

report plugins to ovos-core like ovos-media does to help in transition

* fix stop

* Increment Version to 0.0.7a4

* Update Changelog

* fix/playlist handling (#116)

* fix deprecation warnings

* fix type checks

* better log

* support older ovos-utils

* type checking fixes

* typing

* yeah

* Increment Version to 0.0.7a5

* Update Changelog

* fix/playlist_again (#117)

* Increment Version to 0.0.7a6

* Update Changelog

* default to OCP pipeline + support for utils 0.0.38 (#119)

* remove dead code

since OpenVoiceOS/ovos-core#491 and OpenVoiceOS/ovos-config#96 this is effectively dead code

all NLP matching is dropped in this PR

* rm dead code

* drop old tests

* Increment Version to 0.0.7a7

* Update Changelog

* fix/native_sources (#120)

* fix/native_sources

allow usage with voice satellites, without triggering playback on master side

similar to what classic audio service does, but with a decorator to make it more usable

* handle message=None

* fix backend check

* kwarg

* add helper property

* message None

* default val

* missing kwarg

* drop old classifier tests

* drop old classifier tests

* keep your crappy test

* keep your crappy test

* a relevant test now

* Increment Version to 0.0.7a8

* Update Changelog

* fix/play_from_gui (#121)

* fix/play_from_gui

when selecting entries from featured media PluginStream was not being recognized

if audio restarts with GUI opening, playback would fail due to GUI sending malformed data, this commit also works around that issue

* more fixes

* more fixes

* update tests

* restore tst

* keep old OCP bugs around 👍

* fixy fixes

* Increment Version to 0.0.7a9

* Update Changelog

* fix/playlist_handling (#122)

* fix/playlist_handling

fix position of "now playing" handling

fix PluginStream to MediaEntry extraction

fix Playlist of PluginStream

* deprecate extract_stream

* check bounds of idx

* remove test for old ovos-audio version

compat with utils 0.0.38

* fix tests

* Increment Version to 0.0.7a10

* Update Changelog

* Update README.md

* logs/end_of_track (#124)

make it easier to debug issues like  #123

* Increment Version to 0.0.7a11

* Update Changelog

* Increment Version to 0.0.7

* Update Changelog

---------

Co-authored-by: NeonJarbas <[email protected]>
Co-authored-by: JarbasAi <[email protected]>
Co-authored-by: JarbasAl <[email protected]>
Co-authored-by: JarbasAI <[email protected]>
This was referenced Sep 17, 2024
This was referenced Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant