Trakt · Capability

Media Center Scrobbling

Run with Naftiko

Capability Spec

media-center-scrobbling.yaml Raw ↑
apiVersion: naftiko.dev/v1
kind: Capability
metadata:
  name: media-center-scrobbling
  provider: trakt
  description: Drive the Trakt scrobble lifecycle from a media center (Plex/Kodi/Jellyfin/native) so playback start, pause, and stop translate into accurate watch history with deduplication and 80% completion semantics.
spec:
  shared:
    - trakt-shared
  workflow:
    - step: on-playback-start
      operation: scrobbleStart
      input:
        - movie_or_episode_ids
        - progress: 0.5
    - step: on-pause
      operation: scrobblePause
      input:
        - movie_or_episode_ids
        - progress: ${current_progress}
    - step: on-stop-or-end
      operation: scrobbleStop
      input:
        - movie_or_episode_ids
        - progress: ${final_progress}
      semantics:
        - "progress >= 80 -> action=scrobble (added to history)"
        - "1 <= progress < 80 -> action=pause (sync/playback resumes later)"
        - "progress < 1 -> 422 (ignored)"
        - "Same item rescrobbled within window -> 409 (returns watched_at + expires_at)"
  resilience:
    - on409:
        action: skip-with-log
    - on429:
        action: backoff-and-retry
  successCriteria:
    - "Every completed playback recorded once in /sync/history."
    - "Resume position is correctly stored when the user pauses."