Skip to content

Update /v1/submit integration to match revised API spec#74

Merged
AbandonedCart merged 4 commits intomasterfrom
copilot/add-share-button-to-segment-boxes
Apr 2, 2026
Merged

Update /v1/submit integration to match revised API spec#74
AbandonedCart merged 4 commits intomasterfrom
copilot/add-share-button-to-segment-boxes

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 29, 2026

The /v1/submit API spec dropped tvdb_season_id and added explicit 403 semantics for unsupported clients (e.g. Infuse).

Changes

  • SkipMeSubmitRequest — removed tvdb_season_id field
  • PlayerEditor submit handler — dropped tvdb_season_id from the call; catch block now differentiates 403 via axios.isAxiosError() and surfaces a dedicated "client not supported" message instead of the generic failure string
  • i18n (en-US, de, fr) — added editor.share.clientNotSupported key
} catch (e) {
  const isForbidden = axios.isAxiosError(e) && e.response?.status === 403
  showNotification({
    type: 'negative',
    message: t(isForbidden ? 'editor.share.clientNotSupported' : 'editor.share.failed'),
  })
}

SkipMeSubmitResponse already matched the updated spec (submission.id / submission.status) and needed no changes.


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Summary by Sourcery

Add the ability to share validated media segments from the player editor to the external SkipMe.db service directly from each segment box.

New Features:

  • Introduce a SkipMe.db API service for submitting media segments with mapped segment types and structured payloads.
  • Add a share button to each segment slider that triggers asynchronous sharing of the current segment to SkipMe.db with loading feedback.

Enhancements:

  • Implement validation in the player editor before sharing segments, ensuring supported types, valid provider IDs, known duration, and sane timing boundaries.
  • Wire the player editor to pass the share callback into segment sliders so individual segments can invoke sharing.

Documentation:

  • Extend i18n strings in English, German, and French for segment sharing actions, accessibility labels, and error/success messages.

Agent-Logs-Url: https://github.com/intro-skipper/segment-editor/sessions/95995d49-a25f-4201-a89b-d67d3fc38d14

Co-authored-by: AbandonedCart <1173913+AbandonedCart@users.noreply.github.com>
Copilot AI changed the title [WIP] Add share button before copy button in segment boxes Add SkipMe.db share button to segment boxes Mar 29, 2026
Copilot AI requested a review from AbandonedCart March 29, 2026 00:44
@AbandonedCart AbandonedCart marked this pull request as ready for review March 29, 2026 01:11
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Mar 29, 2026

Reviewer's Guide

Adds a SkipMe.db integration that lets users share validated segments from the player editor via a new share button in each SegmentSlider, backed by a typed API service and localized notifications.

Class diagram for SkipMe.db API service and segment sharing integration

classDiagram
  class SkipMeApiService {
    <<module>>
    +toSkipMeSegmentType(type string) string
    +submitSegmentToSkipMe(request SkipMeSubmitRequest) SkipMeSubmitResponse
    -SKIPME_BASE_URL string
  }

  class SkipMeSubmitRequest {
    +tmdb_id number
    +tvdb_season_id number
    +tvdb_id number
    +segment string
    +season number
    +episode number
    +duration_ms number
    +start_ms number
    +end_ms number
  }

  class SkipMeSubmitResponse {
    +ok boolean
    +submission SkipMeSubmission
  }

  class SkipMeSubmission {
    +id string
    +status string
  }

  class SegmentSliderProps {
    +segments MediaSegmentDto[]
    +activeIndex number
    +onSetActive(index number) void
    +getPlayerTime() number
    +onCopyAllAsJson() void
    +onShare(segment MediaSegmentDto) Promise~void~
    +onEdit(index number) void
    +vibrantColors unknown
  }

  class SegmentSliderComponent {
    <<ReactComponent>>
    -isDragging string
    -isSharing boolean
    -copyMenuOpen boolean
    -activeInput string
    +handleShare() Promise~void~
    +handleDelete() void
    +handleCopyAllAsJsonClick() void
  }

  class PlayerEditorHook {
    <<ReactHook>>
    +useRenderPlayerEditor() PlayerEditorRenderResult
    -handleShareSegment(segment MediaSegmentDto) Promise~void~
    -handleSaveAll() Promise~void~
  }

  class PlayerEditorRenderResult {
    +render() ReactNode
  }

  class MediaSegmentDto {
    +Type string
    +StartTicks number
    +EndTicks number
  }

  class MediaItem {
    +ProviderIds Record~string,string~
    +RunTimeTicks number
    +ParentIndexNumber number
    +IndexNumber number
  }

  class NotificationService {
    +showNotification(type string, message string) void
  }

  SkipMeApiService --> SkipMeSubmitRequest : uses
  SkipMeApiService --> SkipMeSubmitResponse : returns
  SkipMeSubmitResponse --> SkipMeSubmission : contains

  SegmentSliderComponent --> SegmentSliderProps : uses
  SegmentSliderComponent --> MediaSegmentDto : shares
  SegmentSliderComponent --> PlayerEditorHook : calls onShare via props

  PlayerEditorHook --> MediaItem : validates
  PlayerEditorHook --> MediaSegmentDto : validates
  PlayerEditorHook --> SkipMeApiService : calls submitSegmentToSkipMe
  PlayerEditorHook --> NotificationService : calls showNotification

  MediaItem --> "1" MediaSegmentDto : context
  NotificationService <.. SegmentSliderComponent : indirectly notifies via PlayerEditorHook
  NotificationService <.. PlayerEditorHook : uses
Loading

File-Level Changes

Change Details Files
Introduce a typed SkipMe.db API client for submitting segments.
  • Define SKIPME_TYPE_MAP and toSkipMeSegmentType to translate Jellyfin segment types to SkipMe.db strings and ignore unsupported types.
  • Create SkipMeSubmitRequest/SkipMeSubmitResponse interfaces and a submitSegmentToSkipMe helper that POSTs JSON to the SkipMe /v1/submit endpoint using axios.
src/services/skipme/api.ts
Wire a share-to-SkipMe flow from the player editor into the SkipMe.db service with validation and feedback.
  • Add handleShareSegment callback in PlayerEditor that converts the selected segment to SkipMe format, validates type support, provider IDs, duration, and timing, and calls submitSegmentToSkipMe.
  • Parse TMDB/TVDB IDs (including TvdbSeason) safely from ProviderIds, derive duration and segment times in milliseconds, and handle success/failure via localized notifications.
  • Pass handleShareSegment into SegmentSlider via a new onShare prop so each segment box can trigger sharing.
src/components/player/PlayerEditor.tsx
Extend SegmentSlider UI with a share button and loading-aware interaction.
  • Add optional onShare prop and local isSharing state; compute the segment to share from current form values with buildSegmentFromFormValues.
  • Implement handleShare to call onShare once per click, showing a busy state while the async operation is in-flight.
  • Render a Share2 ghost icon button before the copy dropdown with accessibility label, aria-busy, and disabled state tied to isSharing.
src/components/segment/SegmentSlider.tsx
Add localized strings for the share flow and accessibility.
  • Introduce accessibility.shareSegment and editor.share.* keys for success and all validation/error messages.
  • Populate the new i18n keys in en-US, de, and fr locale JSON files.
src/i18n/locales/en-US.json
src/i18n/locales/de.json
src/i18n/locales/fr.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Consider moving SKIPME_BASE_URL to a configuration/env setting so the SkipMe endpoint can be customized per environment (staging, self-hosted mirrors, etc.) rather than being hardcoded.
  • The handleShareSegment callback omits showNotification, toSkipMeSegmentType, and submitSegmentToSkipMe from its dependency array; either include them or explicitly document/disable the exhaustive-deps rule for this hook to avoid stale captures.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider moving `SKIPME_BASE_URL` to a configuration/env setting so the SkipMe endpoint can be customized per environment (staging, self-hosted mirrors, etc.) rather than being hardcoded.
- The `handleShareSegment` callback omits `showNotification`, `toSkipMeSegmentType`, and `submitSegmentToSkipMe` from its dependency array; either include them or explicitly document/disable the exhaustive-deps rule for this hook to avoid stale captures.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot bot commented Mar 29, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Overview

Incremental review of commit that updates the SkipMe.db integration to match the revised /v1/submit API spec.

Changes Reviewed

Change Assessment
Remove tvdb_season_id from SkipMeSubmitRequest interface Intentional API spec change
Add axios import for error type checking Required for 403 detection
Handle 403 errors with specific "client not supported" message Correctly uses axios.isAxiosError() + e.response?.status === 403
Add i18n key editor.share.clientNotSupported Added for en-US, de, and fr locales

Security Assessment

  • Error handling: axios.isAxiosError(e) properly validates axios error type before accessing response
  • Optional chaining: e.response?.status safely handles missing response object

Implementation Quality

Files Reviewed (4 files)
  • src/services/skipme/api.ts - Updated interface
  • src/components/player/PlayerEditor.tsx - Error handling update
  • src/i18n/locales/en-US.json - Translation added
  • src/i18n/locales/de.json - Translation added
  • src/i18n/locales/fr.json - Translation added

Note: This is an incremental review. Full feature review was completed at commit 41a5ce2.

Copilot AI changed the title Add SkipMe.db share button to segment boxes No changes: incomplete problem statement Mar 30, 2026
…ot-supported handling

Agent-Logs-Url: https://github.com/intro-skipper/segment-editor/sessions/8b1d7ad3-46c5-491d-a297-9325a6bfc7d9

Co-authored-by: AbandonedCart <1173913+AbandonedCart@users.noreply.github.com>
Copilot AI changed the title No changes: incomplete problem statement Update /v1/submit integration to match revised API spec Mar 30, 2026
Copilot stopped work on behalf of AbandonedCart due to an error April 2, 2026 19:44
@AbandonedCart AbandonedCart merged commit f90441f into master Apr 2, 2026
4 checks passed
@AbandonedCart AbandonedCart deleted the copilot/add-share-button-to-segment-boxes branch April 2, 2026 19:45
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