-
Notifications
You must be signed in to change notification settings - Fork 201
feat: upload name media type args #180
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API (upload_video)
participant VideoDB
Client->>API (upload_video): POST /upload with JSON {source, [source_type], [media_type], [name]}
API->>API: Extract source, source_type (default "url"), media_type (default "video"), name (default None)
API->>VideoDB: upload(source, source_type, media_type, name)
VideoDB-->>API: Upload result
API-->>Client: Response
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
backend/director/entrypoint/api/routes.py (1)
230-231: Consider updating the function docstring.The docstring currently only mentions "Upload a video to a collection" but the function now supports multiple media types (video, audio, image) and additional optional parameters.
- """Upload a video to a collection.""" + """Upload media (video, audio, or image) to a collection. + + Supports both file uploads and JSON with source URL. + Optional parameters: source_type, media_type, name. + """
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
backend/director/entrypoint/api/routes.py(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: 0xrohitgarg
PR: video-db/Director#89
File: backend/director/entrypoint/api/routes.py:0-0
Timestamp: 2024-11-29T05:47:14.467Z
Learning: In `backend/director/entrypoint/api/routes.py`, the `upload_video` function relies on `conn.upload` for media type validation. The `conn.upload` function in `backend/director/tools/videodb_tool.py` raises an error if the media type is unsupported, and exceptions are caught and passed to the client in `upload_video`.
backend/director/entrypoint/api/routes.py (1)
Learnt from: 0xrohitgarg
PR: video-db/Director#89
File: backend/director/entrypoint/api/routes.py:0-0
Timestamp: 2024-11-29T05:47:14.467Z
Learning: In `backend/director/entrypoint/api/routes.py`, the `upload_video` function relies on `conn.upload` for media type validation. The `conn.upload` function in `backend/director/tools/videodb_tool.py` raises an error if the media type is unsupported, and exceptions are caught and passed to the client in `upload_video`.
🧬 Code Graph Analysis (1)
backend/director/entrypoint/api/routes.py (2)
backend/director/handler.py (1)
upload(148-149)backend/director/tools/videodb_tool.py (1)
upload(197-241)
🔇 Additional comments (1)
backend/director/entrypoint/api/routes.py (1)
250-255: Enhanced upload functionality with appropriate defaults.The changes successfully add support for optional
media_typeandnameparameters while maintaining backward compatibility. The default values align consistently with the underlying handler and tool functions.The approach using
.get()with defaults is robust and prevents KeyError exceptions for missing optional parameters.
nameandmedia_typeargs for client-side presigned url upload handlingSummary by CodeRabbit