This repository has been archived by the owner on Aug 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
user_library_models.go
192 lines (178 loc) · 6.99 KB
/
user_library_models.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
package minutes
import (
"encoding/json"
"fmt"
"time"
)
// UserShow struct
type UserShow struct {
ID string `json:"id" gorethink:"id" gorm:"primary_key"`
AiredEpisodes int `json:"aired_episodes" gorethink:"-" sql:"-"`
Airs struct {
Day string `json:"day" gorethink:"-" sql:"-"`
Time string `json:"time" gorethink:"-" sql:"-"`
Timezone string `json:"timezone" gorethink:"-" sql:"-"`
} `json:"airs" gorethink:"-" sql:"-"`
AvailableTranslations []string `json:"-" gorethink:"-" sql:"-"`
Certification string `json:"-" gorethink:"-" sql:"-"`
Country string `json:"country" gorethink:"-" sql:"-"`
FirstAired string `json:"first_aired" gorethink:"-" sql:"-"`
Genres []string `json:"genres" gorethink:"-" sql:"-"`
Homepage string `json:"-" gorethink:"-" sql:"-"`
IDs struct {
Imdb string `json:"imdb" gorethink:"-" sql:"-"`
Slug string `json:"slug" gorethink:"-" sql:"-"`
Tmdb int `json:"tmdb" gorethink:"-" sql:"-"`
Trakt int `json:"trakt" gorethink:"-" sql:"-"`
Tvdb int `json:"tvdb" gorethink:"-" sql:"-"`
Tvrage int `json:"tvrage" gorethink:"-" sql:"-"`
} `json:"ids" gorethink:"-" sql:"-"`
Images struct {
Banner struct {
Full string `json:"full" gorethink:"-" sql:"-"`
} `json:"banner" gorethink:"-" sql:"-"`
Clearart struct {
Full string `json:"full" gorethink:"-" sql:"-"`
} `json:"clearart" gorethink:"-" sql:"-"`
Fanart struct {
Full string `json:"full" gorethink:"-" sql:"-"`
Medium string `json:"medium" gorethink:"-" sql:"-"`
Thumb string `json:"thumb" gorethink:"-" sql:"-"`
} `json:"fanart" gorethink:"-" sql:"-"`
Logo struct {
Full string `json:"full" gorethink:"-" sql:"-"`
} `json:"logo" gorethink:"-" sql:"-"`
Poster struct {
Full string `json:"full" gorethink:"-" sql:"-"`
Medium string `json:"medium" gorethink:"-" sql:"-"`
Thumb string `json:"thumb" gorethink:"-" sql:"-"`
} `json:"poster" gorethink:"-" sql:"-"`
Thumb struct {
Full string `json:"full" gorethink:"-" sql:"-"`
} `json:"thumb" gorethink:"-" sql:"-"`
} `json:"images" gorethink:"-" sql:"-"`
Language string `json:"language" gorethink:"-" sql:"-"`
Network string `json:"network" gorethink:"-" sql:"-"`
Overview string `json:"overview" gorethink:"-" sql:"-"`
Rating float64 `json:"rating" gorethink:"-" sql:"-"`
Runtime float64 `json:"runtime" gorethink:"-" sql:"-"`
Status string `json:"status" gorethink:"-" sql:"-"`
Title string `json:"title" gorethink:"title,omitempty"`
Trailer string `json:"-" gorethink:"-" sql:"-"`
UpdatedAt string `json:"-" gorethink:"-" `
Votes int `json:"-" gorethink:"-" sql:"-"`
Year int `json:"year" gorethink:"-" sql:"-"`
}
// MergeInPlace -
func (sh *UserShow) MergeInPlace(gsh *Show) {
data, _ := json.Marshal(gsh)
json.Unmarshal(data, &sh)
}
// GetCID -
func (sh *UserShow) GetCID() interface{} {
return sh.ID
}
// UserSeason struct
type UserSeason struct {
ID uint `json:"id" gorm:"primary_key"`
ShowID string `json:"show_id" gorethink:"show_id"`
EpisodeCount int `json:"episode_count" gorethink:"-" sql:"-"`
IDs struct {
Tmdb int `json:"tmdb" gorethink:"-" sql:"-"`
Trakt int `json:"trakt" gorethink:"-" sql:"-"`
Tvdb int `json:"tvdb" gorethink:"-" sql:"-"`
Tvrage int `json:"tvrage" gorethink:"-" sql:"-"`
} `json:"ids" gorethink:"-" sql:"-"`
Images struct {
Poster struct {
Full string `json:"full" gorethink:"-" sql:"-"`
Medium string `json:"medium" gorethink:"-" sql:"-"`
Thumb string `json:"thumb" gorethink:"-" sql:"-"`
} `json:"poster" gorethink:"-" sql:"-"`
Thumb struct {
Full string `json:"full" gorethink:"-" sql:"-"`
} `json:"thumb" gorethink:"-" sql:"-"`
} `json:"images" gorethink:"-" sql:"-"`
Number int `json:"number" gorethink:"number"`
Overview string `json:"overview" gorethink:"-" sql:"-"`
Rating float64 `json:"rating" gorethink:"-" sql:"-"`
Votes int `json:"votes" gorethink:"-" sql:"-"`
CID []interface{} `json:"-" gorethink:"id" sql:"-"`
}
// MergeInPlace -
func (se *UserSeason) MergeInPlace(gse *Season) {
data, _ := json.Marshal(gse)
json.Unmarshal(data, &se)
}
// GetCID -
func (se *UserSeason) GetCID() []interface{} {
return []interface{}{
se.ShowID,
se.Number,
}
}
// UserEpisode struct
type UserEpisode struct {
ID uint `json:"id" gorm:"primary_key"`
ShowID string `json:"show_id" gorethink:"show_id"`
AvailableTranslations []string `json:"-" gorethink:"-" sql:"-"`
FirstAired *time.Time `json:"first_aired" gorethink:"-" sql:"-"`
IDs struct {
Imdb string `json:"imdb" gorethink:"-" sql:"-"`
Tmdb int `json:"tmdb" gorethink:"-" sql:"-"`
Trakt int `json:"trakt" gorethink:"-" sql:"-"`
Tvdb int `json:"tvdb" gorethink:"-" sql:"-"`
Tvrage int `json:"tvrage" gorethink:"-" sql:"-"`
} `json:"ids" gorethink:"-" sql:"-"`
Images struct {
Screenshot struct {
Full string `json:"full" gorethink:"-" sql:"-"`
Medium string `json:"medium" gorethink:"-" sql:"-"`
Thumb string `json:"thumb" gorethink:"-" sql:"-"`
} `json:"screenshot" gorethink:"-" sql:"-"`
} `json:"images" gorethink:"-" sql:"-"`
Number int `json:"number" gorethink:"number,omitempty"`
Overview string `json:"overview" gorethink:"-" sql:"-"`
Rating float64 `json:"-" gorethink:"-" sql:"-"`
Season int `json:"season" gorethink:"season,omitempty"`
Title string `json:"title" gorethink:"title,omitempty"`
UpdatedAt string `json:"updated_at" gorethink:"-" `
Votes int `json:"-" gorethink:"-" sql:"-"`
CID []interface{} `json:"-" gorethink:"id" sql:"-"`
Files []*UserFile `json:"files" gorethink:"files" sql:"-"`
}
// UserFile -
type UserFile struct {
ID uint `json:"id" gorm:"primary_key"`
Name string `json:"name" gorethink:"name"`
Path string `json:"path" gorethink:"path"`
Infohash string `json:"-" gorethink:"infohash"`
Resolution string `json:"resolution" gorethink:"resolution"`
Source string `json:"source" gorethink:"source"`
VideoCodec string `json:"video_codec" gorethink:"video_codec"`
AudioCodec string `json:"audio_codec" gorethink:"audio_codec"`
ReleaseGroup string `json:"release_group" gorethink:"release_group"`
CRC32 string `json:"crc32" gorethink:"crc32"`
Status string `json:"status" gorethink:"status"`
RetryTime int64 `json:"retry_time" gorethink:"retry_time"`
ShowID string `json:"-" gorethink:"_"`
Season int `json:"-" gorethink:"_"`
Episode int `json:"-" gorethink:"_"`
}
// MergeInPlace -
func (ep *UserEpisode) MergeInPlace(gep *Episode) {
data, _ := json.Marshal(gep)
json.Unmarshal(data, &ep)
}
// String -
func (ep *UserEpisode) String() string {
return fmt.Sprintf("ID:%s S%02dE%02d", ep.ShowID, ep.Season, ep.Number)
}
// GetCID -
func (ep *UserEpisode) GetCID() []interface{} {
return []interface{}{
ep.ShowID,
ep.Season,
ep.Number,
}
}