Implement Jackett search entpoint
This commit is contained in:
@@ -0,0 +1,178 @@
|
||||
package release
|
||||
|
||||
type Type int
|
||||
|
||||
const (
|
||||
TypeUnknown Type = iota
|
||||
TypeAlbum
|
||||
TypeEP
|
||||
TypeSingle
|
||||
TypeDiscography
|
||||
TypeCollection
|
||||
TypeCompilation
|
||||
TypeSoundtrack
|
||||
TypeLive
|
||||
TypeBootleg
|
||||
)
|
||||
|
||||
func (t Type) String() string {
|
||||
switch t {
|
||||
case TypeAlbum:
|
||||
return "album"
|
||||
case TypeEP:
|
||||
return "ep"
|
||||
case TypeSingle:
|
||||
return "single"
|
||||
case TypeDiscography:
|
||||
return "discography"
|
||||
case TypeCollection:
|
||||
return "collection"
|
||||
case TypeCompilation:
|
||||
return "compilation"
|
||||
case TypeSoundtrack:
|
||||
return "soundtrack"
|
||||
case TypeLive:
|
||||
return "live"
|
||||
case TypeBootleg:
|
||||
return "bootleg"
|
||||
default:
|
||||
return "unknown"
|
||||
}
|
||||
}
|
||||
|
||||
func (t Type) Priority() int {
|
||||
switch t {
|
||||
case TypeAlbum, TypeEP, TypeSingle:
|
||||
return 1
|
||||
case TypeLive:
|
||||
return 2
|
||||
case TypeSoundtrack:
|
||||
return 3
|
||||
case TypeCollection:
|
||||
return 4
|
||||
case TypeDiscography:
|
||||
return 5
|
||||
case TypeCompilation:
|
||||
return 6
|
||||
case TypeBootleg:
|
||||
return 7
|
||||
default:
|
||||
return 99
|
||||
}
|
||||
}
|
||||
|
||||
type AudioFormat int
|
||||
|
||||
const (
|
||||
FormatUnknown AudioFormat = iota
|
||||
FormatFLAC
|
||||
FormatMP3
|
||||
FormatAAC
|
||||
FormatAPE
|
||||
FormatWavPack
|
||||
FormatALAC
|
||||
FormatOGG
|
||||
FormatWAV
|
||||
)
|
||||
|
||||
func (f AudioFormat) String() string {
|
||||
switch f {
|
||||
case FormatFLAC:
|
||||
return "FLAC"
|
||||
case FormatMP3:
|
||||
return "MP3"
|
||||
case FormatAAC:
|
||||
return "AAC"
|
||||
case FormatAPE:
|
||||
return "APE"
|
||||
case FormatWavPack:
|
||||
return "WavPack"
|
||||
case FormatALAC:
|
||||
return "ALAC"
|
||||
case FormatOGG:
|
||||
return "OGG"
|
||||
case FormatWAV:
|
||||
return "WAV"
|
||||
default:
|
||||
return "unknown"
|
||||
}
|
||||
}
|
||||
|
||||
func (f AudioFormat) IsLossless() bool {
|
||||
switch f {
|
||||
case FormatFLAC, FormatAPE, FormatWavPack, FormatALAC, FormatWAV:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
type Source int
|
||||
|
||||
const (
|
||||
SourceUnknown Source = iota
|
||||
SourceCD
|
||||
SourceWEB
|
||||
SourceVinyl
|
||||
SourceCassette
|
||||
SourceDVD
|
||||
SourceBluRay
|
||||
)
|
||||
|
||||
func (s Source) String() string {
|
||||
switch s {
|
||||
case SourceCD:
|
||||
return "CD"
|
||||
case SourceWEB:
|
||||
return "WEB"
|
||||
case SourceVinyl:
|
||||
return "Vinyl"
|
||||
case SourceCassette:
|
||||
return "Cassette"
|
||||
case SourceDVD:
|
||||
return "DVD"
|
||||
case SourceBluRay:
|
||||
return "BluRay"
|
||||
default:
|
||||
return "unknown"
|
||||
}
|
||||
}
|
||||
|
||||
type Release struct {
|
||||
RawTitle string
|
||||
|
||||
Artist string
|
||||
Album string
|
||||
Year int
|
||||
YearEnd int
|
||||
|
||||
Type Type
|
||||
Genres []string
|
||||
|
||||
Format AudioFormat
|
||||
Source Source
|
||||
Bitrate string
|
||||
BitDepth int
|
||||
SampleRate int
|
||||
RipType string
|
||||
|
||||
ReleaseCount int
|
||||
Tags []string
|
||||
Label string
|
||||
CatalogNum string
|
||||
|
||||
ParsedSuccessfully bool
|
||||
ParseErrors []string
|
||||
}
|
||||
|
||||
func (r *Release) IsDiscography() bool {
|
||||
return r.Type == TypeDiscography || r.Type == TypeCollection
|
||||
}
|
||||
|
||||
func (r *Release) IsSingleRelease() bool {
|
||||
return r.Type == TypeAlbum || r.Type == TypeEP || r.Type == TypeSingle
|
||||
}
|
||||
|
||||
func (r *Release) HasYearRange() bool {
|
||||
return r.YearEnd > 0 && r.YearEnd != r.Year
|
||||
}
|
||||
Reference in New Issue
Block a user