uid

package
v0.1.103 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLibraryEpisode

func GetLibraryEpisode(kodiID int) (*Show, *Episode)

GetLibraryEpisode finds Show/Episode from library

func GetLibrarySeason

func GetLibrarySeason(kodiID int) (*Show, *Season)

GetLibrarySeason finds Show/Season from library

func GetShowForEpisode

func GetShowForEpisode(kodiID int) (*Show, *Episode)

GetShowForEpisode returns 'show' and 'episode'

func HasMovies

func HasMovies() bool

func HasShows

func HasShows() bool

func IsAddedToLibrary

func IsAddedToLibrary(id string, mediaType MediaItemType) (isAdded bool)

IsAddedToLibrary checks if specific TMDB exists in the library

func IsDuplicateEpisode

func IsDuplicateEpisode(tmdbShowID int, seasonNumber int, episodeNumber int) bool

IsDuplicateEpisode checks if episode exists in the library

func IsDuplicateMovie

func IsDuplicateMovie(tmdbID string) bool

IsDuplicateMovie checks if movie exists in the library

func IsDuplicateMovieByInt

func IsDuplicateMovieByInt(tmdbID int) bool

IsDuplicateMovieByInt checks if movie exists in the library

func IsDuplicateShow

func IsDuplicateShow(tmdbID string) bool

IsDuplicateShow checks if show exists in the library

func IsDuplicateShowByInt

func IsDuplicateShowByInt(tmdbID int) bool

IsDuplicateShowByInt checks if show exists in the library

Types

type ContainerType

type ContainerType int
const (
	WatchlistedMoviesContainer ContainerType = iota
	WatchedMoviesContainer
	CollectedMoviesContainer
	UserlistedMoviesContainer

	WatchlistedShowsContainer
	WatchedShowsContainer
	CollectedShowsContainer
	UserlistedShowsContainer
)

type Episode

type Episode struct {
	ID        int
	Title     string
	Season    int
	Episode   int
	File      string
	DateAdded time.Time
	UIDs      *UniqueIDs
	XbmcUIDs  *xbmc.UniqueIDs
	Resume    *Resume
}

Episode represents Episode content type

func (*Episode) IsWatched

func (e *Episode) IsWatched() bool

IsWatched returns watched state

type Library

type Library struct {
	Mu map[MutexType]*sync.RWMutex

	// Stores all the unique IDs collected
	UIDs []*UniqueIDs

	Movies []*Movie
	Shows  []*Show

	Containers map[ContainerType]*LibraryContainer

	Pending Status
	Running Status
	// contains filtered or unexported fields
}

func Get

func Get() *Library

Get returns singleton instance for Library

func (*Library) GetContainer

func (l *Library) GetContainer(id ContainerType) *LibraryContainer

func (*Library) GetMutex

func (l *Library) GetMutex(id MutexType) *sync.RWMutex

func (*Library) Restore

func (l *Library) Restore() error

Restore is restoring Containers from cache to have it in the memory.

func (*Library) Store

func (l *Library) Store() error

Store is storing Containers in cache for future quick-restore.

type LibraryContainer

type LibraryContainer struct {
	Mu sync.RWMutex

	Items map[uint64]struct{}
}

func NewLibraryContainer

func NewLibraryContainer() *LibraryContainer

func (*LibraryContainer) Add

func (c *LibraryContainer) Add(media MediaItemType, uids *UniqueIDs, ids ...int)

func (*LibraryContainer) Clear

func (c *LibraryContainer) Clear()

func (*LibraryContainer) GetKeys

func (c *LibraryContainer) GetKeys(media MediaItemType, traktID int, tmdbID int, imdbID string, ids ...int) (traktKey, tmdbKey, imdbKey uint64)

func (*LibraryContainer) Has

func (c *LibraryContainer) Has(media MediaItemType, uids *UniqueIDs, ids ...int) bool

func (*LibraryContainer) HasWithType

func (c *LibraryContainer) HasWithType(media MediaItemType, scraperType ScraperType, id int) bool

type MediaItemType

type MediaItemType int
const (
	MovieType MediaItemType = iota
	ShowType
	SeasonType
	EpisodeType
)

type Movie

type Movie struct {
	ID        int
	Title     string
	File      string
	Year      int
	DateAdded time.Time
	UIDs      *UniqueIDs
	XbmcUIDs  *xbmc.UniqueIDs
	Resume    *Resume
}

Movie represents Movie content type

func GetLibraryMovie

func GetLibraryMovie(kodiID int) *Movie

GetLibraryMovie finds Movie from library

func GetMovieByIMDB

func GetMovieByIMDB(id string) (*Movie, error)

GetMovieByIMDB ...

func GetMovieByTMDB

func GetMovieByTMDB(id int) (*Movie, error)

GetMovieByTMDB ...

func (*Movie) IsWatched

func (m *Movie) IsWatched() bool

IsWatched returns watched state

type MutexType

type MutexType int
const (
	UIDsMutex MutexType = iota
	MoviesMutex
	ShowsMutex
	TraktMutex
)

type Resume

type Resume struct {
	Position float64 `json:"position"`
	Total    float64 `json:"total"`
}

Resume shows watched progress information

func GetEpisodeResume

func GetEpisodeResume(kodiID int) *Resume

GetEpisodeResume returns Resume info for kodi id

func GetMovieResume

func GetMovieResume(kodiID int) *Resume

GetMovieResume returns Resume info for kodi id

func (*Resume) Reset

func (r *Resume) Reset()

Reset ...

func (*Resume) ToString

func (r *Resume) ToString() string

ToString ...

type ScraperType

type ScraperType int
const (
	TVDBScraper ScraperType = iota
	TMDBScraper
	TraktScraper
	IMDBScraper
)

type Season

type Season struct {
	ID       int
	Title    string
	Season   int
	Episodes int
	UIDs     *UniqueIDs
	XbmcUIDs *xbmc.UniqueIDs
}

Season represents Season content type

type Show

type Show struct {
	ID        int
	Title     string
	Year      int
	DateAdded time.Time
	Seasons   []*Season
	Episodes  []*Episode
	UIDs      *UniqueIDs
	XbmcUIDs  *xbmc.UniqueIDs
}

Show represents Show content type

func FindShowByIMDB

func FindShowByIMDB(id string) (*Show, error)

FindShowByIMDB ...

func FindShowByKodi

func FindShowByKodi(id int) (*Show, error)

FindShowByKodi ...

func FindShowByTMDB

func FindShowByTMDB(id int) (*Show, error)

FindShowByTMDB ...

func GetLibraryShow

func GetLibraryShow(kodiID int) *Show

GetLibraryShow finds Show from library

func GetShowByIMDB

func GetShowByIMDB(id string) (*Show, error)

GetShowByIMDB ...

func GetShowByTMDB

func GetShowByTMDB(id int) (*Show, error)

GetShowByTMDB ...

func (*Show) GetEpisode

func (s *Show) GetEpisode(season, episode int) *Episode

GetEpisode ...

func (*Show) GetSeason

func (s *Show) GetSeason(season int) *Season

GetSeason returns season by Kodi library ID

func (*Show) IsWatched

func (s *Show) IsWatched() bool

IsWatched returns watched state

type Status

type Status struct {
	IsOverall    bool
	IsMovies     bool
	IsShows      bool
	IsEpisodes   bool
	IsTrakt      bool
	IsKodi       bool
	IsKodiMovies bool
	IsKodiShows  bool
}

Status represents library bool statuses

type UniqueIDs

type UniqueIDs struct {
	MediaType MediaItemType `json:"media"`
	Kodi      int           `json:"kodi"`
	TMDB      int           `json:"tmdb"`
	TVDB      int           `json:"tvdb"`
	IMDB      string        `json:"imdb"`
	Trakt     int           `json:"trakt"`
	Playcount int           `json:"playcount"`
}

UniqueIDs represents all IDs for a library item

func GetUIDsFromKodi

func GetUIDsFromKodi(kodiID int) *UniqueIDs

GetUIDsFromKodi returns UIDs object for provided Kodi ID

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL