Documentation
¶
Index ¶
- type ErrInvalidStatus
- type Manager
- func (m *Manager) DeleteFromList(ctx context.Context, mediaListID int) error
- func (m *Manager) GetAniList() Tracker
- func (m *Manager) GetUserLibrary(ctx context.Context, mediaType providers.MediaType) ([]TrackedMedia, error)
- func (m *Manager) IsAniListAuthenticated() bool
- func (m *Manager) IsAniListEnabled() bool
- func (m *Manager) ProcessSyncQueue(ctx context.Context) error
- func (m *Manager) SearchMedia(ctx context.Context, query string, mediaType providers.MediaType) ([]TrackedMedia, error)
- func (m *Manager) SetAniListClient(client Tracker)
- func (m *Manager) UpdateProgress(ctx context.Context, mediaID string, episode int, progress float64) error
- type Progress
- type SyncStatus
- type TrackedMedia
- type Tracker
- type WatchStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrInvalidStatus ¶
type ErrInvalidStatus struct {
Status string
}
ErrInvalidStatus is returned when an invalid status string is provided
func (*ErrInvalidStatus) Error ¶
func (e *ErrInvalidStatus) Error() string
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles tracker instances and operations
func NewManager ¶
NewManager creates a new tracker manager
func (*Manager) DeleteFromList ¶
DeleteFromList removes a media from the tracker
func (*Manager) GetAniList ¶
GetAniList returns the AniList tracker
func (*Manager) GetUserLibrary ¶
func (m *Manager) GetUserLibrary(ctx context.Context, mediaType providers.MediaType) ([]TrackedMedia, error)
GetUserLibrary retrieves the user's library from enabled trackers
func (*Manager) IsAniListAuthenticated ¶
IsAniListAuthenticated checks if AniList is authenticated
func (*Manager) IsAniListEnabled ¶
IsAniListEnabled checks if AniList tracking is enabled
func (*Manager) ProcessSyncQueue ¶
ProcessSyncQueue processes pending sync items
func (*Manager) SearchMedia ¶
func (m *Manager) SearchMedia(ctx context.Context, query string, mediaType providers.MediaType) ([]TrackedMedia, error)
SearchMedia searches for media on enabled trackers
func (*Manager) SetAniListClient ¶
SetAniListClient sets the AniList tracker implementation
type Progress ¶
type Progress struct {
MediaID string `json:"media_id"`
Episode int `json:"episode"`
Percentage float64 `json:"percentage"` // 0.0 - 1.0
TimeWatched time.Duration `json:"time_watched"` // Seconds watched in current episode
TotalTime time.Duration `json:"total_time"` // Total episode duration
LastWatchedAt time.Time `json:"last_watched_at"`
Completed bool `json:"completed"`
}
Progress represents viewing progress for a media item
type SyncStatus ¶
type SyncStatus struct {
MediaID string `json:"media_id"`
LocalProgress int `json:"local_progress"`
CloudProgress int `json:"cloud_progress"`
LastSyncedAt time.Time `json:"last_synced_at"`
NeedsSync bool `json:"needs_sync"`
SyncError string `json:"sync_error,omitempty"`
}
SyncStatus represents the sync state of a media item
type TrackedMedia ¶
type TrackedMedia struct {
ServiceID string `json:"service_id"` // ID in tracking service (AniList, MAL, etc.)
Title string `json:"title"`
Type providers.MediaType `json:"type"`
Progress int `json:"progress"` // Episodes watched
TotalEpisodes int `json:"total_episodes"`
Status WatchStatus `json:"status"`
Score float64 `json:"score"`
StartDate *time.Time `json:"start_date,omitempty"`
EndDate *time.Time `json:"end_date,omitempty"`
Synopsis string `json:"synopsis"`
PosterURL string `json:"poster_url"`
UpdatedAt time.Time `json:"updated_at"`
ListEntryID int `json:"list_entry_id,omitempty"` // ID of the list entry (AniList MediaListEntry ID)
}
TrackedMedia represents a media item in a tracking service
type Tracker ¶
type Tracker interface {
// Authentication
Authenticate(ctx context.Context) error
IsAuthenticated() bool
Logout() error
// Media library
GetUserLibrary(ctx context.Context, mediaType providers.MediaType) ([]TrackedMedia, error)
SearchMedia(ctx context.Context, query string, mediaType providers.MediaType) ([]TrackedMedia, error)
// Progress tracking
UpdateProgress(ctx context.Context, mediaID string, episode int, progress float64) error
GetProgress(ctx context.Context, mediaID string) (*Progress, error)
// Metadata updates
UpdateStatus(ctx context.Context, mediaID string, status WatchStatus) error
UpdateScore(ctx context.Context, mediaID string, score float64) error
UpdateDates(ctx context.Context, mediaID string, startDate, endDate *time.Time) error
// Sync
SyncHistory(ctx context.Context) error
// Deletion (specific to services that support it)
DeleteFromList(ctx context.Context, mediaListID int) error
}
Tracker defines the interface for progress tracking services (AniList, MyAnimeList, Trakt, etc.)
type WatchStatus ¶
type WatchStatus string
WatchStatus represents the watching status of a media item
const ( StatusWatching WatchStatus = "watching" StatusCompleted WatchStatus = "completed" StatusOnHold WatchStatus = "on_hold" StatusDropped WatchStatus = "dropped" StatusPlanToWatch WatchStatus = "plan_to_watch" StatusRewatching WatchStatus = "rewatching" )
func ParseWatchStatus ¶
func ParseWatchStatus(s string) (WatchStatus, error)
ParseWatchStatus parses a string into a WatchStatus
func (WatchStatus) String ¶
func (s WatchStatus) String() string
String returns the string representation of WatchStatus