mirror of
https://github.com/simon-ding/polaris.git
synced 2026-02-17 20:40:50 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0954632b65 |
17
db/const.go
17
db/const.go
@@ -24,6 +24,8 @@ const (
|
||||
SettingMovieSizeLimiter = "movie_size_limiter"
|
||||
SettingAcceptedVideoFormats = "accepted_video_formats"
|
||||
SettingAcceptedSubtitleFormats = "accepted_subtitle_formats"
|
||||
|
||||
SettingAIConfig = "ai_config"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -46,17 +48,18 @@ const (
|
||||
|
||||
const DefaultNamingFormat = "{{.NameCN}} {{.NameEN}} {{if .Year}} ({{.Year}}) {{end}}"
|
||||
|
||||
//https://en.wikipedia.org/wiki/Video_file_format
|
||||
// https://en.wikipedia.org/wiki/Video_file_format
|
||||
var defaultAcceptedVideoFormats = []string{
|
||||
".webm", ".mkv", ".flv", ".vob", ".ogv", ".ogg", ".drc", ".mng", ".avi", ".mts", ".m2ts",".ts",
|
||||
".mov", ".qt", ".wmv", ".yuv", ".rm", ".rmvb", ".viv", ".amv", ".mp4", ".m4p", ".m4v",
|
||||
".webm", ".mkv", ".flv", ".vob", ".ogv", ".ogg", ".drc", ".mng", ".avi", ".mts", ".m2ts", ".ts",
|
||||
".mov", ".qt", ".wmv", ".yuv", ".rm", ".rmvb", ".viv", ".amv", ".mp4", ".m4p", ".m4v",
|
||||
".mpg", ".mp2", ".mpeg", ".mpe", ".mpv", ".m2v", ".m4v",
|
||||
".svi", ".3gp", ".3g2", ".nsv",
|
||||
}
|
||||
|
||||
var defaultAcceptedSubtitleFormats = []string{
|
||||
".ass", ".srt",".vtt", ".webvtt", ".sub", ".idx",
|
||||
".ass", ".srt", ".vtt", ".webvtt", ".sub", ".idx",
|
||||
}
|
||||
|
||||
type NamingInfo struct {
|
||||
NameCN string
|
||||
NameEN string
|
||||
@@ -96,3 +99,9 @@ type ProwlarrSetting struct {
|
||||
ApiKey string `json:"api_key"`
|
||||
URL string `json:"url"`
|
||||
}
|
||||
|
||||
type AIConfig struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
GeminiApiKey string `json:"gemini_api_key"`
|
||||
GeminiModelName string `json:"gemini_model_name"`
|
||||
}
|
||||
|
||||
90
db/db.go
90
db/db.go
@@ -38,14 +38,13 @@ func Open() (*Client, error) {
|
||||
return nil, errors.Wrap(err, "failed opening connection to sqlite")
|
||||
}
|
||||
//defer client.Close()
|
||||
// Run the auto migration tool.
|
||||
if err := client.Schema.Create(context.Background()); err != nil {
|
||||
return nil, errors.Wrap(err, "failed creating schema resources")
|
||||
}
|
||||
c := &Client{
|
||||
ent: client,
|
||||
}
|
||||
// Run the auto migration tool.
|
||||
if err := c.migrate(); err != nil {
|
||||
return nil, errors.Wrap(err, "migrate")
|
||||
}
|
||||
|
||||
c.init()
|
||||
|
||||
return c, nil
|
||||
@@ -266,22 +265,20 @@ type TorznabSetting struct {
|
||||
|
||||
func (c *Client) SaveIndexer(in *ent.Indexers) error {
|
||||
|
||||
count := c.ent.Indexers.Query().Where(indexers.Name(in.Name)).CountX(context.TODO())
|
||||
|
||||
if count > 0 || in.ID != 0 {
|
||||
if in.ID != 0 {
|
||||
//update setting
|
||||
return c.ent.Indexers.Update().Where(indexers.ID(in.ID)).SetName(in.Name).SetImplementation(in.Implementation).
|
||||
SetPriority(in.Priority).SetSeedRatio(in.SeedRatio).SetDisabled(in.Disabled).
|
||||
SetTvSearch(in.TvSearch).SetMovieSearch(in.MovieSearch).SetSettings("").SetSynced(in.Synced).
|
||||
SetAPIKey(in.APIKey).SetURL(in.URL).
|
||||
Exec(context.Background())
|
||||
SetPriority(in.Priority).SetSettings(in.Settings).SetSeedRatio(in.SeedRatio).SetDisabled(in.Disabled).Exec(context.Background())
|
||||
}
|
||||
//create new one
|
||||
count := c.ent.Indexers.Query().Where(indexers.Name(in.Name)).CountX(context.TODO())
|
||||
if count > 0 {
|
||||
return fmt.Errorf("name already esxits: %v", in.Name)
|
||||
}
|
||||
|
||||
_, err := c.ent.Indexers.Create().
|
||||
SetName(in.Name).SetImplementation(in.Implementation).SetPriority(in.Priority).SetSeedRatio(in.SeedRatio).
|
||||
SetTvSearch(in.TvSearch).SetMovieSearch(in.MovieSearch).SetSettings("").SetSynced(in.Synced).
|
||||
SetAPIKey(in.APIKey).SetURL(in.URL).SetDisabled(in.Disabled).Save(context.TODO())
|
||||
SetName(in.Name).SetImplementation(in.Implementation).SetPriority(in.Priority).SetSettings(in.Settings).SetSeedRatio(in.SeedRatio).
|
||||
SetDisabled(in.Disabled).Save(context.TODO())
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "save db")
|
||||
}
|
||||
@@ -289,21 +286,46 @@ func (c *Client) SaveIndexer(in *ent.Indexers) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) DeleteIndexer(id int) {
|
||||
func (c *Client) DeleteTorznab(id int) {
|
||||
c.ent.Indexers.Delete().Where(indexers.ID(id)).Exec(context.TODO())
|
||||
}
|
||||
|
||||
func (c *Client) GetIndexer(id int) (*ent.Indexers, error) {
|
||||
func (c *Client) GetIndexer(id int) (*TorznabInfo, error) {
|
||||
res, err := c.ent.Indexers.Query().Where(indexers.ID(id)).First(context.TODO())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return res, nil
|
||||
var ss TorznabSetting
|
||||
err = json.Unmarshal([]byte(res.Settings), &ss)
|
||||
if err != nil {
|
||||
|
||||
return nil, fmt.Errorf("unmarshal torznab %s error: %v", res.Name, err)
|
||||
}
|
||||
return &TorznabInfo{Indexers: res, TorznabSetting: ss}, nil
|
||||
}
|
||||
|
||||
func (c *Client) GetAllIndexers() []*ent.Indexers {
|
||||
res := c.ent.Indexers.Query().Where(indexers.Implementation(IndexerTorznabImpl)).Order(ent.Asc(indexers.FieldID)).AllX(context.TODO())
|
||||
return res
|
||||
type TorznabInfo struct {
|
||||
*ent.Indexers
|
||||
TorznabSetting
|
||||
}
|
||||
|
||||
func (c *Client) GetAllTorznabInfo() []*TorznabInfo {
|
||||
res := c.ent.Indexers.Query().Where(indexers.Implementation(IndexerTorznabImpl)).AllX(context.TODO())
|
||||
|
||||
var l = make([]*TorznabInfo, 0, len(res))
|
||||
for _, r := range res {
|
||||
var ss TorznabSetting
|
||||
err := json.Unmarshal([]byte(r.Settings), &ss)
|
||||
if err != nil {
|
||||
log.Errorf("unmarshal torznab %s error: %v", r.Name, err)
|
||||
continue
|
||||
}
|
||||
l = append(l, &TorznabInfo{
|
||||
Indexers: r,
|
||||
TorznabSetting: ss,
|
||||
})
|
||||
}
|
||||
return l
|
||||
}
|
||||
|
||||
func (c *Client) SaveDownloader(downloader *ent.DownloadClients) error {
|
||||
@@ -690,6 +712,7 @@ func (c *Client) SaveProwlarrSetting(se *ProwlarrSetting) error {
|
||||
return c.SetSetting(SettingProwlarrInfo, string(data))
|
||||
}
|
||||
|
||||
|
||||
func (c *Client) getAcceptedFormats(key string) ([]string, error) {
|
||||
v := c.GetSetting(key)
|
||||
if v == "" {
|
||||
@@ -707,7 +730,7 @@ func (c *Client) setAcceptedFormats(key string, v []string) error {
|
||||
return err
|
||||
}
|
||||
return c.SetSetting(key, string(data))
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) GetAcceptedVideoFormats() ([]string, error) {
|
||||
res, err := c.getAcceptedFormats(SettingAcceptedVideoFormats)
|
||||
@@ -729,7 +752,7 @@ func (c *Client) GetAcceptedSubtitleFormats() ([]string, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if res == nil {
|
||||
if res== nil {
|
||||
return defaultAcceptedSubtitleFormats, nil
|
||||
}
|
||||
return res, nil
|
||||
@@ -738,3 +761,24 @@ func (c *Client) GetAcceptedSubtitleFormats() ([]string, error) {
|
||||
func (c *Client) SetAcceptedSubtitleFormats(key string, v []string) error {
|
||||
return c.setAcceptedFormats(SettingAcceptedSubtitleFormats, v)
|
||||
}
|
||||
|
||||
func (c *Client) GetAIConfig() (AIConfig, error) {
|
||||
cfg := c.GetSetting(SettingAIConfig)
|
||||
var ai AIConfig
|
||||
if cfg == "" {
|
||||
return ai, nil
|
||||
}
|
||||
err := json.Unmarshal([]byte(cfg), &ai)
|
||||
if err != nil {
|
||||
return AIConfig{}, err
|
||||
}
|
||||
return ai, nil
|
||||
}
|
||||
|
||||
func (c *Client) SetAIConfig(cfg *AIConfig) error {
|
||||
if data, err := json.Marshal(cfg); err != nil {
|
||||
return err
|
||||
} else {
|
||||
return c.SetSetting(SettingAIConfig, string(data))
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"polaris/log"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func (c *Client) migrate() error {
|
||||
// Run the auto migration tool.
|
||||
if err := c.ent.Schema.Create(context.Background()); err != nil {
|
||||
return errors.Wrap(err, "failed creating schema resources")
|
||||
}
|
||||
|
||||
if err := c.migrateIndexerSetting(); err != nil {
|
||||
return errors.Wrap(err, "migrate indexer setting")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) migrateIndexerSetting() error {
|
||||
indexers := c.GetAllIndexers()
|
||||
for _, in := range indexers {
|
||||
|
||||
if in.Settings == "" {
|
||||
continue
|
||||
}
|
||||
if in.APIKey != "" && in.URL != "" {
|
||||
continue
|
||||
}
|
||||
var setting TorznabSetting
|
||||
err := json.Unmarshal([]byte(in.Settings), &setting)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
in.APIKey = setting.ApiKey
|
||||
in.URL = setting.URL
|
||||
if err := c.SaveIndexer(in); err != nil {
|
||||
return errors.Wrap(err, "save indexer")
|
||||
}
|
||||
log.Infof("success migrate indexer setting field: %s", in.Name)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -20,7 +20,7 @@ type Indexers struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
// Implementation holds the value of the "implementation" field.
|
||||
Implementation string `json:"implementation,omitempty"`
|
||||
// deprecated, use api_key and url
|
||||
// Settings holds the value of the "settings" field.
|
||||
Settings string `json:"settings,omitempty"`
|
||||
// EnableRss holds the value of the "enable_rss" field.
|
||||
EnableRss bool `json:"enable_rss,omitempty"`
|
||||
@@ -29,17 +29,7 @@ type Indexers struct {
|
||||
// minimal seed ratio requied, before removing torrent
|
||||
SeedRatio float32 `json:"seed_ratio,omitempty"`
|
||||
// Disabled holds the value of the "disabled" field.
|
||||
Disabled bool `json:"disabled,omitempty"`
|
||||
// TvSearch holds the value of the "tv_search" field.
|
||||
TvSearch bool `json:"tv_search,omitempty"`
|
||||
// MovieSearch holds the value of the "movie_search" field.
|
||||
MovieSearch bool `json:"movie_search,omitempty"`
|
||||
// APIKey holds the value of the "api_key" field.
|
||||
APIKey string `json:"api_key,omitempty"`
|
||||
// URL holds the value of the "url" field.
|
||||
URL string `json:"url,omitempty"`
|
||||
// synced from prowlarr
|
||||
Synced bool `json:"synced,omitempty"`
|
||||
Disabled bool `json:"disabled,omitempty"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
@@ -48,13 +38,13 @@ func (*Indexers) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case indexers.FieldEnableRss, indexers.FieldDisabled, indexers.FieldTvSearch, indexers.FieldMovieSearch, indexers.FieldSynced:
|
||||
case indexers.FieldEnableRss, indexers.FieldDisabled:
|
||||
values[i] = new(sql.NullBool)
|
||||
case indexers.FieldSeedRatio:
|
||||
values[i] = new(sql.NullFloat64)
|
||||
case indexers.FieldID, indexers.FieldPriority:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case indexers.FieldName, indexers.FieldImplementation, indexers.FieldSettings, indexers.FieldAPIKey, indexers.FieldURL:
|
||||
case indexers.FieldName, indexers.FieldImplementation, indexers.FieldSettings:
|
||||
values[i] = new(sql.NullString)
|
||||
default:
|
||||
values[i] = new(sql.UnknownType)
|
||||
@@ -119,36 +109,6 @@ func (i *Indexers) assignValues(columns []string, values []any) error {
|
||||
} else if value.Valid {
|
||||
i.Disabled = value.Bool
|
||||
}
|
||||
case indexers.FieldTvSearch:
|
||||
if value, ok := values[j].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field tv_search", values[j])
|
||||
} else if value.Valid {
|
||||
i.TvSearch = value.Bool
|
||||
}
|
||||
case indexers.FieldMovieSearch:
|
||||
if value, ok := values[j].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field movie_search", values[j])
|
||||
} else if value.Valid {
|
||||
i.MovieSearch = value.Bool
|
||||
}
|
||||
case indexers.FieldAPIKey:
|
||||
if value, ok := values[j].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field api_key", values[j])
|
||||
} else if value.Valid {
|
||||
i.APIKey = value.String
|
||||
}
|
||||
case indexers.FieldURL:
|
||||
if value, ok := values[j].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field url", values[j])
|
||||
} else if value.Valid {
|
||||
i.URL = value.String
|
||||
}
|
||||
case indexers.FieldSynced:
|
||||
if value, ok := values[j].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field synced", values[j])
|
||||
} else if value.Valid {
|
||||
i.Synced = value.Bool
|
||||
}
|
||||
default:
|
||||
i.selectValues.Set(columns[j], values[j])
|
||||
}
|
||||
@@ -205,21 +165,6 @@ func (i *Indexers) String() string {
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("disabled=")
|
||||
builder.WriteString(fmt.Sprintf("%v", i.Disabled))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("tv_search=")
|
||||
builder.WriteString(fmt.Sprintf("%v", i.TvSearch))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("movie_search=")
|
||||
builder.WriteString(fmt.Sprintf("%v", i.MovieSearch))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("api_key=")
|
||||
builder.WriteString(i.APIKey)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("url=")
|
||||
builder.WriteString(i.URL)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("synced=")
|
||||
builder.WriteString(fmt.Sprintf("%v", i.Synced))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
@@ -25,16 +25,6 @@ const (
|
||||
FieldSeedRatio = "seed_ratio"
|
||||
// FieldDisabled holds the string denoting the disabled field in the database.
|
||||
FieldDisabled = "disabled"
|
||||
// FieldTvSearch holds the string denoting the tv_search field in the database.
|
||||
FieldTvSearch = "tv_search"
|
||||
// FieldMovieSearch holds the string denoting the movie_search field in the database.
|
||||
FieldMovieSearch = "movie_search"
|
||||
// FieldAPIKey holds the string denoting the api_key field in the database.
|
||||
FieldAPIKey = "api_key"
|
||||
// FieldURL holds the string denoting the url field in the database.
|
||||
FieldURL = "url"
|
||||
// FieldSynced holds the string denoting the synced field in the database.
|
||||
FieldSynced = "synced"
|
||||
// Table holds the table name of the indexers in the database.
|
||||
Table = "indexers"
|
||||
)
|
||||
@@ -49,11 +39,6 @@ var Columns = []string{
|
||||
FieldPriority,
|
||||
FieldSeedRatio,
|
||||
FieldDisabled,
|
||||
FieldTvSearch,
|
||||
FieldMovieSearch,
|
||||
FieldAPIKey,
|
||||
FieldURL,
|
||||
FieldSynced,
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
@@ -67,8 +52,6 @@ func ValidColumn(column string) bool {
|
||||
}
|
||||
|
||||
var (
|
||||
// DefaultSettings holds the default value on creation for the "settings" field.
|
||||
DefaultSettings string
|
||||
// DefaultEnableRss holds the default value on creation for the "enable_rss" field.
|
||||
DefaultEnableRss bool
|
||||
// DefaultPriority holds the default value on creation for the "priority" field.
|
||||
@@ -77,12 +60,6 @@ var (
|
||||
DefaultSeedRatio float32
|
||||
// DefaultDisabled holds the default value on creation for the "disabled" field.
|
||||
DefaultDisabled bool
|
||||
// DefaultTvSearch holds the default value on creation for the "tv_search" field.
|
||||
DefaultTvSearch bool
|
||||
// DefaultMovieSearch holds the default value on creation for the "movie_search" field.
|
||||
DefaultMovieSearch bool
|
||||
// DefaultSynced holds the default value on creation for the "synced" field.
|
||||
DefaultSynced bool
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the Indexers queries.
|
||||
@@ -127,28 +104,3 @@ func BySeedRatio(opts ...sql.OrderTermOption) OrderOption {
|
||||
func ByDisabled(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDisabled, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTvSearch orders the results by the tv_search field.
|
||||
func ByTvSearch(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTvSearch, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMovieSearch orders the results by the movie_search field.
|
||||
func ByMovieSearch(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMovieSearch, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAPIKey orders the results by the api_key field.
|
||||
func ByAPIKey(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAPIKey, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByURL orders the results by the url field.
|
||||
func ByURL(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldURL, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySynced orders the results by the synced field.
|
||||
func BySynced(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSynced, opts...).ToFunc()
|
||||
}
|
||||
|
||||
@@ -88,31 +88,6 @@ func Disabled(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldDisabled, v))
|
||||
}
|
||||
|
||||
// TvSearch applies equality check predicate on the "tv_search" field. It's identical to TvSearchEQ.
|
||||
func TvSearch(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldTvSearch, v))
|
||||
}
|
||||
|
||||
// MovieSearch applies equality check predicate on the "movie_search" field. It's identical to MovieSearchEQ.
|
||||
func MovieSearch(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldMovieSearch, v))
|
||||
}
|
||||
|
||||
// APIKey applies equality check predicate on the "api_key" field. It's identical to APIKeyEQ.
|
||||
func APIKey(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// URL applies equality check predicate on the "url" field. It's identical to URLEQ.
|
||||
func URL(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldURL, v))
|
||||
}
|
||||
|
||||
// Synced applies equality check predicate on the "synced" field. It's identical to SyncedEQ.
|
||||
func Synced(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldSynced, v))
|
||||
}
|
||||
|
||||
// NameEQ applies the EQ predicate on the "name" field.
|
||||
func NameEQ(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldName, v))
|
||||
@@ -298,16 +273,6 @@ func SettingsHasSuffix(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldHasSuffix(FieldSettings, v))
|
||||
}
|
||||
|
||||
// SettingsIsNil applies the IsNil predicate on the "settings" field.
|
||||
func SettingsIsNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldIsNull(FieldSettings))
|
||||
}
|
||||
|
||||
// SettingsNotNil applies the NotNil predicate on the "settings" field.
|
||||
func SettingsNotNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNotNull(FieldSettings))
|
||||
}
|
||||
|
||||
// SettingsEqualFold applies the EqualFold predicate on the "settings" field.
|
||||
func SettingsEqualFold(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEqualFold(FieldSettings, v))
|
||||
@@ -438,216 +403,6 @@ func DisabledNotNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNotNull(FieldDisabled))
|
||||
}
|
||||
|
||||
// TvSearchEQ applies the EQ predicate on the "tv_search" field.
|
||||
func TvSearchEQ(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldTvSearch, v))
|
||||
}
|
||||
|
||||
// TvSearchNEQ applies the NEQ predicate on the "tv_search" field.
|
||||
func TvSearchNEQ(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNEQ(FieldTvSearch, v))
|
||||
}
|
||||
|
||||
// TvSearchIsNil applies the IsNil predicate on the "tv_search" field.
|
||||
func TvSearchIsNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldIsNull(FieldTvSearch))
|
||||
}
|
||||
|
||||
// TvSearchNotNil applies the NotNil predicate on the "tv_search" field.
|
||||
func TvSearchNotNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNotNull(FieldTvSearch))
|
||||
}
|
||||
|
||||
// MovieSearchEQ applies the EQ predicate on the "movie_search" field.
|
||||
func MovieSearchEQ(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldMovieSearch, v))
|
||||
}
|
||||
|
||||
// MovieSearchNEQ applies the NEQ predicate on the "movie_search" field.
|
||||
func MovieSearchNEQ(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNEQ(FieldMovieSearch, v))
|
||||
}
|
||||
|
||||
// MovieSearchIsNil applies the IsNil predicate on the "movie_search" field.
|
||||
func MovieSearchIsNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldIsNull(FieldMovieSearch))
|
||||
}
|
||||
|
||||
// MovieSearchNotNil applies the NotNil predicate on the "movie_search" field.
|
||||
func MovieSearchNotNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNotNull(FieldMovieSearch))
|
||||
}
|
||||
|
||||
// APIKeyEQ applies the EQ predicate on the "api_key" field.
|
||||
func APIKeyEQ(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyNEQ applies the NEQ predicate on the "api_key" field.
|
||||
func APIKeyNEQ(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNEQ(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyIn applies the In predicate on the "api_key" field.
|
||||
func APIKeyIn(vs ...string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldIn(FieldAPIKey, vs...))
|
||||
}
|
||||
|
||||
// APIKeyNotIn applies the NotIn predicate on the "api_key" field.
|
||||
func APIKeyNotIn(vs ...string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNotIn(FieldAPIKey, vs...))
|
||||
}
|
||||
|
||||
// APIKeyGT applies the GT predicate on the "api_key" field.
|
||||
func APIKeyGT(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldGT(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyGTE applies the GTE predicate on the "api_key" field.
|
||||
func APIKeyGTE(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldGTE(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyLT applies the LT predicate on the "api_key" field.
|
||||
func APIKeyLT(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldLT(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyLTE applies the LTE predicate on the "api_key" field.
|
||||
func APIKeyLTE(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldLTE(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyContains applies the Contains predicate on the "api_key" field.
|
||||
func APIKeyContains(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldContains(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyHasPrefix applies the HasPrefix predicate on the "api_key" field.
|
||||
func APIKeyHasPrefix(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldHasPrefix(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyHasSuffix applies the HasSuffix predicate on the "api_key" field.
|
||||
func APIKeyHasSuffix(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldHasSuffix(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyIsNil applies the IsNil predicate on the "api_key" field.
|
||||
func APIKeyIsNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldIsNull(FieldAPIKey))
|
||||
}
|
||||
|
||||
// APIKeyNotNil applies the NotNil predicate on the "api_key" field.
|
||||
func APIKeyNotNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNotNull(FieldAPIKey))
|
||||
}
|
||||
|
||||
// APIKeyEqualFold applies the EqualFold predicate on the "api_key" field.
|
||||
func APIKeyEqualFold(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEqualFold(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyContainsFold applies the ContainsFold predicate on the "api_key" field.
|
||||
func APIKeyContainsFold(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldContainsFold(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// URLEQ applies the EQ predicate on the "url" field.
|
||||
func URLEQ(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLNEQ applies the NEQ predicate on the "url" field.
|
||||
func URLNEQ(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNEQ(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLIn applies the In predicate on the "url" field.
|
||||
func URLIn(vs ...string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldIn(FieldURL, vs...))
|
||||
}
|
||||
|
||||
// URLNotIn applies the NotIn predicate on the "url" field.
|
||||
func URLNotIn(vs ...string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNotIn(FieldURL, vs...))
|
||||
}
|
||||
|
||||
// URLGT applies the GT predicate on the "url" field.
|
||||
func URLGT(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldGT(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLGTE applies the GTE predicate on the "url" field.
|
||||
func URLGTE(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldGTE(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLLT applies the LT predicate on the "url" field.
|
||||
func URLLT(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldLT(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLLTE applies the LTE predicate on the "url" field.
|
||||
func URLLTE(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldLTE(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLContains applies the Contains predicate on the "url" field.
|
||||
func URLContains(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldContains(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLHasPrefix applies the HasPrefix predicate on the "url" field.
|
||||
func URLHasPrefix(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldHasPrefix(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLHasSuffix applies the HasSuffix predicate on the "url" field.
|
||||
func URLHasSuffix(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldHasSuffix(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLIsNil applies the IsNil predicate on the "url" field.
|
||||
func URLIsNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldIsNull(FieldURL))
|
||||
}
|
||||
|
||||
// URLNotNil applies the NotNil predicate on the "url" field.
|
||||
func URLNotNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNotNull(FieldURL))
|
||||
}
|
||||
|
||||
// URLEqualFold applies the EqualFold predicate on the "url" field.
|
||||
func URLEqualFold(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEqualFold(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLContainsFold applies the ContainsFold predicate on the "url" field.
|
||||
func URLContainsFold(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldContainsFold(FieldURL, v))
|
||||
}
|
||||
|
||||
// SyncedEQ applies the EQ predicate on the "synced" field.
|
||||
func SyncedEQ(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldSynced, v))
|
||||
}
|
||||
|
||||
// SyncedNEQ applies the NEQ predicate on the "synced" field.
|
||||
func SyncedNEQ(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNEQ(FieldSynced, v))
|
||||
}
|
||||
|
||||
// SyncedIsNil applies the IsNil predicate on the "synced" field.
|
||||
func SyncedIsNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldIsNull(FieldSynced))
|
||||
}
|
||||
|
||||
// SyncedNotNil applies the NotNil predicate on the "synced" field.
|
||||
func SyncedNotNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNotNull(FieldSynced))
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.Indexers) predicate.Indexers {
|
||||
return predicate.Indexers(sql.AndPredicates(predicates...))
|
||||
|
||||
@@ -37,14 +37,6 @@ func (ic *IndexersCreate) SetSettings(s string) *IndexersCreate {
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetNillableSettings sets the "settings" field if the given value is not nil.
|
||||
func (ic *IndexersCreate) SetNillableSettings(s *string) *IndexersCreate {
|
||||
if s != nil {
|
||||
ic.SetSettings(*s)
|
||||
}
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetEnableRss sets the "enable_rss" field.
|
||||
func (ic *IndexersCreate) SetEnableRss(b bool) *IndexersCreate {
|
||||
ic.mutation.SetEnableRss(b)
|
||||
@@ -101,76 +93,6 @@ func (ic *IndexersCreate) SetNillableDisabled(b *bool) *IndexersCreate {
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetTvSearch sets the "tv_search" field.
|
||||
func (ic *IndexersCreate) SetTvSearch(b bool) *IndexersCreate {
|
||||
ic.mutation.SetTvSearch(b)
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetNillableTvSearch sets the "tv_search" field if the given value is not nil.
|
||||
func (ic *IndexersCreate) SetNillableTvSearch(b *bool) *IndexersCreate {
|
||||
if b != nil {
|
||||
ic.SetTvSearch(*b)
|
||||
}
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetMovieSearch sets the "movie_search" field.
|
||||
func (ic *IndexersCreate) SetMovieSearch(b bool) *IndexersCreate {
|
||||
ic.mutation.SetMovieSearch(b)
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetNillableMovieSearch sets the "movie_search" field if the given value is not nil.
|
||||
func (ic *IndexersCreate) SetNillableMovieSearch(b *bool) *IndexersCreate {
|
||||
if b != nil {
|
||||
ic.SetMovieSearch(*b)
|
||||
}
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetAPIKey sets the "api_key" field.
|
||||
func (ic *IndexersCreate) SetAPIKey(s string) *IndexersCreate {
|
||||
ic.mutation.SetAPIKey(s)
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetNillableAPIKey sets the "api_key" field if the given value is not nil.
|
||||
func (ic *IndexersCreate) SetNillableAPIKey(s *string) *IndexersCreate {
|
||||
if s != nil {
|
||||
ic.SetAPIKey(*s)
|
||||
}
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetURL sets the "url" field.
|
||||
func (ic *IndexersCreate) SetURL(s string) *IndexersCreate {
|
||||
ic.mutation.SetURL(s)
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetNillableURL sets the "url" field if the given value is not nil.
|
||||
func (ic *IndexersCreate) SetNillableURL(s *string) *IndexersCreate {
|
||||
if s != nil {
|
||||
ic.SetURL(*s)
|
||||
}
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetSynced sets the "synced" field.
|
||||
func (ic *IndexersCreate) SetSynced(b bool) *IndexersCreate {
|
||||
ic.mutation.SetSynced(b)
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetNillableSynced sets the "synced" field if the given value is not nil.
|
||||
func (ic *IndexersCreate) SetNillableSynced(b *bool) *IndexersCreate {
|
||||
if b != nil {
|
||||
ic.SetSynced(*b)
|
||||
}
|
||||
return ic
|
||||
}
|
||||
|
||||
// Mutation returns the IndexersMutation object of the builder.
|
||||
func (ic *IndexersCreate) Mutation() *IndexersMutation {
|
||||
return ic.mutation
|
||||
@@ -206,10 +128,6 @@ func (ic *IndexersCreate) ExecX(ctx context.Context) {
|
||||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (ic *IndexersCreate) defaults() {
|
||||
if _, ok := ic.mutation.Settings(); !ok {
|
||||
v := indexers.DefaultSettings
|
||||
ic.mutation.SetSettings(v)
|
||||
}
|
||||
if _, ok := ic.mutation.EnableRss(); !ok {
|
||||
v := indexers.DefaultEnableRss
|
||||
ic.mutation.SetEnableRss(v)
|
||||
@@ -226,18 +144,6 @@ func (ic *IndexersCreate) defaults() {
|
||||
v := indexers.DefaultDisabled
|
||||
ic.mutation.SetDisabled(v)
|
||||
}
|
||||
if _, ok := ic.mutation.TvSearch(); !ok {
|
||||
v := indexers.DefaultTvSearch
|
||||
ic.mutation.SetTvSearch(v)
|
||||
}
|
||||
if _, ok := ic.mutation.MovieSearch(); !ok {
|
||||
v := indexers.DefaultMovieSearch
|
||||
ic.mutation.SetMovieSearch(v)
|
||||
}
|
||||
if _, ok := ic.mutation.Synced(); !ok {
|
||||
v := indexers.DefaultSynced
|
||||
ic.mutation.SetSynced(v)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
@@ -248,6 +154,9 @@ func (ic *IndexersCreate) check() error {
|
||||
if _, ok := ic.mutation.Implementation(); !ok {
|
||||
return &ValidationError{Name: "implementation", err: errors.New(`ent: missing required field "Indexers.implementation"`)}
|
||||
}
|
||||
if _, ok := ic.mutation.Settings(); !ok {
|
||||
return &ValidationError{Name: "settings", err: errors.New(`ent: missing required field "Indexers.settings"`)}
|
||||
}
|
||||
if _, ok := ic.mutation.EnableRss(); !ok {
|
||||
return &ValidationError{Name: "enable_rss", err: errors.New(`ent: missing required field "Indexers.enable_rss"`)}
|
||||
}
|
||||
@@ -308,26 +217,6 @@ func (ic *IndexersCreate) createSpec() (*Indexers, *sqlgraph.CreateSpec) {
|
||||
_spec.SetField(indexers.FieldDisabled, field.TypeBool, value)
|
||||
_node.Disabled = value
|
||||
}
|
||||
if value, ok := ic.mutation.TvSearch(); ok {
|
||||
_spec.SetField(indexers.FieldTvSearch, field.TypeBool, value)
|
||||
_node.TvSearch = value
|
||||
}
|
||||
if value, ok := ic.mutation.MovieSearch(); ok {
|
||||
_spec.SetField(indexers.FieldMovieSearch, field.TypeBool, value)
|
||||
_node.MovieSearch = value
|
||||
}
|
||||
if value, ok := ic.mutation.APIKey(); ok {
|
||||
_spec.SetField(indexers.FieldAPIKey, field.TypeString, value)
|
||||
_node.APIKey = value
|
||||
}
|
||||
if value, ok := ic.mutation.URL(); ok {
|
||||
_spec.SetField(indexers.FieldURL, field.TypeString, value)
|
||||
_node.URL = value
|
||||
}
|
||||
if value, ok := ic.mutation.Synced(); ok {
|
||||
_spec.SetField(indexers.FieldSynced, field.TypeBool, value)
|
||||
_node.Synced = value
|
||||
}
|
||||
return _node, _spec
|
||||
}
|
||||
|
||||
|
||||
@@ -69,12 +69,6 @@ func (iu *IndexersUpdate) SetNillableSettings(s *string) *IndexersUpdate {
|
||||
return iu
|
||||
}
|
||||
|
||||
// ClearSettings clears the value of the "settings" field.
|
||||
func (iu *IndexersUpdate) ClearSettings() *IndexersUpdate {
|
||||
iu.mutation.ClearSettings()
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetEnableRss sets the "enable_rss" field.
|
||||
func (iu *IndexersUpdate) SetEnableRss(b bool) *IndexersUpdate {
|
||||
iu.mutation.SetEnableRss(b)
|
||||
@@ -157,106 +151,6 @@ func (iu *IndexersUpdate) ClearDisabled() *IndexersUpdate {
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetTvSearch sets the "tv_search" field.
|
||||
func (iu *IndexersUpdate) SetTvSearch(b bool) *IndexersUpdate {
|
||||
iu.mutation.SetTvSearch(b)
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetNillableTvSearch sets the "tv_search" field if the given value is not nil.
|
||||
func (iu *IndexersUpdate) SetNillableTvSearch(b *bool) *IndexersUpdate {
|
||||
if b != nil {
|
||||
iu.SetTvSearch(*b)
|
||||
}
|
||||
return iu
|
||||
}
|
||||
|
||||
// ClearTvSearch clears the value of the "tv_search" field.
|
||||
func (iu *IndexersUpdate) ClearTvSearch() *IndexersUpdate {
|
||||
iu.mutation.ClearTvSearch()
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetMovieSearch sets the "movie_search" field.
|
||||
func (iu *IndexersUpdate) SetMovieSearch(b bool) *IndexersUpdate {
|
||||
iu.mutation.SetMovieSearch(b)
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetNillableMovieSearch sets the "movie_search" field if the given value is not nil.
|
||||
func (iu *IndexersUpdate) SetNillableMovieSearch(b *bool) *IndexersUpdate {
|
||||
if b != nil {
|
||||
iu.SetMovieSearch(*b)
|
||||
}
|
||||
return iu
|
||||
}
|
||||
|
||||
// ClearMovieSearch clears the value of the "movie_search" field.
|
||||
func (iu *IndexersUpdate) ClearMovieSearch() *IndexersUpdate {
|
||||
iu.mutation.ClearMovieSearch()
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetAPIKey sets the "api_key" field.
|
||||
func (iu *IndexersUpdate) SetAPIKey(s string) *IndexersUpdate {
|
||||
iu.mutation.SetAPIKey(s)
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetNillableAPIKey sets the "api_key" field if the given value is not nil.
|
||||
func (iu *IndexersUpdate) SetNillableAPIKey(s *string) *IndexersUpdate {
|
||||
if s != nil {
|
||||
iu.SetAPIKey(*s)
|
||||
}
|
||||
return iu
|
||||
}
|
||||
|
||||
// ClearAPIKey clears the value of the "api_key" field.
|
||||
func (iu *IndexersUpdate) ClearAPIKey() *IndexersUpdate {
|
||||
iu.mutation.ClearAPIKey()
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetURL sets the "url" field.
|
||||
func (iu *IndexersUpdate) SetURL(s string) *IndexersUpdate {
|
||||
iu.mutation.SetURL(s)
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetNillableURL sets the "url" field if the given value is not nil.
|
||||
func (iu *IndexersUpdate) SetNillableURL(s *string) *IndexersUpdate {
|
||||
if s != nil {
|
||||
iu.SetURL(*s)
|
||||
}
|
||||
return iu
|
||||
}
|
||||
|
||||
// ClearURL clears the value of the "url" field.
|
||||
func (iu *IndexersUpdate) ClearURL() *IndexersUpdate {
|
||||
iu.mutation.ClearURL()
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetSynced sets the "synced" field.
|
||||
func (iu *IndexersUpdate) SetSynced(b bool) *IndexersUpdate {
|
||||
iu.mutation.SetSynced(b)
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetNillableSynced sets the "synced" field if the given value is not nil.
|
||||
func (iu *IndexersUpdate) SetNillableSynced(b *bool) *IndexersUpdate {
|
||||
if b != nil {
|
||||
iu.SetSynced(*b)
|
||||
}
|
||||
return iu
|
||||
}
|
||||
|
||||
// ClearSynced clears the value of the "synced" field.
|
||||
func (iu *IndexersUpdate) ClearSynced() *IndexersUpdate {
|
||||
iu.mutation.ClearSynced()
|
||||
return iu
|
||||
}
|
||||
|
||||
// Mutation returns the IndexersMutation object of the builder.
|
||||
func (iu *IndexersUpdate) Mutation() *IndexersMutation {
|
||||
return iu.mutation
|
||||
@@ -307,9 +201,6 @@ func (iu *IndexersUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
if value, ok := iu.mutation.Settings(); ok {
|
||||
_spec.SetField(indexers.FieldSettings, field.TypeString, value)
|
||||
}
|
||||
if iu.mutation.SettingsCleared() {
|
||||
_spec.ClearField(indexers.FieldSettings, field.TypeString)
|
||||
}
|
||||
if value, ok := iu.mutation.EnableRss(); ok {
|
||||
_spec.SetField(indexers.FieldEnableRss, field.TypeBool, value)
|
||||
}
|
||||
@@ -334,36 +225,6 @@ func (iu *IndexersUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
if iu.mutation.DisabledCleared() {
|
||||
_spec.ClearField(indexers.FieldDisabled, field.TypeBool)
|
||||
}
|
||||
if value, ok := iu.mutation.TvSearch(); ok {
|
||||
_spec.SetField(indexers.FieldTvSearch, field.TypeBool, value)
|
||||
}
|
||||
if iu.mutation.TvSearchCleared() {
|
||||
_spec.ClearField(indexers.FieldTvSearch, field.TypeBool)
|
||||
}
|
||||
if value, ok := iu.mutation.MovieSearch(); ok {
|
||||
_spec.SetField(indexers.FieldMovieSearch, field.TypeBool, value)
|
||||
}
|
||||
if iu.mutation.MovieSearchCleared() {
|
||||
_spec.ClearField(indexers.FieldMovieSearch, field.TypeBool)
|
||||
}
|
||||
if value, ok := iu.mutation.APIKey(); ok {
|
||||
_spec.SetField(indexers.FieldAPIKey, field.TypeString, value)
|
||||
}
|
||||
if iu.mutation.APIKeyCleared() {
|
||||
_spec.ClearField(indexers.FieldAPIKey, field.TypeString)
|
||||
}
|
||||
if value, ok := iu.mutation.URL(); ok {
|
||||
_spec.SetField(indexers.FieldURL, field.TypeString, value)
|
||||
}
|
||||
if iu.mutation.URLCleared() {
|
||||
_spec.ClearField(indexers.FieldURL, field.TypeString)
|
||||
}
|
||||
if value, ok := iu.mutation.Synced(); ok {
|
||||
_spec.SetField(indexers.FieldSynced, field.TypeBool, value)
|
||||
}
|
||||
if iu.mutation.SyncedCleared() {
|
||||
_spec.ClearField(indexers.FieldSynced, field.TypeBool)
|
||||
}
|
||||
if n, err = sqlgraph.UpdateNodes(ctx, iu.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{indexers.Label}
|
||||
@@ -426,12 +287,6 @@ func (iuo *IndexersUpdateOne) SetNillableSettings(s *string) *IndexersUpdateOne
|
||||
return iuo
|
||||
}
|
||||
|
||||
// ClearSettings clears the value of the "settings" field.
|
||||
func (iuo *IndexersUpdateOne) ClearSettings() *IndexersUpdateOne {
|
||||
iuo.mutation.ClearSettings()
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetEnableRss sets the "enable_rss" field.
|
||||
func (iuo *IndexersUpdateOne) SetEnableRss(b bool) *IndexersUpdateOne {
|
||||
iuo.mutation.SetEnableRss(b)
|
||||
@@ -514,106 +369,6 @@ func (iuo *IndexersUpdateOne) ClearDisabled() *IndexersUpdateOne {
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetTvSearch sets the "tv_search" field.
|
||||
func (iuo *IndexersUpdateOne) SetTvSearch(b bool) *IndexersUpdateOne {
|
||||
iuo.mutation.SetTvSearch(b)
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetNillableTvSearch sets the "tv_search" field if the given value is not nil.
|
||||
func (iuo *IndexersUpdateOne) SetNillableTvSearch(b *bool) *IndexersUpdateOne {
|
||||
if b != nil {
|
||||
iuo.SetTvSearch(*b)
|
||||
}
|
||||
return iuo
|
||||
}
|
||||
|
||||
// ClearTvSearch clears the value of the "tv_search" field.
|
||||
func (iuo *IndexersUpdateOne) ClearTvSearch() *IndexersUpdateOne {
|
||||
iuo.mutation.ClearTvSearch()
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetMovieSearch sets the "movie_search" field.
|
||||
func (iuo *IndexersUpdateOne) SetMovieSearch(b bool) *IndexersUpdateOne {
|
||||
iuo.mutation.SetMovieSearch(b)
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetNillableMovieSearch sets the "movie_search" field if the given value is not nil.
|
||||
func (iuo *IndexersUpdateOne) SetNillableMovieSearch(b *bool) *IndexersUpdateOne {
|
||||
if b != nil {
|
||||
iuo.SetMovieSearch(*b)
|
||||
}
|
||||
return iuo
|
||||
}
|
||||
|
||||
// ClearMovieSearch clears the value of the "movie_search" field.
|
||||
func (iuo *IndexersUpdateOne) ClearMovieSearch() *IndexersUpdateOne {
|
||||
iuo.mutation.ClearMovieSearch()
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetAPIKey sets the "api_key" field.
|
||||
func (iuo *IndexersUpdateOne) SetAPIKey(s string) *IndexersUpdateOne {
|
||||
iuo.mutation.SetAPIKey(s)
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetNillableAPIKey sets the "api_key" field if the given value is not nil.
|
||||
func (iuo *IndexersUpdateOne) SetNillableAPIKey(s *string) *IndexersUpdateOne {
|
||||
if s != nil {
|
||||
iuo.SetAPIKey(*s)
|
||||
}
|
||||
return iuo
|
||||
}
|
||||
|
||||
// ClearAPIKey clears the value of the "api_key" field.
|
||||
func (iuo *IndexersUpdateOne) ClearAPIKey() *IndexersUpdateOne {
|
||||
iuo.mutation.ClearAPIKey()
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetURL sets the "url" field.
|
||||
func (iuo *IndexersUpdateOne) SetURL(s string) *IndexersUpdateOne {
|
||||
iuo.mutation.SetURL(s)
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetNillableURL sets the "url" field if the given value is not nil.
|
||||
func (iuo *IndexersUpdateOne) SetNillableURL(s *string) *IndexersUpdateOne {
|
||||
if s != nil {
|
||||
iuo.SetURL(*s)
|
||||
}
|
||||
return iuo
|
||||
}
|
||||
|
||||
// ClearURL clears the value of the "url" field.
|
||||
func (iuo *IndexersUpdateOne) ClearURL() *IndexersUpdateOne {
|
||||
iuo.mutation.ClearURL()
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetSynced sets the "synced" field.
|
||||
func (iuo *IndexersUpdateOne) SetSynced(b bool) *IndexersUpdateOne {
|
||||
iuo.mutation.SetSynced(b)
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetNillableSynced sets the "synced" field if the given value is not nil.
|
||||
func (iuo *IndexersUpdateOne) SetNillableSynced(b *bool) *IndexersUpdateOne {
|
||||
if b != nil {
|
||||
iuo.SetSynced(*b)
|
||||
}
|
||||
return iuo
|
||||
}
|
||||
|
||||
// ClearSynced clears the value of the "synced" field.
|
||||
func (iuo *IndexersUpdateOne) ClearSynced() *IndexersUpdateOne {
|
||||
iuo.mutation.ClearSynced()
|
||||
return iuo
|
||||
}
|
||||
|
||||
// Mutation returns the IndexersMutation object of the builder.
|
||||
func (iuo *IndexersUpdateOne) Mutation() *IndexersMutation {
|
||||
return iuo.mutation
|
||||
@@ -694,9 +449,6 @@ func (iuo *IndexersUpdateOne) sqlSave(ctx context.Context) (_node *Indexers, err
|
||||
if value, ok := iuo.mutation.Settings(); ok {
|
||||
_spec.SetField(indexers.FieldSettings, field.TypeString, value)
|
||||
}
|
||||
if iuo.mutation.SettingsCleared() {
|
||||
_spec.ClearField(indexers.FieldSettings, field.TypeString)
|
||||
}
|
||||
if value, ok := iuo.mutation.EnableRss(); ok {
|
||||
_spec.SetField(indexers.FieldEnableRss, field.TypeBool, value)
|
||||
}
|
||||
@@ -721,36 +473,6 @@ func (iuo *IndexersUpdateOne) sqlSave(ctx context.Context) (_node *Indexers, err
|
||||
if iuo.mutation.DisabledCleared() {
|
||||
_spec.ClearField(indexers.FieldDisabled, field.TypeBool)
|
||||
}
|
||||
if value, ok := iuo.mutation.TvSearch(); ok {
|
||||
_spec.SetField(indexers.FieldTvSearch, field.TypeBool, value)
|
||||
}
|
||||
if iuo.mutation.TvSearchCleared() {
|
||||
_spec.ClearField(indexers.FieldTvSearch, field.TypeBool)
|
||||
}
|
||||
if value, ok := iuo.mutation.MovieSearch(); ok {
|
||||
_spec.SetField(indexers.FieldMovieSearch, field.TypeBool, value)
|
||||
}
|
||||
if iuo.mutation.MovieSearchCleared() {
|
||||
_spec.ClearField(indexers.FieldMovieSearch, field.TypeBool)
|
||||
}
|
||||
if value, ok := iuo.mutation.APIKey(); ok {
|
||||
_spec.SetField(indexers.FieldAPIKey, field.TypeString, value)
|
||||
}
|
||||
if iuo.mutation.APIKeyCleared() {
|
||||
_spec.ClearField(indexers.FieldAPIKey, field.TypeString)
|
||||
}
|
||||
if value, ok := iuo.mutation.URL(); ok {
|
||||
_spec.SetField(indexers.FieldURL, field.TypeString, value)
|
||||
}
|
||||
if iuo.mutation.URLCleared() {
|
||||
_spec.ClearField(indexers.FieldURL, field.TypeString)
|
||||
}
|
||||
if value, ok := iuo.mutation.Synced(); ok {
|
||||
_spec.SetField(indexers.FieldSynced, field.TypeBool, value)
|
||||
}
|
||||
if iuo.mutation.SyncedCleared() {
|
||||
_spec.ClearField(indexers.FieldSynced, field.TypeBool)
|
||||
}
|
||||
_node = &Indexers{config: iuo.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
|
||||
@@ -113,16 +113,11 @@ var (
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "name", Type: field.TypeString},
|
||||
{Name: "implementation", Type: field.TypeString},
|
||||
{Name: "settings", Type: field.TypeString, Nullable: true, Default: ""},
|
||||
{Name: "settings", Type: field.TypeString},
|
||||
{Name: "enable_rss", Type: field.TypeBool, Default: true},
|
||||
{Name: "priority", Type: field.TypeInt, Default: 50},
|
||||
{Name: "seed_ratio", Type: field.TypeFloat32, Nullable: true, Default: 0},
|
||||
{Name: "disabled", Type: field.TypeBool, Nullable: true, Default: false},
|
||||
{Name: "tv_search", Type: field.TypeBool, Nullable: true, Default: true},
|
||||
{Name: "movie_search", Type: field.TypeBool, Nullable: true, Default: true},
|
||||
{Name: "api_key", Type: field.TypeString, Nullable: true},
|
||||
{Name: "url", Type: field.TypeString, Nullable: true},
|
||||
{Name: "synced", Type: field.TypeBool, Nullable: true, Default: false},
|
||||
}
|
||||
// IndexersTable holds the schema information for the "indexers" table.
|
||||
IndexersTable = &schema.Table{
|
||||
|
||||
386
ent/mutation.go
386
ent/mutation.go
@@ -4346,11 +4346,6 @@ type IndexersMutation struct {
|
||||
seed_ratio *float32
|
||||
addseed_ratio *float32
|
||||
disabled *bool
|
||||
tv_search *bool
|
||||
movie_search *bool
|
||||
api_key *string
|
||||
url *string
|
||||
synced *bool
|
||||
clearedFields map[string]struct{}
|
||||
done bool
|
||||
oldValue func(context.Context) (*Indexers, error)
|
||||
@@ -4558,22 +4553,9 @@ func (m *IndexersMutation) OldSettings(ctx context.Context) (v string, err error
|
||||
return oldValue.Settings, nil
|
||||
}
|
||||
|
||||
// ClearSettings clears the value of the "settings" field.
|
||||
func (m *IndexersMutation) ClearSettings() {
|
||||
m.settings = nil
|
||||
m.clearedFields[indexers.FieldSettings] = struct{}{}
|
||||
}
|
||||
|
||||
// SettingsCleared returns if the "settings" field was cleared in this mutation.
|
||||
func (m *IndexersMutation) SettingsCleared() bool {
|
||||
_, ok := m.clearedFields[indexers.FieldSettings]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetSettings resets all changes to the "settings" field.
|
||||
func (m *IndexersMutation) ResetSettings() {
|
||||
m.settings = nil
|
||||
delete(m.clearedFields, indexers.FieldSettings)
|
||||
}
|
||||
|
||||
// SetEnableRss sets the "enable_rss" field.
|
||||
@@ -4787,251 +4769,6 @@ func (m *IndexersMutation) ResetDisabled() {
|
||||
delete(m.clearedFields, indexers.FieldDisabled)
|
||||
}
|
||||
|
||||
// SetTvSearch sets the "tv_search" field.
|
||||
func (m *IndexersMutation) SetTvSearch(b bool) {
|
||||
m.tv_search = &b
|
||||
}
|
||||
|
||||
// TvSearch returns the value of the "tv_search" field in the mutation.
|
||||
func (m *IndexersMutation) TvSearch() (r bool, exists bool) {
|
||||
v := m.tv_search
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldTvSearch returns the old "tv_search" field's value of the Indexers entity.
|
||||
// If the Indexers object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *IndexersMutation) OldTvSearch(ctx context.Context) (v bool, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldTvSearch is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldTvSearch requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldTvSearch: %w", err)
|
||||
}
|
||||
return oldValue.TvSearch, nil
|
||||
}
|
||||
|
||||
// ClearTvSearch clears the value of the "tv_search" field.
|
||||
func (m *IndexersMutation) ClearTvSearch() {
|
||||
m.tv_search = nil
|
||||
m.clearedFields[indexers.FieldTvSearch] = struct{}{}
|
||||
}
|
||||
|
||||
// TvSearchCleared returns if the "tv_search" field was cleared in this mutation.
|
||||
func (m *IndexersMutation) TvSearchCleared() bool {
|
||||
_, ok := m.clearedFields[indexers.FieldTvSearch]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetTvSearch resets all changes to the "tv_search" field.
|
||||
func (m *IndexersMutation) ResetTvSearch() {
|
||||
m.tv_search = nil
|
||||
delete(m.clearedFields, indexers.FieldTvSearch)
|
||||
}
|
||||
|
||||
// SetMovieSearch sets the "movie_search" field.
|
||||
func (m *IndexersMutation) SetMovieSearch(b bool) {
|
||||
m.movie_search = &b
|
||||
}
|
||||
|
||||
// MovieSearch returns the value of the "movie_search" field in the mutation.
|
||||
func (m *IndexersMutation) MovieSearch() (r bool, exists bool) {
|
||||
v := m.movie_search
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldMovieSearch returns the old "movie_search" field's value of the Indexers entity.
|
||||
// If the Indexers object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *IndexersMutation) OldMovieSearch(ctx context.Context) (v bool, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldMovieSearch is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldMovieSearch requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldMovieSearch: %w", err)
|
||||
}
|
||||
return oldValue.MovieSearch, nil
|
||||
}
|
||||
|
||||
// ClearMovieSearch clears the value of the "movie_search" field.
|
||||
func (m *IndexersMutation) ClearMovieSearch() {
|
||||
m.movie_search = nil
|
||||
m.clearedFields[indexers.FieldMovieSearch] = struct{}{}
|
||||
}
|
||||
|
||||
// MovieSearchCleared returns if the "movie_search" field was cleared in this mutation.
|
||||
func (m *IndexersMutation) MovieSearchCleared() bool {
|
||||
_, ok := m.clearedFields[indexers.FieldMovieSearch]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetMovieSearch resets all changes to the "movie_search" field.
|
||||
func (m *IndexersMutation) ResetMovieSearch() {
|
||||
m.movie_search = nil
|
||||
delete(m.clearedFields, indexers.FieldMovieSearch)
|
||||
}
|
||||
|
||||
// SetAPIKey sets the "api_key" field.
|
||||
func (m *IndexersMutation) SetAPIKey(s string) {
|
||||
m.api_key = &s
|
||||
}
|
||||
|
||||
// APIKey returns the value of the "api_key" field in the mutation.
|
||||
func (m *IndexersMutation) APIKey() (r string, exists bool) {
|
||||
v := m.api_key
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldAPIKey returns the old "api_key" field's value of the Indexers entity.
|
||||
// If the Indexers object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *IndexersMutation) OldAPIKey(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldAPIKey is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldAPIKey requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldAPIKey: %w", err)
|
||||
}
|
||||
return oldValue.APIKey, nil
|
||||
}
|
||||
|
||||
// ClearAPIKey clears the value of the "api_key" field.
|
||||
func (m *IndexersMutation) ClearAPIKey() {
|
||||
m.api_key = nil
|
||||
m.clearedFields[indexers.FieldAPIKey] = struct{}{}
|
||||
}
|
||||
|
||||
// APIKeyCleared returns if the "api_key" field was cleared in this mutation.
|
||||
func (m *IndexersMutation) APIKeyCleared() bool {
|
||||
_, ok := m.clearedFields[indexers.FieldAPIKey]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetAPIKey resets all changes to the "api_key" field.
|
||||
func (m *IndexersMutation) ResetAPIKey() {
|
||||
m.api_key = nil
|
||||
delete(m.clearedFields, indexers.FieldAPIKey)
|
||||
}
|
||||
|
||||
// SetURL sets the "url" field.
|
||||
func (m *IndexersMutation) SetURL(s string) {
|
||||
m.url = &s
|
||||
}
|
||||
|
||||
// URL returns the value of the "url" field in the mutation.
|
||||
func (m *IndexersMutation) URL() (r string, exists bool) {
|
||||
v := m.url
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldURL returns the old "url" field's value of the Indexers entity.
|
||||
// If the Indexers object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *IndexersMutation) OldURL(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldURL is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldURL requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldURL: %w", err)
|
||||
}
|
||||
return oldValue.URL, nil
|
||||
}
|
||||
|
||||
// ClearURL clears the value of the "url" field.
|
||||
func (m *IndexersMutation) ClearURL() {
|
||||
m.url = nil
|
||||
m.clearedFields[indexers.FieldURL] = struct{}{}
|
||||
}
|
||||
|
||||
// URLCleared returns if the "url" field was cleared in this mutation.
|
||||
func (m *IndexersMutation) URLCleared() bool {
|
||||
_, ok := m.clearedFields[indexers.FieldURL]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetURL resets all changes to the "url" field.
|
||||
func (m *IndexersMutation) ResetURL() {
|
||||
m.url = nil
|
||||
delete(m.clearedFields, indexers.FieldURL)
|
||||
}
|
||||
|
||||
// SetSynced sets the "synced" field.
|
||||
func (m *IndexersMutation) SetSynced(b bool) {
|
||||
m.synced = &b
|
||||
}
|
||||
|
||||
// Synced returns the value of the "synced" field in the mutation.
|
||||
func (m *IndexersMutation) Synced() (r bool, exists bool) {
|
||||
v := m.synced
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldSynced returns the old "synced" field's value of the Indexers entity.
|
||||
// If the Indexers object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *IndexersMutation) OldSynced(ctx context.Context) (v bool, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldSynced is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldSynced requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldSynced: %w", err)
|
||||
}
|
||||
return oldValue.Synced, nil
|
||||
}
|
||||
|
||||
// ClearSynced clears the value of the "synced" field.
|
||||
func (m *IndexersMutation) ClearSynced() {
|
||||
m.synced = nil
|
||||
m.clearedFields[indexers.FieldSynced] = struct{}{}
|
||||
}
|
||||
|
||||
// SyncedCleared returns if the "synced" field was cleared in this mutation.
|
||||
func (m *IndexersMutation) SyncedCleared() bool {
|
||||
_, ok := m.clearedFields[indexers.FieldSynced]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetSynced resets all changes to the "synced" field.
|
||||
func (m *IndexersMutation) ResetSynced() {
|
||||
m.synced = nil
|
||||
delete(m.clearedFields, indexers.FieldSynced)
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the IndexersMutation builder.
|
||||
func (m *IndexersMutation) Where(ps ...predicate.Indexers) {
|
||||
m.predicates = append(m.predicates, ps...)
|
||||
@@ -5066,7 +4803,7 @@ func (m *IndexersMutation) Type() string {
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *IndexersMutation) Fields() []string {
|
||||
fields := make([]string, 0, 12)
|
||||
fields := make([]string, 0, 7)
|
||||
if m.name != nil {
|
||||
fields = append(fields, indexers.FieldName)
|
||||
}
|
||||
@@ -5088,21 +4825,6 @@ func (m *IndexersMutation) Fields() []string {
|
||||
if m.disabled != nil {
|
||||
fields = append(fields, indexers.FieldDisabled)
|
||||
}
|
||||
if m.tv_search != nil {
|
||||
fields = append(fields, indexers.FieldTvSearch)
|
||||
}
|
||||
if m.movie_search != nil {
|
||||
fields = append(fields, indexers.FieldMovieSearch)
|
||||
}
|
||||
if m.api_key != nil {
|
||||
fields = append(fields, indexers.FieldAPIKey)
|
||||
}
|
||||
if m.url != nil {
|
||||
fields = append(fields, indexers.FieldURL)
|
||||
}
|
||||
if m.synced != nil {
|
||||
fields = append(fields, indexers.FieldSynced)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -5125,16 +4847,6 @@ func (m *IndexersMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.SeedRatio()
|
||||
case indexers.FieldDisabled:
|
||||
return m.Disabled()
|
||||
case indexers.FieldTvSearch:
|
||||
return m.TvSearch()
|
||||
case indexers.FieldMovieSearch:
|
||||
return m.MovieSearch()
|
||||
case indexers.FieldAPIKey:
|
||||
return m.APIKey()
|
||||
case indexers.FieldURL:
|
||||
return m.URL()
|
||||
case indexers.FieldSynced:
|
||||
return m.Synced()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
@@ -5158,16 +4870,6 @@ func (m *IndexersMutation) OldField(ctx context.Context, name string) (ent.Value
|
||||
return m.OldSeedRatio(ctx)
|
||||
case indexers.FieldDisabled:
|
||||
return m.OldDisabled(ctx)
|
||||
case indexers.FieldTvSearch:
|
||||
return m.OldTvSearch(ctx)
|
||||
case indexers.FieldMovieSearch:
|
||||
return m.OldMovieSearch(ctx)
|
||||
case indexers.FieldAPIKey:
|
||||
return m.OldAPIKey(ctx)
|
||||
case indexers.FieldURL:
|
||||
return m.OldURL(ctx)
|
||||
case indexers.FieldSynced:
|
||||
return m.OldSynced(ctx)
|
||||
}
|
||||
return nil, fmt.Errorf("unknown Indexers field %s", name)
|
||||
}
|
||||
@@ -5226,41 +4928,6 @@ func (m *IndexersMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetDisabled(v)
|
||||
return nil
|
||||
case indexers.FieldTvSearch:
|
||||
v, ok := value.(bool)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetTvSearch(v)
|
||||
return nil
|
||||
case indexers.FieldMovieSearch:
|
||||
v, ok := value.(bool)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetMovieSearch(v)
|
||||
return nil
|
||||
case indexers.FieldAPIKey:
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetAPIKey(v)
|
||||
return nil
|
||||
case indexers.FieldURL:
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetURL(v)
|
||||
return nil
|
||||
case indexers.FieldSynced:
|
||||
v, ok := value.(bool)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetSynced(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Indexers field %s", name)
|
||||
}
|
||||
@@ -5318,30 +4985,12 @@ func (m *IndexersMutation) AddField(name string, value ent.Value) error {
|
||||
// mutation.
|
||||
func (m *IndexersMutation) ClearedFields() []string {
|
||||
var fields []string
|
||||
if m.FieldCleared(indexers.FieldSettings) {
|
||||
fields = append(fields, indexers.FieldSettings)
|
||||
}
|
||||
if m.FieldCleared(indexers.FieldSeedRatio) {
|
||||
fields = append(fields, indexers.FieldSeedRatio)
|
||||
}
|
||||
if m.FieldCleared(indexers.FieldDisabled) {
|
||||
fields = append(fields, indexers.FieldDisabled)
|
||||
}
|
||||
if m.FieldCleared(indexers.FieldTvSearch) {
|
||||
fields = append(fields, indexers.FieldTvSearch)
|
||||
}
|
||||
if m.FieldCleared(indexers.FieldMovieSearch) {
|
||||
fields = append(fields, indexers.FieldMovieSearch)
|
||||
}
|
||||
if m.FieldCleared(indexers.FieldAPIKey) {
|
||||
fields = append(fields, indexers.FieldAPIKey)
|
||||
}
|
||||
if m.FieldCleared(indexers.FieldURL) {
|
||||
fields = append(fields, indexers.FieldURL)
|
||||
}
|
||||
if m.FieldCleared(indexers.FieldSynced) {
|
||||
fields = append(fields, indexers.FieldSynced)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -5356,30 +5005,12 @@ func (m *IndexersMutation) FieldCleared(name string) bool {
|
||||
// error if the field is not defined in the schema.
|
||||
func (m *IndexersMutation) ClearField(name string) error {
|
||||
switch name {
|
||||
case indexers.FieldSettings:
|
||||
m.ClearSettings()
|
||||
return nil
|
||||
case indexers.FieldSeedRatio:
|
||||
m.ClearSeedRatio()
|
||||
return nil
|
||||
case indexers.FieldDisabled:
|
||||
m.ClearDisabled()
|
||||
return nil
|
||||
case indexers.FieldTvSearch:
|
||||
m.ClearTvSearch()
|
||||
return nil
|
||||
case indexers.FieldMovieSearch:
|
||||
m.ClearMovieSearch()
|
||||
return nil
|
||||
case indexers.FieldAPIKey:
|
||||
m.ClearAPIKey()
|
||||
return nil
|
||||
case indexers.FieldURL:
|
||||
m.ClearURL()
|
||||
return nil
|
||||
case indexers.FieldSynced:
|
||||
m.ClearSynced()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Indexers nullable field %s", name)
|
||||
}
|
||||
@@ -5409,21 +5040,6 @@ func (m *IndexersMutation) ResetField(name string) error {
|
||||
case indexers.FieldDisabled:
|
||||
m.ResetDisabled()
|
||||
return nil
|
||||
case indexers.FieldTvSearch:
|
||||
m.ResetTvSearch()
|
||||
return nil
|
||||
case indexers.FieldMovieSearch:
|
||||
m.ResetMovieSearch()
|
||||
return nil
|
||||
case indexers.FieldAPIKey:
|
||||
m.ResetAPIKey()
|
||||
return nil
|
||||
case indexers.FieldURL:
|
||||
m.ResetURL()
|
||||
return nil
|
||||
case indexers.FieldSynced:
|
||||
m.ResetSynced()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Indexers field %s", name)
|
||||
}
|
||||
|
||||
@@ -71,10 +71,6 @@ func init() {
|
||||
history.DefaultSize = historyDescSize.Default.(int)
|
||||
indexersFields := schema.Indexers{}.Fields()
|
||||
_ = indexersFields
|
||||
// indexersDescSettings is the schema descriptor for settings field.
|
||||
indexersDescSettings := indexersFields[2].Descriptor()
|
||||
// indexers.DefaultSettings holds the default value on creation for the settings field.
|
||||
indexers.DefaultSettings = indexersDescSettings.Default.(string)
|
||||
// indexersDescEnableRss is the schema descriptor for enable_rss field.
|
||||
indexersDescEnableRss := indexersFields[3].Descriptor()
|
||||
// indexers.DefaultEnableRss holds the default value on creation for the enable_rss field.
|
||||
@@ -91,18 +87,6 @@ func init() {
|
||||
indexersDescDisabled := indexersFields[6].Descriptor()
|
||||
// indexers.DefaultDisabled holds the default value on creation for the disabled field.
|
||||
indexers.DefaultDisabled = indexersDescDisabled.Default.(bool)
|
||||
// indexersDescTvSearch is the schema descriptor for tv_search field.
|
||||
indexersDescTvSearch := indexersFields[7].Descriptor()
|
||||
// indexers.DefaultTvSearch holds the default value on creation for the tv_search field.
|
||||
indexers.DefaultTvSearch = indexersDescTvSearch.Default.(bool)
|
||||
// indexersDescMovieSearch is the schema descriptor for movie_search field.
|
||||
indexersDescMovieSearch := indexersFields[8].Descriptor()
|
||||
// indexers.DefaultMovieSearch holds the default value on creation for the movie_search field.
|
||||
indexers.DefaultMovieSearch = indexersDescMovieSearch.Default.(bool)
|
||||
// indexersDescSynced is the schema descriptor for synced field.
|
||||
indexersDescSynced := indexersFields[11].Descriptor()
|
||||
// indexers.DefaultSynced holds the default value on creation for the synced field.
|
||||
indexers.DefaultSynced = indexersDescSynced.Default.(bool)
|
||||
mediaFields := schema.Media{}.Fields()
|
||||
_ = mediaFields
|
||||
// mediaDescCreatedAt is the schema descriptor for created_at field.
|
||||
|
||||
@@ -15,16 +15,11 @@ func (Indexers) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("name"),
|
||||
field.String("implementation"),
|
||||
field.String("settings").Optional().Default("").Comment("deprecated, use api_key and url"),
|
||||
field.String("settings"),
|
||||
field.Bool("enable_rss").Default(true),
|
||||
field.Int("priority").Default(50),
|
||||
field.Float32("seed_ratio").Optional().Default(0).Comment("minimal seed ratio requied, before removing torrent"),
|
||||
field.Bool("disabled").Optional().Default(false),
|
||||
field.Bool("tv_search").Optional().Default(true),
|
||||
field.Bool("movie_search").Optional().Default(true),
|
||||
field.String("api_key").Optional(),
|
||||
field.String("url").Optional(),
|
||||
field.Bool("synced").Optional().Default(false).Comment("synced from prowlarr"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
27
go.mod
27
go.mod
@@ -25,6 +25,12 @@ require (
|
||||
)
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.115.0 // indirect
|
||||
cloud.google.com/go/ai v0.8.0 // indirect
|
||||
cloud.google.com/go/auth v0.7.1 // indirect
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.3 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.5.0 // indirect
|
||||
cloud.google.com/go/longrunning v0.5.10 // indirect
|
||||
github.com/BurntSushi/toml v1.4.0 // indirect
|
||||
github.com/DATA-DOG/go-sqlmock v1.5.2 // indirect
|
||||
github.com/anacrolix/generics v0.0.3-0.20240902042256-7fb2702ef0ca // indirect
|
||||
@@ -33,8 +39,17 @@ require (
|
||||
github.com/andybalholm/cascadia v1.3.2 // indirect
|
||||
github.com/blinkbean/dingtalk v1.1.3 // indirect
|
||||
github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||
github.com/go-logr/logr v1.4.2 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible // indirect
|
||||
github.com/go-test/deep v1.0.4 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/google/generative-ai-go v0.19.0 // indirect
|
||||
github.com/google/s2a-go v0.1.7 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.12.5 // indirect
|
||||
github.com/gregdel/pushover v1.3.1 // indirect
|
||||
github.com/huandu/xstrings v1.3.2 // indirect
|
||||
github.com/minio/sha256-simd v1.0.0 // indirect
|
||||
@@ -47,7 +62,19 @@ require (
|
||||
github.com/stretchr/objx v0.5.2 // indirect
|
||||
github.com/technoweenie/multipartstreamer v1.0.1 // indirect
|
||||
github.com/tetratelabs/wazero v1.8.0 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
|
||||
go.opentelemetry.io/otel v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.28.0 // indirect
|
||||
golang.org/x/oauth2 v0.21.0 // indirect
|
||||
golang.org/x/sync v0.10.0 // indirect
|
||||
golang.org/x/time v0.5.0 // indirect
|
||||
google.golang.org/api v0.188.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d // indirect
|
||||
google.golang.org/grpc v1.65.0 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
lukechampine.com/blake3 v1.1.6 // indirect
|
||||
|
||||
86
go.sum
86
go.sum
@@ -2,6 +2,19 @@ ariga.io/atlas v0.19.1-0.20240203083654-5948b60a8e43 h1:GwdJbXydHCYPedeeLt4x/lrl
|
||||
ariga.io/atlas v0.19.1-0.20240203083654-5948b60a8e43/go.mod h1:uj3pm+hUTVN/X5yfdBexHlZv+1Xu5u5ZbZx7+CDavNU=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.115.0 h1:CnFSK6Xo3lDYRoBKEcAtia6VSC837/ZkJuRduSFnr14=
|
||||
cloud.google.com/go v0.115.0/go.mod h1:8jIM5vVgoAEoiVxQ/O4BFTfHqulPZgs/ufEzMcFMdWU=
|
||||
cloud.google.com/go/ai v0.8.0 h1:rXUEz8Wp2OlrM8r1bfmpF2+VKqc1VJpafE3HgzRnD/w=
|
||||
cloud.google.com/go/ai v0.8.0/go.mod h1:t3Dfk4cM61sytiggo2UyGsDVW3RF1qGZaUKDrZFyqkE=
|
||||
cloud.google.com/go/auth v0.7.1 h1:Iv1bbpzJ2OIg16m94XI9/tlzZZl3cdeR3nGVGj78N7s=
|
||||
cloud.google.com/go/auth v0.7.1/go.mod h1:VEc4p5NNxycWQTMQEDQF0bd6aTMb6VgYDXEwiJJQAbs=
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.3 h1:MlxF+Pd3OmSudg/b1yZ5lJwoXCEaeedAguodky1PcKI=
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.3/go.mod h1:tMQXOfZzFuNuUxOypHlQEXgdfX5cuhwU+ffUuXRJE8I=
|
||||
cloud.google.com/go/compute v1.24.0 h1:phWcR2eWzRJaL/kOiJwfFsPs4BaKq1j6vnpZrc1YlVg=
|
||||
cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY=
|
||||
cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY=
|
||||
cloud.google.com/go/longrunning v0.5.10 h1:eB/BniENNRKhjz/xgiillrdcH3G74TGSl3BXinGlI7E=
|
||||
cloud.google.com/go/longrunning v0.5.10/go.mod h1:tljz5guTr5oc/qhlUjBlk7UAIFMOGuPNxkNDZXlLics=
|
||||
crawshaw.io/iox v0.0.0-20181124134642-c51c3df30797/go.mod h1:sXBiorCo8c46JlQV3oXPKINnZ8mcqnye1EkVkqsectk=
|
||||
crawshaw.io/sqlite v0.3.2/go.mod h1:igAO5JulrQ1DbdZdtVq48mnZUBAPOeFzer7VhDWNtW4=
|
||||
entgo.io/ent v0.13.1 h1:uD8QwN1h6SNphdCCzmkMN3feSUzNnVvV/WIkHKMbzOE=
|
||||
@@ -68,12 +81,14 @@ github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc
|
||||
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
|
||||
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
|
||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
|
||||
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/cyruzin/golang-tmdb v1.6.3 h1:TKK9h+uuwiDOaFlsVispG1KxqhsSM5Y4ZELnUF3GlqU=
|
||||
github.com/cyruzin/golang-tmdb v1.6.3/go.mod h1:ZSryJLCcY+9TiKU+LbouXKns++YBrM8Tizannr05c+I=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@@ -86,6 +101,12 @@ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25Kn
|
||||
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
|
||||
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
|
||||
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
||||
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
@@ -111,6 +132,11 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2
|
||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
||||
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4=
|
||||
github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
@@ -135,6 +161,8 @@ github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVI
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
@@ -145,19 +173,34 @@ github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:x
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/btree v0.0.0-20180124185431-e89373fe6b4a/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/generative-ai-go v0.19.0 h1:R71szggh8wHMCUlEMsW2A/3T+5LdEIkiaHSYgSpUgdg=
|
||||
github.com/google/generative-ai-go v0.19.0/go.mod h1:JYolL13VG7j79kM5BtHz4qwONHkeJQzOCkKXnpqtS/E=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o=
|
||||
github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0=
|
||||
github.com/googleapis/gax-go/v2 v2.12.5 h1:8gw9KZK8TiVKB6q3zHY3SBzLnrGp6HQjyfYBYGmXdxA=
|
||||
github.com/googleapis/gax-go/v2 v2.12.5/go.mod h1:BUDKcWo+RaKq5SC9vVYL0wLADa3VcfswbOMMRmB9H3E=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20190309154008-847fc94819f9/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
@@ -271,6 +314,7 @@ github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3O
|
||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
@@ -350,6 +394,18 @@ github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUA
|
||||
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
|
||||
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 h1:9G6E0TXzGFVfTnawRzrPl83iHOAV7L8NJiR8RSGYV1g=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg=
|
||||
go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo=
|
||||
go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4=
|
||||
go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q=
|
||||
go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s=
|
||||
go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g=
|
||||
go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
@@ -361,6 +417,7 @@ golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
|
||||
golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
|
||||
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
||||
@@ -383,10 +440,12 @@ golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73r
|
||||
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
@@ -395,6 +454,8 @@ golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
|
||||
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs=
|
||||
golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@@ -411,11 +472,13 @@ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5h
|
||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
@@ -438,12 +501,15 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
|
||||
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
@@ -452,20 +518,39 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
|
||||
golift.io/starr v1.0.0 h1:IDSaSL+ZYxdLT/Lg//dg/iwZ39LHO3D5CmbLCOgSXbI=
|
||||
golift.io/starr v1.0.0/go.mod h1:xnUwp4vK62bDvozW9QHUYc08m6kjwaZnGw3Db65fQHw=
|
||||
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
|
||||
google.golang.org/api v0.188.0 h1:51y8fJ/b1AaaBRJr4yWm96fPcuxSo0JcegXE3DaHQHw=
|
||||
google.golang.org/api v0.188.0/go.mod h1:VR0d+2SIiWOYG3r/jdm7adPW9hI2aRv9ETOSCQ9Beag=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||
google.golang.org/genproto v0.0.0-20240711142825-46eb208f015d h1:/hmn0Ku5kWij/kjGsrcJeC1T/MrJi2iNWwgAqrihFwc=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d h1:kHjw/5UfflP/L5EbledDrcG4C2597RtymmGRZvHiCuY=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d/go.mod h1:mw8MG/Qz5wfgYr6VqVCiZcHe/GJEfI+oGGDCohaVgB0=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d h1:JU0iKnSg02Gmb5ZdV8nYsKEKsP6o/FGVWTrw4i1DA9A=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY=
|
||||
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||
google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc=
|
||||
google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
|
||||
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
@@ -491,6 +576,7 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
lukechampine.com/blake3 v1.1.6 h1:H3cROdztr7RCfoaTpGZFQsrqvweFLrqS73j7L7cmR5c=
|
||||
lukechampine.com/blake3 v1.1.6/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA=
|
||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||
|
||||
266
pkg/gemini/gemini.go
Normal file
266
pkg/gemini/gemini.go
Normal file
@@ -0,0 +1,266 @@
|
||||
package gemini
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"polaris/log"
|
||||
"strings"
|
||||
|
||||
"github.com/google/generative-ai-go/genai"
|
||||
"google.golang.org/api/option"
|
||||
)
|
||||
|
||||
func NewClient(apiKey, modelName string) (*Client, error) {
|
||||
ctx := context.Background()
|
||||
client, err := genai.NewClient(ctx, option.WithAPIKey(apiKey))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Client{apiKey: apiKey, modelName: modelName, c: client}, nil
|
||||
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
apiKey string
|
||||
modelName string
|
||||
c *genai.Client
|
||||
}
|
||||
|
||||
type TvInfo struct {
|
||||
TitleEnglish string `json:"title_english"`
|
||||
TitleChinses string `json:"title_chinese"`
|
||||
Season int `json:"season"`
|
||||
StartEpisode int `json:"start_episode"`
|
||||
EndEpisode int `json:"end_episode"`
|
||||
Resolution string `json:"resolution"`
|
||||
Subtitle string `json:"subtitle"`
|
||||
ReleaseGroup string `json:"release_group"`
|
||||
Year int `json:"year"`
|
||||
AudioLanguage string `json:"audio_language"`
|
||||
IsCompleteSeason bool `json:"is_complete_season"`
|
||||
}
|
||||
|
||||
func (c *Client) ParseTvInfo(q string) (*TvInfo, error) {
|
||||
log.Info(q)
|
||||
ctx := context.Background()
|
||||
|
||||
model := c.c.GenerativeModel(c.modelName)
|
||||
|
||||
model.ResponseMIMEType = "application/json"
|
||||
model.ResponseSchema = &genai.Schema{
|
||||
Type: genai.TypeObject,
|
||||
Properties: map[string]*genai.Schema{
|
||||
"title_english": {Type: genai.TypeString},
|
||||
"title_chinese": {Type: genai.TypeString},
|
||||
"season": {Type: genai.TypeInteger, Description: "season number"},
|
||||
"start_episode": {Type: genai.TypeInteger},
|
||||
"end_episode": {Type: genai.TypeInteger},
|
||||
//"episodes": {Type: genai.TypeString},
|
||||
"resolution": {Type: genai.TypeString},
|
||||
"subtitle": {Type: genai.TypeString},
|
||||
"release_group": {Type: genai.TypeString},
|
||||
"year": {Type: genai.TypeInteger},
|
||||
"audio_language": {Type: genai.TypeString},
|
||||
"is_complete_season": {Type: genai.TypeBoolean},
|
||||
},
|
||||
Required: []string{"title_english", "title_chinese", "season", "start_episode", "resolution"},
|
||||
}
|
||||
|
||||
resp, err := model.GenerateContent(ctx, genai.Text(q))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, part := range resp.Candidates[0].Content.Parts {
|
||||
if txt, ok := part.(genai.Text); ok {
|
||||
var info TvInfo
|
||||
if err := json.Unmarshal([]byte(txt), &info); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &info, nil
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("not found")
|
||||
|
||||
}
|
||||
|
||||
type MovieInfo struct {
|
||||
TitleEnglish string `json:"title_english"`
|
||||
TitleChinses string `json:"title_chinese"`
|
||||
Resolution string `json:"resolution"`
|
||||
Subtitle string `json:"subtitle"`
|
||||
ReleaseGroup string `json:"release_group"`
|
||||
Year int `json:"year"`
|
||||
AudioLanguage string `json:"audio_language"`
|
||||
}
|
||||
|
||||
func (c *Client) ParseMovieInfo(q string) (*MovieInfo, error) {
|
||||
log.Info(q)
|
||||
ctx := context.Background()
|
||||
|
||||
model := c.c.GenerativeModel(c.modelName)
|
||||
|
||||
model.ResponseMIMEType = "application/json"
|
||||
model.ResponseSchema = &genai.Schema{
|
||||
Type: genai.TypeObject,
|
||||
Properties: map[string]*genai.Schema{
|
||||
"title_english": {Type: genai.TypeString},
|
||||
"title_chinese": {Type: genai.TypeString},
|
||||
"resolution": {Type: genai.TypeString},
|
||||
"subtitle": {Type: genai.TypeString},
|
||||
"release_group": {Type: genai.TypeString},
|
||||
"year": {Type: genai.TypeInteger},
|
||||
"audio_language": {Type: genai.TypeString},
|
||||
},
|
||||
Required: []string{"title_english", "title_chinese", "resolution"},
|
||||
}
|
||||
|
||||
resp, err := model.GenerateContent(ctx, genai.Text(q))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, part := range resp.Candidates[0].Content.Parts {
|
||||
if txt, ok := part.(genai.Text); ok {
|
||||
var info MovieInfo
|
||||
if err := json.Unmarshal([]byte(txt), &info); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &info, nil
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("not found")
|
||||
|
||||
}
|
||||
|
||||
func (c *Client) isTvSeries(q string) (bool, error) {
|
||||
ctx := context.Background()
|
||||
|
||||
model := c.c.GenerativeModel(c.modelName)
|
||||
|
||||
model.ResponseMIMEType = "application/json"
|
||||
model.ResponseSchema = &genai.Schema{
|
||||
Type: genai.TypeBoolean, Nullable: true, Description: "whether the input text implies a tv series",
|
||||
}
|
||||
|
||||
resp, err := model.GenerateContent(ctx, genai.Text(q))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
for _, part := range resp.Candidates[0].Content.Parts {
|
||||
if txt, ok := part.(genai.Text); ok {
|
||||
return strings.ToLower(string(txt)) == "true", nil
|
||||
}
|
||||
}
|
||||
return false, fmt.Errorf("error")
|
||||
}
|
||||
|
||||
func (c *Client) ImpliesSameTvOrMovie(torrentName, mediaName string) bool {
|
||||
ctx := context.Background()
|
||||
|
||||
model := c.c.GenerativeModel(c.modelName)
|
||||
|
||||
model.ResponseMIMEType = "application/json"
|
||||
model.ResponseSchema = &genai.Schema{
|
||||
Type: genai.TypeBoolean, Nullable: true,
|
||||
}
|
||||
q := fmt.Sprintf("whether this file name \"%s\" implies the same TV series or movie with name \"%s\"?", torrentName, mediaName)
|
||||
resp, err := model.GenerateContent(ctx, genai.Text(q))
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
for _, part := range resp.Candidates[0].Content.Parts {
|
||||
if txt, ok := part.(genai.Text); ok {
|
||||
return strings.ToLower(string(txt)) == "true"
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
||||
}
|
||||
|
||||
func (c *Client) FilterTvOrMovies(resourcesNames []string, titles ...string) ([]string, error) {
|
||||
ctx := context.Background()
|
||||
|
||||
model := c.c.GenerativeModel(c.modelName)
|
||||
|
||||
model.ResponseMIMEType = "application/json"
|
||||
model.ResponseSchema = &genai.Schema{
|
||||
Type: genai.TypeArray,
|
||||
Items: &genai.Schema{Type: genai.TypeString},
|
||||
}
|
||||
for i, s := range titles {
|
||||
titles[i] = "\"" + s + "\""
|
||||
}
|
||||
p := &bytes.Buffer{}
|
||||
p.WriteString(`the following list of file names, list all of which implies the same TV series or movie of name`)
|
||||
p.WriteString(strings.Join(titles, " or "))
|
||||
p.WriteString(":\n")
|
||||
|
||||
for _, r := range resourcesNames {
|
||||
p.WriteString(" * ")
|
||||
p.WriteString(r)
|
||||
p.WriteString("\n")
|
||||
}
|
||||
log.Debugf("FilterTvOrMovies prompt is %s", p.String())
|
||||
|
||||
resp, err := model.GenerateContent(ctx, genai.Text(p.String()))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, part := range resp.Candidates[0].Content.Parts {
|
||||
if txt, ok := part.(genai.Text); ok {
|
||||
|
||||
var s []string
|
||||
if err := json.Unmarshal([]byte(txt), &s); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("nothing found")
|
||||
|
||||
}
|
||||
|
||||
|
||||
func (c *Client) FilterMovies(resourcesNames []string, year int, titles ...string) ([]string, error) {
|
||||
ctx := context.Background()
|
||||
|
||||
model := c.c.GenerativeModel(c.modelName)
|
||||
|
||||
model.ResponseMIMEType = "application/json"
|
||||
model.ResponseSchema = &genai.Schema{
|
||||
Type: genai.TypeArray,
|
||||
Items: &genai.Schema{Type: genai.TypeString},
|
||||
}
|
||||
for i, s := range titles {
|
||||
titles[i] = "\"" + s + "\""
|
||||
}
|
||||
p := &bytes.Buffer{}
|
||||
p.WriteString( fmt.Sprint("the following list of file names, list all of which match following criteria: 1. Is movie 2. Released in year %d 3. Have name of ", year))
|
||||
p.WriteString(strings.Join(titles, " or "))
|
||||
p.WriteString(":\n")
|
||||
|
||||
for _, r := range resourcesNames {
|
||||
p.WriteString(" * ")
|
||||
p.WriteString(r)
|
||||
p.WriteString("\n")
|
||||
}
|
||||
log.Debugf("FilterTvOrMovies prompt is %s", p.String())
|
||||
|
||||
resp, err := model.GenerateContent(ctx, genai.Text(p.String()))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, part := range resp.Candidates[0].Content.Parts {
|
||||
if txt, ok := part.(genai.Text); ok {
|
||||
|
||||
var s []string
|
||||
if err := json.Unmarshal([]byte(txt), &s); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("nothing found")
|
||||
|
||||
}
|
||||
8
pkg/gemini/genimi_test.go
Normal file
8
pkg/gemini/genimi_test.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package gemini
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_any1(t *testing.T) {
|
||||
}
|
||||
@@ -31,28 +31,26 @@ func New(apiKey, url string) *Client {
|
||||
return &Client{p: p, apiKey: apiKey, url: url}
|
||||
}
|
||||
|
||||
func (c *Client) GetIndexers() ([]*ent.Indexers, error) {
|
||||
func (c *Client) GetIndexers(t ProwlarrSupportType) ([]*db.TorznabInfo, error) {
|
||||
ins, err := c.p.GetIndexers()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var indexers []*ent.Indexers
|
||||
var indexers []*db.TorznabInfo
|
||||
for _, in := range ins {
|
||||
|
||||
tvSearch := true
|
||||
movieSearch := true
|
||||
if len(in.Capabilities.TvSearchParams) == 0 { //no tv resource in this indexer
|
||||
tvSearch = false
|
||||
if !in.Enable {
|
||||
continue
|
||||
}
|
||||
if len(in.Capabilities.MovieSearchParams) == 0 { //no movie resource in this indexer
|
||||
movieSearch = false
|
||||
if t == "tv" && len(in.Capabilities.TvSearchParams) == 0 { //no tv resource in this indexer
|
||||
continue
|
||||
} else if t == "movie" && len(in.Capabilities.MovieSearchParams) == 0 { //no movie resource in this indexer
|
||||
continue
|
||||
}
|
||||
seedRatio := 0.0
|
||||
for _, f := range in.Fields {
|
||||
if f.Name == "torrentBaseSettings.seedRatio" && f.Value != nil {
|
||||
if r, ok := f.Value.(float64); ok {
|
||||
seedRatio = r
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,18 +61,17 @@ func (c *Client) GetIndexers() ([]*ent.Indexers, error) {
|
||||
data, _ := json.Marshal(&setting)
|
||||
|
||||
entIndexer := ent.Indexers{
|
||||
Disabled: !in.Enable,
|
||||
Name: in.Name,
|
||||
Implementation: "torznab",
|
||||
Priority: 128 - int(in.Priority),
|
||||
SeedRatio: float32(seedRatio),
|
||||
Settings: string(data),
|
||||
TvSearch: tvSearch,
|
||||
MovieSearch: movieSearch,
|
||||
APIKey: c.apiKey,
|
||||
URL: fmt.Sprintf("%s/%d/api", strings.TrimSuffix(c.url, "/"), in.ID),
|
||||
}
|
||||
indexers = append(indexers, &entIndexer)
|
||||
|
||||
indexers = append(indexers, &db.TorznabInfo{
|
||||
Indexers: &entIndexer,
|
||||
TorznabSetting: setting,
|
||||
})
|
||||
}
|
||||
return indexers, nil
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
func Test111(t *testing.T) {
|
||||
c := New("", "http://10.0.0.8:9696/")
|
||||
apis , err := c.GetIndexers()
|
||||
apis , err := c.GetIndexers("tv")
|
||||
log.Infof("errors: %v", err)
|
||||
log.Infof("indexers: %+v", apis[0])
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"polaris/ent"
|
||||
"polaris/db"
|
||||
"polaris/log"
|
||||
"slices"
|
||||
"strconv"
|
||||
@@ -74,7 +74,7 @@ func (i *Item) GetAttr(key string) string {
|
||||
}
|
||||
return ""
|
||||
}
|
||||
func (r *Response) ToResults(indexer *ent.Indexers) []Result {
|
||||
func (r *Response) ToResults(indexer *db.TorznabInfo) []Result {
|
||||
var res []Result
|
||||
for _, item := range r.Channel.Item {
|
||||
if slices.Contains(item.Category, "3000") { //exclude audio files
|
||||
@@ -130,7 +130,7 @@ func tryParseFloat(s string) float32 {
|
||||
return float32(r)
|
||||
}
|
||||
|
||||
func Search(indexer *ent.Indexers, keyWord string) ([]Result, error) {
|
||||
func Search(indexer *db.TorznabInfo, keyWord string) ([]Result, error) {
|
||||
ctx, cancel := context.WithTimeout(context.TODO(), 30*time.Second)
|
||||
defer cancel()
|
||||
|
||||
@@ -139,7 +139,7 @@ func Search(indexer *ent.Indexers, keyWord string) ([]Result, error) {
|
||||
return nil, errors.Wrap(err, "new request")
|
||||
}
|
||||
var q = url.Values{}
|
||||
q.Add("apikey", indexer.APIKey)
|
||||
q.Add("apikey", indexer.ApiKey)
|
||||
q.Add("t", "search")
|
||||
q.Add("q", keyWord)
|
||||
req.URL.RawQuery = q.Encode()
|
||||
@@ -183,7 +183,7 @@ type Result struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Link string `json:"link"`
|
||||
Size int64 `json:"size"`
|
||||
Size int64 `json:"size"`
|
||||
Seeders int `json:"seeders"`
|
||||
Peers int `json:"peers"`
|
||||
Category int `json:"category"`
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"polaris/ent"
|
||||
"polaris/log"
|
||||
"polaris/pkg/prowlarr"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
const prowlarrPrefix = "Prowlarr_"
|
||||
|
||||
func (c *Client) SyncProwlarrIndexers(apiKey, url string) error {
|
||||
client := prowlarr.New(apiKey, url)
|
||||
if ins, err := client.GetIndexers(); err != nil {
|
||||
return errors.Wrap(err, "connect to prowlarr error")
|
||||
} else {
|
||||
var prowlarrNames = make(map[string]bool, len(ins))
|
||||
for _, in := range ins {
|
||||
prowlarrNames[in.Name] = true
|
||||
}
|
||||
all := c.db.GetAllIndexers()
|
||||
for _, index := range all {
|
||||
|
||||
if index.Synced {
|
||||
if !prowlarrNames[strings.TrimPrefix(index.Name, prowlarrPrefix)] {
|
||||
c.db.DeleteIndexer(index.ID) //remove deleted indexers
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, indexer := range ins {
|
||||
if err := c.db.SaveIndexer(&ent.Indexers{
|
||||
Disabled: indexer.Disabled,
|
||||
Name: prowlarrPrefix + indexer.Name,
|
||||
Priority: indexer.Priority,
|
||||
SeedRatio: indexer.SeedRatio,
|
||||
//Settings: indexer.Settings,
|
||||
Implementation: "torznab",
|
||||
APIKey: indexer.APIKey,
|
||||
URL: indexer.URL,
|
||||
TvSearch: indexer.TvSearch,
|
||||
MovieSearch: indexer.MovieSearch,
|
||||
Synced: true,
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "save prowlarr indexers")
|
||||
}
|
||||
log.Debugf("synced prowlarr indexer to db: %v", indexer.Name)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) syncProwlarr() error {
|
||||
p, err := c.db.GetProwlarrSetting()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "db")
|
||||
}
|
||||
if p.Disabled {
|
||||
return nil
|
||||
}
|
||||
if err := c.SyncProwlarrIndexers(p.ApiKey, p.URL); err != nil {
|
||||
return errors.Wrap(err, "sync prowlarr indexers")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
func (c *Client) DeleteAllProwlarrIndexers() error {
|
||||
all := c.db.GetAllIndexers()
|
||||
for _, index := range all {
|
||||
if index.Synced {
|
||||
c.db.DeleteIndexer(index.ID)
|
||||
log.Debugf("success delete prowlarr indexer: %s", index.Name)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -25,9 +25,6 @@ func (c *Client) addSysCron() {
|
||||
if v == "true" {
|
||||
return nil
|
||||
}
|
||||
if err := c.syncProwlarr(); err != nil {
|
||||
log.Warnf("sync prowlarr error: %v", err)
|
||||
}
|
||||
c.downloadAllTvSeries()
|
||||
c.downloadAllMovies()
|
||||
return nil
|
||||
@@ -227,7 +224,7 @@ func (c *Client) moveCompletedTask(id int) (err1 error) {
|
||||
}
|
||||
c.sendMsg(fmt.Sprintf(message.ProcessingComplete, torrentName))
|
||||
|
||||
//判断是否需要删除本地文件, TODO prowlarr has no indexer id
|
||||
//判断是否需要删除本地文件
|
||||
r1, ok := c.isSeedRatioLimitReached(r.IndexerID, torrent)
|
||||
if downloadclient.RemoveCompletedDownloads && ok {
|
||||
log.Debugf("download complete,remove torrent and files related, torrent: %v, seed ratio: %v", torrentName, r1)
|
||||
|
||||
@@ -6,7 +6,9 @@ import (
|
||||
"polaris/ent"
|
||||
"polaris/ent/media"
|
||||
"polaris/log"
|
||||
"polaris/pkg/gemini"
|
||||
"polaris/pkg/metadata"
|
||||
"polaris/pkg/prowlarr"
|
||||
"polaris/pkg/torznab"
|
||||
"slices"
|
||||
"sort"
|
||||
@@ -71,6 +73,58 @@ func names2Query(media *ent.Media) []string {
|
||||
return names
|
||||
}
|
||||
|
||||
func filterBasedOnGemini(cfg db.AIConfig, res []torznab.Result, names ...string) []torznab.Result {
|
||||
|
||||
var torrentNames []string
|
||||
for _, r := range res {
|
||||
torrentNames = append(torrentNames, r.Name)
|
||||
}
|
||||
g, err := gemini.NewClient(cfg.GeminiApiKey, cfg.GeminiModelName)
|
||||
if err != nil {
|
||||
log.Warnf("create gemini client: %v", err)
|
||||
return res
|
||||
}
|
||||
resf, err := g.FilterTvOrMovies(torrentNames, names...)
|
||||
if err != nil {
|
||||
log.Warnf("filter with gemini: %v", err)
|
||||
return res
|
||||
}
|
||||
var newRes []torznab.Result
|
||||
for _, r := range res {
|
||||
if slices.Contains(resf, r.Name) {
|
||||
newRes = append(newRes, r)
|
||||
}
|
||||
}
|
||||
return newRes
|
||||
}
|
||||
|
||||
func filterBasedOnRules(res []torznab.Result, names ...string) []torznab.Result {
|
||||
var filtered []torznab.Result
|
||||
for _, r := range res {
|
||||
meta := metadata.ParseTv(r.Name)
|
||||
if meta.IsAcceptable(names...) {
|
||||
filtered = append(filtered, r)
|
||||
}
|
||||
}
|
||||
return filtered
|
||||
}
|
||||
|
||||
func filterResourceNames(db1 *db.Client, res []torznab.Result, names ...string) []torznab.Result {
|
||||
n1 := len(res)
|
||||
cfg, err := db1.GetAIConfig()
|
||||
if err != nil {
|
||||
log.Warnf("get ai config: %v", err)
|
||||
}
|
||||
if cfg.Enabled {
|
||||
res = filterBasedOnGemini(cfg, res, names...)
|
||||
} else {
|
||||
res = filterBasedOnRules(res, names...)
|
||||
}
|
||||
log.Infof("resource before name filtering length is %d, after filtering length is %d", n1, len(res))
|
||||
return res
|
||||
|
||||
}
|
||||
|
||||
func SearchTvSeries(db1 *db.Client, param *SearchParam) ([]torznab.Result, error) {
|
||||
series := db1.GetMediaDetails(param.MediaId)
|
||||
if series == nil {
|
||||
@@ -85,7 +139,9 @@ func SearchTvSeries(db1 *db.Client, param *SearchParam) ([]torznab.Result, error
|
||||
|
||||
names := names2Query(series.Media)
|
||||
|
||||
res := searchWithTorznab(db1, SearchTypeTv, names...)
|
||||
res := searchWithTorznab(db1, prowlarr.TV, names...)
|
||||
|
||||
res = filterResourceNames(db1, res, names...)
|
||||
|
||||
var filtered []torznab.Result
|
||||
lo:
|
||||
@@ -247,9 +303,11 @@ func SearchMovie(db1 *db.Client, param *SearchParam) ([]torznab.Result, error) {
|
||||
}
|
||||
names := names2Query(movieDetail.Media)
|
||||
|
||||
res := searchWithTorznab(db1, SearchTypeMovie, names...)
|
||||
res := searchWithTorznab(db1, prowlarr.Movie, names...)
|
||||
res = filterResourceNames(db1, res, names...)
|
||||
|
||||
if movieDetail.Extras.IsJav() {
|
||||
res1 := searchWithTorznab(db1, SearchTypeMovie, movieDetail.Extras.JavId)
|
||||
res1 := searchWithTorznab(db1, prowlarr.Movie, movieDetail.Extras.JavId)
|
||||
res = append(res, res1...)
|
||||
}
|
||||
|
||||
@@ -303,18 +361,21 @@ func SearchMovie(db1 *db.Client, param *SearchParam) ([]torznab.Result, error) {
|
||||
|
||||
}
|
||||
|
||||
type SearchType int
|
||||
|
||||
const (
|
||||
SearchTypeTv SearchType = 1
|
||||
SearchTypeMovie SearchType = 2
|
||||
)
|
||||
|
||||
func searchWithTorznab(db *db.Client, t SearchType, queries ...string) []torznab.Result {
|
||||
func searchWithTorznab(db *db.Client, t prowlarr.ProwlarrSupportType, queries ...string) []torznab.Result {
|
||||
|
||||
var res []torznab.Result
|
||||
allTorznab := db.GetAllIndexers()
|
||||
allTorznab := db.GetAllTorznabInfo()
|
||||
|
||||
p, err := db.GetProwlarrSetting()
|
||||
if err == nil && !p.Disabled { //prowlarr exists
|
||||
c := prowlarr.New(p.ApiKey, p.URL)
|
||||
all, err := c.GetIndexers(t)
|
||||
if err != nil {
|
||||
log.Warnf("get prowlarr all indexer error: %v", err)
|
||||
} else {
|
||||
allTorznab = append(allTorznab, all...)
|
||||
}
|
||||
}
|
||||
resChan := make(chan []torznab.Result)
|
||||
var wg sync.WaitGroup
|
||||
|
||||
@@ -322,13 +383,6 @@ func searchWithTorznab(db *db.Client, t SearchType, queries ...string) []torznab
|
||||
if tor.Disabled {
|
||||
continue
|
||||
}
|
||||
if t == SearchTypeTv && !tor.TvSearch {
|
||||
continue
|
||||
}
|
||||
if t == SearchTypeMovie && !tor.MovieSearch {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, q := range queries {
|
||||
wg.Add(1)
|
||||
|
||||
|
||||
@@ -80,6 +80,8 @@ func (s *Server) Serve() error {
|
||||
setting.POST("/prowlarr", HttpHandler(s.SaveProwlarrSetting))
|
||||
setting.GET("/limiter", HttpHandler(s.GetSizeLimiter))
|
||||
setting.POST("/limiter", HttpHandler(s.SetSizeLimiter))
|
||||
setting.GET("/ai", HttpHandler(s.GetAIConfig))
|
||||
setting.POST("/ai", HttpHandler(s.SetAIConfig))
|
||||
}
|
||||
activity := api.Group("/activity")
|
||||
{
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"polaris/db"
|
||||
"polaris/ent"
|
||||
"polaris/ent/downloadclients"
|
||||
"polaris/log"
|
||||
"polaris/pkg/prowlarr"
|
||||
"polaris/pkg/qbittorrent"
|
||||
"polaris/pkg/torznab"
|
||||
"polaris/pkg/transmission"
|
||||
@@ -144,25 +146,29 @@ func (s *Server) AddTorznabInfo(c *gin.Context) (interface{}, error) {
|
||||
utils.TrimFields(&in)
|
||||
|
||||
log.Infof("add indexer settings: %+v", in)
|
||||
setting := db.TorznabSetting{
|
||||
URL: in.URL,
|
||||
ApiKey: in.ApiKey,
|
||||
}
|
||||
|
||||
data, err := json.Marshal(setting)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "marshal json")
|
||||
}
|
||||
if in.Priority > 128 {
|
||||
in.Priority = 128
|
||||
}
|
||||
if in.Priority < 1 {
|
||||
in.Priority = 1
|
||||
}
|
||||
|
||||
indexer := ent.Indexers{
|
||||
ID: in.ID,
|
||||
Name: in.Name,
|
||||
Implementation: "torznab",
|
||||
Settings: string(data),
|
||||
Priority: in.Priority,
|
||||
Disabled: in.Disabled,
|
||||
SeedRatio: in.SeedRatio,
|
||||
APIKey: in.ApiKey,
|
||||
URL: in.URL,
|
||||
}
|
||||
err := s.db.SaveIndexer(&indexer)
|
||||
err = s.db.SaveIndexer(&indexer)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "add ")
|
||||
}
|
||||
@@ -177,12 +183,12 @@ func (s *Server) DeleteTorznabInfo(c *gin.Context) (interface{}, error) {
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("id is not correct: %v", ids)
|
||||
}
|
||||
s.db.DeleteIndexer(id)
|
||||
s.db.DeleteTorznab(id)
|
||||
return "success", nil
|
||||
}
|
||||
|
||||
func (s *Server) GetAllIndexers(c *gin.Context) (interface{}, error) {
|
||||
indexers := s.db.GetAllIndexers()
|
||||
indexers := s.db.GetAllTorznabInfo()
|
||||
if len(indexers) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -310,16 +316,11 @@ func (s *Server) SaveProwlarrSetting(c *gin.Context) (interface{}, error) {
|
||||
if err := c.ShouldBindJSON(&in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if in.Disabled {
|
||||
if err := s.core.DeleteAllProwlarrIndexers(); err != nil {
|
||||
return nil, errors.Wrap(err, "delete prowlarr indexers")
|
||||
if !in.Disabled {
|
||||
client := prowlarr.New(in.ApiKey, in.URL)
|
||||
if _, err := client.GetIndexers(prowlarr.TV); err != nil {
|
||||
return nil, errors.Wrap(err, "connect to prowlarr error")
|
||||
}
|
||||
} else {
|
||||
if err := s.core.SyncProwlarrIndexers(in.ApiKey, in.URL); err != nil {
|
||||
return nil, errors.Wrap(err, "verify prowlarr")
|
||||
}
|
||||
|
||||
}
|
||||
err := s.db.SaveProwlarrSetting(&in)
|
||||
if err != nil {
|
||||
@@ -362,3 +363,22 @@ func (s *Server) SetSizeLimiter(c *gin.Context) (interface{}, error) {
|
||||
}
|
||||
return "success", nil
|
||||
}
|
||||
|
||||
func (s *Server) GetAIConfig(c *gin.Context) (interface{}, error) {
|
||||
aiConfig, err := s.db.GetAIConfig()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "db")
|
||||
}
|
||||
return aiConfig, nil
|
||||
}
|
||||
|
||||
func (s *Server) SetAIConfig(c *gin.Context) (interface{}, error) {
|
||||
var in db.AIConfig
|
||||
if err := c.ShouldBindJSON(&in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := s.db.SetAIConfig(&in); err != nil {
|
||||
return nil, errors.Wrap(err, "db")
|
||||
}
|
||||
return "success", nil
|
||||
}
|
||||
@@ -46,6 +46,7 @@ class APIs {
|
||||
static final deleteImportlistUrl = "$_baseUrl/api/v1/importlist/delete";
|
||||
static final getAllImportlists = "$_baseUrl/api/v1/importlist/";
|
||||
static final prowlarrUrl = "$_baseUrl/api/v1/setting/prowlarr";
|
||||
static final aiConfigUrl = "$_baseUrl/api/v1/setting/ai";
|
||||
|
||||
static final notifierAllUrl = "$_baseUrl/api/v1/notifier/all";
|
||||
static final notifierDeleteUrl = "$_baseUrl/api/v1/notifier/id/";
|
||||
|
||||
@@ -29,6 +29,9 @@ var prowlarrSettingDataProvider =
|
||||
AsyncNotifierProvider.autoDispose<ProwlarrSettingData, ProwlarrSetting>(
|
||||
ProwlarrSettingData.new);
|
||||
|
||||
var aiConfigDataProvider =
|
||||
AsyncNotifierProvider.autoDispose<AIConfigData, AIConfig>(AIConfigData.new);
|
||||
|
||||
class EditSettingData extends AutoDisposeAsyncNotifier<GeneralSetting> {
|
||||
@override
|
||||
FutureOr<GeneralSetting> build() async {
|
||||
@@ -161,7 +164,6 @@ class Indexer {
|
||||
int? priority;
|
||||
double? seedRatio;
|
||||
bool? disabled;
|
||||
bool? synced;
|
||||
|
||||
Indexer(
|
||||
{this.name,
|
||||
@@ -170,8 +172,7 @@ class Indexer {
|
||||
this.id,
|
||||
this.priority = 50,
|
||||
this.seedRatio = 0,
|
||||
this.disabled,
|
||||
this.synced});
|
||||
this.disabled});
|
||||
|
||||
Indexer.fromJson(Map<String, dynamic> json) {
|
||||
name = json['name'];
|
||||
@@ -181,7 +182,6 @@ class Indexer {
|
||||
priority = json["priority"];
|
||||
seedRatio = json["seed_ratio"] ?? 0;
|
||||
disabled = json["disabled"] ?? false;
|
||||
synced = json["synced"] ?? false;
|
||||
}
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
@@ -551,3 +551,50 @@ class ProwlarrSettingData extends AutoDisposeAsyncNotifier<ProwlarrSetting> {
|
||||
ref.invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
class AIConfigData extends AutoDisposeAsyncNotifier<AIConfig> {
|
||||
@override
|
||||
FutureOr<AIConfig> build() async {
|
||||
final dio = APIs.getDio();
|
||||
var resp = await dio.get(APIs.aiConfigUrl);
|
||||
var sp = ServerResponse.fromJson(resp.data);
|
||||
if (sp.code != 0) {
|
||||
throw sp.message;
|
||||
}
|
||||
return AIConfig.fromJson(sp.data);
|
||||
}
|
||||
|
||||
Future<void> save(AIConfig ai) async {
|
||||
final dio = APIs.getDio();
|
||||
var resp = await dio.post(APIs.aiConfigUrl, data: ai.toJson());
|
||||
var sp = ServerResponse.fromJson(resp.data);
|
||||
if (sp.code != 0) {
|
||||
throw sp.message;
|
||||
}
|
||||
ref.invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
class AIConfig {
|
||||
final bool enabled;
|
||||
final String geminiApiKey;
|
||||
final String geminiModelName;
|
||||
|
||||
AIConfig(
|
||||
{required this.enabled,
|
||||
required this.geminiApiKey,
|
||||
required this.geminiModelName});
|
||||
|
||||
factory AIConfig.fromJson(Map<String, dynamic> json) {
|
||||
return AIConfig(
|
||||
enabled: json["enabled"],
|
||||
geminiApiKey: json["gemini_api_key"],
|
||||
geminiModelName: json["gemini_model_name"]);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"enabled": enabled,
|
||||
"gemini_api_key": geminiApiKey,
|
||||
"gemini_model_name": geminiModelName
|
||||
};
|
||||
}
|
||||
|
||||
@@ -23,152 +23,183 @@ class _GeneralState extends ConsumerState<GeneralSettings> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var settings = ref.watch(settingProvider);
|
||||
|
||||
return settings.when(
|
||||
data: (v) {
|
||||
return FormBuilder(
|
||||
key: _formKey, //设置globalKey,用于后面获取FormState
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
initialValue: {
|
||||
"tmdb_api": v.tmdbApiKey,
|
||||
"download_dir": v.downloadDIr,
|
||||
"log_level": v.logLevel,
|
||||
"proxy": v.proxy,
|
||||
"enable_plexmatch": v.enablePlexmatch,
|
||||
"allow_qiangban": v.allowQiangban,
|
||||
"enable_nfo": v.enableNfo,
|
||||
"enable_adult": v.enableAdult,
|
||||
"tv_naming_format": v.tvNamingFormat,
|
||||
"movie_naming_format": v.movieNamingFormat,
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
FormBuilderTextField(
|
||||
name: "tmdb_api",
|
||||
decoration: Commons.requiredTextFieldStyle(
|
||||
text: "TMDB Api Key", icon: const Icon(Icons.key)),
|
||||
//
|
||||
validator: FormBuilderValidators.required(),
|
||||
),
|
||||
FormBuilderTextField(
|
||||
name: "download_dir",
|
||||
decoration: Commons.requiredTextFieldStyle(
|
||||
text: "下载路径",
|
||||
icon: const Icon(Icons.folder),
|
||||
helperText: "媒体文件临时下载路径,非最终存储路径"),
|
||||
//
|
||||
validator: FormBuilderValidators.required(),
|
||||
),
|
||||
FormBuilderTextField(
|
||||
name: "proxy",
|
||||
decoration: const InputDecoration(
|
||||
labelText: "代理地址",
|
||||
icon: Icon(Icons.web),
|
||||
hintText: "http://10.0.0.1:1080",
|
||||
helperText: "后台联网代理地址,留空表示不启用代理"),
|
||||
),
|
||||
FormBuilderTextField(
|
||||
decoration: const InputDecoration(
|
||||
icon: Icon(Icons.folder),
|
||||
labelText: "电视剧路径命名规则",
|
||||
helperText:
|
||||
"go template语法,可用的变量为:.NameCN, .NameEN, .Year, .TmdbID"),
|
||||
name: "tv_naming_format",
|
||||
),
|
||||
FormBuilderTextField(
|
||||
decoration: const InputDecoration(
|
||||
icon: Icon(Icons.folder),
|
||||
labelText: "电影路径命名规则",
|
||||
helperText:
|
||||
"go template语法,可用的变量为:.NameCN, .NameEN, .Year, .TmdbID"),
|
||||
name: "movie_naming_format",
|
||||
),
|
||||
SizedBox(
|
||||
width: 300,
|
||||
child: FormBuilderDropdown(
|
||||
name: "log_level",
|
||||
decoration: const InputDecoration(
|
||||
labelText: "日志级别",
|
||||
icon: Icon(Icons.file_present_rounded),
|
||||
),
|
||||
items: const [
|
||||
DropdownMenuItem(value: "debug", child: Text("DEBUG")),
|
||||
DropdownMenuItem(value: "info", child: Text("INFO")),
|
||||
DropdownMenuItem(value: "warn", child: Text("WARN")),
|
||||
DropdownMenuItem(value: "error", child: Text("ERROR")),
|
||||
],
|
||||
validator: FormBuilderValidators.required(),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 300,
|
||||
child: FormBuilderSwitch(
|
||||
decoration:
|
||||
const InputDecoration(icon: Icon(Icons.back_hand)),
|
||||
name: "enable_adult",
|
||||
title: const Text("是否显示成人内容")),
|
||||
),
|
||||
SizedBox(
|
||||
width: 300,
|
||||
child: FormBuilderSwitch(
|
||||
decoration:
|
||||
const InputDecoration(icon: Icon(Icons.token)),
|
||||
name: "enable_plexmatch",
|
||||
title: const Text("Plex 刮削支持")),
|
||||
),
|
||||
SizedBox(
|
||||
width: 300,
|
||||
child: FormBuilderSwitch(
|
||||
decoration: const InputDecoration(
|
||||
icon: Icon(Icons.library_books),
|
||||
helperText: "emby/kodi等软件刮削需要"),
|
||||
name: "enable_nfo",
|
||||
title: const Text("nfo 文件支持")),
|
||||
),
|
||||
SizedBox(
|
||||
width: 300,
|
||||
child: FormBuilderSwitch(
|
||||
decoration: const InputDecoration(
|
||||
icon: Icon(Icons.remove_circle)),
|
||||
name: "allow_qiangban",
|
||||
title: const Text("是否下载枪版资源")),
|
||||
),
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 28.0),
|
||||
child: ElevatedButton(
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Text("保存"),
|
||||
var aiConfig = ref.watch(aiConfigDataProvider);
|
||||
return aiConfig.when(
|
||||
data: (ai) {
|
||||
return settings.when(
|
||||
data: (v) {
|
||||
return FormBuilder(
|
||||
key: _formKey, //设置globalKey,用于后面获取FormState
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
initialValue: {
|
||||
"tmdb_api": v.tmdbApiKey,
|
||||
"download_dir": v.downloadDIr,
|
||||
"log_level": v.logLevel,
|
||||
"proxy": v.proxy,
|
||||
"enable_plexmatch": v.enablePlexmatch,
|
||||
"allow_qiangban": v.allowQiangban,
|
||||
"enable_nfo": v.enableNfo,
|
||||
"enable_adult": v.enableAdult,
|
||||
"tv_naming_format": v.tvNamingFormat,
|
||||
"movie_naming_format": v.movieNamingFormat,
|
||||
"ai_enabled": ai.enabled,
|
||||
"ai_api_key": ai.geminiApiKey,
|
||||
"ai_model_name": ai.geminiModelName
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
FormBuilderTextField(
|
||||
name: "tmdb_api",
|
||||
decoration: Commons.requiredTextFieldStyle(
|
||||
text: "TMDB Api Key", icon: const Icon(Icons.key)),
|
||||
//
|
||||
validator: FormBuilderValidators.required(),
|
||||
),
|
||||
FormBuilderTextField(
|
||||
name: "download_dir",
|
||||
decoration: Commons.requiredTextFieldStyle(
|
||||
text: "下载路径",
|
||||
icon: const Icon(Icons.folder),
|
||||
helperText: "媒体文件临时下载路径,非最终存储路径"),
|
||||
//
|
||||
validator: FormBuilderValidators.required(),
|
||||
),
|
||||
FormBuilderTextField(
|
||||
name: "proxy",
|
||||
decoration: const InputDecoration(
|
||||
labelText: "代理地址",
|
||||
icon: Icon(Icons.web),
|
||||
hintText: "http://10.0.0.1:1080",
|
||||
helperText: "后台联网代理地址,留空表示不启用代理"),
|
||||
),
|
||||
FormBuilderTextField(
|
||||
decoration: const InputDecoration(
|
||||
icon: Icon(Icons.folder),
|
||||
labelText: "电视剧路径命名规则",
|
||||
helperText:
|
||||
"go template语法,可用的变量为:.NameCN, .NameEN, .Year, .TmdbID"),
|
||||
name: "tv_naming_format",
|
||||
),
|
||||
FormBuilderTextField(
|
||||
decoration: const InputDecoration(
|
||||
icon: Icon(Icons.folder),
|
||||
labelText: "电影路径命名规则",
|
||||
helperText:
|
||||
"go template语法,可用的变量为:.NameCN, .NameEN, .Year, .TmdbID"),
|
||||
name: "movie_naming_format",
|
||||
),
|
||||
SizedBox(
|
||||
width: 300,
|
||||
child: FormBuilderDropdown(
|
||||
name: "log_level",
|
||||
decoration: const InputDecoration(
|
||||
labelText: "日志级别",
|
||||
icon: Icon(Icons.file_present_rounded),
|
||||
),
|
||||
items: const [
|
||||
DropdownMenuItem(
|
||||
value: "debug", child: Text("DEBUG")),
|
||||
DropdownMenuItem(
|
||||
value: "info", child: Text("INFO")),
|
||||
DropdownMenuItem(
|
||||
value: "warn", child: Text("WARN")),
|
||||
DropdownMenuItem(
|
||||
value: "error", child: Text("ERROR")),
|
||||
],
|
||||
validator: FormBuilderValidators.required(),
|
||||
),
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.saveAndValidate()) {
|
||||
var values = _formKey.currentState!.value;
|
||||
var f = ref
|
||||
.read(settingProvider.notifier)
|
||||
.updateSettings(GeneralSetting(
|
||||
tmdbApiKey: values["tmdb_api"],
|
||||
downloadDIr: values["download_dir"],
|
||||
logLevel: values["log_level"],
|
||||
proxy: values["proxy"],
|
||||
allowQiangban: values["allow_qiangban"],
|
||||
enableAdult: values["enable_adult"],
|
||||
enableNfo: values["enable_nfo"],
|
||||
tvNamingFormat: values["tv_naming_format"],
|
||||
movieNamingFormat:
|
||||
values["movie_naming_format"],
|
||||
enablePlexmatch:
|
||||
values["enable_plexmatch"]))
|
||||
.then((v) => showSnakeBar("更新成功"));
|
||||
showLoadingWithFuture(f);
|
||||
}
|
||||
}),
|
||||
),
|
||||
SizedBox(
|
||||
width: 300,
|
||||
child: FormBuilderSwitch(
|
||||
decoration: const InputDecoration(
|
||||
icon: Icon(Icons.back_hand)),
|
||||
name: "enable_adult",
|
||||
title: const Text("是否显示成人内容")),
|
||||
),
|
||||
SizedBox(
|
||||
width: 300,
|
||||
child: FormBuilderSwitch(
|
||||
decoration:
|
||||
const InputDecoration(icon: Icon(Icons.token)),
|
||||
name: "enable_plexmatch",
|
||||
title: const Text("Plex 刮削支持")),
|
||||
),
|
||||
SizedBox(
|
||||
width: 300,
|
||||
child: FormBuilderSwitch(
|
||||
decoration: const InputDecoration(
|
||||
icon: Icon(Icons.library_books),
|
||||
helperText: "emby/kodi等软件刮削需要"),
|
||||
name: "enable_nfo",
|
||||
title: const Text("nfo 文件支持")),
|
||||
),
|
||||
SizedBox(
|
||||
width: 300,
|
||||
child: FormBuilderSwitch(
|
||||
decoration: const InputDecoration(
|
||||
icon: Icon(Icons.remove_circle)),
|
||||
name: "allow_qiangban",
|
||||
title: const Text("是否下载枪版资源")),
|
||||
),
|
||||
Divider(),
|
||||
FormBuilderSwitch(
|
||||
name: "ai_enabled", title: Text("开启Gemini AI集成")),
|
||||
FormBuilderTextField(
|
||||
name: "ai_model_name",
|
||||
decoration: InputDecoration(labelText: "Gemini 模型名称"),
|
||||
),
|
||||
FormBuilderTextField(
|
||||
name: "ai_api_key",
|
||||
decoration:
|
||||
InputDecoration(labelText: "Gemini Api Key"),
|
||||
),
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 28.0),
|
||||
child: ElevatedButton(
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Text("保存"),
|
||||
),
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.saveAndValidate()) {
|
||||
var values = _formKey.currentState!.value;
|
||||
ref.read(aiConfigDataProvider.notifier).save(
|
||||
AIConfig(
|
||||
enabled: values["ai_enabled"],
|
||||
geminiApiKey: values["ai_api_key"],
|
||||
geminiModelName: values["ai_model_name"]));
|
||||
var f = ref
|
||||
.read(settingProvider.notifier)
|
||||
.updateSettings(GeneralSetting(
|
||||
tmdbApiKey: values["tmdb_api"],
|
||||
downloadDIr: values["download_dir"],
|
||||
logLevel: values["log_level"],
|
||||
proxy: values["proxy"],
|
||||
allowQiangban:
|
||||
values["allow_qiangban"],
|
||||
enableAdult: values["enable_adult"],
|
||||
enableNfo: values["enable_nfo"],
|
||||
tvNamingFormat:
|
||||
values["tv_naming_format"],
|
||||
movieNamingFormat:
|
||||
values["movie_naming_format"],
|
||||
enablePlexmatch:
|
||||
values["enable_plexmatch"]))
|
||||
.then((v) => showSnakeBar("更新成功"));
|
||||
showLoadingWithFuture(f);
|
||||
}
|
||||
}),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
);
|
||||
},
|
||||
error: (err, trace) => PoNetworkError(err: err),
|
||||
loading: () => const MyProgressIndicator());
|
||||
},
|
||||
error: (err, trace) => PoNetworkError(err: err),
|
||||
loading: () => const MyProgressIndicator());
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:form_builder_validators/form_builder_validators.dart';
|
||||
import 'package:ui/providers/settings.dart';
|
||||
import 'package:ui/settings/dialog.dart';
|
||||
import 'package:ui/widgets/progress_indicator.dart';
|
||||
import 'package:ui/widgets/utils.dart';
|
||||
import 'package:ui/widgets/widgets.dart';
|
||||
|
||||
class IndexerSettings extends ConsumerStatefulWidget {
|
||||
@@ -17,112 +16,22 @@ class IndexerSettings extends ConsumerStatefulWidget {
|
||||
}
|
||||
|
||||
class _IndexerState extends ConsumerState<IndexerSettings> {
|
||||
final _formKey = GlobalKey<FormBuilderState>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var indexers = ref.watch(indexersProvider);
|
||||
return indexers.when(
|
||||
data: (value) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 10, bottom: 10, left: 10),
|
||||
child: Text("Prowlarr 设置", style: TextStyle(fontSize: 18)),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 20), child: prowlarrSetting()),
|
||||
Divider(),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 10, bottom: 10, left: 10),
|
||||
child: Text("索引器列表", style: TextStyle(fontSize: 18)),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 20),
|
||||
child: Wrap(
|
||||
children: List.generate(value.length + 1, (i) {
|
||||
if (i < value.length) {
|
||||
var indexer = value[i];
|
||||
return SettingsCard(
|
||||
onTap: () => showIndexerDetails(indexer),
|
||||
child: Text(indexer.name ?? ""));
|
||||
}
|
||||
return SettingsCard(
|
||||
onTap: () => showIndexerDetails(Indexer()),
|
||||
child: const Icon(Icons.add));
|
||||
}),
|
||||
)),
|
||||
],
|
||||
);
|
||||
},
|
||||
error: (err, trace) => PoNetworkError(err: err),
|
||||
loading: () => const MyProgressIndicator());
|
||||
}
|
||||
|
||||
Widget prowlarrSetting() {
|
||||
var ps = ref.watch(prowlarrSettingDataProvider);
|
||||
return ps.when(
|
||||
data: (v) => FormBuilder(
|
||||
key: _formKey, //设置globalKey,用于后面获取FormState
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
initialValue: {
|
||||
"api_key": v.apiKey,
|
||||
"url": v.url,
|
||||
"disabled": v.disabled
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
FormBuilderTextField(
|
||||
name: "url",
|
||||
decoration: const InputDecoration(
|
||||
labelText: "Prowlarr URL",
|
||||
icon: Icon(Icons.web),
|
||||
hintText: "http://10.0.0.8:9696"),
|
||||
validator: FormBuilderValidators.required(),
|
||||
),
|
||||
FormBuilderTextField(
|
||||
name: "api_key",
|
||||
decoration: const InputDecoration(
|
||||
labelText: "API Key",
|
||||
icon: Icon(Icons.key),
|
||||
helperText: "Prowlarr 设置 -> 通用 -> API 密钥"),
|
||||
validator: FormBuilderValidators.required(),
|
||||
),
|
||||
FormBuilderSwitch(
|
||||
name: "disabled",
|
||||
title: const Text("禁用 Prowlarr"),
|
||||
decoration:
|
||||
InputDecoration(icon: Icon(Icons.do_not_disturb)),
|
||||
),
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.saveAndValidate()) {
|
||||
var values = _formKey.currentState!.value;
|
||||
var f = ref
|
||||
.read(prowlarrSettingDataProvider.notifier)
|
||||
.save(ProwlarrSetting(
|
||||
apiKey: values["api_key"],
|
||||
url: values["url"],
|
||||
disabled: values["disabled"]))
|
||||
.then((v) {
|
||||
showSnakeBar("更新成功");
|
||||
ref.invalidate(indexersProvider);
|
||||
});
|
||||
showLoadingWithFuture(f);
|
||||
}
|
||||
},
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Text("保存"),
|
||||
)),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
data: (value) => Wrap(
|
||||
children: List.generate(value.length + 1, (i) {
|
||||
if (i < value.length) {
|
||||
var indexer = value[i];
|
||||
return SettingsCard(
|
||||
onTap: () => showIndexerDetails(indexer),
|
||||
child: Text(indexer.name ?? ""));
|
||||
}
|
||||
return SettingsCard(
|
||||
onTap: () => showIndexerDetails(Indexer()),
|
||||
child: const Icon(Icons.add));
|
||||
}),
|
||||
),
|
||||
error: (err, trace) => PoNetworkError(err: err),
|
||||
loading: () => const MyProgressIndicator());
|
||||
@@ -145,7 +54,6 @@ class _IndexerState extends ConsumerState<IndexerSettings> {
|
||||
child: Column(
|
||||
children: [
|
||||
FormBuilderDropdown(
|
||||
enabled: indexer.synced != true,
|
||||
name: "impl",
|
||||
decoration: const InputDecoration(labelText: "类型"),
|
||||
items: const [
|
||||
@@ -153,28 +61,24 @@ class _IndexerState extends ConsumerState<IndexerSettings> {
|
||||
],
|
||||
),
|
||||
FormBuilderTextField(
|
||||
enabled: indexer.synced != true,
|
||||
name: "name",
|
||||
decoration: Commons.requiredTextFieldStyle(text: "名称"),
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: FormBuilderValidators.required(),
|
||||
),
|
||||
FormBuilderTextField(
|
||||
enabled: indexer.synced != true,
|
||||
name: "url",
|
||||
decoration: Commons.requiredTextFieldStyle(text: "地址"),
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: FormBuilderValidators.required(),
|
||||
),
|
||||
FormBuilderTextField(
|
||||
enabled: indexer.synced != true,
|
||||
name: "api_key",
|
||||
decoration: Commons.requiredTextFieldStyle(text: "API Key"),
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: FormBuilderValidators.required(),
|
||||
),
|
||||
FormBuilderTextField(
|
||||
enabled: indexer.synced != true,
|
||||
name: "priority",
|
||||
decoration: const InputDecoration(
|
||||
labelText: "索引优先级",
|
||||
@@ -184,7 +88,6 @@ class _IndexerState extends ConsumerState<IndexerSettings> {
|
||||
validator: FormBuilderValidators.positiveNumber(),
|
||||
),
|
||||
FormBuilderTextField(
|
||||
enabled: indexer.synced != true,
|
||||
name: "seed_ratio",
|
||||
decoration: const InputDecoration(
|
||||
labelText: "做种率",
|
||||
@@ -194,10 +97,7 @@ class _IndexerState extends ConsumerState<IndexerSettings> {
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: FormBuilderValidators.numeric(),
|
||||
),
|
||||
FormBuilderSwitch(
|
||||
enabled: indexer.synced != true,
|
||||
name: "disabled",
|
||||
title: const Text("禁用此索引器"))
|
||||
FormBuilderSwitch(name: "disabled", title: const Text("禁用此索引器"))
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -222,11 +122,6 @@ class _IndexerState extends ConsumerState<IndexerSettings> {
|
||||
}
|
||||
|
||||
return showSettingDialog(
|
||||
context,
|
||||
indexer.synced != true?"索引器":"Prowlarr 索引器",
|
||||
(indexer.id != null) && (indexer.synced != true),
|
||||
body,
|
||||
onSubmit,
|
||||
onDelete);
|
||||
context, "索引器", indexer.id != null, body, onSubmit, onDelete);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:ui/settings/general.dart';
|
||||
import 'package:ui/settings/importlist.dart';
|
||||
import 'package:ui/settings/indexer.dart';
|
||||
import 'package:ui/settings/notifier.dart';
|
||||
import 'package:ui/settings/prowlarr.dart';
|
||||
import 'package:ui/settings/storage.dart';
|
||||
|
||||
class SystemSettingsPage extends ConsumerStatefulWidget {
|
||||
@@ -26,6 +27,7 @@ class _SystemSettingsPageState extends ConsumerState<SystemSettingsPage> {
|
||||
children: [
|
||||
getExpansionTile("常规", const GeneralSettings()),
|
||||
getExpansionTile("索引器", const IndexerSettings()),
|
||||
getExpansionTile("Prowlarr 设置", const ProwlarrSettingPage()),
|
||||
getExpansionTile("下载器", const DownloaderSettings()),
|
||||
getExpansionTile("存储", const StorageSettings()),
|
||||
getExpansionTile("通知客户端", const NotifierSettings()),
|
||||
|
||||
Reference in New Issue
Block a user