Compare commits

...

34 Commits

Author SHA1 Message Date
Simon Ding
842f8fae09 feat: prowlarr refactor and support prowlarr seed ratio 2025-01-10 11:39:16 +08:00
Simon Ding
03105a1989 chore: update deps 2024-12-22 13:45:11 +08:00
Simon Ding
e169172c68 doc: update 2024-12-13 14:34:34 +08:00
Simon Ding
937b035634 fix 2024-12-13 13:48:58 +08:00
Simon Ding
c639e11b90 fix: debian do not support arm v6 2024-12-13 13:44:32 +08:00
Simon Ding
f2ac688ed8 feat: release build flutter use github action 2024-12-13 13:33:39 +08:00
Simon Ding
369263a55c fix 2024-12-13 13:25:51 +08:00
Simon Ding
9d4848129f feat: build flutter use github action 2024-12-13 13:22:12 +08:00
Simon Ding
f7e82fa464 feat: search with alternative titles 2024-12-13 12:19:02 +08:00
Simon Ding
d2354ab33c feat: ditch html render and update flutter packages 2024-12-13 11:44:42 +08:00
Simon Ding
67014cfb16 feat: save media alternative titles 2024-12-13 11:35:32 +08:00
Simon
60edeacd0d Merge pull request #10 from simon-ding/dependabot/go_modules/go_modules-5a9c29dde4
chore(deps): bump golang.org/x/crypto from 0.27.0 to 0.31.0 in the go_modules group across 1 directory
2024-12-12 12:33:06 +08:00
dependabot[bot]
4c77cf5798 chore(deps): bump golang.org/x/crypto
Bumps the go_modules group with 1 update in the / directory: [golang.org/x/crypto](https://github.com/golang/crypto).


Updates `golang.org/x/crypto` from 0.27.0 to 0.31.0
- [Commits](https://github.com/golang/crypto/compare/v0.27.0...v0.31.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  dependency-group: go_modules
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-12 00:29:52 +00:00
Simon Ding
3cf48d1f8e fix: remove files 2024-12-11 21:25:28 +08:00
Simon Ding
6d127c6d00 feat: add option to delete storage media files 2024-12-11 21:09:00 +08:00
Simon Ding
22f76e3f57 fix: monitor new episode 2024-12-11 20:27:51 +08:00
Simon Ding
e947396c04 fix: cache 2024-12-11 20:11:33 +08:00
Simon Ding
1020190c01 feat: cache download status number 2024-12-11 20:04:37 +08:00
Simon Ding
7c05acd1cf feat: in favor of gridview.builder for better performance 2024-12-11 14:44:41 +08:00
Simon Ding
76a9183b52 refactor: reduce default poster image size to w500 2024-12-11 12:24:16 +08:00
Simon Ding
6698d368c3 chore: updates 2024-12-06 11:06:50 +08:00
Simon Ding
acb627d011 feat: add arm v7 2024-11-26 18:50:40 +08:00
Simon Ding
7c64d964e8 ui: cancel timer before calling 2024-11-21 10:01:52 +08:00
Simon Ding
bec3b04705 ui: add macos client 2024-11-21 09:45:44 +08:00
Simon Ding
990da92b75 chore: change env name 2024-11-20 19:21:25 +08:00
Simon Ding
ee14cc63b8 chore: updates 2024-11-20 19:20:14 +08:00
Simon Ding
8df7b8665b chore: add sub ext 2024-11-20 16:25:35 +08:00
Simon Ding
ea90e014b1 feat: remove default internal size limiter 2024-11-20 15:34:57 +08:00
Simon Ding
6372c5c6e6 chore: update error msg 2024-11-20 15:06:26 +08:00
Simon Ding
7b6dba1afe feat: only accept video files and subtitles of known formats 2024-11-20 12:03:56 +08:00
Simon Ding
c833f6fab6 feat: complete size limiter feature 2024-11-19 23:54:27 +08:00
Simon Ding
b4c2002ad1 feat: apply global size limiter 2024-11-19 19:51:06 +08:00
Simon Ding
b2a9f1f83b refactor: size limiter 2024-11-19 19:24:43 +08:00
Simon Ding
b69881d26b WIP: size limiter 2024-11-19 18:22:40 +08:00
89 changed files with 4294 additions and 370 deletions

View File

@@ -29,6 +29,19 @@ jobs:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3
- name: Build Web
run: |
cd ui
flutter pub get
flutter build web --no-web-resources-cdn
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5

View File

@@ -37,12 +37,25 @@ jobs:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3
- name: Build Web
run: |
cd ui
flutter pub get
flutter build web --no-web-resources-cdn
- name: Build and push
id: push
uses: docker/build-push-action@v6
@@ -50,9 +63,7 @@ jobs:
context: .
file: Dockerfile
push: true
platforms: |
linux/amd64
linux/arm64
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/s390x,linux/ppc64le
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@@ -1,11 +1,3 @@
FROM instrumentisto/flutter:3 AS flutter
WORKDIR /app
COPY ./ui/pubspec.yaml ./ui/pubspec.lock ./
RUN flutter pub get
COPY ./ui/ ./
RUN flutter build web --no-web-resources-cdn --web-renderer html
# 打包依赖阶段使用golang作为基础镜像
FROM golang:1.23 as builder
# 启用go module
@@ -20,7 +12,6 @@ RUN go mod download
COPY . .
COPY --from=flutter /app/build/web ./ui/build/web/
# 指定OS等并go build
RUN CGO_ENABLED=0 go build -o polaris -ldflags="-X polaris/db.Version=$(git describe --tags --long)" ./cmd/

View File

@@ -12,7 +12,7 @@
![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/simon-ding/polaris)
**Polaris 是一个电视剧和电影的追踪下载软件。对动漫日剧美剧都有良好的匹配,支持webdav或者本地存储。**
**Polaris 是一个电视剧和电影的追踪下载软件。对美剧动漫日剧都有良好的匹配,支持多种存储方式webdav、alist、本地存储**
</div>
@@ -38,6 +38,15 @@
- [x] 支持导入plex watchlistplex里标记自动导入polaris
- [x] and more...
## 支持的平台
- linux/amd64
- linux/arm64
- linux/arm/v7
- linux/386
- linux/s390x
- linux/ppc64le
## Todos

View File

@@ -3,9 +3,7 @@ package main
import (
"polaris/db"
"polaris/log"
"polaris/pkg/utils"
"polaris/server"
"time"
)
func main() {
@@ -18,13 +16,13 @@ func main() {
log.Panicf("init db error: %v", err)
}
go func() {
time.Sleep(2 * time.Second)
if err := utils.OpenURL("http://127.0.0.1:8080"); err != nil {
log.Errorf("open url error: %v", err)
}
// go func() {
// time.Sleep(2 * time.Second)
// if err := utils.OpenURL("http://127.0.0.1:8080"); err != nil {
// log.Errorf("open url error: %v", err)
// }
}()
// }()
s := server.NewServer(dbClient)
if err := s.Serve(); err != nil {
log.Errorf("server start error: %v", err)

View File

@@ -1,5 +1,7 @@
package db
import "polaris/ent/media"
var Version = "undefined"
const (
@@ -14,10 +16,14 @@ const (
SettingNfoSupportEnabled = "nfo_support_enabled"
SettingAllowQiangban = "filter_qiangban"
SettingEnableTmdbAdultContent = "tmdb_adult_content"
SetttingSizeLimiter = "size_limiter"
SettingTvNamingFormat = "tv_naming_format"
SettingMovieNamingFormat = "movie_naming_format"
SettingProwlarrInfo = "prowlarr_info"
SettingTvSizeLimiter = "tv_size_limiter"
SettingMovieSizeLimiter = "movie_size_limiter"
SettingAcceptedVideoFormats = "accepted_video_formats"
SettingAcceptedSubtitleFormats = "accepted_subtitle_formats"
)
const (
@@ -40,6 +46,17 @@ const (
const DefaultNamingFormat = "{{.NameCN}} {{.NameEN}} {{if .Year}} ({{.Year}}) {{end}}"
//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",
".mpg", ".mp2", ".mpeg", ".mpe", ".mpv", ".m2v", ".m4v",
".svi", ".3gp", ".3g2", ".nsv",
}
var defaultAcceptedSubtitleFormats = []string{
".ass", ".srt",".vtt", ".webvtt", ".sub", ".idx",
}
type NamingInfo struct {
NameCN string
NameEN string
@@ -51,15 +68,27 @@ type ResolutionType string
const JwtSerectKey = "jwt_secrect_key"
type SizeLimiter struct {
R720p Limiter `json:"720p"`
R1080p Limiter `json:"1080p"`
R2160p Limiter `json:"2160p"`
type MediaSizeLimiter struct {
P720p SizeLimiter `json:"720p"`
P1080 SizeLimiter `json:"1080p"`
P2160 SizeLimiter `json:"2160p"`
}
type Limiter struct {
Max int `json:"max"`
Min int `json:"min"`
func (m *MediaSizeLimiter) GetLimiter(r media.Resolution) SizeLimiter {
if r == media.Resolution1080p {
return m.P1080
} else if r == media.Resolution720p {
return m.P720p
} else if r == media.Resolution2160p {
return m.P2160
}
return SizeLimiter{}
}
type SizeLimiter struct {
MaxSIze int64 `json:"max_size"`
MinSize int64 `json:"min_size"`
PreferSIze int64 `json:"prefer_size"`
}
type ProwlarrSetting struct {

146
db/db.go
View File

@@ -38,13 +38,14 @@ 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
@@ -157,6 +158,7 @@ func (c *Client) AddMediaWatchlist(m *ent.Media, episodes []int) (*ent.Media, er
SetDownloadHistoryEpisodes(m.DownloadHistoryEpisodes).
SetLimiter(m.Limiter).
SetExtras(m.Extras).
SetAlternativeTitles(m.AlternativeTitles).
AddEpisodeIDs(episodes...).
Save(context.TODO())
return r, err
@@ -251,6 +253,7 @@ func (c *Client) SaveEposideDetail2(d *ent.Episode) (int, error) {
SetMediaID(d.MediaID).
SetStatus(d.Status).
SetOverview(d.Overview).
SetMonitored(d.Monitored).
SetTitle(d.Title).Save(context.TODO())
return ep.ID, err
@@ -263,20 +266,22 @@ type TorznabSetting struct {
func (c *Client) SaveIndexer(in *ent.Indexers) error {
if in.ID != 0 {
count := c.ent.Indexers.Query().Where(indexers.Name(in.Name)).CountX(context.TODO())
if count > 0 || in.ID != 0 {
//update setting
return c.ent.Indexers.Update().Where(indexers.ID(in.ID)).SetName(in.Name).SetImplementation(in.Implementation).
SetPriority(in.Priority).SetSettings(in.Settings).SetSeedRatio(in.SeedRatio).SetDisabled(in.Disabled).Exec(context.Background())
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())
}
//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).SetSettings(in.Settings).SetSeedRatio(in.SeedRatio).
SetDisabled(in.Disabled).Save(context.TODO())
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())
if err != nil {
return errors.Wrap(err, "save db")
}
@@ -284,46 +289,21 @@ func (c *Client) SaveIndexer(in *ent.Indexers) error {
return nil
}
func (c *Client) DeleteTorznab(id int) {
func (c *Client) DeleteIndexer(id int) {
c.ent.Indexers.Delete().Where(indexers.ID(id)).Exec(context.TODO())
}
func (c *Client) GetIndexer(id int) (*TorznabInfo, error) {
func (c *Client) GetIndexer(id int) (*ent.Indexers, error) {
res, err := c.ent.Indexers.Query().Where(indexers.ID(id)).First(context.TODO())
if err != nil {
return nil, err
}
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
return res, nil
}
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) GetAllIndexers() []*ent.Indexers {
res := c.ent.Indexers.Query().Where(indexers.Implementation(IndexerTorznabImpl)).Order(ent.Asc(indexers.FieldID)).AllX(context.TODO())
return res
}
func (c *Client) SaveDownloader(downloader *ent.DownloadClients) error {
@@ -441,7 +421,7 @@ type Storage struct {
}
func (s *Storage) ToWebDavSetting() WebdavSetting {
if s.Implementation != storage.ImplementationWebdav && s.Implementation != storage.ImplementationAlist{
if s.Implementation != storage.ImplementationWebdav && s.Implementation != storage.ImplementationAlist {
panic("not webdav storage")
}
var webdavSetting WebdavSetting
@@ -631,19 +611,38 @@ func (c *Client) DeleteImportlist(id int) error {
return c.ent.ImportList.DeleteOneID(id).Exec(context.TODO())
}
func (c *Client) GetSizeLimiter() (*SizeLimiter, error) {
v := c.GetSetting(SetttingSizeLimiter)
var limiter SizeLimiter
func (c *Client) GetSizeLimiter(mediaType string) (*MediaSizeLimiter, error) {
var v string
if mediaType == "tv" {
v = c.GetSetting(SettingTvSizeLimiter)
} else if mediaType == "movie" {
v = c.GetSetting(SettingMovieSizeLimiter)
} else {
return nil, errors.Errorf("media type not supported: %v", mediaType)
}
var limiter MediaSizeLimiter
if v == "" {
return &limiter, nil
}
err := json.Unmarshal([]byte(v), &limiter)
return &limiter, err
}
func (c *Client) SetSizeLimiter(limiter *SizeLimiter) error {
func (c *Client) SetSizeLimiter(mediaType string, limiter *MediaSizeLimiter) error {
data, err := json.Marshal(limiter)
if err != nil {
return err
}
return c.SetSetting(SetttingSizeLimiter, string(data))
if mediaType == "tv" {
return c.SetSetting(SettingTvSizeLimiter, string(data))
} else if mediaType == "movie" {
return c.SetSetting(SettingMovieSizeLimiter, string(data))
} else {
return errors.Errorf("media type not supported: %v", mediaType)
}
}
func (c *Client) GetTvNamingFormat() string {
@@ -690,3 +689,52 @@ 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 == "" {
return nil, nil
}
var res []string
err := json.Unmarshal([]byte(v), &res)
return res, err
}
func (c *Client) setAcceptedFormats(key string, v []string) error {
data, err := json.Marshal(v)
if err != nil {
return err
}
return c.SetSetting(key, string(data))
}
func (c *Client) GetAcceptedVideoFormats() ([]string, error) {
res, err := c.getAcceptedFormats(SettingAcceptedVideoFormats)
if err != nil {
return nil, err
}
if res == nil {
return defaultAcceptedVideoFormats, nil
}
return res, nil
}
func (c *Client) SetAcceptedVideoFormats(key string, v []string) error {
return c.setAcceptedFormats(SettingAcceptedVideoFormats, v)
}
func (c *Client) GetAcceptedSubtitleFormats() ([]string, error) {
res, err := c.getAcceptedFormats(SettingAcceptedSubtitleFormats)
if err != nil {
return nil, err
}
if res == nil {
return defaultAcceptedSubtitleFormats, nil
}
return res, nil
}
func (c *Client) SetAcceptedSubtitleFormats(key string, v []string) error {
return c.setAcceptedFormats(SettingAcceptedSubtitleFormats, v)
}

46
db/migrate.go Normal file
View File

@@ -0,0 +1,46 @@
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
}

View File

@@ -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"`
// Settings holds the value of the "settings" field.
// deprecated, use api_key and url
Settings string `json:"settings,omitempty"`
// EnableRss holds the value of the "enable_rss" field.
EnableRss bool `json:"enable_rss,omitempty"`
@@ -29,7 +29,17 @@ 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"`
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"`
selectValues sql.SelectValues
}
@@ -38,13 +48,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:
case indexers.FieldEnableRss, indexers.FieldDisabled, indexers.FieldTvSearch, indexers.FieldMovieSearch, indexers.FieldSynced:
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:
case indexers.FieldName, indexers.FieldImplementation, indexers.FieldSettings, indexers.FieldAPIKey, indexers.FieldURL:
values[i] = new(sql.NullString)
default:
values[i] = new(sql.UnknownType)
@@ -109,6 +119,36 @@ 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])
}
@@ -165,6 +205,21 @@ 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()
}

View File

@@ -25,6 +25,16 @@ 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"
)
@@ -39,6 +49,11 @@ var Columns = []string{
FieldPriority,
FieldSeedRatio,
FieldDisabled,
FieldTvSearch,
FieldMovieSearch,
FieldAPIKey,
FieldURL,
FieldSynced,
}
// ValidColumn reports if the column name is valid (part of the table columns).
@@ -52,6 +67,8 @@ 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.
@@ -60,6 +77,12 @@ 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.
@@ -104,3 +127,28 @@ 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()
}

View File

@@ -88,6 +88,31 @@ 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))
@@ -273,6 +298,16 @@ 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))
@@ -403,6 +438,216 @@ 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...))

View File

@@ -37,6 +37,14 @@ 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)
@@ -93,6 +101,76 @@ 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
@@ -128,6 +206,10 @@ 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)
@@ -144,6 +226,18 @@ 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.
@@ -154,9 +248,6 @@ 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"`)}
}
@@ -217,6 +308,26 @@ 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
}

View File

@@ -69,6 +69,12 @@ 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)
@@ -151,6 +157,106 @@ 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
@@ -201,6 +307,9 @@ 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)
}
@@ -225,6 +334,36 @@ 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}
@@ -287,6 +426,12 @@ 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)
@@ -369,6 +514,106 @@ 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
@@ -449,6 +694,9 @@ 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)
}
@@ -473,6 +721,36 @@ 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

View File

@@ -49,6 +49,8 @@ type Media struct {
Limiter schema.MediaLimiter `json:"limiter,omitempty"`
// Extras holds the value of the "extras" field.
Extras schema.MediaExtras `json:"extras,omitempty"`
// AlternativeTitles holds the value of the "alternative_titles" field.
AlternativeTitles []schema.AlternativeTilte `json:"alternative_titles,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the MediaQuery when eager-loading is set.
Edges MediaEdges `json:"edges"`
@@ -78,7 +80,7 @@ func (*Media) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case media.FieldLimiter, media.FieldExtras:
case media.FieldLimiter, media.FieldExtras, media.FieldAlternativeTitles:
values[i] = new([]byte)
case media.FieldDownloadHistoryEpisodes:
values[i] = new(sql.NullBool)
@@ -203,6 +205,14 @@ func (m *Media) assignValues(columns []string, values []any) error {
return fmt.Errorf("unmarshal field extras: %w", err)
}
}
case media.FieldAlternativeTitles:
if value, ok := values[i].(*[]byte); !ok {
return fmt.Errorf("unexpected type %T for field alternative_titles", values[i])
} else if value != nil && len(*value) > 0 {
if err := json.Unmarshal(*value, &m.AlternativeTitles); err != nil {
return fmt.Errorf("unmarshal field alternative_titles: %w", err)
}
}
default:
m.selectValues.Set(columns[i], values[i])
}
@@ -288,6 +298,9 @@ func (m *Media) String() string {
builder.WriteString(", ")
builder.WriteString("extras=")
builder.WriteString(fmt.Sprintf("%v", m.Extras))
builder.WriteString(", ")
builder.WriteString("alternative_titles=")
builder.WriteString(fmt.Sprintf("%v", m.AlternativeTitles))
builder.WriteByte(')')
return builder.String()
}

View File

@@ -45,6 +45,8 @@ const (
FieldLimiter = "limiter"
// FieldExtras holds the string denoting the extras field in the database.
FieldExtras = "extras"
// FieldAlternativeTitles holds the string denoting the alternative_titles field in the database.
FieldAlternativeTitles = "alternative_titles"
// EdgeEpisodes holds the string denoting the episodes edge name in mutations.
EdgeEpisodes = "episodes"
// Table holds the table name of the media in the database.
@@ -76,6 +78,7 @@ var Columns = []string{
FieldDownloadHistoryEpisodes,
FieldLimiter,
FieldExtras,
FieldAlternativeTitles,
}
// ValidColumn reports if the column name is valid (part of the table columns).

View File

@@ -795,6 +795,16 @@ func ExtrasNotNil() predicate.Media {
return predicate.Media(sql.FieldNotNull(FieldExtras))
}
// AlternativeTitlesIsNil applies the IsNil predicate on the "alternative_titles" field.
func AlternativeTitlesIsNil() predicate.Media {
return predicate.Media(sql.FieldIsNull(FieldAlternativeTitles))
}
// AlternativeTitlesNotNil applies the NotNil predicate on the "alternative_titles" field.
func AlternativeTitlesNotNil() predicate.Media {
return predicate.Media(sql.FieldNotNull(FieldAlternativeTitles))
}
// HasEpisodes applies the HasEdge predicate on the "episodes" edge.
func HasEpisodes() predicate.Media {
return predicate.Media(func(s *sql.Selector) {

View File

@@ -184,6 +184,12 @@ func (mc *MediaCreate) SetNillableExtras(se *schema.MediaExtras) *MediaCreate {
return mc
}
// SetAlternativeTitles sets the "alternative_titles" field.
func (mc *MediaCreate) SetAlternativeTitles(st []schema.AlternativeTilte) *MediaCreate {
mc.mutation.SetAlternativeTitles(st)
return mc
}
// AddEpisodeIDs adds the "episodes" edge to the Episode entity by IDs.
func (mc *MediaCreate) AddEpisodeIDs(ids ...int) *MediaCreate {
mc.mutation.AddEpisodeIDs(ids...)
@@ -377,6 +383,10 @@ func (mc *MediaCreate) createSpec() (*Media, *sqlgraph.CreateSpec) {
_spec.SetField(media.FieldExtras, field.TypeJSON, value)
_node.Extras = value
}
if value, ok := mc.mutation.AlternativeTitles(); ok {
_spec.SetField(media.FieldAlternativeTitles, field.TypeJSON, value)
_node.AlternativeTitles = value
}
if nodes := mc.mutation.EpisodesIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,

View File

@@ -14,6 +14,7 @@ import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/dialect/sql/sqljson"
"entgo.io/ent/schema/field"
)
@@ -290,6 +291,24 @@ func (mu *MediaUpdate) ClearExtras() *MediaUpdate {
return mu
}
// SetAlternativeTitles sets the "alternative_titles" field.
func (mu *MediaUpdate) SetAlternativeTitles(st []schema.AlternativeTilte) *MediaUpdate {
mu.mutation.SetAlternativeTitles(st)
return mu
}
// AppendAlternativeTitles appends st to the "alternative_titles" field.
func (mu *MediaUpdate) AppendAlternativeTitles(st []schema.AlternativeTilte) *MediaUpdate {
mu.mutation.AppendAlternativeTitles(st)
return mu
}
// ClearAlternativeTitles clears the value of the "alternative_titles" field.
func (mu *MediaUpdate) ClearAlternativeTitles() *MediaUpdate {
mu.mutation.ClearAlternativeTitles()
return mu
}
// AddEpisodeIDs adds the "episodes" edge to the Episode entity by IDs.
func (mu *MediaUpdate) AddEpisodeIDs(ids ...int) *MediaUpdate {
mu.mutation.AddEpisodeIDs(ids...)
@@ -454,6 +473,17 @@ func (mu *MediaUpdate) sqlSave(ctx context.Context) (n int, err error) {
if mu.mutation.ExtrasCleared() {
_spec.ClearField(media.FieldExtras, field.TypeJSON)
}
if value, ok := mu.mutation.AlternativeTitles(); ok {
_spec.SetField(media.FieldAlternativeTitles, field.TypeJSON, value)
}
if value, ok := mu.mutation.AppendedAlternativeTitles(); ok {
_spec.AddModifier(func(u *sql.UpdateBuilder) {
sqljson.Append(u, media.FieldAlternativeTitles, value)
})
}
if mu.mutation.AlternativeTitlesCleared() {
_spec.ClearField(media.FieldAlternativeTitles, field.TypeJSON)
}
if mu.mutation.EpisodesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
@@ -779,6 +809,24 @@ func (muo *MediaUpdateOne) ClearExtras() *MediaUpdateOne {
return muo
}
// SetAlternativeTitles sets the "alternative_titles" field.
func (muo *MediaUpdateOne) SetAlternativeTitles(st []schema.AlternativeTilte) *MediaUpdateOne {
muo.mutation.SetAlternativeTitles(st)
return muo
}
// AppendAlternativeTitles appends st to the "alternative_titles" field.
func (muo *MediaUpdateOne) AppendAlternativeTitles(st []schema.AlternativeTilte) *MediaUpdateOne {
muo.mutation.AppendAlternativeTitles(st)
return muo
}
// ClearAlternativeTitles clears the value of the "alternative_titles" field.
func (muo *MediaUpdateOne) ClearAlternativeTitles() *MediaUpdateOne {
muo.mutation.ClearAlternativeTitles()
return muo
}
// AddEpisodeIDs adds the "episodes" edge to the Episode entity by IDs.
func (muo *MediaUpdateOne) AddEpisodeIDs(ids ...int) *MediaUpdateOne {
muo.mutation.AddEpisodeIDs(ids...)
@@ -973,6 +1021,17 @@ func (muo *MediaUpdateOne) sqlSave(ctx context.Context) (_node *Media, err error
if muo.mutation.ExtrasCleared() {
_spec.ClearField(media.FieldExtras, field.TypeJSON)
}
if value, ok := muo.mutation.AlternativeTitles(); ok {
_spec.SetField(media.FieldAlternativeTitles, field.TypeJSON, value)
}
if value, ok := muo.mutation.AppendedAlternativeTitles(); ok {
_spec.AddModifier(func(u *sql.UpdateBuilder) {
sqljson.Append(u, media.FieldAlternativeTitles, value)
})
}
if muo.mutation.AlternativeTitlesCleared() {
_spec.ClearField(media.FieldAlternativeTitles, field.TypeJSON)
}
if muo.mutation.EpisodesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,

View File

@@ -113,11 +113,16 @@ var (
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "name", Type: field.TypeString},
{Name: "implementation", Type: field.TypeString},
{Name: "settings", Type: field.TypeString},
{Name: "settings", Type: field.TypeString, Nullable: true, Default: ""},
{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{
@@ -143,6 +148,7 @@ var (
{Name: "download_history_episodes", Type: field.TypeBool, Nullable: true, Default: false},
{Name: "limiter", Type: field.TypeJSON, Nullable: true},
{Name: "extras", Type: field.TypeJSON, Nullable: true},
{Name: "alternative_titles", Type: field.TypeJSON, Nullable: true},
}
// MediaTable holds the schema information for the "media" table.
MediaTable = &schema.Table{

View File

@@ -4346,6 +4346,11 @@ 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)
@@ -4553,9 +4558,22 @@ 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.
@@ -4769,6 +4787,251 @@ 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...)
@@ -4803,7 +5066,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, 7)
fields := make([]string, 0, 12)
if m.name != nil {
fields = append(fields, indexers.FieldName)
}
@@ -4825,6 +5088,21 @@ 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
}
@@ -4847,6 +5125,16 @@ 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
}
@@ -4870,6 +5158,16 @@ 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)
}
@@ -4928,6 +5226,41 @@ 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)
}
@@ -4985,12 +5318,30 @@ 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
}
@@ -5005,12 +5356,30 @@ 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)
}
@@ -5040,6 +5409,21 @@ 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)
}
@@ -5115,6 +5499,8 @@ type MediaMutation struct {
download_history_episodes *bool
limiter *schema.MediaLimiter
extras *schema.MediaExtras
alternative_titles *[]schema.AlternativeTilte
appendalternative_titles []schema.AlternativeTilte
clearedFields map[string]struct{}
episodes map[int]struct{}
removedepisodes map[int]struct{}
@@ -5881,6 +6267,71 @@ func (m *MediaMutation) ResetExtras() {
delete(m.clearedFields, media.FieldExtras)
}
// SetAlternativeTitles sets the "alternative_titles" field.
func (m *MediaMutation) SetAlternativeTitles(st []schema.AlternativeTilte) {
m.alternative_titles = &st
m.appendalternative_titles = nil
}
// AlternativeTitles returns the value of the "alternative_titles" field in the mutation.
func (m *MediaMutation) AlternativeTitles() (r []schema.AlternativeTilte, exists bool) {
v := m.alternative_titles
if v == nil {
return
}
return *v, true
}
// OldAlternativeTitles returns the old "alternative_titles" field's value of the Media entity.
// If the Media 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 *MediaMutation) OldAlternativeTitles(ctx context.Context) (v []schema.AlternativeTilte, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldAlternativeTitles is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldAlternativeTitles requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldAlternativeTitles: %w", err)
}
return oldValue.AlternativeTitles, nil
}
// AppendAlternativeTitles adds st to the "alternative_titles" field.
func (m *MediaMutation) AppendAlternativeTitles(st []schema.AlternativeTilte) {
m.appendalternative_titles = append(m.appendalternative_titles, st...)
}
// AppendedAlternativeTitles returns the list of values that were appended to the "alternative_titles" field in this mutation.
func (m *MediaMutation) AppendedAlternativeTitles() ([]schema.AlternativeTilte, bool) {
if len(m.appendalternative_titles) == 0 {
return nil, false
}
return m.appendalternative_titles, true
}
// ClearAlternativeTitles clears the value of the "alternative_titles" field.
func (m *MediaMutation) ClearAlternativeTitles() {
m.alternative_titles = nil
m.appendalternative_titles = nil
m.clearedFields[media.FieldAlternativeTitles] = struct{}{}
}
// AlternativeTitlesCleared returns if the "alternative_titles" field was cleared in this mutation.
func (m *MediaMutation) AlternativeTitlesCleared() bool {
_, ok := m.clearedFields[media.FieldAlternativeTitles]
return ok
}
// ResetAlternativeTitles resets all changes to the "alternative_titles" field.
func (m *MediaMutation) ResetAlternativeTitles() {
m.alternative_titles = nil
m.appendalternative_titles = nil
delete(m.clearedFields, media.FieldAlternativeTitles)
}
// AddEpisodeIDs adds the "episodes" edge to the Episode entity by ids.
func (m *MediaMutation) AddEpisodeIDs(ids ...int) {
if m.episodes == nil {
@@ -5969,7 +6420,7 @@ func (m *MediaMutation) Type() string {
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *MediaMutation) Fields() []string {
fields := make([]string, 0, 15)
fields := make([]string, 0, 16)
if m.tmdb_id != nil {
fields = append(fields, media.FieldTmdbID)
}
@@ -6015,6 +6466,9 @@ func (m *MediaMutation) Fields() []string {
if m.extras != nil {
fields = append(fields, media.FieldExtras)
}
if m.alternative_titles != nil {
fields = append(fields, media.FieldAlternativeTitles)
}
return fields
}
@@ -6053,6 +6507,8 @@ func (m *MediaMutation) Field(name string) (ent.Value, bool) {
return m.Limiter()
case media.FieldExtras:
return m.Extras()
case media.FieldAlternativeTitles:
return m.AlternativeTitles()
}
return nil, false
}
@@ -6092,6 +6548,8 @@ func (m *MediaMutation) OldField(ctx context.Context, name string) (ent.Value, e
return m.OldLimiter(ctx)
case media.FieldExtras:
return m.OldExtras(ctx)
case media.FieldAlternativeTitles:
return m.OldAlternativeTitles(ctx)
}
return nil, fmt.Errorf("unknown Media field %s", name)
}
@@ -6206,6 +6664,13 @@ func (m *MediaMutation) SetField(name string, value ent.Value) error {
}
m.SetExtras(v)
return nil
case media.FieldAlternativeTitles:
v, ok := value.([]schema.AlternativeTilte)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetAlternativeTitles(v)
return nil
}
return fmt.Errorf("unknown Media field %s", name)
}
@@ -6281,6 +6746,9 @@ func (m *MediaMutation) ClearedFields() []string {
if m.FieldCleared(media.FieldExtras) {
fields = append(fields, media.FieldExtras)
}
if m.FieldCleared(media.FieldAlternativeTitles) {
fields = append(fields, media.FieldAlternativeTitles)
}
return fields
}
@@ -6313,6 +6781,9 @@ func (m *MediaMutation) ClearField(name string) error {
case media.FieldExtras:
m.ClearExtras()
return nil
case media.FieldAlternativeTitles:
m.ClearAlternativeTitles()
return nil
}
return fmt.Errorf("unknown Media nullable field %s", name)
}
@@ -6366,6 +6837,9 @@ func (m *MediaMutation) ResetField(name string) error {
case media.FieldExtras:
m.ResetExtras()
return nil
case media.FieldAlternativeTitles:
m.ResetAlternativeTitles()
return nil
}
return fmt.Errorf("unknown Media field %s", name)
}

View File

@@ -71,6 +71,10 @@ 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.
@@ -87,6 +91,18 @@ 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.

View File

@@ -15,11 +15,16 @@ func (Indexers) Fields() []ent.Field {
return []ent.Field{
field.String("name"),
field.String("implementation"),
field.String("settings"),
field.String("settings").Optional().Default("").Comment("deprecated, use api_key and url"),
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"),
}
}

View File

@@ -31,6 +31,7 @@ func (Media) Fields() []ent.Field {
field.Bool("download_history_episodes").Optional().Default(false).Comment("tv series only"),
field.JSON("limiter", MediaLimiter{}).Optional(),
field.JSON("extras", MediaExtras{}).Optional(),
field.JSON("alternative_titles", []AlternativeTilte{}).Optional(),
}
}
@@ -41,9 +42,16 @@ func (Media) Edges() []ent.Edge {
}
}
type AlternativeTilte struct {
Iso3166_1 string `json:"iso_3166_1"`
Title string `json:"title"`
Type string `json:"type"`
}
type MediaLimiter struct {
SizeMin int `json:"size_min"` //in B
SizeMax int `json:"size_max"` //in B
SizeMin int64 `json:"size_min"` //in B
SizeMax int64 `json:"size_max"` //in B
PreferSize int64 `json:"prefer_max"`
}
type MediaExtras struct {
@@ -51,7 +59,7 @@ type MediaExtras struct {
JavId string `json:"javid"`
//OriginCountry []string `json:"origin_country"`
OriginalLanguage string `json:"original_language"`
Genres []struct {
Genres []struct {
ID int64 `json:"id"`
Name string `json:"name"`
} `json:"genres"`

10
go.mod
View File

@@ -10,7 +10,7 @@ require (
github.com/mattn/go-sqlite3 v1.14.22 // indirect
github.com/robfig/cron v1.2.0
go.uber.org/zap v1.27.0
golang.org/x/net v0.27.0
golang.org/x/net v0.33.0
)
require (
@@ -47,7 +47,7 @@ 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
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sync v0.10.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
@@ -95,11 +95,11 @@ require (
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/zclconf/go-cty v1.8.0 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.27.0
golang.org/x/crypto v0.31.0
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948
golang.org/x/mod v0.20.0 // indirect
golang.org/x/sys v0.25.0
golang.org/x/text v0.18.0 // indirect
golang.org/x/sys v0.28.0
golang.org/x/text v0.21.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect

20
go.sum
View File

@@ -362,8 +362,8 @@ 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-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A=
golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70=
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 h1:kx6Ds3MlpiUHKj7syVnbp57++8WpuKPcR5yjLBjvLEA=
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
@@ -391,8 +391,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
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=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
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/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -403,8 +403,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -423,8 +423,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
@@ -436,8 +436,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
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.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
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/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=

View File

@@ -31,26 +31,28 @@ func New(apiKey, url string) *Client {
return &Client{p: p, apiKey: apiKey, url: url}
}
func (c *Client) GetIndexers(t ProwlarrSupportType) ([]*db.TorznabInfo, error) {
func (c *Client) GetIndexers() ([]*ent.Indexers, error) {
ins, err := c.p.GetIndexers()
if err != nil {
return nil, err
}
var indexers []*db.TorznabInfo
var indexers []*ent.Indexers
for _, in := range ins {
if !in.Enable {
continue
tvSearch := true
movieSearch := true
if len(in.Capabilities.TvSearchParams) == 0 { //no tv resource in this indexer
tvSearch = 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
if len(in.Capabilities.MovieSearchParams) == 0 { //no movie resource in this indexer
movieSearch = false
}
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
}
}
}
@@ -61,17 +63,18 @@ func (c *Client) GetIndexers(t ProwlarrSupportType) ([]*db.TorznabInfo, 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, &db.TorznabInfo{
Indexers: &entIndexer,
TorznabSetting: setting,
})
indexers = append(indexers, &entIndexer)
}
return indexers, nil
}

View File

@@ -7,7 +7,7 @@ import (
func Test111(t *testing.T) {
c := New("", "http://10.0.0.8:9696/")
apis , err := c.GetIndexers("tv")
apis , err := c.GetIndexers()
log.Infof("errors: %v", err)
log.Infof("indexers: %+v", apis[0])
}

View File

@@ -10,20 +10,22 @@ import (
"github.com/gabriel-vasile/mimetype"
)
func NewAlist(cfg *alist.Config, dir string) (*Alist, error) {
func NewAlist(cfg *alist.Config, dir string, videoFormats []string, subtitleFormats []string) (*Alist, error) {
cl := alist.New(cfg)
_, err := cl.Login()
if err != nil {
return nil, err
}
return &Alist{baseDir: dir, cfg: cfg, client: cl}, nil
return &Alist{baseDir: dir, cfg: cfg, client: cl, videoFormats: videoFormats, subtitleFormats: subtitleFormats}, nil
}
type Alist struct {
baseDir string
cfg *alist.Config
client *alist.Client
progresser func() float64
baseDir string
cfg *alist.Config
client *alist.Client
progresser func() float64
videoFormats []string
subtitleFormats []string
}
func (a *Alist) Move(src, dest string) error {
@@ -34,7 +36,7 @@ func (a *Alist) Move(src, dest string) error {
}
func (a *Alist) Copy(src, dest string) error {
b, err := NewBase(src)
b, err := NewBase(src, a.videoFormats, a.subtitleFormats)
if err != nil {
return err
}
@@ -70,3 +72,7 @@ func (a *Alist) UploadProgress() float64 {
}
return a.progresser()
}
func (a *Alist) RemoveAll(path string) error {
return nil
}

View File

@@ -7,10 +7,12 @@ import (
"path/filepath"
"polaris/log"
"polaris/pkg/utils"
"strings"
"github.com/gabriel-vasile/mimetype"
"github.com/pkg/errors"
)
type Storage interface {
Move(src, dest string) error
Copy(src, dest string) error
@@ -18,24 +20,69 @@ type Storage interface {
ReadFile(string) ([]byte, error)
WriteFile(string, []byte) error
UploadProgress() float64
RemoveAll(path string) error
}
type uploadFunc func(destPath string, destInfo fs.FileInfo, srcReader io.Reader, mimeType *mimetype.MIME) error
type Base struct {
src string
totalSize int64
uploadedSize int64
src string
videoFormats []string
subtitleFormats []string
totalSize int64
uploadedSize int64
}
func NewBase(src string) (*Base, error) {
b := &Base{src: src}
func NewBase(src string, videoFormats []string, subtitleFormats []string) (*Base, error) {
b := &Base{src: src, videoFormats: videoFormats, subtitleFormats: subtitleFormats}
err := b.calculateSize()
return b, err
}
func (b *Base) checkVideoFilesExist() bool {
if len(b.videoFormats) == 0 { // do not check
return true
}
hasVideo := false
filepath.Walk(b.src, func(path string, info fs.FileInfo, err error) error {
ext := filepath.Ext(strings.ToLower(info.Name()))
for _, f := range b.videoFormats {
if f == ext {
hasVideo = true
}
}
return nil
})
return hasVideo
}
func (b *Base) isFileNeeded(name string) bool {
ext := filepath.Ext(strings.ToLower(name))
if len(b.videoFormats) == 0 {
return true
} else {
for _, f := range b.videoFormats {
if f == ext {
return true
}
}
}
if len(b.subtitleFormats) > 0 {
for _, f := range b.subtitleFormats {
if f == ext {
return true
}
}
}
return false
}
func (b *Base) Upload(destDir string, tryLink, detectMime, changeMediaHash bool, upload uploadFunc, mkdir func(string) error) error {
if !b.checkVideoFilesExist() {
return errors.Errorf("torrent has no video file(s)")
}
os.MkdirAll(destDir, os.ModePerm)
targetBase := filepath.Join(destDir, filepath.Base(b.src)) //文件的场景,要加上文件名, move filename ./dir/
@@ -61,6 +108,10 @@ func (b *Base) Upload(destDir string, tryLink, detectMime, changeMediaHash bool,
if info.IsDir() {
mkdir(destName)
} else { //is file
if !b.isFileNeeded(info.Name()) {
log.Debugf("file is not needed, skip: %s", info.Name())
return nil
}
if tryLink {
if err := os.Link(path, destName); err == nil {
return nil //link success
@@ -116,12 +167,11 @@ func (b *Base) calculateSize() error {
}
func (b *Base) Progress() float64 {
return float64(b.uploadedSize)/float64(b.totalSize)
return float64(b.uploadedSize) / float64(b.totalSize)
}
type progressReader struct {
R io.Reader
R io.Reader
Add func(int)
}
@@ -129,4 +179,4 @@ func (pr *progressReader) Read(p []byte) (int, error) {
n, err := pr.R.Read(p)
pr.Add(n)
return n, err
}
}

View File

@@ -11,18 +11,19 @@ import (
"github.com/pkg/errors"
)
func NewLocalStorage(dir string) (*LocalStorage, error) {
func NewLocalStorage(dir string, videoFormats []string, subtitleFormats []string) (*LocalStorage, error) {
os.MkdirAll(dir, 0655)
return &LocalStorage{dir: dir}, nil
return &LocalStorage{dir: dir, videoFormats: videoFormats, subtitleFormats: subtitleFormats}, nil
}
type LocalStorage struct {
dir string
dir string
videoFormats []string
subtitleFormats []string
}
func (l *LocalStorage) Copy(src, destDir string) error {
b, err := NewBase(src)
b, err := NewBase(src, l.videoFormats, l.subtitleFormats)
if err != nil {
return err
}
@@ -69,4 +70,8 @@ func (l *LocalStorage) WriteFile(name string, data []byte) error {
func (l *LocalStorage) UploadProgress() float64 {
return 0
}
func (l *LocalStorage) RemoveAll(path string) error {
return os.RemoveAll(filepath.Join(l.dir, path))
}

View File

@@ -16,10 +16,12 @@ type WebdavStorage struct {
fs *gowebdav.Client
dir string
changeMediaHash bool
progresser func() float64
progresser func() float64
videoFormats []string
subtitleFormats []string
}
func NewWebdavStorage(url, user, password, path string, changeMediaHash bool) (*WebdavStorage, error) {
func NewWebdavStorage(url, user, password, path string, changeMediaHash bool, videoFormats []string, subtitleFormats []string) (*WebdavStorage, error) {
c := gowebdav.NewClient(url, user, password)
if err := c.Connect(); err != nil {
return nil, errors.Wrap(err, "connect webdav")
@@ -27,11 +29,13 @@ func NewWebdavStorage(url, user, password, path string, changeMediaHash bool) (*
return &WebdavStorage{
fs: c,
dir: path,
videoFormats: videoFormats,
subtitleFormats: subtitleFormats,
}, nil
}
func (w *WebdavStorage) Copy(local, remoteDir string) error {
b, err := NewBase(local)
b, err := NewBase(local, w.videoFormats, w.subtitleFormats)
if err != nil {
return err
}
@@ -80,4 +84,8 @@ func (w *WebdavStorage) UploadProgress() float64 {
return 0
}
return w.progresser()
}
}
func (w *WebdavStorage) RemoveAll(path string) error {
return w.fs.RemoveAll(filepath.Join(w.dir, path))
}

View File

@@ -7,7 +7,7 @@ import (
"io"
"net/http"
"net/url"
"polaris/db"
"polaris/ent"
"polaris/log"
"slices"
"strconv"
@@ -74,7 +74,7 @@ func (i *Item) GetAttr(key string) string {
}
return ""
}
func (r *Response) ToResults(indexer *db.TorznabInfo) []Result {
func (r *Response) ToResults(indexer *ent.Indexers) []Result {
var res []Result
for _, item := range r.Channel.Item {
if slices.Contains(item.Category, "3000") { //exclude audio files
@@ -96,9 +96,9 @@ func (r *Response) ToResults(indexer *db.TorznabInfo) []Result {
Description: item.Description,
Link: item.Link,
Size: mustAtoI(item.Size),
Seeders: mustAtoI(item.GetAttr("seeders")),
Peers: mustAtoI(item.GetAttr("peers")),
Category: mustAtoI(item.GetAttr("category")),
Seeders: int(mustAtoI(item.GetAttr("seeders"))),
Peers: int(mustAtoI(item.GetAttr("peers"))),
Category: int(mustAtoI(item.GetAttr("category"))),
ImdbId: imdb,
DownloadVolumeFactor: tryParseFloat(item.GetAttr("downloadvolumefactor")),
UploadVolumeFactor: tryParseFloat(item.GetAttr("uploadvolumefactor")),
@@ -112,8 +112,8 @@ func (r *Response) ToResults(indexer *db.TorznabInfo) []Result {
return res
}
func mustAtoI(key string) int {
i, err := strconv.Atoi(key)
func mustAtoI(key string) int64 {
i, err := strconv.ParseInt(key, 10, 64)
if err != nil {
log.Errorf("must atoi error: %v", err)
panic(err)
@@ -130,7 +130,7 @@ func tryParseFloat(s string) float32 {
return float32(r)
}
func Search(indexer *db.TorznabInfo, keyWord string) ([]Result, error) {
func Search(indexer *ent.Indexers, keyWord string) ([]Result, error) {
ctx, cancel := context.WithTimeout(context.TODO(), 30*time.Second)
defer cancel()
@@ -139,7 +139,7 @@ func Search(indexer *db.TorznabInfo, 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 int `json:"size"`
Size int64 `json:"size"`
Seeders int `json:"seeders"`
Peers int `json:"peers"`
Category int `json:"category"`

View File

@@ -46,6 +46,7 @@ func (c *Client) registerCronJob(name string, cron string, f func() error) {
func (c *Client) Init() {
go c.reloadTasks()
c.addSysCron()
go c.checkW500PosterOnStartup()
}
func (c *Client) reloadTasks() {

2
server/core/fliters.go Normal file
View File

@@ -0,0 +1,2 @@
package core

View File

@@ -114,8 +114,9 @@ type AddWatchlistIn struct {
Resolution string `json:"resolution" binding:"required"`
Folder string `json:"folder" binding:"required"`
DownloadHistoryEpisodes bool `json:"download_history_episodes"` //for tv
SizeMin int `json:"size_min"`
SizeMax int `json:"size_max"`
SizeMin int64 `json:"size_min"`
SizeMax int64 `json:"size_max"`
PreferSize int64 `json:"prefer_size"`
}
func (c *Client) AddTv2Watchlist(in AddWatchlistIn) (interface{}, error) {
@@ -139,7 +140,7 @@ func (c *Client) AddTv2Watchlist(in AddWatchlistIn) (interface{}, error) {
}
log.Infof("find detail for tv id %d: %+v", in.TmdbID, detail)
lastSeason := 0
lastSeason := 0
for _, season := range detail.Seasons {
if season.SeasonNumber > lastSeason && season.EpisodeCount > 0 { //如果最新一季已经有剧集信息,则以最新一季为准
lastSeason = season.SeasonNumber
@@ -148,6 +149,11 @@ func (c *Client) AddTv2Watchlist(in AddWatchlistIn) (interface{}, error) {
log.Debugf("latest season is %v", lastSeason)
alterTitles, err := c.getAlterTitles(in.TmdbID, media.MediaTypeTv)
if err != nil {
return nil, errors.Wrap(err, "get alter titles")
}
var epIds []int
for _, season := range detail.Seasons {
seasonId := season.SeasonNumber
@@ -194,6 +200,7 @@ func (c *Client) AddTv2Watchlist(in AddWatchlistIn) (interface{}, error) {
epIds = append(epIds, epid)
}
}
m := &ent.Media{
TmdbID: int(detail.ID),
ImdbID: detail.IMDbID,
@@ -212,6 +219,7 @@ func (c *Client) AddTv2Watchlist(in AddWatchlistIn) (interface{}, error) {
OriginalLanguage: detail.OriginalLanguage,
Genres: detail.Genres,
},
AlternativeTitles: alterTitles,
}
r, err := c.db.AddMediaWatchlist(m, epIds)
@@ -222,6 +230,10 @@ func (c *Client) AddTv2Watchlist(in AddWatchlistIn) (interface{}, error) {
if err := c.downloadPoster(detail.PosterPath, r.ID); err != nil {
log.Errorf("download poster error: %v", err)
}
if err := c.downloadW500Poster(detail.PosterPath, r.ID); err != nil {
log.Errorf("download w500 poster error: %v", err)
}
if err := c.downloadBackdrop(detail.BackdropPath, r.ID); err != nil {
log.Errorf("download poster error: %v", err)
}
@@ -235,6 +247,42 @@ func (c *Client) AddTv2Watchlist(in AddWatchlistIn) (interface{}, error) {
return nil, nil
}
func (c *Client) getAlterTitles(tmdbId int, mediaType media.MediaType) ([]schema.AlternativeTilte, error){
var titles []schema.AlternativeTilte
if mediaType == media.MediaTypeTv {
alterTitles, err := c.MustTMDB().GetTVAlternativeTitles(tmdbId, c.language)
if err != nil {
return nil, errors.Wrap(err, "tmdb")
}
for _, t := range alterTitles.Results {
titles = append(titles, schema.AlternativeTilte{
Iso3166_1: t.Iso3166_1,
Title: t.Title,
Type: t.Type,
})
}
} else if mediaType == media.MediaTypeMovie {
alterTitles, err := c.MustTMDB().GetMovieAlternativeTitles(tmdbId, c.language)
if err != nil {
return nil, errors.Wrap(err, "tmdb")
}
for _, t := range alterTitles.Titles {
titles = append(titles, schema.AlternativeTilte{
Iso3166_1: t.Iso3166_1,
Title: t.Title,
Type: t.Type,
})
}
}
log.Debugf("get alternative titles: %+v", titles)
return titles, nil
}
func (c *Client) AddMovie2Watchlist(in AddWatchlistIn) (interface{}, error) {
log.Infof("add movie watchlist input: %+v", in)
detailCn, err := c.MustTMDB().GetMovieDetails(in.TmdbID, db.LanguageCN)
@@ -253,6 +301,12 @@ func (c *Client) AddMovie2Watchlist(in AddWatchlistIn) (interface{}, error) {
}
log.Infof("find detail for movie id %d: %v", in.TmdbID, detail)
alterTitles, err := c.getAlterTitles(in.TmdbID, media.MediaTypeMovie)
if err != nil {
return nil, errors.Wrap(err, "get alter titles")
}
epid, err := c.db.SaveEposideDetail(&ent.Episode{
SeasonNumber: 1,
EpisodeNumber: 1,
@@ -279,6 +333,7 @@ func (c *Client) AddMovie2Watchlist(in AddWatchlistIn) (interface{}, error) {
StorageID: in.StorageID,
TargetDir: in.Folder,
Limiter: schema.MediaLimiter{SizeMin: in.SizeMin, SizeMax: in.SizeMax},
AlternativeTitles: alterTitles,
}
extras := schema.MediaExtras{
@@ -300,6 +355,10 @@ func (c *Client) AddMovie2Watchlist(in AddWatchlistIn) (interface{}, error) {
if err := c.downloadPoster(detail.PosterPath, r.ID); err != nil {
log.Errorf("download poster error: %v", err)
}
if err := c.downloadW500Poster(detail.PosterPath, r.ID); err != nil {
log.Errorf("download w500 poster error: %v", err)
}
if err := c.downloadBackdrop(detail.BackdropPath, r.ID); err != nil {
log.Errorf("download backdrop error: %v", err)
}
@@ -314,7 +373,7 @@ func (c *Client) AddMovie2Watchlist(in AddWatchlistIn) (interface{}, error) {
}
func (c *Client) checkMovieFolder(m *ent.Media) error {
var storageImpl, err = c.getStorage(m.StorageID, media.MediaTypeMovie)
var storageImpl, err = c.GetStorage(m.StorageID, media.MediaTypeMovie)
if err != nil {
return err
}
@@ -327,8 +386,8 @@ func (c *Client) checkMovieFolder(m *ent.Media) error {
return err
}
for _,f := range files {
if f.IsDir() || f.Size() < 100 * 1000 * 1000 /* 100M */{ //忽略路径和小于100M的文件
for _, f := range files {
if f.IsDir() || f.Size() < 100*1000*1000 /* 100M */ { //忽略路径和小于100M的文件
continue
}
meta := metadata.ParseMovie(f.Name())
@@ -371,6 +430,11 @@ func (c *Client) downloadPoster(path string, mediaID int) error {
return c.downloadImage(url, mediaID, "poster.jpg")
}
func (c *Client) downloadW500Poster(path string, mediaID int) error {
url := "https://image.tmdb.org/t/p/w500" + path
return c.downloadImage(url, mediaID, "poster_w500.jpg")
}
func (c *Client) downloadImage(url string, mediaID int, name string) error {
log.Infof("try to download image: %v", url)
@@ -396,6 +460,46 @@ func (c *Client) downloadImage(url string, mediaID int, name string) error {
}
func (c *Client) checkW500PosterOnStartup() {
log.Infof("check all w500 posters")
all := c.db.GetMediaWatchlist(media.MediaTypeTv)
movies := c.db.GetMediaWatchlist(media.MediaTypeMovie)
all = append(all, movies...)
for _, e := range all {
targetFile := filepath.Join(fmt.Sprintf("%v/%d", db.ImgPath, e.ID), "poster_w500.jpg")
if _, err := os.Stat(targetFile); err != nil {
log.Infof("poster_w500.jpg not exist for %s, will download it", e.NameEn)
if e.MediaType ==media.MediaTypeTv {
detail, err := c.MustTMDB().GetTvDetails(e.TmdbID, db.LanguageCN)
if err != nil {
log.Warnf("get tmdb detail for %s error: %v", e.NameEn, err)
continue
}
if err := c.downloadW500Poster(detail.PosterPath, e.ID); err != nil {
log.Warnf("download w500 poster error: %v", err)
continue
}
} else {
detail, err := c.MustTMDB().GetMovieDetails(e.TmdbID, db.LanguageCN)
if err != nil {
log.Warnf("get tmdb detail for %s error: %v", e.NameEn, err)
continue
}
if err := c.downloadW500Poster(detail.PosterPath, e.ID); err != nil {
log.Warnf("download w500 poster error: %v", err)
continue
}
}
}
}
}
func (c *Client) SuggestedMovieFolderName(tmdbId int) (string, error) {
d1, err := c.MustTMDB().GetMovieDetails(tmdbId, c.language)

80
server/core/indexer.go Normal file
View File

@@ -0,0 +1,80 @@
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
}

View File

@@ -35,7 +35,7 @@ func (c *Client) writeNfoFile(historyId int) error {
}
if md.MediaType == media.MediaTypeTv { //tvshow.nfo
st, err := c.getStorage(md.StorageID, media.MediaTypeTv)
st, err := c.GetStorage(md.StorageID, media.MediaTypeTv)
if err != nil {
return errors.Wrap(err, "get storage")
}
@@ -70,7 +70,7 @@ func (c *Client) writeNfoFile(historyId int) error {
}
} else if md.MediaType == media.MediaTypeMovie { //movie.nfo
st, err := c.getStorage(md.StorageID, media.MediaTypeMovie)
st, err := c.GetStorage(md.StorageID, media.MediaTypeMovie)
if err != nil {
return errors.Wrap(err, "get storage")
}
@@ -122,7 +122,7 @@ func (c *Client) writePlexmatch(historyId int) error {
if series.MediaType != media.MediaTypeTv { //.plexmatch only support tv series
return nil
}
st, err := c.getStorage(series.StorageID, media.MediaTypeTv)
st, err := c.GetStorage(series.StorageID, media.MediaTypeTv)
if err != nil {
return errors.Wrap(err, "get storage")
}
@@ -197,17 +197,26 @@ func (c *Client) nfoSupportEnabled() bool {
return c.db.GetSetting(db.SettingNfoSupportEnabled) == "true"
}
func (c *Client) getStorage(storageId int, mediaType media.MediaType) (storage.Storage, error) {
func (c *Client) GetStorage(storageId int, mediaType media.MediaType) (storage.Storage, error) {
st := c.db.GetStorage(storageId)
targetPath := st.TvPath
if mediaType == media.MediaTypeMovie {
targetPath = st.MoviePath
}
videoFormats, err := c.db.GetAcceptedVideoFormats()
if err != nil {
log.Warnf("get accepted video format error: %v", err)
}
subtitleFormats, err := c.db.GetAcceptedSubtitleFormats()
if err != nil {
log.Warnf("get accepted subtitle format error: %v", err)
}
switch st.Implementation {
case storage1.ImplementationLocal:
storageImpl1, err := storage.NewLocalStorage(targetPath)
storageImpl1, err := storage.NewLocalStorage(targetPath, videoFormats, subtitleFormats)
if err != nil {
return nil, errors.Wrap(err, "new local")
}
@@ -215,14 +224,14 @@ func (c *Client) getStorage(storageId int, mediaType media.MediaType) (storage.S
case storage1.ImplementationWebdav:
ws := st.ToWebDavSetting()
storageImpl1, err := storage.NewWebdavStorage(ws.URL, ws.User, ws.Password, targetPath, ws.ChangeFileHash == "true")
storageImpl1, err := storage.NewWebdavStorage(ws.URL, ws.User, ws.Password, targetPath, ws.ChangeFileHash == "true", videoFormats, subtitleFormats)
if err != nil {
return nil, errors.Wrap(err, "new webdav")
}
return storageImpl1, nil
case storage1.ImplementationAlist:
cfg := st.ToWebDavSetting()
storageImpl1, err := storage.NewAlist(&alist.Config{URL: cfg.URL, Username: cfg.User, Password: cfg.Password}, targetPath)
storageImpl1, err := storage.NewAlist(&alist.Config{URL: cfg.URL, Username: cfg.User, Password: cfg.Password}, targetPath, videoFormats, subtitleFormats)
if err != nil {
return nil, errors.Wrap(err, "alist")
}

View File

@@ -68,7 +68,7 @@ func (c *Client) DownloadEpisodeTorrent(r1 torznab.Result, seriesId, seasonNum i
SourceTitle: r1.Name,
TargetDir: dir,
Status: history.StatusRunning,
Size: r1.Size,
Size: int(r1.Size),
//Saved: torrent.Save(),
Link: magnet,
DownloadClientID: dlc.ID,
@@ -192,7 +192,7 @@ lo:
return torrentNames, nil
}
func (c *Client) DownloadMovie(m *ent.Media, link, name string, size int, indexerID int) (*string, error) {
func (c *Client) DownloadMovie(m *ent.Media, link, name string, size int64, indexerID int) (*string, error) {
trc, dlc, err := c.GetDownloadClient()
if err != nil {
return nil, errors.Wrap(err, "connect transmission")
@@ -219,7 +219,7 @@ func (c *Client) DownloadMovie(m *ent.Media, link, name string, size int, indexe
SourceTitle: name,
TargetDir: m.TargetDir,
Status: history.StatusRunning,
Size: size,
Size: int(size),
//Saved: torrent.Save(),
Link: magnet,
DownloadClientID: dlc.ID,

View File

@@ -2,6 +2,7 @@ package core
import (
"fmt"
"os"
"path/filepath"
"polaris/db"
"polaris/ent"
@@ -20,6 +21,13 @@ import (
func (c *Client) addSysCron() {
c.registerCronJob("check_running_tasks", "@every 1m", c.checkTasks)
c.registerCronJob("check_available_medias_to_download", "0 0 * * * *", func() error {
v := os.Getenv("POLARIS_NO_AUTO_DOWNLOAD")
if v == "true" {
return nil
}
if err := c.syncProwlarr(); err != nil {
log.Warnf("sync prowlarr error: %v", err)
}
c.downloadAllTvSeries()
c.downloadAllMovies()
return nil
@@ -198,7 +206,7 @@ func (c *Client) moveCompletedTask(id int) (err1 error) {
}
st := c.db.GetStorage(series.StorageID)
log.Infof("move task files to target dir: %v", r.TargetDir)
stImpl, err := c.getStorage(st.ID, series.MediaType)
stImpl, err := c.GetStorage(st.ID, series.MediaType)
if err != nil {
return err
}
@@ -219,7 +227,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)
@@ -238,7 +246,7 @@ func (c *Client) CheckDownloadedSeriesFiles(m *ent.Media) error {
}
log.Infof("check files in directory: %s", m.TargetDir)
var storageImpl, err = c.getStorage(m.StorageID, media.MediaTypeTv)
var storageImpl, err = c.GetStorage(m.StorageID, media.MediaTypeTv)
if err != nil {
return err
}
@@ -434,7 +442,7 @@ func (c *Client) downloadMovieSingleEpisode(ep *ent.Episode, targetDir string) (
SourceTitle: r1.Name,
TargetDir: targetDir,
Status: history.StatusRunning,
Size: r1.Size,
Size: int(r1.Size),
//Saved: torrent.Save(),
Link: magnet,
DownloadClientID: dlc.ID,

View File

@@ -3,10 +3,10 @@ package core
import (
"fmt"
"polaris/db"
"polaris/ent"
"polaris/ent/media"
"polaris/log"
"polaris/pkg/metadata"
"polaris/pkg/prowlarr"
"polaris/pkg/torznab"
"slices"
"sort"
@@ -26,14 +26,66 @@ type SearchParam struct {
FilterQiangban bool //for movie, 是否过滤枪版电影
}
func names2Query(media *ent.Media) []string {
var names = []string{media.NameEn}
if media.NameCn != "" {
hasName := false
for _, n := range names {
if media.NameCn == n {
hasName = true
}
}
if !hasName {
names = append(names, media.NameCn)
}
}
if media.OriginalName != "" {
hasName := false
for _, n := range names {
if media.OriginalName == n {
hasName = true
}
}
if !hasName {
names = append(names, media.OriginalName)
}
}
for _, t := range media.AlternativeTitles {
if (t.Iso3166_1 == "CN" || t.Iso3166_1 == "US") && t.Type == "" {
hasName := false
for _, n := range names {
if t.Title == n {
hasName = true
}
}
if !hasName {
names = append(names, t.Title)
}
}
}
log.Debugf("name to query %+v", names)
return names
}
func SearchTvSeries(db1 *db.Client, param *SearchParam) ([]torznab.Result, error) {
series := db1.GetMediaDetails(param.MediaId)
if series == nil {
return nil, fmt.Errorf("no tv series of id %v", param.MediaId)
}
limiter, err := db1.GetSizeLimiter("tv")
if err != nil {
log.Warnf("get tv size limiter: %v", err)
limiter = &db.MediaSizeLimiter{}
}
log.Debugf("check tv series %s, season %d, episode %v", series.NameEn, param.SeasonNum, param.Episodes)
res := searchWithTorznab(db1, prowlarr.TV, series.NameEn, series.NameCn, series.OriginalName)
names := names2Query(series.Media)
res := searchWithTorznab(db1, SearchTypeTv, names...)
var filtered []torznab.Result
lo:
@@ -80,7 +132,7 @@ lo:
continue
}
if !torrentSizeOk(series, r.Size, meta.EndEpisode+1-meta.StartEpisode, param) {
if !torrentSizeOk(series, limiter, r.Size, meta.EndEpisode+1-meta.StartEpisode, param) {
continue
}
@@ -114,14 +166,8 @@ func imdbIDMatchExact(id1, id2 string) bool {
return id1 == id2
}
func torrentSizeOk(detail *db.MediaDetails, torrentSize int, torrentEpisodeNum int, param *SearchParam) bool {
defaultMinSize := 80 * 1000 * 1000 //tv, 80M min
if detail.MediaType == media.MediaTypeMovie {
defaultMinSize = 200 * 1000 * 1000 // movie, 200M min
}
if detail.Limiter.SizeMin > 0 { //if size limiter set, use configured min size
defaultMinSize = detail.Limiter.SizeMin
}
func torrentSizeOk(detail *db.MediaDetails, globalLimiter *db.MediaSizeLimiter, torrentSize int64,
torrentEpisodeNum int, param *SearchParam) bool {
multiplier := 1 //大小倍数正常为1如果是季包则为季内集数
if detail.MediaType == media.MediaTypeTv {
@@ -133,21 +179,34 @@ func torrentSizeOk(detail *db.MediaDetails, torrentSize int, torrentEpisodeNum i
}
if param.CheckFileSize { //check file size when trigger automatic download
if detail.Limiter.SizeMin > 0 { //min size
sizeMin := detail.Limiter.SizeMin * multiplier
sizeMin := detail.Limiter.SizeMin * int64(multiplier)
if torrentSize < sizeMin { //比最小要求的大小还要小, min size not qualify
return false
}
} else if globalLimiter != nil {
resLimiter := globalLimiter.GetLimiter(detail.Resolution)
sizeMin := resLimiter.MinSize * int64(multiplier)
if torrentSize < sizeMin { //比最小要求的大小还要小, min size not qualify
return false
}
}
if detail.Limiter.SizeMax > 0 { //max size
sizeMax := detail.Limiter.SizeMax * multiplier
sizeMax := detail.Limiter.SizeMax * int64(multiplier)
if torrentSize > sizeMax { //larger than max size wanted, max size not qualify
return false
}
} else if globalLimiter != nil {
resLimiter := globalLimiter.GetLimiter(detail.Resolution)
sizeMax := resLimiter.MaxSIze * int64(multiplier)
if torrentSize > sizeMax { //larger than max size wanted, max size not qualify
return false
}
}
}
return torrentSize > defaultMinSize*multiplier
return true
}
func seasonEpisodeCount(detail *db.MediaDetails, seasonNum int) int {
@@ -181,9 +240,16 @@ func SearchMovie(db1 *db.Client, param *SearchParam) ([]torznab.Result, error) {
return nil, errors.New("no media found of id")
}
res := searchWithTorznab(db1, prowlarr.Movie, movieDetail.NameEn, movieDetail.NameCn, movieDetail.OriginalName)
limiter, err := db1.GetSizeLimiter("movie")
if err != nil {
log.Warnf("get tv size limiter: %v", err)
limiter = &db.MediaSizeLimiter{}
}
names := names2Query(movieDetail.Media)
res := searchWithTorznab(db1, SearchTypeMovie, names...)
if movieDetail.Extras.IsJav() {
res1 := searchWithTorznab(db1, prowlarr.Movie, movieDetail.Extras.JavId)
res1 := searchWithTorznab(db1, SearchTypeMovie, movieDetail.Extras.JavId)
res = append(res, res1...)
}
@@ -221,7 +287,7 @@ func SearchMovie(db1 *db.Client, param *SearchParam) ([]torznab.Result, error) {
continue
}
if !torrentSizeOk(movieDetail, r.Size, 1, param) {
if !torrentSizeOk(movieDetail, limiter, r.Size, 1, param) {
continue
}
@@ -237,21 +303,18 @@ func SearchMovie(db1 *db.Client, param *SearchParam) ([]torznab.Result, error) {
}
func searchWithTorznab(db *db.Client, t prowlarr.ProwlarrSupportType, queries ...string) []torznab.Result {
type SearchType int
const (
SearchTypeTv SearchType = 1
SearchTypeMovie SearchType = 2
)
func searchWithTorznab(db *db.Client, t SearchType, queries ...string) []torznab.Result {
var res []torznab.Result
allTorznab := db.GetAllTorznabInfo()
allTorznab := db.GetAllIndexers()
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
@@ -259,6 +322,13 @@ func searchWithTorznab(db *db.Client, t prowlarr.ProwlarrSupportType, queries ..
if tor.Disabled {
continue
}
if t == SearchTypeTv && !tor.TvSearch {
continue
}
if t == SearchTypeMovie && !tor.MovieSearch {
continue
}
for _, q := range queries {
wg.Add(1)
@@ -343,5 +413,7 @@ func torrentNameOk(detail *db.MediaDetails, tester NameTester) bool {
if detail.Extras.IsJav() && tester.IsAcceptable(detail.Extras.JavId) {
return true
}
return tester.IsAcceptable(detail.NameCn, detail.NameEn, detail.OriginalName)
names := names2Query(detail.Media)
return tester.IsAcceptable(names...)
}

View File

@@ -7,9 +7,11 @@ import (
"net/url"
"polaris/db"
"polaris/log"
"polaris/pkg/cache"
"polaris/pkg/tmdb"
"polaris/server/core"
"polaris/ui"
"time"
ginzap "github.com/gin-contrib/zap"
@@ -22,20 +24,24 @@ import (
func NewServer(db *db.Client) *Server {
r := gin.Default()
s := &Server{
r: r,
db: db,
language: db.GetLanguage(),
r: r,
db: db,
language: db.GetLanguage(),
monitorNumCache: cache.NewCache[int, int](10 * time.Minute),
downloadNumCache: cache.NewCache[int, int](10 * time.Minute),
}
s.core = core.NewClient(db, s.language)
return s
}
type Server struct {
r *gin.Engine
db *db.Client
core *core.Client
language string
jwtSerect string
r *gin.Engine
db *db.Client
core *core.Client
language string
jwtSerect string
monitorNumCache *cache.Cache[int, int]
downloadNumCache *cache.Cache[int, int]
}
func (s *Server) Serve() error {
@@ -72,6 +78,8 @@ func (s *Server) Serve() error {
setting.POST("/cron/trigger", HttpHandler(s.TriggerCronJob))
setting.GET("/prowlarr", HttpHandler(s.GetProwlarrSetting))
setting.POST("/prowlarr", HttpHandler(s.SaveProwlarrSetting))
setting.GET("/limiter", HttpHandler(s.GetSizeLimiter))
setting.POST("/limiter", HttpHandler(s.SetSizeLimiter))
}
activity := api.Group("/activity")
{

View File

@@ -1,14 +1,12 @@
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"
@@ -104,7 +102,6 @@ func (s *Server) SetSetting(c *gin.Context) (interface{}, error) {
return nil, nil
}
func (s *Server) GetSetting(c *gin.Context) (interface{}, error) {
tmdb := s.db.GetSetting(db.SettingTmdbApiKey)
downloadDir := s.db.GetSetting(db.SettingDownloadDir)
@@ -147,29 +144,25 @@ 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 ")
}
@@ -184,12 +177,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.DeleteTorznab(id)
s.db.DeleteIndexer(id)
return "success", nil
}
func (s *Server) GetAllIndexers(c *gin.Context) (interface{}, error) {
indexers := s.db.GetAllTorznabInfo()
indexers := s.db.GetAllIndexers()
if len(indexers) == 0 {
return nil, nil
}
@@ -306,7 +299,7 @@ func (s *Server) TriggerCronJob(c *gin.Context) (interface{}, error) {
}
func (s *Server) GetProwlarrSetting(c *gin.Context) (interface{}, error) {
se, err :=s.db.GetProwlarrSetting()
se, err := s.db.GetProwlarrSetting()
if err != nil {
return &db.ProwlarrSetting{}, nil
}
@@ -317,11 +310,16 @@ func (s *Server) SaveProwlarrSetting(c *gin.Context) (interface{}, error) {
if err := c.ShouldBindJSON(&in); err != nil {
return nil, err
}
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")
}
if in.Disabled {
if err := s.core.DeleteAllProwlarrIndexers(); err != nil {
return nil, errors.Wrap(err, "delete prowlarr indexers")
}
} 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 {
@@ -329,3 +327,38 @@ func (s *Server) SaveProwlarrSetting(c *gin.Context) (interface{}, error) {
}
return "success", nil
}
type ResolutionSizeLimiter struct {
TvLimiter *db.MediaSizeLimiter `json:"tv_limiter"`
MovieLimiter *db.MediaSizeLimiter `json:"movie_limiter"`
}
func (s *Server) GetSizeLimiter(c *gin.Context) (interface{}, error) {
tv, err := s.db.GetSizeLimiter("tv")
if err != nil {
return nil, errors.Wrap(err, "db")
}
movie, err := s.db.GetSizeLimiter("movie")
if err != nil {
return nil, errors.Wrap(err, "db")
}
r := ResolutionSizeLimiter{
TvLimiter: tv,
MovieLimiter: movie,
}
return r, nil
}
func (s *Server) SetSizeLimiter(c *gin.Context) (interface{}, error) {
var in ResolutionSizeLimiter
if err := c.ShouldBindJSON(&in); err != nil {
return nil, err
}
if err := s.db.SetSizeLimiter("tv", in.TvLimiter); err != nil {
return nil, errors.Wrap(err, "db")
}
if err := s.db.SetSizeLimiter("movie", in.MovieLimiter); err != nil {
return nil, errors.Wrap(err, "db")
}
return "success", nil
}

View File

@@ -30,7 +30,7 @@ func (s *Server) AddStorage(c *gin.Context) (interface{}, error) {
if in.Implementation == "webdav" {
//test webdav
wd := in.ToWebDavSetting()
st, err := storage.NewWebdavStorage(wd.URL, wd.User, wd.Password, in.TvPath, false)
st, err := storage.NewWebdavStorage(wd.URL, wd.User, wd.Password, in.TvPath, false, nil, nil)
if err != nil {
return nil, errors.Wrap(err, "new webdav")
}
@@ -43,7 +43,7 @@ func (s *Server) AddStorage(c *gin.Context) (interface{}, error) {
}
} else if in.Implementation == "alist" {
cfg := in.ToAlistSetting()
_, err := storage.NewAlist(&alist.Config{URL: cfg.URL, Username: cfg.User, Password: cfg.Password}, in.TvPath)
_, err := storage.NewAlist(&alist.Config{URL: cfg.URL, Username: cfg.User, Password: cfg.Password}, in.TvPath, nil, nil)
if err != nil {
return nil, errors.Wrap(err, "alist")
}

View File

@@ -10,6 +10,7 @@ import (
"polaris/log"
"polaris/server/core"
"strconv"
"strings"
"github.com/gin-gonic/gin"
"github.com/pkg/errors"
@@ -102,17 +103,25 @@ func (s *Server) GetTvWatchlist(c *gin.Context) (interface{}, error) {
MonitoredNum: 0,
DownloadedNum: 0,
}
details := s.db.GetMediaDetails(item.ID)
for _, ep := range details.Episodes {
if ep.Monitored {
ms.MonitoredNum++
if ep.Status == episode.StatusDownloaded {
ms.DownloadedNum++
mon, ok1 := s.monitorNumCache.Get(item.ID)
dow, ok2 := s.downloadNumCache.Get(item.ID)
if ok1 && ok2 {
ms.MonitoredNum = mon
ms.DownloadedNum = dow
} else {
details := s.db.GetMediaDetails(item.ID)
for _, ep := range details.Episodes {
if ep.Monitored {
ms.MonitoredNum++
if ep.Status == episode.StatusDownloaded {
ms.DownloadedNum++
}
}
}
s.monitorNumCache.Set(item.ID, ms.MonitoredNum)
s.downloadNumCache.Set(item.ID, ms.DownloadedNum)
}
res[i] = ms
}
return res, nil
@@ -162,9 +171,32 @@ func (s *Server) DeleteFromWatchlist(c *gin.Context) (interface{}, error) {
if err != nil {
return nil, errors.Wrap(err, "convert")
}
deleteFiles := c.Query("delete_files")
if strings.ToLower(deleteFiles) == "true" {
//will delete local media file
log.Infof("will delete local media files for %d", id)
m, err := s.db.GetMedia(id)
if err != nil {
log.Warnf("get media: %v", err)
} else {
st, err := s.core.GetStorage(m.StorageID, m.MediaType)
if err != nil {
log.Warnf("get storage error: %v", err)
} else {
if err := st.RemoveAll(m.TargetDir); err != nil {
log.Warnf("remove all : %v", err)
} else {
log.Infof("delete media files success: %v", m.TargetDir)
}
}
}
}
if err := s.db.DeleteMedia(id); err != nil {
return nil, errors.Wrap(err, "delete db")
}
os.RemoveAll(filepath.Join(db.ImgPath, ids)) //delete image related
return "success", nil
}

View File

@@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.
version:
revision: "80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819"
revision: "dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668"
channel: "stable"
project_type: app
@@ -13,11 +13,11 @@ project_type: app
migration:
platforms:
- platform: root
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
- platform: ios
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668
base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668
- platform: macos
create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668
base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668
# User provided section

View File

@@ -4,7 +4,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:ui/activity.dart';
import 'package:ui/calendar.dart';
import 'package:ui/init_wizard.dart';
import 'package:ui/login_page.dart';
import 'package:ui/movie_watchlist.dart';

View File

@@ -58,6 +58,8 @@ class APIs {
static final tvParseUrl = "$_baseUrl/api/v1/setting/parse/tv";
static final movieParseUrl = "$_baseUrl/api/v1/setting/parse/movie";
static final mediaSizeLimiterUrl = "$_baseUrl/api/v1/setting/limiter";
static const tmdbApiKey = "tmdb_api_key";
static const downloadDirKey = "download_dir";
@@ -131,7 +133,7 @@ class APIs {
if (sp.code != 0) {
throw sp.message;
}
return sp.data==null? []:sp.data as List<String>;
return sp.data == null ? [] : sp.data as List<String>;
}
static Future<List<String>> downloadAllMovies() async {
@@ -142,7 +144,7 @@ class APIs {
if (sp.code != 0) {
throw sp.message;
}
return sp.data==null? []:sp.data as List<String>;
return sp.data == null ? [] : sp.data as List<String>;
}
static Future<String> parseTvName(String s) async {

View File

@@ -25,9 +25,15 @@ var mediaHistoryDataProvider = FutureProvider.autoDispose.family(
class ActivityData
extends AutoDisposeFamilyAsyncNotifier<List<Activity>, String> {
Timer? _timer;
@override
FutureOr<List<Activity>> build(String arg) async {
final dio = await APIs.getDio();
if (_timer != null) {
_timer!.cancel();
}
final dio = APIs.getDio();
var resp =
await dio.get(APIs.activityUrl, queryParameters: {"status": arg});
final sp = ServerResponse.fromJson(resp.data);
@@ -41,7 +47,7 @@ class ActivityData
if (arg == "active") {
//refresh active downloads
Timer(const Duration(seconds: 5),
_timer = Timer(const Duration(seconds: 5),
() => ref.invalidateSelf()); //Periodically Refresh
}
return activities;
@@ -73,7 +79,8 @@ class Activity {
required this.saved,
required this.progress,
required this.size,
required this.seedRatio, required this.uploadProgress});
required this.seedRatio,
required this.uploadProgress});
final int? id;
final int? mediaId;
@@ -101,7 +108,6 @@ class Activity {
progress: json["progress"],
seedRatio: json["seed_ratio"],
size: json["size"],
uploadProgress: json["upload_progress"]
);
uploadProgress: json["upload_progress"]);
}
}

View File

@@ -24,9 +24,9 @@ class SeriesDetailData
return SeriesDetails.fromJson(rsp.data);
}
Future<void> delete() async {
final dio = await APIs.getDio();
var resp = await dio.delete("${APIs.seriesDetailUrl}$id");
Future<void> delete(bool removeFiles ) async {
final dio = APIs.getDio();
var resp = await dio.delete("${APIs.seriesDetailUrl}$id", queryParameters: {"delete_files": removeFiles});
var rsp = ServerResponse.fromJson(resp.data);
if (rsp.code != 0) {
throw rsp.message;

View File

@@ -161,6 +161,7 @@ class Indexer {
int? priority;
double? seedRatio;
bool? disabled;
bool? synced;
Indexer(
{this.name,
@@ -169,7 +170,8 @@ class Indexer {
this.id,
this.priority = 50,
this.seedRatio = 0,
this.disabled});
this.disabled,
this.synced});
Indexer.fromJson(Map<String, dynamic> json) {
name = json['name'];
@@ -179,6 +181,7 @@ 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>{};

View File

@@ -0,0 +1,109 @@
import 'dart:async';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:ui/providers/APIs.dart';
import 'package:ui/providers/server_response.dart';
var mediaSizeLimiterDataProvider =
AsyncNotifierProvider.autoDispose<MediaSizeLimiterData, MediaSizeLimiter>(
MediaSizeLimiterData.new);
class MediaSizeLimiterData extends AutoDisposeAsyncNotifier<MediaSizeLimiter> {
@override
FutureOr<MediaSizeLimiter> build() async {
final dio = APIs.getDio();
var resp = await dio.get(APIs.mediaSizeLimiterUrl);
var sp = ServerResponse.fromJson(resp.data);
if (sp.code != 0) {
throw sp.message;
}
return MediaSizeLimiter.fromJson(sp.data);
}
Future<void> submit(MediaSizeLimiter limiter) async {
final dio = APIs.getDio();
var resp = await dio.post(APIs.mediaSizeLimiterUrl, data: limiter.toJson());
var sp = ServerResponse.fromJson(resp.data);
if (sp.code != 0) {
throw sp.message;
}
ref.invalidateSelf();
}
}
class MediaSizeLimiter {
SizeLimiter? tvLimiter;
SizeLimiter? movieLimiter;
MediaSizeLimiter({this.tvLimiter, this.movieLimiter});
MediaSizeLimiter.fromJson(Map<String, dynamic> json) {
tvLimiter = json['tv_limiter'] != null
? SizeLimiter.fromJson(json['tv_limiter'])
: null;
movieLimiter = json['movie_limiter'] != null
? SizeLimiter.fromJson(json['movie_limiter'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (tvLimiter != null) {
data['tv_limiter'] = tvLimiter!.toJson();
}
if (movieLimiter != null) {
data['movie_limiter'] = movieLimiter!.toJson();
}
return data;
}
}
class SizeLimiter {
ResLimiter? p720p;
ResLimiter? p1080p;
ResLimiter? p2160p;
SizeLimiter({this.p720p, this.p1080p, this.p2160p});
SizeLimiter.fromJson(Map<String, dynamic> json) {
p720p = json['720p'] != null ? ResLimiter.fromJson(json['720p']) : null;
p1080p = json['1080p'] != null ? ResLimiter.fromJson(json['1080p']) : null;
p2160p = json['2160p'] != null ? ResLimiter.fromJson(json['2160p']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (p720p != null) {
data['720p'] = p720p!.toJson();
}
if (p1080p != null) {
data['1080p'] = p1080p!.toJson();
}
if (p2160p != null) {
data['2160p'] = p2160p!.toJson();
}
return data;
}
}
class ResLimiter {
int? maxSize;
int? minSize;
int? preferSize;
ResLimiter({this.maxSize, this.minSize, this.preferSize});
ResLimiter.fromJson(Map<String, dynamic> json) {
maxSize = json['max_size'];
minSize = json['min_size'];
preferSize = json['prefer_size'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['max_size'] = maxSize;
data['min_size'] = minSize;
data['prefer_size'] = preferSize;
return data;
}
}

View File

@@ -108,8 +108,8 @@ class SearchPageData
"resolution": resolution,
"folder": folder,
"download_history_episodes": downloadHistoryEpisodes,
"size_min": (limiter.start * 1000*1000).toInt(),
"size_max": (limiter.end * 1000*1000).toInt(),
"size_min": (limiter.start * 1000 * 1000).toInt(),
"size_max": (limiter.end * 1000 * 1000).toInt(),
});
var sp = ServerResponse.fromJson(resp.data);
if (sp.code != 0) {

View File

@@ -4,6 +4,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:quiver/strings.dart';
import 'package:ui/providers/settings.dart';
import 'package:ui/providers/size_limiter.dart';
import 'package:ui/settings/dialog.dart';
import 'package:ui/widgets/progress_indicator.dart';
import 'package:ui/widgets/widgets.dart';
@@ -22,20 +23,28 @@ class _DownloaderState extends ConsumerState<DownloaderSettings> {
@override
Widget build(BuildContext context) {
var downloadClients = ref.watch(dwonloadClientsProvider);
return downloadClients.when(
data: (value) => Wrap(
children: List.generate(value.length + 1, (i) {
if (i < value.length) {
var client = value[i];
return SettingsCard(
onTap: () => showDownloadClientDetails(client),
child: Text(client.name ?? ""));
}
return SettingsCard(
onTap: () => showSelections(), child: const Icon(Icons.add));
})),
error: (err, trace) => PoNetworkError(err: err),
loading: () => const MyProgressIndicator());
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
downloadClients.when(
data: (value) => Wrap(
children: List.generate(value.length + 1, (i) {
if (i < value.length) {
var client = value[i];
return SettingsCard(
onTap: () => showDownloadClientDetails(client),
child: Text(client.name ?? ""));
}
return SettingsCard(
onTap: () => showSelections(),
child: const Icon(Icons.add));
})),
error: (err, trace) => PoNetworkError(err: err),
loading: () => const MyProgressIndicator()),
Divider(),
getSizeLimiterWidget()
],
);
}
Future<void> showDownloadClientDetails(DownloadClient client) {
@@ -199,4 +208,160 @@ class _DownloaderState extends ConsumerState<DownloaderSettings> {
);
});
}
Widget getSizeLimiterWidget() {
var data = ref.watch(mediaSizeLimiterDataProvider);
final _formKey = GlobalKey<FormBuilderState>();
return Container(
padding: EdgeInsets.only(left: 20, right: 20, top: 20),
child: data.when(
data: (value) {
return FormBuilder(
key: _formKey,
initialValue: {
"tv_720p_min": toMbString(value.tvLimiter!.p720p!.minSize!),
"tv_720p_max": toMbString(value.tvLimiter!.p720p!.maxSize!),
"tv_1080p_min": toMbString(value.tvLimiter!.p1080p!.minSize!),
"tv_1080p_max": toMbString(value.tvLimiter!.p1080p!.maxSize!),
"tv_2160p_min": toMbString(value.tvLimiter!.p2160p!.minSize!),
"tv_2160p_max": toMbString(value.tvLimiter!.p2160p!.maxSize!),
"movie_720p_min":
toMbString(value.movieLimiter!.p720p!.minSize!),
"movie_720p_max":
toMbString(value.movieLimiter!.p720p!.maxSize!),
"movie_1080p_min":
toMbString(value.movieLimiter!.p1080p!.minSize!),
"movie_1080p_max":
toMbString(value.movieLimiter!.p1080p!.maxSize!),
"movie_2160p_min":
toMbString(value.movieLimiter!.p2160p!.minSize!),
"movie_2160p_max":
toMbString(value.movieLimiter!.p2160p!.maxSize!),
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"剧集大小限制",
style: TextStyle(fontSize: 18),
),
Divider(),
minMaxRow(" 720p", "tv_720p_min", "tv_720p_max"),
minMaxRow("1080p", "tv_1080p_min", "tv_1080p_max"),
minMaxRow("2160p", "tv_2160p_min", "tv_2160p_max"),
Text(
"电影大小限制",
style: TextStyle(fontSize: 18),
),
Divider(),
minMaxRow(" 720p", "movie_720p_min", "movie_720p_max"),
minMaxRow("1080p", "movie_1080p_min", "movie_1080p_max"),
minMaxRow("2160p", "movie_2160p_min", "movie_2160p_max"),
Center(
child: Padding(
padding: EdgeInsets.all(20),
child: LoadingElevatedButton(
onPressed: () async {
if (_formKey.currentState!.saveAndValidate()) {
var values = _formKey.currentState!.value;
return ref
.read(mediaSizeLimiterDataProvider.notifier)
.submit(MediaSizeLimiter(
tvLimiter: SizeLimiter(
p720p: ResLimiter(
minSize:
toByteInt(values["tv_720p_min"]),
maxSize:
toByteInt(values["tv_720p_max"])),
p1080p: ResLimiter(
minSize:
toByteInt(values["tv_1080p_min"]),
maxSize: toByteInt(
values["tv_1080p_max"])),
p2160p: ResLimiter(
minSize:
toByteInt(values["tv_2160p_min"]),
maxSize: toByteInt(
values["tv_2160p_max"])),
),
movieLimiter: SizeLimiter(
p720p: ResLimiter(
minSize: toByteInt(
values["movie_720p_min"]),
maxSize: toByteInt(
values["movie_720p_max"])),
p1080p: ResLimiter(
minSize: toByteInt(
values["movie_1080p_min"]),
maxSize: toByteInt(
values["movie_1080p_max"])),
p2160p: ResLimiter(
minSize: toByteInt(
values["movie_2160p_min"]),
maxSize: toByteInt(
values["movie_2160p_max"])),
)));
} else {
throw "validation_error";
}
},
label: Text("保存"),
),
),
)
],
),
);
},
error: (err, trace) => Container(),
loading: () => const MyProgressIndicator()),
);
}
Widget minMaxRow(String title, String nameMin, String nameMax) {
return Row(
children: [
Flexible(flex: 2, child: Container()),
Flexible(
flex: 2,
child: Text(
title,
style: TextStyle(fontSize: 16),
)),
Flexible(flex: 1, child: Container()),
Flexible(
flex: 6,
child: FormBuilderTextField(
name: nameMin,
decoration: InputDecoration(suffixText: "MB", labelText: "最小"),
validator: FormBuilderValidators.compose([
FormBuilderValidators.required(),
FormBuilderValidators.numeric()
]),
)),
Flexible(flex: 1, child: Text(" - ")),
Flexible(
flex: 6,
child: FormBuilderTextField(
name: nameMax,
decoration: InputDecoration(suffixText: "MB", labelText: "最大"),
validator: FormBuilderValidators.compose([
FormBuilderValidators.required(),
FormBuilderValidators.numeric()
]),
)),
Flexible(flex: 2, child: Container()),
],
);
}
}
String toMbString(int size) {
return (size / 1000 / 1000).toString();
}
int toByteInt(String s) {
return int.parse(s) * 1000 * 1000;
}

View File

@@ -5,6 +5,7 @@ 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 {
@@ -16,22 +17,112 @@ 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) => 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));
}),
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("保存"),
)),
),
)
],
),
),
error: (err, trace) => PoNetworkError(err: err),
loading: () => const MyProgressIndicator());
@@ -54,6 +145,7 @@ class _IndexerState extends ConsumerState<IndexerSettings> {
child: Column(
children: [
FormBuilderDropdown(
enabled: indexer.synced != true,
name: "impl",
decoration: const InputDecoration(labelText: "类型"),
items: const [
@@ -61,24 +153,28 @@ 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: "索引优先级",
@@ -88,6 +184,7 @@ class _IndexerState extends ConsumerState<IndexerSettings> {
validator: FormBuilderValidators.positiveNumber(),
),
FormBuilderTextField(
enabled: indexer.synced != true,
name: "seed_ratio",
decoration: const InputDecoration(
labelText: "做种率",
@@ -97,7 +194,10 @@ class _IndexerState extends ConsumerState<IndexerSettings> {
autovalidateMode: AutovalidateMode.onUserInteraction,
validator: FormBuilderValidators.numeric(),
),
FormBuilderSwitch(name: "disabled", title: const Text("禁用此索引器"))
FormBuilderSwitch(
enabled: indexer.synced != true,
name: "disabled",
title: const Text("禁用此索引器"))
],
),
);
@@ -122,6 +222,11 @@ class _IndexerState extends ConsumerState<IndexerSettings> {
}
return showSettingDialog(
context, "索引器", indexer.id != null, body, onSubmit, onDelete);
context,
indexer.synced != true?"索引器":"Prowlarr 索引器",
(indexer.id != null) && (indexer.synced != true),
body,
onSubmit,
onDelete);
}
}

View File

@@ -6,7 +6,6 @@ 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 {
@@ -27,7 +26,6 @@ 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()),

View File

@@ -44,14 +44,34 @@ class WelcomePageState extends ConsumerState<WelcomePage> {
children: [
() {
return data.when(
data: (value) => SingleChildScrollView(
child: Wrap(
alignment: WrapAlignment.start,
spacing: isSmallScreen(context) ? 0 : 10,
runSpacing: isSmallScreen(context) ? 10 : 20,
children: getMediaAll(value),
),
),
data: (value) {
if (value.isEmpty) {
return Container(
height: MediaQuery.of(context).size.height * 0.7,
alignment: Alignment.center,
child: const Text(
"啥都没有...",
style: TextStyle(fontSize: 16),
));
}
if (onlyShowUnfinished) {
value = value
.where((v) => v.downloadedNum != v.monitoredNum)
.toList();
}
return GridView.builder(
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: cardWidth(context) ,
childAspectRatio: 0.55,
mainAxisSpacing: isSmallScreen(context) ? 10 : 20,
crossAxisSpacing: isSmallScreen(context) ? 0 : 10),
itemCount: value.length,
itemBuilder: (context, index) =>
MediaCard(item: value[index]),
);
},
error: (err, trace) => PoNetworkError(err: err),
loading: () => const MyProgressIndicator());
}(),
@@ -152,28 +172,6 @@ class WelcomePageState extends ConsumerState<WelcomePage> {
final screenWidth = MediaQuery.of(context).size.width;
return screenWidth < 600;
}
List<Widget> getMediaAll(List<MediaDetail> list) {
if (list.isEmpty) {
return [
Container(
height: MediaQuery.of(context).size.height * 0.6,
alignment: Alignment.center,
child: const Text(
"啥都没有...",
style: TextStyle(fontSize: 16),
))
];
}
if (onlyShowUnfinished) {
list = list.where((v) => v.downloadedNum != v.monitoredNum).toList();
}
return List.generate(list.length, (i) {
final item = list[i];
return MediaCard(item: item);
});
}
Future<void> _showNameParsingDialog() async {
final resultController = TextEditingController();
return showDialog<void>(
@@ -243,8 +241,6 @@ class WelcomePageState extends ConsumerState<WelcomePage> {
class MediaCard extends StatelessWidget {
final MediaDetail item;
static const double smallWidth = 110;
static const double largeWidth = 140;
const MediaCard({super.key, required this.item});
@override
@@ -265,19 +261,18 @@ class MediaCard extends StatelessWidget {
context.go(TvDetailsPage.toRoute(item.id!));
}
},
child: Column(
child: LayoutBuilder(builder: (context, constraints) => Wrap(
direction: Axis.horizontal,
children: <Widget>[
Ink.image(
width: constraints.maxWidth,
height: constraints.maxWidth / 2 * 3,
fit: BoxFit.cover,
image: NetworkImage(
"${APIs.imagesUrl}/${item.id}/poster_w500.jpg",
)),
SizedBox(
width: cardWidth(context),
height: cardWidth(context) / 2 * 3,
child: Ink.image(
fit: BoxFit.cover,
image: NetworkImage(
"${APIs.imagesUrl}/${item.id}/poster.jpg",
)),
),
SizedBox(
width: cardWidth(context),
width: constraints.maxWidth,
child: Column(
children: [
LinearProgressIndicator(
@@ -297,15 +292,18 @@ class MediaCard extends StatelessWidget {
],
)),
],
),
)),
));
}
double cardWidth(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
if (screenWidth < 600) {
return smallWidth;
}
return largeWidth;
}
}
double cardWidth(BuildContext context) {
const double smallWidth = 110;
const double largeWidth = 140;
final screenWidth = MediaQuery.of(context).size.width;
if (screenWidth < 600) {
return smallWidth;
}
return largeWidth;
}

View File

@@ -193,13 +193,25 @@ class _DetailCardState extends ConsumerState<DetailCard> {
}
Future<void> showConfirmDialog(BuildContext oriContext) {
var deleteFiles = false;
return showDialog<void>(
context: context,
barrierDismissible: true,
builder: (BuildContext context) {
return AlertDialog(
title: const Text("确认删除"),
content: Text("${widget.details.name}"),
title: const Text("确认删除"),
content: StatefulBuilder(builder: (context, setState) {
return CheckboxListTile(
value: deleteFiles,
title: Text("删除媒体文件"),
onChanged: (v) {
setState(
() {
deleteFiles = v!;
},
);
});
}),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
@@ -209,7 +221,7 @@ class _DetailCardState extends ConsumerState<DetailCard> {
ref
.read(mediaDetailsProvider(widget.details.id.toString())
.notifier)
.delete()
.delete(deleteFiles)
.then((v) {
if (oriContext.mounted) {
oriContext.go(widget.details.mediaType == "tv"

View File

@@ -282,6 +282,52 @@ class _LoadingTextButtonState extends State<LoadingTextButton> {
}
}
class LoadingElevatedButton extends StatefulWidget {
const LoadingElevatedButton(
{super.key, required this.onPressed, required this.label});
final Future<void> Function() onPressed;
final Widget label;
@override
State<StatefulWidget> createState() {
return _LoadingElevatedButtonState();
}
}
class _LoadingElevatedButtonState extends State<LoadingElevatedButton> {
bool loading = false;
@override
Widget build(BuildContext context) {
return ElevatedButton.icon(
onPressed: loading
? null
: () async {
setState(() => loading = true);
try {
await widget.onPressed();
} catch (e) {
showSnakeBar("操作失败:$e");
} finally {
setState(() => loading = false);
}
},
icon: loading
? Container(
width: 24,
height: 24,
padding: const EdgeInsets.all(2.0),
child: const CircularProgressIndicator(
color: Colors.grey,
strokeWidth: 3,
),
)
: Text(""),
label: widget.label,
);
}
}
class PoError extends StatelessWidget {
const PoError({super.key, required this.msg, required this.err});
final String msg;
@@ -292,10 +338,16 @@ class PoError extends StatelessWidget {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("$msg ", style: TextStyle(color:Theme.of(context).colorScheme.error),),
Text(
"$msg ",
style: TextStyle(color: Theme.of(context).colorScheme.error),
),
Tooltip(
message: "$err",
child: Icon(Icons.info,color: Theme.of(context).colorScheme.error,),
child: Icon(
Icons.info,
color: Theme.of(context).colorScheme.error,
),
)
],
);
@@ -304,9 +356,30 @@ class PoError extends StatelessWidget {
class PoNetworkError extends StatelessWidget {
const PoNetworkError({super.key, required this.err});
final dynamic err;
final dynamic err;
@override
Widget build(BuildContext context) {
return PoError(msg: "网络错误,请检查网络链接", err: err);
}
}
class PoProgressIndicator extends StatelessWidget {
const PoProgressIndicator({super.key, this.backgroundColor, this.value, this.icon});
final double? value;
final Color? backgroundColor;
final IconData? icon;
@override
Widget build(BuildContext context) {
return Stack(
alignment: AlignmentDirectional.center,
children: [
CircularProgressIndicator(
backgroundColor: backgroundColor,
value: value,
),
icon != null ? Opacity(opacity: 0.7, child: Icon(icon, color: Theme.of(context).colorScheme.primary,),):Container()
],
);
}
}

7
ui/macos/.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
# Flutter-related
**/Flutter/ephemeral/
**/Pods/
# Xcode-related
**/dgph
**/xcuserdata/

View File

@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"

View File

@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"

View File

@@ -0,0 +1,12 @@
//
// Generated file. Do not edit.
//
import FlutterMacOS
import Foundation
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
}

43
ui/macos/Podfile Normal file
View File

@@ -0,0 +1,43 @@
platform :osx, '10.14'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_macos_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target)
end
end

22
ui/macos/Podfile.lock Normal file
View File

@@ -0,0 +1,22 @@
PODS:
- FlutterMacOS (1.0.0)
- url_launcher_macos (0.0.1):
- FlutterMacOS
DEPENDENCIES:
- FlutterMacOS (from `Flutter/ephemeral`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
EXTERNAL SOURCES:
FlutterMacOS:
:path: Flutter/ephemeral
url_launcher_macos:
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
url_launcher_macos: c82c93949963e55b228a30115bd219499a6fe404
PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367
COCOAPODS: 1.15.2

View File

@@ -0,0 +1,801 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objects = {
/* Begin PBXAggregateTarget section */
33CC111A2044C6BA0003C045 /* Flutter Assemble */ = {
isa = PBXAggregateTarget;
buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */;
buildPhases = (
33CC111E2044C6BF0003C045 /* ShellScript */,
);
dependencies = (
);
name = "Flutter Assemble";
productName = FLX;
};
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
1923000523C26F70A19C5B17 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EAAFECE3C7921C6460954E3D /* Pods_RunnerTests.framework */; };
331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; };
335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; };
33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; };
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
465BCE0EA17751098AAEB5E0 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 338C847C60E19B48128A7DBB /* Pods_Runner.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 33CC10E52044A3C60003C045 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 33CC10EC2044A3C60003C045;
remoteInfo = Runner;
};
33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 33CC10E52044A3C60003C045 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 33CC111A2044C6BA0003C045;
remoteInfo = FLX;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
33CC110E2044A8840003C045 /* Bundle Framework */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Bundle Framework";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
338C847C60E19B48128A7DBB /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
33CC10ED2044A3C60003C045 /* ui.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ui.app; sourceTree = BUILT_PRODUCTS_DIR; };
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = "<group>"; };
33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = "<group>"; };
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = "<group>"; };
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = "<group>"; };
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = "<group>"; };
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
479C447F60C752B08C7F2A48 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
49BC4AE8CB23ABB9DF839C61 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
864A824B0E9687E6B7C26662 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
AE69DDBE6A2D973F2DDE4773 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
EAAFECE3C7921C6460954E3D /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
EC6DB94E6F2EE2EBF7D7A8D3 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
F04941AF3F4D22EC07E9EC57 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
331C80D2294CF70F00263BE5 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1923000523C26F70A19C5B17 /* Pods_RunnerTests.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
33CC10EA2044A3C60003C045 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
465BCE0EA17751098AAEB5E0 /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
331C80D6294CF71000263BE5 /* RunnerTests */ = {
isa = PBXGroup;
children = (
331C80D7294CF71000263BE5 /* RunnerTests.swift */,
);
path = RunnerTests;
sourceTree = "<group>";
};
33BA886A226E78AF003329D5 /* Configs */ = {
isa = PBXGroup;
children = (
33E5194F232828860026EE4D /* AppInfo.xcconfig */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
333000ED22D3DE5D00554162 /* Warnings.xcconfig */,
);
path = Configs;
sourceTree = "<group>";
};
33CC10E42044A3C60003C045 = {
isa = PBXGroup;
children = (
33FAB671232836740065AC1E /* Runner */,
33CEB47122A05771004F2AC0 /* Flutter */,
331C80D6294CF71000263BE5 /* RunnerTests */,
33CC10EE2044A3C60003C045 /* Products */,
D73912EC22F37F3D000D13A0 /* Frameworks */,
8E8421BAD07F4A7F642628C0 /* Pods */,
);
sourceTree = "<group>";
};
33CC10EE2044A3C60003C045 /* Products */ = {
isa = PBXGroup;
children = (
33CC10ED2044A3C60003C045 /* ui.app */,
331C80D5294CF71000263BE5 /* RunnerTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
33CC11242044D66E0003C045 /* Resources */ = {
isa = PBXGroup;
children = (
33CC10F22044A3C60003C045 /* Assets.xcassets */,
33CC10F42044A3C60003C045 /* MainMenu.xib */,
33CC10F72044A3C60003C045 /* Info.plist */,
);
name = Resources;
path = ..;
sourceTree = "<group>";
};
33CEB47122A05771004F2AC0 /* Flutter */ = {
isa = PBXGroup;
children = (
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */,
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */,
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */,
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */,
);
path = Flutter;
sourceTree = "<group>";
};
33FAB671232836740065AC1E /* Runner */ = {
isa = PBXGroup;
children = (
33CC10F02044A3C60003C045 /* AppDelegate.swift */,
33CC11122044BFA00003C045 /* MainFlutterWindow.swift */,
33E51913231747F40026EE4D /* DebugProfile.entitlements */,
33E51914231749380026EE4D /* Release.entitlements */,
33CC11242044D66E0003C045 /* Resources */,
33BA886A226E78AF003329D5 /* Configs */,
);
path = Runner;
sourceTree = "<group>";
};
8E8421BAD07F4A7F642628C0 /* Pods */ = {
isa = PBXGroup;
children = (
EC6DB94E6F2EE2EBF7D7A8D3 /* Pods-Runner.debug.xcconfig */,
F04941AF3F4D22EC07E9EC57 /* Pods-Runner.release.xcconfig */,
864A824B0E9687E6B7C26662 /* Pods-Runner.profile.xcconfig */,
479C447F60C752B08C7F2A48 /* Pods-RunnerTests.debug.xcconfig */,
49BC4AE8CB23ABB9DF839C61 /* Pods-RunnerTests.release.xcconfig */,
AE69DDBE6A2D973F2DDE4773 /* Pods-RunnerTests.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
D73912EC22F37F3D000D13A0 /* Frameworks */ = {
isa = PBXGroup;
children = (
338C847C60E19B48128A7DBB /* Pods_Runner.framework */,
EAAFECE3C7921C6460954E3D /* Pods_RunnerTests.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
331C80D4294CF70F00263BE5 /* RunnerTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
buildPhases = (
46368FA552F764B76BC73E54 /* [CP] Check Pods Manifest.lock */,
331C80D1294CF70F00263BE5 /* Sources */,
331C80D2294CF70F00263BE5 /* Frameworks */,
331C80D3294CF70F00263BE5 /* Resources */,
);
buildRules = (
);
dependencies = (
331C80DA294CF71000263BE5 /* PBXTargetDependency */,
);
name = RunnerTests;
productName = RunnerTests;
productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
33CC10EC2044A3C60003C045 /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
EC8714E8A2401D3E05CE5A6C /* [CP] Check Pods Manifest.lock */,
33CC10E92044A3C60003C045 /* Sources */,
33CC10EA2044A3C60003C045 /* Frameworks */,
33CC10EB2044A3C60003C045 /* Resources */,
33CC110E2044A8840003C045 /* Bundle Framework */,
3399D490228B24CF009A79C7 /* ShellScript */,
C724001738DB1B5869C33FBB /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
dependencies = (
33CC11202044C79F0003C045 /* PBXTargetDependency */,
);
name = Runner;
productName = Runner;
productReference = 33CC10ED2044A3C60003C045 /* ui.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
33CC10E52044A3C60003C045 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
331C80D4294CF70F00263BE5 = {
CreatedOnToolsVersion = 14.0;
TestTargetID = 33CC10EC2044A3C60003C045;
};
33CC10EC2044A3C60003C045 = {
CreatedOnToolsVersion = 9.2;
LastSwiftMigration = 1100;
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.Sandbox = {
enabled = 1;
};
};
};
33CC111A2044C6BA0003C045 = {
CreatedOnToolsVersion = 9.2;
ProvisioningStyle = Manual;
};
};
};
buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 33CC10E42044A3C60003C045;
productRefGroup = 33CC10EE2044A3C60003C045 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
33CC10EC2044A3C60003C045 /* Runner */,
331C80D4294CF70F00263BE5 /* RunnerTests */,
33CC111A2044C6BA0003C045 /* Flutter Assemble */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
331C80D3294CF70F00263BE5 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
33CC10EB2044A3C60003C045 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */,
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
3399D490228B24CF009A79C7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n";
};
33CC111E2044C6BF0003C045 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
Flutter/ephemeral/FlutterInputs.xcfilelist,
);
inputPaths = (
Flutter/ephemeral/tripwire,
);
outputFileListPaths = (
Flutter/ephemeral/FlutterOutputs.xcfilelist,
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
};
46368FA552F764B76BC73E54 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
C724001738DB1B5869C33FBB /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
EC8714E8A2401D3E05CE5A6C /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
331C80D1294CF70F00263BE5 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
33CC10E92044A3C60003C045 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */,
33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */,
335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
331C80DA294CF71000263BE5 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 33CC10EC2044A3C60003C045 /* Runner */;
targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */;
};
33CC11202044C79F0003C045 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */;
targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
33CC10F42044A3C60003C045 /* MainMenu.xib */ = {
isa = PBXVariantGroup;
children = (
33CC10F52044A3C60003C045 /* Base */,
);
name = MainMenu.xib;
path = Runner;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
331C80DB294CF71000263BE5 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 479C447F60C752B08C7F2A48 /* Pods-RunnerTests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.ui.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ui.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/ui";
};
name = Debug;
};
331C80DC294CF71000263BE5 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 49BC4AE8CB23ABB9DF839C61 /* Pods-RunnerTests.release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.ui.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ui.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/ui";
};
name = Release;
};
331C80DD294CF71000263BE5 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = AE69DDBE6A2D973F2DDE4773 /* Pods-RunnerTests.profile.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.ui.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ui.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/ui";
};
name = Profile;
};
338D0CE9231458BD00FA5F75 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
name = Profile;
};
338D0CEA231458BD00FA5F75 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
};
name = Profile;
};
338D0CEB231458BD00FA5F75 /* Profile */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Manual;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Profile;
};
33CC10F92044A3C60003C045 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
33CC10FA2044A3C60003C045 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
name = Release;
};
33CC10FC2044A3C60003C045 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
33CC10FD2044A3C60003C045 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
};
name = Release;
};
33CC111C2044C6BA0003C045 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Manual;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
33CC111D2044C6BA0003C045 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
331C80DB294CF71000263BE5 /* Debug */,
331C80DC294CF71000263BE5 /* Release */,
331C80DD294CF71000263BE5 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
33CC10F92044A3C60003C045 /* Debug */,
33CC10FA2044A3C60003C045 /* Release */,
338D0CE9231458BD00FA5F75 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
33CC10FC2044A3C60003C045 /* Debug */,
33CC10FD2044A3C60003C045 /* Release */,
338D0CEA231458BD00FA5F75 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = {
isa = XCConfigurationList;
buildConfigurations = (
33CC111C2044C6BA0003C045 /* Debug */,
33CC111D2044C6BA0003C045 /* Release */,
338D0CEB231458BD00FA5F75 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 33CC10E52044A3C60003C045 /* Project object */;
}

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "ui.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "ui.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "331C80D4294CF70F00263BE5"
BuildableName = "RunnerTests.xctest"
BlueprintName = "RunnerTests"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "ui.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "ui.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,9 @@
import Cocoa
import FlutterMacOS
@main
class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}
}

View File

@@ -0,0 +1,68 @@
{
"images" : [
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "app_icon_16.png",
"scale" : "1x"
},
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "app_icon_32.png",
"scale" : "2x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "app_icon_32.png",
"scale" : "1x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "app_icon_64.png",
"scale" : "2x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "app_icon_128.png",
"scale" : "1x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "app_icon_256.png",
"scale" : "2x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "app_icon_256.png",
"scale" : "1x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "app_icon_512.png",
"scale" : "2x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "app_icon_512.png",
"scale" : "1x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "app_icon_1024.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -0,0 +1,343 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
<connections>
<outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="Runner" customModuleProvider="target">
<connections>
<outlet property="applicationMenu" destination="uQy-DD-JDr" id="XBo-yE-nKs"/>
<outlet property="mainFlutterWindow" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
</connections>
</customObject>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
<items>
<menuItem title="APP_NAME" id="1Xt-HY-uBw">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="APP_NAME" systemMenu="apple" id="uQy-DD-JDr">
<items>
<menuItem title="About APP_NAME" id="5kV-Vb-QxS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
<menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
<menuItem title="Services" id="NMo-om-nkz">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
<menuItem title="Hide APP_NAME" keyEquivalent="h" id="Olw-nP-bQN">
<connections>
<action selector="hide:" target="-1" id="PnN-Uc-m68"/>
</connections>
</menuItem>
<menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
</connections>
</menuItem>
<menuItem title="Show All" id="Kd2-mp-pUS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
<menuItem title="Quit APP_NAME" keyEquivalent="q" id="4sb-4s-VLi">
<connections>
<action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Edit" id="5QF-Oa-p0T">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Edit" id="W48-6f-4Dl">
<items>
<menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
<connections>
<action selector="undo:" target="-1" id="M6e-cu-g7V"/>
</connections>
</menuItem>
<menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
<connections>
<action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
<menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
<connections>
<action selector="cut:" target="-1" id="YJe-68-I9s"/>
</connections>
</menuItem>
<menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
<connections>
<action selector="copy:" target="-1" id="G1f-GL-Joy"/>
</connections>
</menuItem>
<menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
<connections>
<action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
</connections>
</menuItem>
<menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/>
</connections>
</menuItem>
<menuItem title="Delete" id="pa3-QI-u2k">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
</connections>
</menuItem>
<menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
<connections>
<action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
<menuItem title="Find" id="4EN-yA-p0u">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Find" id="1b7-l0-nxx">
<items>
<menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
<connections>
<action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/>
</connections>
</menuItem>
<menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/>
</connections>
</menuItem>
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
<connections>
<action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/>
</connections>
</menuItem>
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
<connections>
<action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/>
</connections>
</menuItem>
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
<connections>
<action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/>
</connections>
</menuItem>
<menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
<connections>
<action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
<items>
<menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
<connections>
<action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/>
</connections>
</menuItem>
<menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
<connections>
<action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
<menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/>
</connections>
</menuItem>
<menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/>
</connections>
</menuItem>
<menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Substitutions" id="9ic-FL-obx">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
<items>
<menuItem title="Show Substitutions" id="z6F-FW-3nz">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
<menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/>
</connections>
</menuItem>
<menuItem title="Smart Quotes" id="hQb-2v-fYv">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/>
</connections>
</menuItem>
<menuItem title="Smart Dashes" id="rgM-f4-ycn">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/>
</connections>
</menuItem>
<menuItem title="Smart Links" id="cwL-P1-jid">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/>
</connections>
</menuItem>
<menuItem title="Data Detectors" id="tRr-pd-1PS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/>
</connections>
</menuItem>
<menuItem title="Text Replacement" id="HFQ-gK-NFA">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Transformations" id="2oI-Rn-ZJC">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Transformations" id="c8a-y6-VQd">
<items>
<menuItem title="Make Upper Case" id="vmV-6d-7jI">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/>
</connections>
</menuItem>
<menuItem title="Make Lower Case" id="d9M-CD-aMd">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/>
</connections>
</menuItem>
<menuItem title="Capitalize" id="UEZ-Bs-lqG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Speech" id="xrE-MZ-jX0">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Speech" id="3rS-ZA-NoH">
<items>
<menuItem title="Start Speaking" id="Ynk-f8-cLZ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/>
</connections>
</menuItem>
<menuItem title="Stop Speaking" id="Oyz-dy-DGm">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="View" id="H8h-7b-M4v">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="View" id="HyV-fh-RgO">
<items>
<menuItem title="Enter Full Screen" keyEquivalent="f" id="4J7-dP-txa">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="toggleFullScreen:" target="-1" id="dU3-MA-1Rq"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Window" id="aUF-d1-5bR">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
<items>
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
<connections>
<action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
</connections>
</menuItem>
<menuItem title="Zoom" id="R4o-n2-Eq4">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Help" id="EPT-qC-fAb">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Help" systemMenu="help" id="rJ0-wn-3NY"/>
</menuItem>
</items>
<point key="canvasLocation" x="142" y="-258"/>
</menu>
<window title="APP_NAME" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="MainFlutterWindow" customModule="Runner" customModuleProvider="target">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<rect key="contentRect" x="335" y="390" width="800" height="600"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1577"/>
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="800" height="600"/>
<autoresizingMask key="autoresizingMask"/>
</view>
</window>
</objects>
</document>

View File

@@ -0,0 +1,14 @@
// Application-level settings for the Runner target.
//
// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
// future. If not, the values below would default to using the project name when this becomes a
// 'flutter create' template.
// The application's name. By default this is also the title of the Flutter window.
PRODUCT_NAME = ui
// The application's bundle identifier
PRODUCT_BUNDLE_IDENTIFIER = com.example.ui
// The copyright displayed in application information
PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved.

View File

@@ -0,0 +1,2 @@
#include "../../Flutter/Flutter-Debug.xcconfig"
#include "Warnings.xcconfig"

View File

@@ -0,0 +1,2 @@
#include "../../Flutter/Flutter-Release.xcconfig"
#include "Warnings.xcconfig"

View File

@@ -0,0 +1,13 @@
WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
GCC_WARN_UNDECLARED_SELECTOR = YES
CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
CLANG_WARN_PRAGMA_PACK = YES
CLANG_WARN_STRICT_PROTOTYPES = YES
CLANG_WARN_COMMA = YES
GCC_WARN_STRICT_SELECTOR_MATCH = YES
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
GCC_WARN_SHADOW = YES
CLANG_WARN_UNREACHABLE_CODE = YES

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>$(PRODUCT_COPYRIGHT)</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

View File

@@ -0,0 +1,15 @@
import Cocoa
import FlutterMacOS
class MainFlutterWindow: NSWindow {
override func awakeFromNib() {
let flutterViewController = FlutterViewController()
let windowFrame = self.frame
self.contentViewController = flutterViewController
self.setFrame(windowFrame, display: true)
RegisterGeneratedPlugins(registry: flutterViewController)
super.awakeFromNib()
}
}

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,12 @@
import Cocoa
import FlutterMacOS
import XCTest
class RunnerTests: XCTestCase {
func testExample() {
// If you add code to the Runner application, consider adding tests here.
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.
}
}

View File

@@ -53,10 +53,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.18.0"
version: "1.19.0"
cupertino_icons:
dependency: "direct main"
description:
@@ -217,18 +217,18 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06"
url: "https://pub.flutter-io.cn"
source: hosted
version: "10.0.5"
version: "10.0.7"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379"
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.5"
version: "3.0.8"
leak_tracker_testing:
dependency: transitive
description:
@@ -377,7 +377,7 @@ packages:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
version: "0.0.0"
source_span:
dependency: transitive
description:
@@ -390,10 +390,10 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.11.1"
version: "1.12.0"
state_notifier:
dependency: transitive
description:
@@ -414,10 +414,10 @@ packages:
dependency: transitive
description:
name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0"
version: "1.3.0"
table_calendar:
dependency: "direct main"
description:
@@ -438,10 +438,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.7.2"
version: "0.7.3"
timeago:
dependency: "direct main"
description:
@@ -534,10 +534,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b
url: "https://pub.flutter-io.cn"
source: hosted
version: "14.2.5"
version: "14.3.0"
web:
dependency: transitive
description: