forked from golift/starr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshared.go
120 lines (101 loc) · 3.01 KB
/
shared.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
package starr
import "strings"
/* This file contains shared structs or constants for all the *arr apps. */
// App can be used to satisfy a context value key.
// It is not used in this library; provided for convenience.
type App string
// These constants are just here for convenience.
// If you add more here, add them to String() below.
const (
Emby App = "Emby"
Lidarr App = "Lidarr"
Plex App = "Plex"
Prowlarr App = "Prowlarr"
Radarr App = "Radarr"
Readarr App = "Readarr"
Sonarr App = "Sonarr"
)
// Silly constants to not screw up integer->string conversions.
const (
Base10 = 10
)
// String turns an App name into a string.
func (a App) String() string {
return string(a)
}
// Lower turns an App name into a lowercase string.
func (a App) Lower() string {
return strings.ToLower(string(a))
}
// StatusMessage represents the status of the item. All apps use this.
type StatusMessage struct {
Title string `json:"title"`
Messages []string `json:"messages"`
}
// BaseQuality is a base quality profile.
type BaseQuality struct {
ID int64 `json:"id"`
Name string `json:"name"`
Source string `json:"source,omitempty"`
Resolution int `json:"resolution,omitempty"`
Modifier string `json:"modifier,omitempty"`
}
// Quality is a download quality profile attached to a movie, book, track or series.
// It may contain 1 or more profiles.
// Readarr does not use Name or ID in this struct.
type Quality struct {
Name string `json:"name,omitempty"`
ID int `json:"id,omitempty"`
Quality *BaseQuality `json:"quality,omitempty"`
Items []*Quality `json:"items"`
Allowed bool `json:"allowed"`
Revision *QualityRevision `json:"revision,omitempty"` // Not sure which app had this....
}
// QualityRevision is probably used in Sonarr.
type QualityRevision struct {
Version int64 `json:"version"`
Real int64 `json:"real"`
IsRepack bool `json:"isRepack,omitempty"`
}
// Ratings belong to a few types.
type Ratings struct {
Votes int64 `json:"votes"`
Value float64 `json:"value"`
Popularity float64 `json:"popularity,omitempty"`
}
// IsLoaded is a generic struct used in a few places.
type IsLoaded struct {
IsLoaded bool `json:"isLoaded"`
}
// Link is used in a few places.
type Link struct {
URL string `json:"url"`
Name string `json:"name"`
}
// Tag may be applied to nearly anything.
type Tag struct {
ID int
Label string
}
// Image is used in a few places.
type Image struct {
CoverType string `json:"coverType"`
URL string `json:"url"`
RemoteURL string `json:"remoteUrl,omitempty"`
Extension string `json:"extension,omitempty"`
}
// Path is for unmanaged folder paths.
type Path struct {
Name string `json:"name"`
Path string `json:"path"`
}
// Value is generic ID/Name struct applied to a few places.
type Value struct {
ID int64 `json:"id"`
Name string `json:"name"`
}
// KeyValue is yet another reusable generic type.
type KeyValue struct {
Key string `json:"key"`
Value int `json:"value"`
}