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

Add ImageVideo backend #88

Merged
merged 6 commits into from
May 1, 2024
Merged

Add ImageVideo backend #88

merged 6 commits into from
May 1, 2024

Conversation

talmo
Copy link
Contributor

@talmo talmo commented May 1, 2024

Adds support for videos that are defined as a list of images.

Summary by CodeRabbit

  • New Features

    • Enhanced video handling to accept multiple filenames, allowing for greater flexibility in video management.
    • Introduced a new subclass for image-based videos, improving support for different video formats.
  • Bug Fixes

    • Improved video existence verification to check all associated files, ensuring more reliable video handling.
  • Tests

    • Added new test cases for the updated video functionalities, ensuring robustness and reliability of the new features.

Copy link
Contributor

coderabbitai bot commented May 1, 2024

Walkthrough

The recent updates enhance the VideoBackend and Video classes to handle multiple filenames, offering more flexibility for video processing. New methods and classes support image sequences as video streams. Tests now cover these functionalities, ensuring robust video handling.

Changes

Files Change Summary
sleap_io/io/video.py Updated VideoBackend to accept strings or lists for filenames; introduced ImageVideo subclass.
sleap_io/model/video.py Enhanced Video class to manage multiple filenames, added existence checks, and filename replacement methods.
tests/fixtures/videos.py Added centered_pair_frame_paths fixture for video frame paths.
tests/io/test_video_backends.py Included tests for ImageVideo functionality.
tests/model/test_video.py Updated tests for video existence and filename replacement scenarios.

🐇✨
In the code where videos play,
A rabbit hopped and found a way,
To juggle files, not one but more,
Now frames dance, like never before!
🎥🌟


Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 3003ce0 and 2f8c2b5.
Files selected for processing (1)
  • .github/workflows/ci.yml (1 hunks)
Files skipped from review due to trivial changes (1)
  • .github/workflows/ci.yml

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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

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

CodeRabbit Configration 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.

@talmo talmo changed the title Add ImageVideo Add ImageVideo backend May 1, 2024
Copy link

codecov bot commented May 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.61%. Comparing base (01a638b) to head (2f8c2b5).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #88      +/-   ##
==========================================
+ Coverage   95.46%   95.61%   +0.14%     
==========================================
  Files          14       14              
  Lines        1633     1665      +32     
==========================================
+ Hits         1559     1592      +33     
+ Misses         74       73       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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: 2

Out of diff range and nitpick comments (2)
sleap_io/model/video.py (2)

Line range hint 9-9: Remove duplicate import of Optional.

- from typing import Tuple, Optional, Optional
+ from typing import Tuple, Optional

Line range hint 90-90: Replace bare except with more specific exception handling to avoid suppressing unexpected errors.

-        except:
+        except AttributeError:  # Assuming AttributeError is the relevant exception here

if isinstance(filename, Path):
filename = filename.as_posix()

if type(filename) == str and Path(filename).is_dir():
Copy link
Contributor

Choose a reason for hiding this comment

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

Use isinstance() instead of type comparison for checking if filename is a string.

-        if type(filename) == str and Path(filename).is_dir():
+        if isinstance(filename, str) and Path(filename).is_dir():

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
if type(filename) == str and Path(filename).is_dir():
if isinstance(filename, str) and Path(filename).is_dir():


if filename.endswith(MediaVideo.EXTS):
if type(filename) == list:
Copy link
Contributor

Choose a reason for hiding this comment

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

Use isinstance() for type checking to ensure consistency and readability.

-        if type(filename) == list:
+        if isinstance(filename, list):

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
if type(filename) == list:
if isinstance(filename, list):

@talmo talmo merged commit 61ab2d3 into main May 1, 2024
8 checks passed
@talmo talmo deleted the talmo/imgs-video branch May 1, 2024 05:29
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.

1 participant