forked from scakemyer/quasar
-
Notifications
You must be signed in to change notification settings - Fork 43
/
types.go
145 lines (122 loc) · 2.48 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
package uid
import (
"sync"
"time"
"github.com/elgatito/elementum/xbmc"
)
type MutexType int
type ContainerType int
type MediaItemType int
type ScraperType int
const (
UIDsMutex MutexType = iota
MoviesMutex
ShowsMutex
TraktMutex
)
const (
WatchlistedMoviesContainer ContainerType = iota
WatchedMoviesContainer
CollectedMoviesContainer
UserlistedMoviesContainer
WatchlistedShowsContainer
WatchedShowsContainer
CollectedShowsContainer
UserlistedShowsContainer
)
const (
MovieType MediaItemType = iota
ShowType
SeasonType
EpisodeType
)
const (
TVDBScraper ScraperType = iota
TMDBScraper
TraktScraper
IMDBScraper
)
// Status represents library bool statuses
type Status struct {
IsOverall bool
IsMovies bool
IsShows bool
IsEpisodes bool
IsTrakt bool
IsKodi bool
IsKodiMovies bool
IsKodiShows bool
}
// UniqueIDs represents all IDs for a library item
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"`
}
// Movie represents Movie content type
type Movie struct {
ID int
Title string
File string
Year int
DateAdded time.Time
UIDs *UniqueIDs
XbmcUIDs *xbmc.UniqueIDs
Resume *Resume
}
// Show represents Show content type
type Show struct {
ID int
Title string
Year int
DateAdded time.Time
Seasons []*Season
Episodes []*Episode
UIDs *UniqueIDs
XbmcUIDs *xbmc.UniqueIDs
}
// Season represents Season content type
type Season struct {
ID int
Title string
Season int
Episodes int
UIDs *UniqueIDs
XbmcUIDs *xbmc.UniqueIDs
}
// Episode represents Episode content type
type Episode struct {
ID int
Title string
Season int
Episode int
File string
DateAdded time.Time
UIDs *UniqueIDs
XbmcUIDs *xbmc.UniqueIDs
Resume *Resume
}
// Resume shows watched progress information
type Resume struct {
Position float64 `json:"position"`
Total float64 `json:"total"`
}
type LibraryContainer struct {
Mu sync.RWMutex
Items map[uint64]struct{}
}
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
globalMutex sync.RWMutex
}