mirror of
https://github.com/simon-ding/polaris.git
synced 2026-02-22 19:50:57 +08:00
Compare commits
58 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e9e85206e | ||
|
|
3babb9f5c7 | ||
|
|
c9928f10ce | ||
|
|
a2da1e7479 | ||
|
|
038f643ce3 | ||
|
|
cf2fa90d5d | ||
|
|
677923ea8a | ||
|
|
1192d00fe0 | ||
|
|
b317636a8a | ||
|
|
0e6465593b | ||
|
|
2cb8a5b6fb | ||
|
|
8b7bd1f6c6 | ||
|
|
1a9ba8a599 | ||
|
|
709d9ea4eb | ||
|
|
ed692b5aae | ||
|
|
f80ee71018 | ||
|
|
98fae05e16 | ||
|
|
f2faefa837 | ||
|
|
b281c6febb | ||
|
|
09862a2844 | ||
|
|
f77f565146 | ||
|
|
befd5c6a8a | ||
|
|
8376fef376 | ||
|
|
9b641fb593 | ||
|
|
9b0fb42043 | ||
|
|
bf2aeaa2d0 | ||
|
|
c52204619d | ||
|
|
485a580661 | ||
|
|
a22100b2fc | ||
|
|
1728690860 | ||
|
|
e0d0ab80b6 | ||
|
|
19f21ddd6e | ||
|
|
37ad1391db | ||
|
|
5daeca0bd9 | ||
|
|
7e4d907ef6 | ||
|
|
6527f843d8 | ||
|
|
f5ca53f7d7 | ||
|
|
7461918a6c | ||
|
|
3af5f96cb0 | ||
|
|
7dfa4eafc4 | ||
|
|
579b010d13 | ||
|
|
c42cbb5e5d | ||
|
|
6a5c105f8c | ||
|
|
e8067f96f1 | ||
|
|
84a0197776 | ||
|
|
f9556ec2d2 | ||
|
|
98d14befa9 | ||
|
|
6fcc569bf2 | ||
|
|
672e7f914d | ||
|
|
20bdcdbcde | ||
|
|
577a6cee1e | ||
|
|
4186d7d97f | ||
|
|
5d726dbcf1 | ||
|
|
ce25c090f5 | ||
|
|
2683c5dbf2 | ||
|
|
b717885270 | ||
|
|
4e457e99b9 | ||
|
|
ecfe31ea45 |
50
.github/workflows/goreleaser.yml
vendored
Normal file
50
.github/workflows/goreleaser.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
name: goreleaser
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- 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 --web-renderer html
|
||||
-
|
||||
name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '>=1.23.0'
|
||||
check-latest: true
|
||||
-
|
||||
name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
# either 'goreleaser' (default) or 'goreleaser-pro'
|
||||
distribution: goreleaser
|
||||
# 'latest', 'nightly', or a semver
|
||||
version: '~> v2'
|
||||
args: release --clean --skip=validate
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
|
||||
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -30,3 +30,5 @@ ui/dist/
|
||||
# Go workspace file
|
||||
go.work
|
||||
go.work.sum
|
||||
|
||||
dist/
|
||||
|
||||
51
.goreleaser.yaml
Normal file
51
.goreleaser.yaml
Normal file
@@ -0,0 +1,51 @@
|
||||
# This is an example .goreleaser.yml file with some sensible defaults.
|
||||
# Make sure to check the documentation at https://goreleaser.com
|
||||
|
||||
# The lines below are called `modelines`. See `:help modeline`
|
||||
# Feel free to remove those if you don't want/need to use them.
|
||||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
|
||||
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
|
||||
|
||||
version: 2
|
||||
|
||||
before:
|
||||
hooks:
|
||||
# You may remove this if you don't use go modules.
|
||||
- go mod tidy
|
||||
# you may remove this if you don't need go generate
|
||||
#- go generate ./...
|
||||
|
||||
builds:
|
||||
- env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
- linux
|
||||
- windows
|
||||
- darwin
|
||||
- freebsd
|
||||
main: ./cmd
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
|
||||
archives:
|
||||
- format: tar.gz
|
||||
# this name template makes the OS and Arch compatible with the results of `uname`.
|
||||
name_template: >-
|
||||
{{ .ProjectName }}_
|
||||
{{- title .Os }}_
|
||||
{{- if eq .Arch "amd64" }}x86_64
|
||||
{{- else if eq .Arch "386" }}i386
|
||||
{{- else }}{{ .Arch }}{{ end }}
|
||||
{{- if .Arm }}v{{ .Arm }}{{ end }}
|
||||
# use zip for windows archives
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- "^docs:"
|
||||
- "^test:"
|
||||
18
Dockerfile
18
Dockerfile
@@ -6,7 +6,7 @@ COPY ./ui/ ./
|
||||
RUN flutter build web --no-web-resources-cdn --web-renderer html
|
||||
|
||||
# 打包依赖阶段使用golang作为基础镜像
|
||||
FROM golang:1.22 as builder
|
||||
FROM golang:1.23 as builder
|
||||
|
||||
# 启用go module
|
||||
ENV GO111MODULE=on \
|
||||
@@ -22,19 +22,23 @@ COPY . .
|
||||
|
||||
COPY --from=flutter /app/build/web ./ui/build/web/
|
||||
# 指定OS等,并go build
|
||||
RUN CGO_ENABLED=1 go build -o polaris -ldflags="-X polaris/db.Version=$(git describe --tags --long)" ./cmd/
|
||||
RUN CGO_ENABLED=0 go build -o polaris -ldflags="-X polaris/db.Version=$(git describe --tags --long)" ./cmd/
|
||||
|
||||
FROM debian:stable-slim
|
||||
ENV TZ="Asia/Shanghai" GIN_MODE=release
|
||||
|
||||
WORKDIR /app
|
||||
RUN apt-get update && apt-get -y install ca-certificates
|
||||
RUN apt-get update && apt-get -y install ca-certificates tzdata gosu tini locales && ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \
|
||||
&& echo "${TZ}" > /etc/timezone && apt-get clean && sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
|
||||
|
||||
ENV TZ="Asia/Shanghai" GIN_MODE=release PUID=0 PGID=0 UMASK=0
|
||||
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
|
||||
|
||||
# 将上一个阶段publish文件夹下的所有文件复制进来
|
||||
COPY --from=builder /app/polaris .
|
||||
COPY --from=builder /app/entrypoint.sh .
|
||||
RUN chmod +x /app/entrypoint.sh
|
||||
|
||||
VOLUME /app/data
|
||||
EXPOSE 8080
|
||||
|
||||
#USER 1000:1000
|
||||
|
||||
ENTRYPOINT ["./polaris"]
|
||||
ENTRYPOINT ["tini","./entrypoint.sh"]
|
||||
47
README.md
47
README.md
@@ -1,4 +1,10 @@
|
||||
# Polaris
|
||||
|
||||

|
||||
|
||||
|
||||
<h1 align="center">Polaris</h1>
|
||||
|
||||
<div align="center">
|
||||
|
||||

|
||||

|
||||
@@ -6,17 +12,16 @@
|
||||

|
||||
|
||||
|
||||
Polaris 是一个电视剧和电影的追踪软件。配置好了之后,当剧集或者电影播出后,会第一时间下载对应的资源。支持本地存储或者webdav。
|
||||
**Polaris 是一个电视剧和电影的追踪下载软件。对动漫日剧美剧都有良好的匹配,支持webdav或者本地存储。**
|
||||
|
||||
</div>
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
交流群: https://t.me/+8R2nzrlSs2JhMDgx
|
||||
|
||||
## 快速开始
|
||||
|
||||
使用此程序参考 [【快速开始】](https://simonding.gitbook.io/polaris/quick_start)
|
||||
使用此程序参考 [【快速开始】](./doc/quick_start.md)
|
||||
|
||||
## Features
|
||||
|
||||
@@ -29,31 +34,43 @@ Polaris 是一个电视剧和电影的追踪软件。配置好了之后,当剧
|
||||
- [x] plex 刮削支持
|
||||
- [x] NFO 刮削文件支持
|
||||
- [x] BT/PT 支持
|
||||
- [x] qbittorrent/transmission客户端支持
|
||||
- [x] and more...
|
||||
|
||||
## Todos
|
||||
|
||||
- [ ] qbittorrent客户端支持
|
||||
|
||||
- [ ] 更多通知客户端支持
|
||||
- [ ] 第三方watchlist导入支持
|
||||
- [ ] 手机客户端
|
||||
|
||||
|
||||
## 原理
|
||||
## 截图
|
||||
|
||||
本程序不提供任何视频相关资源,所有的资源都通过 jackett/prowlarr 所对接的BT/PT站点提供。
|
||||
|
||||
1. 此程序通过调用 jackett/prowlarr API搜索相关资源,然后匹配上对应的剧集
|
||||
2. 把搜索到的资源送到下载器下载
|
||||
3. 下载完成后归入对应的路径
|
||||

|
||||

|
||||

|
||||
|
||||
## 对比 sonarr/radarr
|
||||
|
||||
## 运行原理
|
||||
|
||||
Polaris本身不提供任何资源,要使其能正常工作,需要同时安装一个下载客户端(transmission)和一个索引客户端(jackett)。
|
||||
|
||||
Polaris通过索引客户端查询相关的BT/PT站点,然后把查到的资源送到下载器,等待下载器下载完成对应资源。下载完成后,根据下载的对应资源,整理到对应的文件夹里去
|
||||
|
||||

|
||||
|
||||
<!-- ## 对比 sonarr/radarr
|
||||
* 更好的中文支持
|
||||
* 对于动漫、日剧的良好支持,配合国内站点基本能匹配上对应资源
|
||||
* 支持 webdav 后端存储,可以配合 alist 或者阿里云来实现下载后实时传到云上的功能。这样外出就可以不依靠家里的宽带来看电影了,或者实现个轻 NAS 功能,下载功能放在本地,数据放在云盘
|
||||
* golang 实现后端,相比于 .NET 更节省资源
|
||||
* 一个程序同时实现了电影、电视剧功能,不需要装两个程序
|
||||
* 当然 sonarr/radarr 也是非常优秀的开源项目,目前 Polaris 功能还没有 sonarr/radarr 丰富
|
||||
* 当然 sonarr/radarr 也是非常优秀的开源项目,目前 Polaris 功能还没有 sonarr/radarr 丰富 -->
|
||||
|
||||
|
||||
## Stargazers over time
|
||||
[](https://starchart.cc/simon-ding/polaris)
|
||||
|
||||
-------------
|
||||
|
||||
|
||||
12
cmd/main.go
12
cmd/main.go
@@ -3,20 +3,28 @@ package main
|
||||
import (
|
||||
"polaris/db"
|
||||
"polaris/log"
|
||||
"polaris/pkg/utils"
|
||||
"polaris/server"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.Infof("------------------- Starting Polaris ---------------------")
|
||||
|
||||
syscall.Umask(0) //max permission 0777
|
||||
//utils.MaxPermission()
|
||||
|
||||
dbClient, err := db.Open()
|
||||
if err != nil {
|
||||
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)
|
||||
}
|
||||
|
||||
}()
|
||||
s := server.NewServer(dbClient)
|
||||
if err := s.Serve(); err != nil {
|
||||
log.Errorf("server start error: %v", err)
|
||||
|
||||
@@ -17,6 +17,7 @@ const (
|
||||
SetttingSizeLimiter = "size_limiter"
|
||||
SettingTvNamingFormat = "tv_naming_format"
|
||||
SettingMovieNamingFormat = "movie_naming_format"
|
||||
SettingProwlarrInfo = "prowlarr_info"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -37,7 +38,7 @@ const (
|
||||
LanguageCN = "zh-CN"
|
||||
)
|
||||
|
||||
const DefaultNamingFormat = "{{.NameCN}} {{.NameEN}} ({{.Year}})"
|
||||
const DefaultNamingFormat = "{{.NameCN}} {{.NameEN}} {{if .Year}} ({{.Year}}) {{end}}"
|
||||
|
||||
type NamingInfo struct {
|
||||
NameCN string
|
||||
@@ -60,3 +61,8 @@ type Limiter struct {
|
||||
Max int `json:"max"`
|
||||
Min int `json:"min"`
|
||||
}
|
||||
|
||||
type ProwlarrSetting struct {
|
||||
ApiKey string `json:"api_key"`
|
||||
URL string `json:"url"`
|
||||
}
|
||||
|
||||
81
db/db.go
81
db/db.go
@@ -22,7 +22,8 @@ import (
|
||||
|
||||
"entgo.io/ent/dialect"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
_ "github.com/ncruces/go-sqlite3/driver"
|
||||
_ "github.com/ncruces/go-sqlite3/embed"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
@@ -65,9 +66,13 @@ func (c *Client) init() {
|
||||
log.Infof("set default log level")
|
||||
c.SetSetting(SettingLogLevel, "info")
|
||||
}
|
||||
if tr := c.GetTransmission(); tr == nil {
|
||||
if tr := c.GetAllDonloadClients(); len(tr) == 0 {
|
||||
log.Warnf("no download client, set default download client")
|
||||
c.SaveTransmission("transmission", "http://transmission:9091", "", "")
|
||||
c.SaveDownloader(&ent.DownloadClients{
|
||||
Name: "transmission",
|
||||
Implementation: downloadclients.ImplementationTransmission,
|
||||
URL: "http://transmission:9091",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +164,7 @@ func (c *Client) AddMediaWatchlist(m *ent.Media, episodes []int) (*ent.Media, er
|
||||
}
|
||||
|
||||
func (c *Client) GetMediaWatchlist(mediaType media.MediaType) []*ent.Media {
|
||||
list, err := c.ent.Media.Query().Where(media.MediaTypeEQ(mediaType)).All(context.TODO())
|
||||
list, err := c.ent.Media.Query().Where(media.MediaTypeEQ(mediaType)).Order(ent.Desc(media.FieldID)).All(context.TODO())
|
||||
if err != nil {
|
||||
log.Infof("query wtach list error: %v", err)
|
||||
return nil
|
||||
@@ -218,7 +223,10 @@ func (c *Client) DeleteMedia(id int) error {
|
||||
return err
|
||||
}
|
||||
_, err = c.ent.Media.Delete().Where(media.ID(id)).Exec(context.TODO())
|
||||
return err
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return c.CleanAllDanglingEpisodes()
|
||||
}
|
||||
|
||||
func (c *Client) SaveEposideDetail(d *ent.Episode) (int, error) {
|
||||
@@ -318,30 +326,21 @@ func (c *Client) GetAllTorznabInfo() []*TorznabInfo {
|
||||
return l
|
||||
}
|
||||
|
||||
func (c *Client) SaveTransmission(name, url, user, password string) error {
|
||||
count := c.ent.DownloadClients.Query().Where(downloadclients.Name(name)).CountX(context.TODO())
|
||||
func (c *Client) SaveDownloader(downloader *ent.DownloadClients) error {
|
||||
count := c.ent.DownloadClients.Query().Where(downloadclients.Name(downloader.Name)).CountX(context.TODO())
|
||||
if count != 0 {
|
||||
err := c.ent.DownloadClients.Update().Where(downloadclients.Name(name)).
|
||||
SetURL(url).SetUser(user).SetPassword(password).Exec(context.TODO())
|
||||
err := c.ent.DownloadClients.Update().Where(downloadclients.Name(downloader.Name)).SetImplementation(downloader.Implementation).
|
||||
SetURL(downloader.URL).SetUser(downloader.User).SetPassword(downloader.Password).SetPriority1(downloader.Priority1).Exec(context.TODO())
|
||||
return err
|
||||
}
|
||||
|
||||
_, err := c.ent.DownloadClients.Create().SetEnable(true).SetImplementation("transmission").
|
||||
SetName(name).SetURL(url).SetUser(user).SetPassword(password).Save(context.TODO())
|
||||
_, err := c.ent.DownloadClients.Create().SetEnable(true).SetImplementation(downloader.Implementation).
|
||||
SetName(downloader.Name).SetURL(downloader.URL).SetUser(downloader.User).SetPriority1(downloader.Priority1).SetPassword(downloader.Password).Save(context.TODO())
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *Client) GetTransmission() *ent.DownloadClients {
|
||||
dc, err := c.ent.DownloadClients.Query().Where(downloadclients.Implementation("transmission")).First(context.TODO())
|
||||
if err != nil {
|
||||
log.Errorf("no transmission client found: %v", err)
|
||||
return nil
|
||||
}
|
||||
return dc
|
||||
}
|
||||
|
||||
func (c *Client) GetAllDonloadClients() []*ent.DownloadClients {
|
||||
cc, err := c.ent.DownloadClients.Query().All(context.TODO())
|
||||
cc, err := c.ent.DownloadClients.Query().Order(ent.Asc(downloadclients.FieldPriority1)).All(context.TODO())
|
||||
if err != nil {
|
||||
log.Errorf("no download client")
|
||||
return nil
|
||||
@@ -474,9 +473,17 @@ func (c *Client) SetDefaultStorageByName(name string) error {
|
||||
}
|
||||
|
||||
func (c *Client) SaveHistoryRecord(h ent.History) (*ent.History, error) {
|
||||
if h.Link != "" {
|
||||
r, err := utils.Link2Magnet(h.Link)
|
||||
if err != nil {
|
||||
log.Warnf("convert link to magnet error, link %v, error: %v", h.Link, err)
|
||||
} else {
|
||||
h.Link = r
|
||||
}
|
||||
}
|
||||
return c.ent.History.Create().SetMediaID(h.MediaID).SetEpisodeID(h.EpisodeID).SetDate(time.Now()).
|
||||
SetStatus(h.Status).SetTargetDir(h.TargetDir).SetSourceTitle(h.SourceTitle).SetIndexerID(h.IndexerID).
|
||||
SetDownloadClientID(h.DownloadClientID).SetSize(h.Size).SetSaved(h.Saved).Save(context.TODO())
|
||||
SetDownloadClientID(h.DownloadClientID).SetSize(h.Size).SetSaved(h.Saved).SetLink(h.Link).Save(context.TODO())
|
||||
}
|
||||
|
||||
func (c *Client) SetHistoryStatus(id int, status history.Status) error {
|
||||
@@ -643,4 +650,34 @@ func (c *Client) GetMovingNamingFormat() string {
|
||||
return DefaultNamingFormat
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func (c *Client) CleanAllDanglingEpisodes() error {
|
||||
_, err := c.ent.Episode.Delete().Where(episode.Not(episode.HasMedia())).Exec(context.Background())
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *Client) AddBlacklistItem(item *ent.Blacklist) error {
|
||||
return c.ent.Blacklist.Create().SetType(item.Type).SetValue(item.Value).SetNotes(item.Notes).Exec(context.Background())
|
||||
}
|
||||
|
||||
|
||||
func (c *Client) GetProwlarrSetting() (*ProwlarrSetting, error) {
|
||||
s := c.GetSetting(SettingProwlarrInfo)
|
||||
if s == "" {
|
||||
return nil, errors.New("prowlarr setting not set")
|
||||
}
|
||||
var se ProwlarrSetting
|
||||
if err := json.Unmarshal([]byte(s), &se); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &se, nil
|
||||
}
|
||||
|
||||
func (c *Client) SaveProwlarrSetting(se *ProwlarrSetting) error {
|
||||
data, err := json.Marshal(se)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return c.SetSetting(SettingProwlarrInfo, string(data))
|
||||
}
|
||||
BIN
doc/assets/unraid.png
Normal file
BIN
doc/assets/unraid.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 206 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 74 KiB |
BIN
doc/assets/yuanli.png
Normal file
BIN
doc/assets/yuanli.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 170 KiB |
@@ -2,44 +2,28 @@
|
||||
|
||||
要正确使用此程序,需要配置好以下设置:
|
||||
|
||||
### TMDB设置
|
||||
### 1. TMDB设置
|
||||
|
||||
1. 因为此程序需要使用到 TMDB 的数据,使用此程序首先要申请一个 TMDB 的 Api Key. 申请教程请 google [tmdb api key申请](https://www.google.com/search?q=tmdb+api+key%E7%94%B3%E8%AF%B7)
|
||||
|
||||
2. 拿到 TMDB Api Key之后,请填到 *设置 -> 常规设置 -> TMDB Api Key里*
|
||||
|
||||
### 索引器
|
||||
**注意:** TMDB可能需要翻墙才能使用,参考 [TMDB 访问问题](./tmdb.md)
|
||||
|
||||
索引器是资源提供者,目前支持 torznab 协议,意味着 polarr 或者 jackett 都可以支持。请自行部署相关程序,或者使用的 docker compose 配置一起拉起
|
||||
### 2. 索引器
|
||||
|
||||
推荐使用 linuxserver 的镜像:https://docs.linuxserver.io/images/docker-jackett/
|
||||
使用配置页面索引器配置或者prowlarr设置,其中一个即可。
|
||||
|
||||
#### 索引器配置
|
||||
#### jackett配置参考 [jackett](./jackett.md)
|
||||
|
||||
索引器配置这里以 jackett 为例。使用默认 docker compose 配置拉起后以 http://< ip >:9117 可访问 jackett 的主页。
|
||||
#### prowlarr设置
|
||||
|
||||
1. 打开 jackett 主页后,点击页面上面的 Add indexer,会出现 BT/PT 站点列表,选择你需要的站点点击+号添加。如果是PT,请自行配置好相关配置
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
2. 添加后主页即会显示相应的BT/PT站点,点击 *Copy Torznab Feed* 即得到了我们需要的地址
|
||||
|
||||

|
||||
|
||||
3. 回到我们的主程序 Polaris 当中,点击 *设置 -> 索引器设置* -> 点击+号增加新的索引器,输入一个名称,拷贝我们第2步得到的地址到地址栏
|
||||
|
||||

|
||||
|
||||
4. 选相框中我们可以看到,还需要一个 API Key,我们回到 Jackett 中,在页面右上角,复制我们需要的 API Key:
|
||||

|
||||
|
||||
5. 恭喜!你已经成功完成了索引器配置。如需要更多的站点,请重复相同的操作完成配置
|
||||
1) 取得prowlarr的url和api key, api key在 *Prowlarr 设置 -> 通用 -> API 密钥* 处取得
|
||||
2) 对应参数填到 polaris程序,*设置->prowlarr设置*当中
|
||||
|
||||
### 下载器
|
||||
|
||||
资源下载器,目前可支持 tansmission,请配置好对应配置
|
||||
资源下载器,目前可支持 tansmission/qbittorrent,请配置好对应配置
|
||||
|
||||

|
||||
|
||||
|
||||
21
doc/jackett.md
Normal file
21
doc/jackett.md
Normal file
@@ -0,0 +1,21 @@
|
||||
## jackett 索引器配置
|
||||
|
||||
1. 打开 jackett 主页后,点击页面上面的 Add indexer,会出现 BT/PT 站点列表,选择你需要的站点点击+号添加。如果是PT,请自行配置好相关配置
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
2. 添加后主页即会显示相应的BT/PT站点,点击 *Copy Torznab Feed* 即得到了我们需要的地址
|
||||
|
||||

|
||||
|
||||
3. 回到我们的主程序 Polaris 当中,点击 *设置 -> 索引器设置* -> 点击+号增加新的索引器,输入一个名称,拷贝我们第2步得到的地址到地址栏
|
||||
|
||||

|
||||
|
||||
4. 选相框中我们可以看到,还需要一个 API Key,我们回到 Jackett 中,在页面右上角,复制我们需要的 API Key:
|
||||

|
||||
|
||||
5. 恭喜!你已经成功完成了索引器配置。如需要更多的站点,请重复相同的操作完成配置
|
||||
@@ -1,8 +1,81 @@
|
||||
## 快速开始
|
||||
# 快速开始
|
||||
|
||||
最简单部署 Polaris 的方式是使用 docker compose,Polaris要完整运行另外需要一个索引客户端和一个下载客户端。索引客户端支持 polarr 或 jackett,下载客户端目前只支持 transmission。
|
||||
## 1. 安装 Polaris
|
||||
|
||||
下面是一个示例 docker-compose 配置,为了简单起见,一起拉起了 transmission 和 jackett,你也可选择单独安装
|
||||
### 1.1 Docker Compose 方式安装
|
||||
|
||||
最简单使用本程序的方式是通过docker compose,下面内容保存成 docker-compose.yml,然后执行 docker compose up -d, 即可拉起程序。
|
||||
|
||||
```yaml
|
||||
services:
|
||||
polaris:
|
||||
image: ghcr.io/simon-ding/polaris:latest
|
||||
restart: always
|
||||
environment:
|
||||
- PUID=99
|
||||
- PGID=100
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- <配置文件路径>:/app/data #程序配置文件路径
|
||||
- <下载路径>:/downloads #下载路径,需要和下载客户端配置一致
|
||||
- <媒体文件路径>:/data #媒体数据存储路径,也可以启动自己配置webdav存储
|
||||
ports:
|
||||
- 8080:8080
|
||||
```
|
||||
|
||||
### 1.2 Docker 方式安装
|
||||
|
||||
也可以通过原始 docker 命令的方式安装 Polaris:
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
-v <配置文件路径>:/app/data \
|
||||
-v <下载路径>:/downloads \
|
||||
-v <媒体文件路径>:/data \
|
||||
-e PUID=99 \
|
||||
-e PGID=100 \
|
||||
-e TZ=Asia/Shanghai \
|
||||
-p 8080:8080 \
|
||||
--restart always \
|
||||
ghcr.io/simon-ding/polaris:latest
|
||||
```
|
||||
|
||||
### 1.3 Unraid 安装
|
||||
|
||||
参考下图进行配置
|
||||
|
||||

|
||||
|
||||
### 1.4 访问
|
||||
拉起之后访问 http://< ip >:8080 即可访问 Polaris 的主页:
|
||||
|
||||

|
||||
|
||||
|
||||
## 2. 安装下载客户端
|
||||
|
||||
Polaris 需要下载客户端的配合使用,目前支持 Transmission 和 Qbittorrent。推荐使用linuxserver镜像进行安装
|
||||
|
||||
* [linuxserver/transmission](https://docs.linuxserver.io/images/docker-transmission)
|
||||
|
||||
* [linuxserver/qbittorrent](https://docs.linuxserver.io/images/docker-qbittorrent/)
|
||||
|
||||
需要注意的是下载客户端内 /downloads 路径的映射地址要和 Polaris的/downloads路径映射保持一致。也就是说他俩都要映射到同一路径。
|
||||
|
||||
## 3. 安装 Jackett/Prowlarr
|
||||
|
||||
Polaris 如果要正常工作,还需要一个索引客户端的支持,目前支持jackett/prowlarr索引客户端。推荐使用prowlarr,设置更简单
|
||||
|
||||
安装方式见:
|
||||
|
||||
* [linuxserver/jackett](https://docs.linuxserver.io/images/docker-jackett/)
|
||||
* [linuxserver/prowlarr](https://docs.linuxserver.io/images/docker-prowlarr/)
|
||||
|
||||
|
||||
|
||||
## 4. 联合安装
|
||||
|
||||
如果觉得一个个安装麻烦,也可以使用下面docker compose文件,一键拉起所有组件
|
||||
|
||||
**注意:** transmission 的下载路径映射要和 polaris 保持一致,如果您不知道怎么做,请保持默认设置。
|
||||
|
||||
@@ -11,6 +84,10 @@ services:
|
||||
polaris:
|
||||
image: ghcr.io/simon-ding/polaris:latest
|
||||
restart: always
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- ./config/polaris:/app/data #程序配置文件路径
|
||||
- /downloads:/downloads #下载路径,需要和下载客户端配置一致
|
||||
@@ -43,27 +120,16 @@ services:
|
||||
restart: unless-stopped
|
||||
```
|
||||
|
||||
拉起之后访问 http://< ip >:8080 的形式访问
|
||||
复制上面文件保存成 docker-compose.yml 文件,然后执行下面命令
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
|
||||

|
||||
|
||||
## 配置
|
||||
## 5. 配置
|
||||
|
||||
详细配置请看 [配置篇](./configuration.md)
|
||||
|
||||
|
||||
## 开始使用
|
||||
|
||||
1. 完成配置之后,我们就可以在右上角的搜索按钮里输入我们想看的电影、电视剧。
|
||||

|
||||
|
||||
2. 找到对应电影电视剧后,点击加入想看列表
|
||||

|
||||
|
||||
3. 当电影有资源、或者电视剧有更新时,程序就会自动下载对应资源到指定的存储。对于剧集,您也可以进入剧集的详细页面,点击搜索按钮来自己搜索对应集的资源。
|
||||
|
||||
|
||||
到此,您已经基本掌握了此程序的使用方式,请尽情体验吧!
|
||||
|
||||
|
||||
|
||||
6
doc/tmdb.md
Normal file
6
doc/tmdb.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# TMDB 访问问题
|
||||
|
||||
由于国内特殊的网络环境,访问 tmdb 可能需要翻墙代理,有两种解决方案
|
||||
|
||||
1. 设置路由器全局代理,openwrt等第三方路由固件可以实现这个功能
|
||||
2. 使用程序代理功能,*常规->代理地址* 中设置,格式如 http://192.168.0.10:1080
|
||||
131
ent/blacklist.go
Normal file
131
ent/blacklist.go
Normal file
@@ -0,0 +1,131 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"polaris/ent/blacklist"
|
||||
"polaris/ent/schema"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// Blacklist is the model entity for the Blacklist schema.
|
||||
type Blacklist struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int `json:"id,omitempty"`
|
||||
// Type holds the value of the "type" field.
|
||||
Type blacklist.Type `json:"type,omitempty"`
|
||||
// Value holds the value of the "value" field.
|
||||
Value schema.BlacklistValue `json:"value,omitempty"`
|
||||
// Notes holds the value of the "notes" field.
|
||||
Notes string `json:"notes,omitempty"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Blacklist) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case blacklist.FieldValue:
|
||||
values[i] = new([]byte)
|
||||
case blacklist.FieldID:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case blacklist.FieldType, blacklist.FieldNotes:
|
||||
values[i] = new(sql.NullString)
|
||||
default:
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
}
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Blacklist fields.
|
||||
func (b *Blacklist) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case blacklist.FieldID:
|
||||
value, ok := values[i].(*sql.NullInt64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
b.ID = int(value.Int64)
|
||||
case blacklist.FieldType:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field type", values[i])
|
||||
} else if value.Valid {
|
||||
b.Type = blacklist.Type(value.String)
|
||||
}
|
||||
case blacklist.FieldValue:
|
||||
if value, ok := values[i].(*[]byte); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field value", values[i])
|
||||
} else if value != nil && len(*value) > 0 {
|
||||
if err := json.Unmarshal(*value, &b.Value); err != nil {
|
||||
return fmt.Errorf("unmarshal field value: %w", err)
|
||||
}
|
||||
}
|
||||
case blacklist.FieldNotes:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field notes", values[i])
|
||||
} else if value.Valid {
|
||||
b.Notes = value.String
|
||||
}
|
||||
default:
|
||||
b.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetValue returns the ent.Value that was dynamically selected and assigned to the Blacklist.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (b *Blacklist) GetValue(name string) (ent.Value, error) {
|
||||
return b.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this Blacklist.
|
||||
// Note that you need to call Blacklist.Unwrap() before calling this method if this Blacklist
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (b *Blacklist) Update() *BlacklistUpdateOne {
|
||||
return NewBlacklistClient(b.config).UpdateOne(b)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the Blacklist entity that was returned from a transaction after it was closed,
|
||||
// so that all future queries will be executed through the driver which created the transaction.
|
||||
func (b *Blacklist) Unwrap() *Blacklist {
|
||||
_tx, ok := b.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: Blacklist is not a transactional entity")
|
||||
}
|
||||
b.config.driver = _tx.drv
|
||||
return b
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (b *Blacklist) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("Blacklist(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", b.ID))
|
||||
builder.WriteString("type=")
|
||||
builder.WriteString(fmt.Sprintf("%v", b.Type))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("value=")
|
||||
builder.WriteString(fmt.Sprintf("%v", b.Value))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("notes=")
|
||||
builder.WriteString(b.Notes)
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// Blacklists is a parsable slice of Blacklist.
|
||||
type Blacklists []*Blacklist
|
||||
89
ent/blacklist/blacklist.go
Normal file
89
ent/blacklist/blacklist.go
Normal file
@@ -0,0 +1,89 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package blacklist
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"polaris/ent/schema"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the blacklist type in the database.
|
||||
Label = "blacklist"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldType holds the string denoting the type field in the database.
|
||||
FieldType = "type"
|
||||
// FieldValue holds the string denoting the value field in the database.
|
||||
FieldValue = "value"
|
||||
// FieldNotes holds the string denoting the notes field in the database.
|
||||
FieldNotes = "notes"
|
||||
// Table holds the table name of the blacklist in the database.
|
||||
Table = "blacklists"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for blacklist fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldType,
|
||||
FieldValue,
|
||||
FieldNotes,
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
func ValidColumn(column string) bool {
|
||||
for i := range Columns {
|
||||
if column == Columns[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var (
|
||||
// DefaultValue holds the default value on creation for the "value" field.
|
||||
DefaultValue schema.BlacklistValue
|
||||
)
|
||||
|
||||
// Type defines the type for the "type" enum field.
|
||||
type Type string
|
||||
|
||||
// Type values.
|
||||
const (
|
||||
TypeMedia Type = "media"
|
||||
TypeTorrent Type = "torrent"
|
||||
)
|
||||
|
||||
func (_type Type) String() string {
|
||||
return string(_type)
|
||||
}
|
||||
|
||||
// TypeValidator is a validator for the "type" field enum values. It is called by the builders before save.
|
||||
func TypeValidator(_type Type) error {
|
||||
switch _type {
|
||||
case TypeMedia, TypeTorrent:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("blacklist: invalid enum value for type field: %q", _type)
|
||||
}
|
||||
}
|
||||
|
||||
// OrderOption defines the ordering options for the Blacklist queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByType orders the results by the type field.
|
||||
func ByType(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldType, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByNotes orders the results by the notes field.
|
||||
func ByNotes(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldNotes, opts...).ToFunc()
|
||||
}
|
||||
169
ent/blacklist/where.go
Normal file
169
ent/blacklist/where.go
Normal file
@@ -0,0 +1,169 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package blacklist
|
||||
|
||||
import (
|
||||
"polaris/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...int) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...int) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// Notes applies equality check predicate on the "notes" field. It's identical to NotesEQ.
|
||||
func Notes(v string) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldEQ(FieldNotes, v))
|
||||
}
|
||||
|
||||
// TypeEQ applies the EQ predicate on the "type" field.
|
||||
func TypeEQ(v Type) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldEQ(FieldType, v))
|
||||
}
|
||||
|
||||
// TypeNEQ applies the NEQ predicate on the "type" field.
|
||||
func TypeNEQ(v Type) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldNEQ(FieldType, v))
|
||||
}
|
||||
|
||||
// TypeIn applies the In predicate on the "type" field.
|
||||
func TypeIn(vs ...Type) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldIn(FieldType, vs...))
|
||||
}
|
||||
|
||||
// TypeNotIn applies the NotIn predicate on the "type" field.
|
||||
func TypeNotIn(vs ...Type) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldNotIn(FieldType, vs...))
|
||||
}
|
||||
|
||||
// NotesEQ applies the EQ predicate on the "notes" field.
|
||||
func NotesEQ(v string) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldEQ(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesNEQ applies the NEQ predicate on the "notes" field.
|
||||
func NotesNEQ(v string) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldNEQ(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesIn applies the In predicate on the "notes" field.
|
||||
func NotesIn(vs ...string) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldIn(FieldNotes, vs...))
|
||||
}
|
||||
|
||||
// NotesNotIn applies the NotIn predicate on the "notes" field.
|
||||
func NotesNotIn(vs ...string) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldNotIn(FieldNotes, vs...))
|
||||
}
|
||||
|
||||
// NotesGT applies the GT predicate on the "notes" field.
|
||||
func NotesGT(v string) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldGT(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesGTE applies the GTE predicate on the "notes" field.
|
||||
func NotesGTE(v string) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldGTE(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesLT applies the LT predicate on the "notes" field.
|
||||
func NotesLT(v string) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldLT(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesLTE applies the LTE predicate on the "notes" field.
|
||||
func NotesLTE(v string) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldLTE(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesContains applies the Contains predicate on the "notes" field.
|
||||
func NotesContains(v string) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldContains(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesHasPrefix applies the HasPrefix predicate on the "notes" field.
|
||||
func NotesHasPrefix(v string) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldHasPrefix(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesHasSuffix applies the HasSuffix predicate on the "notes" field.
|
||||
func NotesHasSuffix(v string) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldHasSuffix(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesIsNil applies the IsNil predicate on the "notes" field.
|
||||
func NotesIsNil() predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldIsNull(FieldNotes))
|
||||
}
|
||||
|
||||
// NotesNotNil applies the NotNil predicate on the "notes" field.
|
||||
func NotesNotNil() predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldNotNull(FieldNotes))
|
||||
}
|
||||
|
||||
// NotesEqualFold applies the EqualFold predicate on the "notes" field.
|
||||
func NotesEqualFold(v string) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldEqualFold(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesContainsFold applies the ContainsFold predicate on the "notes" field.
|
||||
func NotesContainsFold(v string) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.FieldContainsFold(FieldNotes, v))
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.Blacklist) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.Blacklist) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.Blacklist) predicate.Blacklist {
|
||||
return predicate.Blacklist(sql.NotPredicates(p))
|
||||
}
|
||||
238
ent/blacklist_create.go
Normal file
238
ent/blacklist_create.go
Normal file
@@ -0,0 +1,238 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"polaris/ent/blacklist"
|
||||
"polaris/ent/schema"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// BlacklistCreate is the builder for creating a Blacklist entity.
|
||||
type BlacklistCreate struct {
|
||||
config
|
||||
mutation *BlacklistMutation
|
||||
hooks []Hook
|
||||
}
|
||||
|
||||
// SetType sets the "type" field.
|
||||
func (bc *BlacklistCreate) SetType(b blacklist.Type) *BlacklistCreate {
|
||||
bc.mutation.SetType(b)
|
||||
return bc
|
||||
}
|
||||
|
||||
// SetValue sets the "value" field.
|
||||
func (bc *BlacklistCreate) SetValue(sv schema.BlacklistValue) *BlacklistCreate {
|
||||
bc.mutation.SetValue(sv)
|
||||
return bc
|
||||
}
|
||||
|
||||
// SetNillableValue sets the "value" field if the given value is not nil.
|
||||
func (bc *BlacklistCreate) SetNillableValue(sv *schema.BlacklistValue) *BlacklistCreate {
|
||||
if sv != nil {
|
||||
bc.SetValue(*sv)
|
||||
}
|
||||
return bc
|
||||
}
|
||||
|
||||
// SetNotes sets the "notes" field.
|
||||
func (bc *BlacklistCreate) SetNotes(s string) *BlacklistCreate {
|
||||
bc.mutation.SetNotes(s)
|
||||
return bc
|
||||
}
|
||||
|
||||
// SetNillableNotes sets the "notes" field if the given value is not nil.
|
||||
func (bc *BlacklistCreate) SetNillableNotes(s *string) *BlacklistCreate {
|
||||
if s != nil {
|
||||
bc.SetNotes(*s)
|
||||
}
|
||||
return bc
|
||||
}
|
||||
|
||||
// Mutation returns the BlacklistMutation object of the builder.
|
||||
func (bc *BlacklistCreate) Mutation() *BlacklistMutation {
|
||||
return bc.mutation
|
||||
}
|
||||
|
||||
// Save creates the Blacklist in the database.
|
||||
func (bc *BlacklistCreate) Save(ctx context.Context) (*Blacklist, error) {
|
||||
bc.defaults()
|
||||
return withHooks(ctx, bc.sqlSave, bc.mutation, bc.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
func (bc *BlacklistCreate) SaveX(ctx context.Context) *Blacklist {
|
||||
v, err := bc.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (bc *BlacklistCreate) Exec(ctx context.Context) error {
|
||||
_, err := bc.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (bc *BlacklistCreate) ExecX(ctx context.Context) {
|
||||
if err := bc.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (bc *BlacklistCreate) defaults() {
|
||||
if _, ok := bc.mutation.Value(); !ok {
|
||||
v := blacklist.DefaultValue
|
||||
bc.mutation.SetValue(v)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (bc *BlacklistCreate) check() error {
|
||||
if _, ok := bc.mutation.GetType(); !ok {
|
||||
return &ValidationError{Name: "type", err: errors.New(`ent: missing required field "Blacklist.type"`)}
|
||||
}
|
||||
if v, ok := bc.mutation.GetType(); ok {
|
||||
if err := blacklist.TypeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "type", err: fmt.Errorf(`ent: validator failed for field "Blacklist.type": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := bc.mutation.Value(); !ok {
|
||||
return &ValidationError{Name: "value", err: errors.New(`ent: missing required field "Blacklist.value"`)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (bc *BlacklistCreate) sqlSave(ctx context.Context) (*Blacklist, error) {
|
||||
if err := bc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := bc.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, bc.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int(id)
|
||||
bc.mutation.id = &_node.ID
|
||||
bc.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (bc *BlacklistCreate) createSpec() (*Blacklist, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &Blacklist{config: bc.config}
|
||||
_spec = sqlgraph.NewCreateSpec(blacklist.Table, sqlgraph.NewFieldSpec(blacklist.FieldID, field.TypeInt))
|
||||
)
|
||||
if value, ok := bc.mutation.GetType(); ok {
|
||||
_spec.SetField(blacklist.FieldType, field.TypeEnum, value)
|
||||
_node.Type = value
|
||||
}
|
||||
if value, ok := bc.mutation.Value(); ok {
|
||||
_spec.SetField(blacklist.FieldValue, field.TypeJSON, value)
|
||||
_node.Value = value
|
||||
}
|
||||
if value, ok := bc.mutation.Notes(); ok {
|
||||
_spec.SetField(blacklist.FieldNotes, field.TypeString, value)
|
||||
_node.Notes = value
|
||||
}
|
||||
return _node, _spec
|
||||
}
|
||||
|
||||
// BlacklistCreateBulk is the builder for creating many Blacklist entities in bulk.
|
||||
type BlacklistCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*BlacklistCreate
|
||||
}
|
||||
|
||||
// Save creates the Blacklist entities in the database.
|
||||
func (bcb *BlacklistCreateBulk) Save(ctx context.Context) ([]*Blacklist, error) {
|
||||
if bcb.err != nil {
|
||||
return nil, bcb.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(bcb.builders))
|
||||
nodes := make([]*Blacklist, len(bcb.builders))
|
||||
mutators := make([]Mutator, len(bcb.builders))
|
||||
for i := range bcb.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := bcb.builders[i]
|
||||
builder.defaults()
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*BlacklistMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err := builder.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, bcb.builders[i+1].mutation)
|
||||
} else {
|
||||
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, bcb.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &nodes[i].ID
|
||||
if specs[i].ID.Value != nil {
|
||||
id := specs[i].ID.Value.(int64)
|
||||
nodes[i].ID = int(id)
|
||||
}
|
||||
mutation.done = true
|
||||
return nodes[i], nil
|
||||
})
|
||||
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||
mut = builder.hooks[i](mut)
|
||||
}
|
||||
mutators[i] = mut
|
||||
}(i, ctx)
|
||||
}
|
||||
if len(mutators) > 0 {
|
||||
if _, err := mutators[0].Mutate(ctx, bcb.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (bcb *BlacklistCreateBulk) SaveX(ctx context.Context) []*Blacklist {
|
||||
v, err := bcb.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (bcb *BlacklistCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := bcb.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (bcb *BlacklistCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := bcb.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
88
ent/blacklist_delete.go
Normal file
88
ent/blacklist_delete.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"polaris/ent/blacklist"
|
||||
"polaris/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// BlacklistDelete is the builder for deleting a Blacklist entity.
|
||||
type BlacklistDelete struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *BlacklistMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the BlacklistDelete builder.
|
||||
func (bd *BlacklistDelete) Where(ps ...predicate.Blacklist) *BlacklistDelete {
|
||||
bd.mutation.Where(ps...)
|
||||
return bd
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (bd *BlacklistDelete) Exec(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, bd.sqlExec, bd.mutation, bd.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (bd *BlacklistDelete) ExecX(ctx context.Context) int {
|
||||
n, err := bd.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (bd *BlacklistDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(blacklist.Table, sqlgraph.NewFieldSpec(blacklist.FieldID, field.TypeInt))
|
||||
if ps := bd.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
affected, err := sqlgraph.DeleteNodes(ctx, bd.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
bd.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// BlacklistDeleteOne is the builder for deleting a single Blacklist entity.
|
||||
type BlacklistDeleteOne struct {
|
||||
bd *BlacklistDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the BlacklistDelete builder.
|
||||
func (bdo *BlacklistDeleteOne) Where(ps ...predicate.Blacklist) *BlacklistDeleteOne {
|
||||
bdo.bd.mutation.Where(ps...)
|
||||
return bdo
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (bdo *BlacklistDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := bdo.bd.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
case n == 0:
|
||||
return &NotFoundError{blacklist.Label}
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (bdo *BlacklistDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := bdo.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
526
ent/blacklist_query.go
Normal file
526
ent/blacklist_query.go
Normal file
@@ -0,0 +1,526 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"math"
|
||||
"polaris/ent/blacklist"
|
||||
"polaris/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// BlacklistQuery is the builder for querying Blacklist entities.
|
||||
type BlacklistQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []blacklist.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.Blacklist
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
path func(context.Context) (*sql.Selector, error)
|
||||
}
|
||||
|
||||
// Where adds a new predicate for the BlacklistQuery builder.
|
||||
func (bq *BlacklistQuery) Where(ps ...predicate.Blacklist) *BlacklistQuery {
|
||||
bq.predicates = append(bq.predicates, ps...)
|
||||
return bq
|
||||
}
|
||||
|
||||
// Limit the number of records to be returned by this query.
|
||||
func (bq *BlacklistQuery) Limit(limit int) *BlacklistQuery {
|
||||
bq.ctx.Limit = &limit
|
||||
return bq
|
||||
}
|
||||
|
||||
// Offset to start from.
|
||||
func (bq *BlacklistQuery) Offset(offset int) *BlacklistQuery {
|
||||
bq.ctx.Offset = &offset
|
||||
return bq
|
||||
}
|
||||
|
||||
// Unique configures the query builder to filter duplicate records on query.
|
||||
// By default, unique is set to true, and can be disabled using this method.
|
||||
func (bq *BlacklistQuery) Unique(unique bool) *BlacklistQuery {
|
||||
bq.ctx.Unique = &unique
|
||||
return bq
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (bq *BlacklistQuery) Order(o ...blacklist.OrderOption) *BlacklistQuery {
|
||||
bq.order = append(bq.order, o...)
|
||||
return bq
|
||||
}
|
||||
|
||||
// First returns the first Blacklist entity from the query.
|
||||
// Returns a *NotFoundError when no Blacklist was found.
|
||||
func (bq *BlacklistQuery) First(ctx context.Context) (*Blacklist, error) {
|
||||
nodes, err := bq.Limit(1).All(setContextOp(ctx, bq.ctx, "First"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nil, &NotFoundError{blacklist.Label}
|
||||
}
|
||||
return nodes[0], nil
|
||||
}
|
||||
|
||||
// FirstX is like First, but panics if an error occurs.
|
||||
func (bq *BlacklistQuery) FirstX(ctx context.Context) *Blacklist {
|
||||
node, err := bq.First(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// FirstID returns the first Blacklist ID from the query.
|
||||
// Returns a *NotFoundError when no Blacklist ID was found.
|
||||
func (bq *BlacklistQuery) FirstID(ctx context.Context) (id int, err error) {
|
||||
var ids []int
|
||||
if ids, err = bq.Limit(1).IDs(setContextOp(ctx, bq.ctx, "FirstID")); err != nil {
|
||||
return
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
err = &NotFoundError{blacklist.Label}
|
||||
return
|
||||
}
|
||||
return ids[0], nil
|
||||
}
|
||||
|
||||
// FirstIDX is like FirstID, but panics if an error occurs.
|
||||
func (bq *BlacklistQuery) FirstIDX(ctx context.Context) int {
|
||||
id, err := bq.FirstID(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// Only returns a single Blacklist entity found by the query, ensuring it only returns one.
|
||||
// Returns a *NotSingularError when more than one Blacklist entity is found.
|
||||
// Returns a *NotFoundError when no Blacklist entities are found.
|
||||
func (bq *BlacklistQuery) Only(ctx context.Context) (*Blacklist, error) {
|
||||
nodes, err := bq.Limit(2).All(setContextOp(ctx, bq.ctx, "Only"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch len(nodes) {
|
||||
case 1:
|
||||
return nodes[0], nil
|
||||
case 0:
|
||||
return nil, &NotFoundError{blacklist.Label}
|
||||
default:
|
||||
return nil, &NotSingularError{blacklist.Label}
|
||||
}
|
||||
}
|
||||
|
||||
// OnlyX is like Only, but panics if an error occurs.
|
||||
func (bq *BlacklistQuery) OnlyX(ctx context.Context) *Blacklist {
|
||||
node, err := bq.Only(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// OnlyID is like Only, but returns the only Blacklist ID in the query.
|
||||
// Returns a *NotSingularError when more than one Blacklist ID is found.
|
||||
// Returns a *NotFoundError when no entities are found.
|
||||
func (bq *BlacklistQuery) OnlyID(ctx context.Context) (id int, err error) {
|
||||
var ids []int
|
||||
if ids, err = bq.Limit(2).IDs(setContextOp(ctx, bq.ctx, "OnlyID")); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(ids) {
|
||||
case 1:
|
||||
id = ids[0]
|
||||
case 0:
|
||||
err = &NotFoundError{blacklist.Label}
|
||||
default:
|
||||
err = &NotSingularError{blacklist.Label}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// OnlyIDX is like OnlyID, but panics if an error occurs.
|
||||
func (bq *BlacklistQuery) OnlyIDX(ctx context.Context) int {
|
||||
id, err := bq.OnlyID(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// All executes the query and returns a list of Blacklists.
|
||||
func (bq *BlacklistQuery) All(ctx context.Context) ([]*Blacklist, error) {
|
||||
ctx = setContextOp(ctx, bq.ctx, "All")
|
||||
if err := bq.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
qr := querierAll[[]*Blacklist, *BlacklistQuery]()
|
||||
return withInterceptors[[]*Blacklist](ctx, bq, qr, bq.inters)
|
||||
}
|
||||
|
||||
// AllX is like All, but panics if an error occurs.
|
||||
func (bq *BlacklistQuery) AllX(ctx context.Context) []*Blacklist {
|
||||
nodes, err := bq.All(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return nodes
|
||||
}
|
||||
|
||||
// IDs executes the query and returns a list of Blacklist IDs.
|
||||
func (bq *BlacklistQuery) IDs(ctx context.Context) (ids []int, err error) {
|
||||
if bq.ctx.Unique == nil && bq.path != nil {
|
||||
bq.Unique(true)
|
||||
}
|
||||
ctx = setContextOp(ctx, bq.ctx, "IDs")
|
||||
if err = bq.Select(blacklist.FieldID).Scan(ctx, &ids); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ids, nil
|
||||
}
|
||||
|
||||
// IDsX is like IDs, but panics if an error occurs.
|
||||
func (bq *BlacklistQuery) IDsX(ctx context.Context) []int {
|
||||
ids, err := bq.IDs(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
// Count returns the count of the given query.
|
||||
func (bq *BlacklistQuery) Count(ctx context.Context) (int, error) {
|
||||
ctx = setContextOp(ctx, bq.ctx, "Count")
|
||||
if err := bq.prepareQuery(ctx); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return withInterceptors[int](ctx, bq, querierCount[*BlacklistQuery](), bq.inters)
|
||||
}
|
||||
|
||||
// CountX is like Count, but panics if an error occurs.
|
||||
func (bq *BlacklistQuery) CountX(ctx context.Context) int {
|
||||
count, err := bq.Count(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
// Exist returns true if the query has elements in the graph.
|
||||
func (bq *BlacklistQuery) Exist(ctx context.Context) (bool, error) {
|
||||
ctx = setContextOp(ctx, bq.ctx, "Exist")
|
||||
switch _, err := bq.FirstID(ctx); {
|
||||
case IsNotFound(err):
|
||||
return false, nil
|
||||
case err != nil:
|
||||
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||
default:
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExistX is like Exist, but panics if an error occurs.
|
||||
func (bq *BlacklistQuery) ExistX(ctx context.Context) bool {
|
||||
exist, err := bq.Exist(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return exist
|
||||
}
|
||||
|
||||
// Clone returns a duplicate of the BlacklistQuery builder, including all associated steps. It can be
|
||||
// used to prepare common query builders and use them differently after the clone is made.
|
||||
func (bq *BlacklistQuery) Clone() *BlacklistQuery {
|
||||
if bq == nil {
|
||||
return nil
|
||||
}
|
||||
return &BlacklistQuery{
|
||||
config: bq.config,
|
||||
ctx: bq.ctx.Clone(),
|
||||
order: append([]blacklist.OrderOption{}, bq.order...),
|
||||
inters: append([]Interceptor{}, bq.inters...),
|
||||
predicates: append([]predicate.Blacklist{}, bq.predicates...),
|
||||
// clone intermediate query.
|
||||
sql: bq.sql.Clone(),
|
||||
path: bq.path,
|
||||
}
|
||||
}
|
||||
|
||||
// GroupBy is used to group vertices by one or more fields/columns.
|
||||
// It is often used with aggregate functions, like: count, max, mean, min, sum.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// Type blacklist.Type `json:"type,omitempty"`
|
||||
// Count int `json:"count,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.Blacklist.Query().
|
||||
// GroupBy(blacklist.FieldType).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
func (bq *BlacklistQuery) GroupBy(field string, fields ...string) *BlacklistGroupBy {
|
||||
bq.ctx.Fields = append([]string{field}, fields...)
|
||||
grbuild := &BlacklistGroupBy{build: bq}
|
||||
grbuild.flds = &bq.ctx.Fields
|
||||
grbuild.label = blacklist.Label
|
||||
grbuild.scan = grbuild.Scan
|
||||
return grbuild
|
||||
}
|
||||
|
||||
// Select allows the selection one or more fields/columns for the given query,
|
||||
// instead of selecting all fields in the entity.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// Type blacklist.Type `json:"type,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.Blacklist.Query().
|
||||
// Select(blacklist.FieldType).
|
||||
// Scan(ctx, &v)
|
||||
func (bq *BlacklistQuery) Select(fields ...string) *BlacklistSelect {
|
||||
bq.ctx.Fields = append(bq.ctx.Fields, fields...)
|
||||
sbuild := &BlacklistSelect{BlacklistQuery: bq}
|
||||
sbuild.label = blacklist.Label
|
||||
sbuild.flds, sbuild.scan = &bq.ctx.Fields, sbuild.Scan
|
||||
return sbuild
|
||||
}
|
||||
|
||||
// Aggregate returns a BlacklistSelect configured with the given aggregations.
|
||||
func (bq *BlacklistQuery) Aggregate(fns ...AggregateFunc) *BlacklistSelect {
|
||||
return bq.Select().Aggregate(fns...)
|
||||
}
|
||||
|
||||
func (bq *BlacklistQuery) prepareQuery(ctx context.Context) error {
|
||||
for _, inter := range bq.inters {
|
||||
if inter == nil {
|
||||
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
|
||||
}
|
||||
if trv, ok := inter.(Traverser); ok {
|
||||
if err := trv.Traverse(ctx, bq); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, f := range bq.ctx.Fields {
|
||||
if !blacklist.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
}
|
||||
if bq.path != nil {
|
||||
prev, err := bq.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
bq.sql = prev
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (bq *BlacklistQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Blacklist, error) {
|
||||
var (
|
||||
nodes = []*Blacklist{}
|
||||
_spec = bq.querySpec()
|
||||
)
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*Blacklist).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &Blacklist{config: bq.config}
|
||||
nodes = append(nodes, node)
|
||||
return node.assignValues(columns, values)
|
||||
}
|
||||
for i := range hooks {
|
||||
hooks[i](ctx, _spec)
|
||||
}
|
||||
if err := sqlgraph.QueryNodes(ctx, bq.driver, _spec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nodes, nil
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
func (bq *BlacklistQuery) sqlCount(ctx context.Context) (int, error) {
|
||||
_spec := bq.querySpec()
|
||||
_spec.Node.Columns = bq.ctx.Fields
|
||||
if len(bq.ctx.Fields) > 0 {
|
||||
_spec.Unique = bq.ctx.Unique != nil && *bq.ctx.Unique
|
||||
}
|
||||
return sqlgraph.CountNodes(ctx, bq.driver, _spec)
|
||||
}
|
||||
|
||||
func (bq *BlacklistQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
_spec := sqlgraph.NewQuerySpec(blacklist.Table, blacklist.Columns, sqlgraph.NewFieldSpec(blacklist.FieldID, field.TypeInt))
|
||||
_spec.From = bq.sql
|
||||
if unique := bq.ctx.Unique; unique != nil {
|
||||
_spec.Unique = *unique
|
||||
} else if bq.path != nil {
|
||||
_spec.Unique = true
|
||||
}
|
||||
if fields := bq.ctx.Fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, blacklist.FieldID)
|
||||
for i := range fields {
|
||||
if fields[i] != blacklist.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := bq.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if limit := bq.ctx.Limit; limit != nil {
|
||||
_spec.Limit = *limit
|
||||
}
|
||||
if offset := bq.ctx.Offset; offset != nil {
|
||||
_spec.Offset = *offset
|
||||
}
|
||||
if ps := bq.order; len(ps) > 0 {
|
||||
_spec.Order = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
return _spec
|
||||
}
|
||||
|
||||
func (bq *BlacklistQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
builder := sql.Dialect(bq.driver.Dialect())
|
||||
t1 := builder.Table(blacklist.Table)
|
||||
columns := bq.ctx.Fields
|
||||
if len(columns) == 0 {
|
||||
columns = blacklist.Columns
|
||||
}
|
||||
selector := builder.Select(t1.Columns(columns...)...).From(t1)
|
||||
if bq.sql != nil {
|
||||
selector = bq.sql
|
||||
selector.Select(selector.Columns(columns...)...)
|
||||
}
|
||||
if bq.ctx.Unique != nil && *bq.ctx.Unique {
|
||||
selector.Distinct()
|
||||
}
|
||||
for _, p := range bq.predicates {
|
||||
p(selector)
|
||||
}
|
||||
for _, p := range bq.order {
|
||||
p(selector)
|
||||
}
|
||||
if offset := bq.ctx.Offset; offset != nil {
|
||||
// limit is mandatory for offset clause. We start
|
||||
// with default value, and override it below if needed.
|
||||
selector.Offset(*offset).Limit(math.MaxInt32)
|
||||
}
|
||||
if limit := bq.ctx.Limit; limit != nil {
|
||||
selector.Limit(*limit)
|
||||
}
|
||||
return selector
|
||||
}
|
||||
|
||||
// BlacklistGroupBy is the group-by builder for Blacklist entities.
|
||||
type BlacklistGroupBy struct {
|
||||
selector
|
||||
build *BlacklistQuery
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the group-by query.
|
||||
func (bgb *BlacklistGroupBy) Aggregate(fns ...AggregateFunc) *BlacklistGroupBy {
|
||||
bgb.fns = append(bgb.fns, fns...)
|
||||
return bgb
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (bgb *BlacklistGroupBy) Scan(ctx context.Context, v any) error {
|
||||
ctx = setContextOp(ctx, bgb.build.ctx, "GroupBy")
|
||||
if err := bgb.build.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
return scanWithInterceptors[*BlacklistQuery, *BlacklistGroupBy](ctx, bgb.build, bgb, bgb.build.inters, v)
|
||||
}
|
||||
|
||||
func (bgb *BlacklistGroupBy) sqlScan(ctx context.Context, root *BlacklistQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx).Select()
|
||||
aggregation := make([]string, 0, len(bgb.fns))
|
||||
for _, fn := range bgb.fns {
|
||||
aggregation = append(aggregation, fn(selector))
|
||||
}
|
||||
if len(selector.SelectedColumns()) == 0 {
|
||||
columns := make([]string, 0, len(*bgb.flds)+len(bgb.fns))
|
||||
for _, f := range *bgb.flds {
|
||||
columns = append(columns, selector.C(f))
|
||||
}
|
||||
columns = append(columns, aggregation...)
|
||||
selector.Select(columns...)
|
||||
}
|
||||
selector.GroupBy(selector.Columns(*bgb.flds...)...)
|
||||
if err := selector.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := bgb.build.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
|
||||
// BlacklistSelect is the builder for selecting fields of Blacklist entities.
|
||||
type BlacklistSelect struct {
|
||||
*BlacklistQuery
|
||||
selector
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the selector query.
|
||||
func (bs *BlacklistSelect) Aggregate(fns ...AggregateFunc) *BlacklistSelect {
|
||||
bs.fns = append(bs.fns, fns...)
|
||||
return bs
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (bs *BlacklistSelect) Scan(ctx context.Context, v any) error {
|
||||
ctx = setContextOp(ctx, bs.ctx, "Select")
|
||||
if err := bs.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
return scanWithInterceptors[*BlacklistQuery, *BlacklistSelect](ctx, bs.BlacklistQuery, bs, bs.inters, v)
|
||||
}
|
||||
|
||||
func (bs *BlacklistSelect) sqlScan(ctx context.Context, root *BlacklistQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx)
|
||||
aggregation := make([]string, 0, len(bs.fns))
|
||||
for _, fn := range bs.fns {
|
||||
aggregation = append(aggregation, fn(selector))
|
||||
}
|
||||
switch n := len(*bs.selector.flds); {
|
||||
case n == 0 && len(aggregation) > 0:
|
||||
selector.Select(aggregation...)
|
||||
case n != 0 && len(aggregation) > 0:
|
||||
selector.AppendSelect(aggregation...)
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := bs.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
322
ent/blacklist_update.go
Normal file
322
ent/blacklist_update.go
Normal file
@@ -0,0 +1,322 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"polaris/ent/blacklist"
|
||||
"polaris/ent/predicate"
|
||||
"polaris/ent/schema"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// BlacklistUpdate is the builder for updating Blacklist entities.
|
||||
type BlacklistUpdate struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *BlacklistMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the BlacklistUpdate builder.
|
||||
func (bu *BlacklistUpdate) Where(ps ...predicate.Blacklist) *BlacklistUpdate {
|
||||
bu.mutation.Where(ps...)
|
||||
return bu
|
||||
}
|
||||
|
||||
// SetType sets the "type" field.
|
||||
func (bu *BlacklistUpdate) SetType(b blacklist.Type) *BlacklistUpdate {
|
||||
bu.mutation.SetType(b)
|
||||
return bu
|
||||
}
|
||||
|
||||
// SetNillableType sets the "type" field if the given value is not nil.
|
||||
func (bu *BlacklistUpdate) SetNillableType(b *blacklist.Type) *BlacklistUpdate {
|
||||
if b != nil {
|
||||
bu.SetType(*b)
|
||||
}
|
||||
return bu
|
||||
}
|
||||
|
||||
// SetValue sets the "value" field.
|
||||
func (bu *BlacklistUpdate) SetValue(sv schema.BlacklistValue) *BlacklistUpdate {
|
||||
bu.mutation.SetValue(sv)
|
||||
return bu
|
||||
}
|
||||
|
||||
// SetNillableValue sets the "value" field if the given value is not nil.
|
||||
func (bu *BlacklistUpdate) SetNillableValue(sv *schema.BlacklistValue) *BlacklistUpdate {
|
||||
if sv != nil {
|
||||
bu.SetValue(*sv)
|
||||
}
|
||||
return bu
|
||||
}
|
||||
|
||||
// SetNotes sets the "notes" field.
|
||||
func (bu *BlacklistUpdate) SetNotes(s string) *BlacklistUpdate {
|
||||
bu.mutation.SetNotes(s)
|
||||
return bu
|
||||
}
|
||||
|
||||
// SetNillableNotes sets the "notes" field if the given value is not nil.
|
||||
func (bu *BlacklistUpdate) SetNillableNotes(s *string) *BlacklistUpdate {
|
||||
if s != nil {
|
||||
bu.SetNotes(*s)
|
||||
}
|
||||
return bu
|
||||
}
|
||||
|
||||
// ClearNotes clears the value of the "notes" field.
|
||||
func (bu *BlacklistUpdate) ClearNotes() *BlacklistUpdate {
|
||||
bu.mutation.ClearNotes()
|
||||
return bu
|
||||
}
|
||||
|
||||
// Mutation returns the BlacklistMutation object of the builder.
|
||||
func (bu *BlacklistUpdate) Mutation() *BlacklistMutation {
|
||||
return bu.mutation
|
||||
}
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (bu *BlacklistUpdate) Save(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, bu.sqlSave, bu.mutation, bu.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (bu *BlacklistUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := bu.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return affected
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (bu *BlacklistUpdate) Exec(ctx context.Context) error {
|
||||
_, err := bu.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (bu *BlacklistUpdate) ExecX(ctx context.Context) {
|
||||
if err := bu.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (bu *BlacklistUpdate) check() error {
|
||||
if v, ok := bu.mutation.GetType(); ok {
|
||||
if err := blacklist.TypeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "type", err: fmt.Errorf(`ent: validator failed for field "Blacklist.type": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (bu *BlacklistUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
if err := bu.check(); err != nil {
|
||||
return n, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(blacklist.Table, blacklist.Columns, sqlgraph.NewFieldSpec(blacklist.FieldID, field.TypeInt))
|
||||
if ps := bu.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := bu.mutation.GetType(); ok {
|
||||
_spec.SetField(blacklist.FieldType, field.TypeEnum, value)
|
||||
}
|
||||
if value, ok := bu.mutation.Value(); ok {
|
||||
_spec.SetField(blacklist.FieldValue, field.TypeJSON, value)
|
||||
}
|
||||
if value, ok := bu.mutation.Notes(); ok {
|
||||
_spec.SetField(blacklist.FieldNotes, field.TypeString, value)
|
||||
}
|
||||
if bu.mutation.NotesCleared() {
|
||||
_spec.ClearField(blacklist.FieldNotes, field.TypeString)
|
||||
}
|
||||
if n, err = sqlgraph.UpdateNodes(ctx, bu.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{blacklist.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
bu.mutation.done = true
|
||||
return n, nil
|
||||
}
|
||||
|
||||
// BlacklistUpdateOne is the builder for updating a single Blacklist entity.
|
||||
type BlacklistUpdateOne struct {
|
||||
config
|
||||
fields []string
|
||||
hooks []Hook
|
||||
mutation *BlacklistMutation
|
||||
}
|
||||
|
||||
// SetType sets the "type" field.
|
||||
func (buo *BlacklistUpdateOne) SetType(b blacklist.Type) *BlacklistUpdateOne {
|
||||
buo.mutation.SetType(b)
|
||||
return buo
|
||||
}
|
||||
|
||||
// SetNillableType sets the "type" field if the given value is not nil.
|
||||
func (buo *BlacklistUpdateOne) SetNillableType(b *blacklist.Type) *BlacklistUpdateOne {
|
||||
if b != nil {
|
||||
buo.SetType(*b)
|
||||
}
|
||||
return buo
|
||||
}
|
||||
|
||||
// SetValue sets the "value" field.
|
||||
func (buo *BlacklistUpdateOne) SetValue(sv schema.BlacklistValue) *BlacklistUpdateOne {
|
||||
buo.mutation.SetValue(sv)
|
||||
return buo
|
||||
}
|
||||
|
||||
// SetNillableValue sets the "value" field if the given value is not nil.
|
||||
func (buo *BlacklistUpdateOne) SetNillableValue(sv *schema.BlacklistValue) *BlacklistUpdateOne {
|
||||
if sv != nil {
|
||||
buo.SetValue(*sv)
|
||||
}
|
||||
return buo
|
||||
}
|
||||
|
||||
// SetNotes sets the "notes" field.
|
||||
func (buo *BlacklistUpdateOne) SetNotes(s string) *BlacklistUpdateOne {
|
||||
buo.mutation.SetNotes(s)
|
||||
return buo
|
||||
}
|
||||
|
||||
// SetNillableNotes sets the "notes" field if the given value is not nil.
|
||||
func (buo *BlacklistUpdateOne) SetNillableNotes(s *string) *BlacklistUpdateOne {
|
||||
if s != nil {
|
||||
buo.SetNotes(*s)
|
||||
}
|
||||
return buo
|
||||
}
|
||||
|
||||
// ClearNotes clears the value of the "notes" field.
|
||||
func (buo *BlacklistUpdateOne) ClearNotes() *BlacklistUpdateOne {
|
||||
buo.mutation.ClearNotes()
|
||||
return buo
|
||||
}
|
||||
|
||||
// Mutation returns the BlacklistMutation object of the builder.
|
||||
func (buo *BlacklistUpdateOne) Mutation() *BlacklistMutation {
|
||||
return buo.mutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the BlacklistUpdate builder.
|
||||
func (buo *BlacklistUpdateOne) Where(ps ...predicate.Blacklist) *BlacklistUpdateOne {
|
||||
buo.mutation.Where(ps...)
|
||||
return buo
|
||||
}
|
||||
|
||||
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||
// The default is selecting all fields defined in the entity schema.
|
||||
func (buo *BlacklistUpdateOne) Select(field string, fields ...string) *BlacklistUpdateOne {
|
||||
buo.fields = append([]string{field}, fields...)
|
||||
return buo
|
||||
}
|
||||
|
||||
// Save executes the query and returns the updated Blacklist entity.
|
||||
func (buo *BlacklistUpdateOne) Save(ctx context.Context) (*Blacklist, error) {
|
||||
return withHooks(ctx, buo.sqlSave, buo.mutation, buo.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (buo *BlacklistUpdateOne) SaveX(ctx context.Context) *Blacklist {
|
||||
node, err := buo.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// Exec executes the query on the entity.
|
||||
func (buo *BlacklistUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := buo.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (buo *BlacklistUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := buo.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (buo *BlacklistUpdateOne) check() error {
|
||||
if v, ok := buo.mutation.GetType(); ok {
|
||||
if err := blacklist.TypeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "type", err: fmt.Errorf(`ent: validator failed for field "Blacklist.type": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (buo *BlacklistUpdateOne) sqlSave(ctx context.Context) (_node *Blacklist, err error) {
|
||||
if err := buo.check(); err != nil {
|
||||
return _node, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(blacklist.Table, blacklist.Columns, sqlgraph.NewFieldSpec(blacklist.FieldID, field.TypeInt))
|
||||
id, ok := buo.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Blacklist.id" for update`)}
|
||||
}
|
||||
_spec.Node.ID.Value = id
|
||||
if fields := buo.fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, blacklist.FieldID)
|
||||
for _, f := range fields {
|
||||
if !blacklist.ValidColumn(f) {
|
||||
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
if f != blacklist.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := buo.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := buo.mutation.GetType(); ok {
|
||||
_spec.SetField(blacklist.FieldType, field.TypeEnum, value)
|
||||
}
|
||||
if value, ok := buo.mutation.Value(); ok {
|
||||
_spec.SetField(blacklist.FieldValue, field.TypeJSON, value)
|
||||
}
|
||||
if value, ok := buo.mutation.Notes(); ok {
|
||||
_spec.SetField(blacklist.FieldNotes, field.TypeString, value)
|
||||
}
|
||||
if buo.mutation.NotesCleared() {
|
||||
_spec.ClearField(blacklist.FieldNotes, field.TypeString)
|
||||
}
|
||||
_node = &Blacklist{config: buo.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
if err = sqlgraph.UpdateNode(ctx, buo.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{blacklist.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
buo.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
155
ent/client.go
155
ent/client.go
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"polaris/ent/migrate"
|
||||
|
||||
"polaris/ent/blacklist"
|
||||
"polaris/ent/downloadclients"
|
||||
"polaris/ent/episode"
|
||||
"polaris/ent/history"
|
||||
@@ -32,6 +33,8 @@ type Client struct {
|
||||
config
|
||||
// Schema is the client for creating, migrating and dropping schema.
|
||||
Schema *migrate.Schema
|
||||
// Blacklist is the client for interacting with the Blacklist builders.
|
||||
Blacklist *BlacklistClient
|
||||
// DownloadClients is the client for interacting with the DownloadClients builders.
|
||||
DownloadClients *DownloadClientsClient
|
||||
// Episode is the client for interacting with the Episode builders.
|
||||
@@ -61,6 +64,7 @@ func NewClient(opts ...Option) *Client {
|
||||
|
||||
func (c *Client) init() {
|
||||
c.Schema = migrate.NewSchema(c.driver)
|
||||
c.Blacklist = NewBlacklistClient(c.config)
|
||||
c.DownloadClients = NewDownloadClientsClient(c.config)
|
||||
c.Episode = NewEpisodeClient(c.config)
|
||||
c.History = NewHistoryClient(c.config)
|
||||
@@ -162,6 +166,7 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) {
|
||||
return &Tx{
|
||||
ctx: ctx,
|
||||
config: cfg,
|
||||
Blacklist: NewBlacklistClient(cfg),
|
||||
DownloadClients: NewDownloadClientsClient(cfg),
|
||||
Episode: NewEpisodeClient(cfg),
|
||||
History: NewHistoryClient(cfg),
|
||||
@@ -190,6 +195,7 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
|
||||
return &Tx{
|
||||
ctx: ctx,
|
||||
config: cfg,
|
||||
Blacklist: NewBlacklistClient(cfg),
|
||||
DownloadClients: NewDownloadClientsClient(cfg),
|
||||
Episode: NewEpisodeClient(cfg),
|
||||
History: NewHistoryClient(cfg),
|
||||
@@ -205,7 +211,7 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
|
||||
// Debug returns a new debug-client. It's used to get verbose logging on specific operations.
|
||||
//
|
||||
// client.Debug().
|
||||
// DownloadClients.
|
||||
// Blacklist.
|
||||
// Query().
|
||||
// Count(ctx)
|
||||
func (c *Client) Debug() *Client {
|
||||
@@ -228,8 +234,8 @@ func (c *Client) Close() error {
|
||||
// In order to add hooks to a specific client, call: `client.Node.Use(...)`.
|
||||
func (c *Client) Use(hooks ...Hook) {
|
||||
for _, n := range []interface{ Use(...Hook) }{
|
||||
c.DownloadClients, c.Episode, c.History, c.ImportList, c.Indexers, c.Media,
|
||||
c.NotificationClient, c.Settings, c.Storage,
|
||||
c.Blacklist, c.DownloadClients, c.Episode, c.History, c.ImportList, c.Indexers,
|
||||
c.Media, c.NotificationClient, c.Settings, c.Storage,
|
||||
} {
|
||||
n.Use(hooks...)
|
||||
}
|
||||
@@ -239,8 +245,8 @@ func (c *Client) Use(hooks ...Hook) {
|
||||
// In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
|
||||
func (c *Client) Intercept(interceptors ...Interceptor) {
|
||||
for _, n := range []interface{ Intercept(...Interceptor) }{
|
||||
c.DownloadClients, c.Episode, c.History, c.ImportList, c.Indexers, c.Media,
|
||||
c.NotificationClient, c.Settings, c.Storage,
|
||||
c.Blacklist, c.DownloadClients, c.Episode, c.History, c.ImportList, c.Indexers,
|
||||
c.Media, c.NotificationClient, c.Settings, c.Storage,
|
||||
} {
|
||||
n.Intercept(interceptors...)
|
||||
}
|
||||
@@ -249,6 +255,8 @@ func (c *Client) Intercept(interceptors ...Interceptor) {
|
||||
// Mutate implements the ent.Mutator interface.
|
||||
func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
|
||||
switch m := m.(type) {
|
||||
case *BlacklistMutation:
|
||||
return c.Blacklist.mutate(ctx, m)
|
||||
case *DownloadClientsMutation:
|
||||
return c.DownloadClients.mutate(ctx, m)
|
||||
case *EpisodeMutation:
|
||||
@@ -272,6 +280,139 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// BlacklistClient is a client for the Blacklist schema.
|
||||
type BlacklistClient struct {
|
||||
config
|
||||
}
|
||||
|
||||
// NewBlacklistClient returns a client for the Blacklist from the given config.
|
||||
func NewBlacklistClient(c config) *BlacklistClient {
|
||||
return &BlacklistClient{config: c}
|
||||
}
|
||||
|
||||
// Use adds a list of mutation hooks to the hooks stack.
|
||||
// A call to `Use(f, g, h)` equals to `blacklist.Hooks(f(g(h())))`.
|
||||
func (c *BlacklistClient) Use(hooks ...Hook) {
|
||||
c.hooks.Blacklist = append(c.hooks.Blacklist, hooks...)
|
||||
}
|
||||
|
||||
// Intercept adds a list of query interceptors to the interceptors stack.
|
||||
// A call to `Intercept(f, g, h)` equals to `blacklist.Intercept(f(g(h())))`.
|
||||
func (c *BlacklistClient) Intercept(interceptors ...Interceptor) {
|
||||
c.inters.Blacklist = append(c.inters.Blacklist, interceptors...)
|
||||
}
|
||||
|
||||
// Create returns a builder for creating a Blacklist entity.
|
||||
func (c *BlacklistClient) Create() *BlacklistCreate {
|
||||
mutation := newBlacklistMutation(c.config, OpCreate)
|
||||
return &BlacklistCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
}
|
||||
|
||||
// CreateBulk returns a builder for creating a bulk of Blacklist entities.
|
||||
func (c *BlacklistClient) CreateBulk(builders ...*BlacklistCreate) *BlacklistCreateBulk {
|
||||
return &BlacklistCreateBulk{config: c.config, builders: builders}
|
||||
}
|
||||
|
||||
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
|
||||
// a builder and applies setFunc on it.
|
||||
func (c *BlacklistClient) MapCreateBulk(slice any, setFunc func(*BlacklistCreate, int)) *BlacklistCreateBulk {
|
||||
rv := reflect.ValueOf(slice)
|
||||
if rv.Kind() != reflect.Slice {
|
||||
return &BlacklistCreateBulk{err: fmt.Errorf("calling to BlacklistClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
||||
}
|
||||
builders := make([]*BlacklistCreate, rv.Len())
|
||||
for i := 0; i < rv.Len(); i++ {
|
||||
builders[i] = c.Create()
|
||||
setFunc(builders[i], i)
|
||||
}
|
||||
return &BlacklistCreateBulk{config: c.config, builders: builders}
|
||||
}
|
||||
|
||||
// Update returns an update builder for Blacklist.
|
||||
func (c *BlacklistClient) Update() *BlacklistUpdate {
|
||||
mutation := newBlacklistMutation(c.config, OpUpdate)
|
||||
return &BlacklistUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
}
|
||||
|
||||
// UpdateOne returns an update builder for the given entity.
|
||||
func (c *BlacklistClient) UpdateOne(b *Blacklist) *BlacklistUpdateOne {
|
||||
mutation := newBlacklistMutation(c.config, OpUpdateOne, withBlacklist(b))
|
||||
return &BlacklistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
}
|
||||
|
||||
// UpdateOneID returns an update builder for the given id.
|
||||
func (c *BlacklistClient) UpdateOneID(id int) *BlacklistUpdateOne {
|
||||
mutation := newBlacklistMutation(c.config, OpUpdateOne, withBlacklistID(id))
|
||||
return &BlacklistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
}
|
||||
|
||||
// Delete returns a delete builder for Blacklist.
|
||||
func (c *BlacklistClient) Delete() *BlacklistDelete {
|
||||
mutation := newBlacklistMutation(c.config, OpDelete)
|
||||
return &BlacklistDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
}
|
||||
|
||||
// DeleteOne returns a builder for deleting the given entity.
|
||||
func (c *BlacklistClient) DeleteOne(b *Blacklist) *BlacklistDeleteOne {
|
||||
return c.DeleteOneID(b.ID)
|
||||
}
|
||||
|
||||
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||
func (c *BlacklistClient) DeleteOneID(id int) *BlacklistDeleteOne {
|
||||
builder := c.Delete().Where(blacklist.ID(id))
|
||||
builder.mutation.id = &id
|
||||
builder.mutation.op = OpDeleteOne
|
||||
return &BlacklistDeleteOne{builder}
|
||||
}
|
||||
|
||||
// Query returns a query builder for Blacklist.
|
||||
func (c *BlacklistClient) Query() *BlacklistQuery {
|
||||
return &BlacklistQuery{
|
||||
config: c.config,
|
||||
ctx: &QueryContext{Type: TypeBlacklist},
|
||||
inters: c.Interceptors(),
|
||||
}
|
||||
}
|
||||
|
||||
// Get returns a Blacklist entity by its id.
|
||||
func (c *BlacklistClient) Get(ctx context.Context, id int) (*Blacklist, error) {
|
||||
return c.Query().Where(blacklist.ID(id)).Only(ctx)
|
||||
}
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *BlacklistClient) GetX(ctx context.Context, id int) *Blacklist {
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return obj
|
||||
}
|
||||
|
||||
// Hooks returns the client hooks.
|
||||
func (c *BlacklistClient) Hooks() []Hook {
|
||||
return c.hooks.Blacklist
|
||||
}
|
||||
|
||||
// Interceptors returns the client interceptors.
|
||||
func (c *BlacklistClient) Interceptors() []Interceptor {
|
||||
return c.inters.Blacklist
|
||||
}
|
||||
|
||||
func (c *BlacklistClient) mutate(ctx context.Context, m *BlacklistMutation) (Value, error) {
|
||||
switch m.Op() {
|
||||
case OpCreate:
|
||||
return (&BlacklistCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpUpdate:
|
||||
return (&BlacklistUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpUpdateOne:
|
||||
return (&BlacklistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpDelete, OpDeleteOne:
|
||||
return (&BlacklistDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
||||
default:
|
||||
return nil, fmt.Errorf("ent: unknown Blacklist mutation op: %q", m.Op())
|
||||
}
|
||||
}
|
||||
|
||||
// DownloadClientsClient is a client for the DownloadClients schema.
|
||||
type DownloadClientsClient struct {
|
||||
config
|
||||
@@ -1504,11 +1645,11 @@ func (c *StorageClient) mutate(ctx context.Context, m *StorageMutation) (Value,
|
||||
// hooks and interceptors per client, for fast access.
|
||||
type (
|
||||
hooks struct {
|
||||
DownloadClients, Episode, History, ImportList, Indexers, Media,
|
||||
Blacklist, DownloadClients, Episode, History, ImportList, Indexers, Media,
|
||||
NotificationClient, Settings, Storage []ent.Hook
|
||||
}
|
||||
inters struct {
|
||||
DownloadClients, Episode, History, ImportList, Indexers, Media,
|
||||
Blacklist, DownloadClients, Episode, History, ImportList, Indexers, Media,
|
||||
NotificationClient, Settings, Storage []ent.Interceptor
|
||||
}
|
||||
)
|
||||
|
||||
@@ -21,7 +21,7 @@ type DownloadClients struct {
|
||||
// Name holds the value of the "name" field.
|
||||
Name string `json:"name,omitempty"`
|
||||
// Implementation holds the value of the "implementation" field.
|
||||
Implementation string `json:"implementation,omitempty"`
|
||||
Implementation downloadclients.Implementation `json:"implementation,omitempty"`
|
||||
// URL holds the value of the "url" field.
|
||||
URL string `json:"url,omitempty"`
|
||||
// User holds the value of the "user" field.
|
||||
@@ -30,8 +30,8 @@ type DownloadClients struct {
|
||||
Password string `json:"password,omitempty"`
|
||||
// Settings holds the value of the "settings" field.
|
||||
Settings string `json:"settings,omitempty"`
|
||||
// Priority holds the value of the "priority" field.
|
||||
Priority string `json:"priority,omitempty"`
|
||||
// Priority1 holds the value of the "priority1" field.
|
||||
Priority1 int `json:"priority1,omitempty"`
|
||||
// RemoveCompletedDownloads holds the value of the "remove_completed_downloads" field.
|
||||
RemoveCompletedDownloads bool `json:"remove_completed_downloads,omitempty"`
|
||||
// RemoveFailedDownloads holds the value of the "remove_failed_downloads" field.
|
||||
@@ -48,9 +48,9 @@ func (*DownloadClients) scanValues(columns []string) ([]any, error) {
|
||||
switch columns[i] {
|
||||
case downloadclients.FieldEnable, downloadclients.FieldRemoveCompletedDownloads, downloadclients.FieldRemoveFailedDownloads:
|
||||
values[i] = new(sql.NullBool)
|
||||
case downloadclients.FieldID:
|
||||
case downloadclients.FieldID, downloadclients.FieldPriority1:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case downloadclients.FieldName, downloadclients.FieldImplementation, downloadclients.FieldURL, downloadclients.FieldUser, downloadclients.FieldPassword, downloadclients.FieldSettings, downloadclients.FieldPriority, downloadclients.FieldTags:
|
||||
case downloadclients.FieldName, downloadclients.FieldImplementation, downloadclients.FieldURL, downloadclients.FieldUser, downloadclients.FieldPassword, downloadclients.FieldSettings, downloadclients.FieldTags:
|
||||
values[i] = new(sql.NullString)
|
||||
default:
|
||||
values[i] = new(sql.UnknownType)
|
||||
@@ -89,7 +89,7 @@ func (dc *DownloadClients) assignValues(columns []string, values []any) error {
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field implementation", values[i])
|
||||
} else if value.Valid {
|
||||
dc.Implementation = value.String
|
||||
dc.Implementation = downloadclients.Implementation(value.String)
|
||||
}
|
||||
case downloadclients.FieldURL:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
@@ -115,11 +115,11 @@ func (dc *DownloadClients) assignValues(columns []string, values []any) error {
|
||||
} else if value.Valid {
|
||||
dc.Settings = value.String
|
||||
}
|
||||
case downloadclients.FieldPriority:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field priority", values[i])
|
||||
case downloadclients.FieldPriority1:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field priority1", values[i])
|
||||
} else if value.Valid {
|
||||
dc.Priority = value.String
|
||||
dc.Priority1 = int(value.Int64)
|
||||
}
|
||||
case downloadclients.FieldRemoveCompletedDownloads:
|
||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||||
@@ -182,7 +182,7 @@ func (dc *DownloadClients) String() string {
|
||||
builder.WriteString(dc.Name)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("implementation=")
|
||||
builder.WriteString(dc.Implementation)
|
||||
builder.WriteString(fmt.Sprintf("%v", dc.Implementation))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("url=")
|
||||
builder.WriteString(dc.URL)
|
||||
@@ -196,8 +196,8 @@ func (dc *DownloadClients) String() string {
|
||||
builder.WriteString("settings=")
|
||||
builder.WriteString(dc.Settings)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("priority=")
|
||||
builder.WriteString(dc.Priority)
|
||||
builder.WriteString("priority1=")
|
||||
builder.WriteString(fmt.Sprintf("%v", dc.Priority1))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("remove_completed_downloads=")
|
||||
builder.WriteString(fmt.Sprintf("%v", dc.RemoveCompletedDownloads))
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
package downloadclients
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
@@ -25,8 +27,8 @@ const (
|
||||
FieldPassword = "password"
|
||||
// FieldSettings holds the string denoting the settings field in the database.
|
||||
FieldSettings = "settings"
|
||||
// FieldPriority holds the string denoting the priority field in the database.
|
||||
FieldPriority = "priority"
|
||||
// FieldPriority1 holds the string denoting the priority1 field in the database.
|
||||
FieldPriority1 = "priority1"
|
||||
// FieldRemoveCompletedDownloads holds the string denoting the remove_completed_downloads field in the database.
|
||||
FieldRemoveCompletedDownloads = "remove_completed_downloads"
|
||||
// FieldRemoveFailedDownloads holds the string denoting the remove_failed_downloads field in the database.
|
||||
@@ -47,7 +49,7 @@ var Columns = []string{
|
||||
FieldUser,
|
||||
FieldPassword,
|
||||
FieldSettings,
|
||||
FieldPriority,
|
||||
FieldPriority1,
|
||||
FieldRemoveCompletedDownloads,
|
||||
FieldRemoveFailedDownloads,
|
||||
FieldTags,
|
||||
@@ -70,8 +72,10 @@ var (
|
||||
DefaultPassword string
|
||||
// DefaultSettings holds the default value on creation for the "settings" field.
|
||||
DefaultSettings string
|
||||
// DefaultPriority holds the default value on creation for the "priority" field.
|
||||
DefaultPriority string
|
||||
// DefaultPriority1 holds the default value on creation for the "priority1" field.
|
||||
DefaultPriority1 int
|
||||
// Priority1Validator is a validator for the "priority1" field. It is called by the builders before save.
|
||||
Priority1Validator func(int) error
|
||||
// DefaultRemoveCompletedDownloads holds the default value on creation for the "remove_completed_downloads" field.
|
||||
DefaultRemoveCompletedDownloads bool
|
||||
// DefaultRemoveFailedDownloads holds the default value on creation for the "remove_failed_downloads" field.
|
||||
@@ -80,6 +84,29 @@ var (
|
||||
DefaultTags string
|
||||
)
|
||||
|
||||
// Implementation defines the type for the "implementation" enum field.
|
||||
type Implementation string
|
||||
|
||||
// Implementation values.
|
||||
const (
|
||||
ImplementationTransmission Implementation = "transmission"
|
||||
ImplementationQbittorrent Implementation = "qbittorrent"
|
||||
)
|
||||
|
||||
func (i Implementation) String() string {
|
||||
return string(i)
|
||||
}
|
||||
|
||||
// ImplementationValidator is a validator for the "implementation" field enum values. It is called by the builders before save.
|
||||
func ImplementationValidator(i Implementation) error {
|
||||
switch i {
|
||||
case ImplementationTransmission, ImplementationQbittorrent:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("downloadclients: invalid enum value for implementation field: %q", i)
|
||||
}
|
||||
}
|
||||
|
||||
// OrderOption defines the ordering options for the DownloadClients queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
@@ -123,9 +150,9 @@ func BySettings(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSettings, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByPriority orders the results by the priority field.
|
||||
func ByPriority(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldPriority, opts...).ToFunc()
|
||||
// ByPriority1 orders the results by the priority1 field.
|
||||
func ByPriority1(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldPriority1, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByRemoveCompletedDownloads orders the results by the remove_completed_downloads field.
|
||||
|
||||
@@ -63,11 +63,6 @@ func Name(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldEQ(FieldName, v))
|
||||
}
|
||||
|
||||
// Implementation applies equality check predicate on the "implementation" field. It's identical to ImplementationEQ.
|
||||
func Implementation(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldEQ(FieldImplementation, v))
|
||||
}
|
||||
|
||||
// URL applies equality check predicate on the "url" field. It's identical to URLEQ.
|
||||
func URL(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldEQ(FieldURL, v))
|
||||
@@ -88,9 +83,9 @@ func Settings(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldEQ(FieldSettings, v))
|
||||
}
|
||||
|
||||
// Priority applies equality check predicate on the "priority" field. It's identical to PriorityEQ.
|
||||
func Priority(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldEQ(FieldPriority, v))
|
||||
// Priority1 applies equality check predicate on the "priority1" field. It's identical to Priority1EQ.
|
||||
func Priority1(v int) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldEQ(FieldPriority1, v))
|
||||
}
|
||||
|
||||
// RemoveCompletedDownloads applies equality check predicate on the "remove_completed_downloads" field. It's identical to RemoveCompletedDownloadsEQ.
|
||||
@@ -184,70 +179,25 @@ func NameContainsFold(v string) predicate.DownloadClients {
|
||||
}
|
||||
|
||||
// ImplementationEQ applies the EQ predicate on the "implementation" field.
|
||||
func ImplementationEQ(v string) predicate.DownloadClients {
|
||||
func ImplementationEQ(v Implementation) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldEQ(FieldImplementation, v))
|
||||
}
|
||||
|
||||
// ImplementationNEQ applies the NEQ predicate on the "implementation" field.
|
||||
func ImplementationNEQ(v string) predicate.DownloadClients {
|
||||
func ImplementationNEQ(v Implementation) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldNEQ(FieldImplementation, v))
|
||||
}
|
||||
|
||||
// ImplementationIn applies the In predicate on the "implementation" field.
|
||||
func ImplementationIn(vs ...string) predicate.DownloadClients {
|
||||
func ImplementationIn(vs ...Implementation) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldIn(FieldImplementation, vs...))
|
||||
}
|
||||
|
||||
// ImplementationNotIn applies the NotIn predicate on the "implementation" field.
|
||||
func ImplementationNotIn(vs ...string) predicate.DownloadClients {
|
||||
func ImplementationNotIn(vs ...Implementation) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldNotIn(FieldImplementation, vs...))
|
||||
}
|
||||
|
||||
// ImplementationGT applies the GT predicate on the "implementation" field.
|
||||
func ImplementationGT(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldGT(FieldImplementation, v))
|
||||
}
|
||||
|
||||
// ImplementationGTE applies the GTE predicate on the "implementation" field.
|
||||
func ImplementationGTE(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldGTE(FieldImplementation, v))
|
||||
}
|
||||
|
||||
// ImplementationLT applies the LT predicate on the "implementation" field.
|
||||
func ImplementationLT(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldLT(FieldImplementation, v))
|
||||
}
|
||||
|
||||
// ImplementationLTE applies the LTE predicate on the "implementation" field.
|
||||
func ImplementationLTE(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldLTE(FieldImplementation, v))
|
||||
}
|
||||
|
||||
// ImplementationContains applies the Contains predicate on the "implementation" field.
|
||||
func ImplementationContains(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldContains(FieldImplementation, v))
|
||||
}
|
||||
|
||||
// ImplementationHasPrefix applies the HasPrefix predicate on the "implementation" field.
|
||||
func ImplementationHasPrefix(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldHasPrefix(FieldImplementation, v))
|
||||
}
|
||||
|
||||
// ImplementationHasSuffix applies the HasSuffix predicate on the "implementation" field.
|
||||
func ImplementationHasSuffix(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldHasSuffix(FieldImplementation, v))
|
||||
}
|
||||
|
||||
// ImplementationEqualFold applies the EqualFold predicate on the "implementation" field.
|
||||
func ImplementationEqualFold(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldEqualFold(FieldImplementation, v))
|
||||
}
|
||||
|
||||
// ImplementationContainsFold applies the ContainsFold predicate on the "implementation" field.
|
||||
func ImplementationContainsFold(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldContainsFold(FieldImplementation, v))
|
||||
}
|
||||
|
||||
// URLEQ applies the EQ predicate on the "url" field.
|
||||
func URLEQ(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldEQ(FieldURL, v))
|
||||
@@ -508,69 +458,44 @@ func SettingsContainsFold(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldContainsFold(FieldSettings, v))
|
||||
}
|
||||
|
||||
// PriorityEQ applies the EQ predicate on the "priority" field.
|
||||
func PriorityEQ(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldEQ(FieldPriority, v))
|
||||
// Priority1EQ applies the EQ predicate on the "priority1" field.
|
||||
func Priority1EQ(v int) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldEQ(FieldPriority1, v))
|
||||
}
|
||||
|
||||
// PriorityNEQ applies the NEQ predicate on the "priority" field.
|
||||
func PriorityNEQ(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldNEQ(FieldPriority, v))
|
||||
// Priority1NEQ applies the NEQ predicate on the "priority1" field.
|
||||
func Priority1NEQ(v int) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldNEQ(FieldPriority1, v))
|
||||
}
|
||||
|
||||
// PriorityIn applies the In predicate on the "priority" field.
|
||||
func PriorityIn(vs ...string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldIn(FieldPriority, vs...))
|
||||
// Priority1In applies the In predicate on the "priority1" field.
|
||||
func Priority1In(vs ...int) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldIn(FieldPriority1, vs...))
|
||||
}
|
||||
|
||||
// PriorityNotIn applies the NotIn predicate on the "priority" field.
|
||||
func PriorityNotIn(vs ...string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldNotIn(FieldPriority, vs...))
|
||||
// Priority1NotIn applies the NotIn predicate on the "priority1" field.
|
||||
func Priority1NotIn(vs ...int) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldNotIn(FieldPriority1, vs...))
|
||||
}
|
||||
|
||||
// PriorityGT applies the GT predicate on the "priority" field.
|
||||
func PriorityGT(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldGT(FieldPriority, v))
|
||||
// Priority1GT applies the GT predicate on the "priority1" field.
|
||||
func Priority1GT(v int) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldGT(FieldPriority1, v))
|
||||
}
|
||||
|
||||
// PriorityGTE applies the GTE predicate on the "priority" field.
|
||||
func PriorityGTE(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldGTE(FieldPriority, v))
|
||||
// Priority1GTE applies the GTE predicate on the "priority1" field.
|
||||
func Priority1GTE(v int) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldGTE(FieldPriority1, v))
|
||||
}
|
||||
|
||||
// PriorityLT applies the LT predicate on the "priority" field.
|
||||
func PriorityLT(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldLT(FieldPriority, v))
|
||||
// Priority1LT applies the LT predicate on the "priority1" field.
|
||||
func Priority1LT(v int) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldLT(FieldPriority1, v))
|
||||
}
|
||||
|
||||
// PriorityLTE applies the LTE predicate on the "priority" field.
|
||||
func PriorityLTE(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldLTE(FieldPriority, v))
|
||||
}
|
||||
|
||||
// PriorityContains applies the Contains predicate on the "priority" field.
|
||||
func PriorityContains(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldContains(FieldPriority, v))
|
||||
}
|
||||
|
||||
// PriorityHasPrefix applies the HasPrefix predicate on the "priority" field.
|
||||
func PriorityHasPrefix(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldHasPrefix(FieldPriority, v))
|
||||
}
|
||||
|
||||
// PriorityHasSuffix applies the HasSuffix predicate on the "priority" field.
|
||||
func PriorityHasSuffix(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldHasSuffix(FieldPriority, v))
|
||||
}
|
||||
|
||||
// PriorityEqualFold applies the EqualFold predicate on the "priority" field.
|
||||
func PriorityEqualFold(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldEqualFold(FieldPriority, v))
|
||||
}
|
||||
|
||||
// PriorityContainsFold applies the ContainsFold predicate on the "priority" field.
|
||||
func PriorityContainsFold(v string) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldContainsFold(FieldPriority, v))
|
||||
// Priority1LTE applies the LTE predicate on the "priority1" field.
|
||||
func Priority1LTE(v int) predicate.DownloadClients {
|
||||
return predicate.DownloadClients(sql.FieldLTE(FieldPriority1, v))
|
||||
}
|
||||
|
||||
// RemoveCompletedDownloadsEQ applies the EQ predicate on the "remove_completed_downloads" field.
|
||||
|
||||
@@ -32,8 +32,8 @@ func (dcc *DownloadClientsCreate) SetName(s string) *DownloadClientsCreate {
|
||||
}
|
||||
|
||||
// SetImplementation sets the "implementation" field.
|
||||
func (dcc *DownloadClientsCreate) SetImplementation(s string) *DownloadClientsCreate {
|
||||
dcc.mutation.SetImplementation(s)
|
||||
func (dcc *DownloadClientsCreate) SetImplementation(d downloadclients.Implementation) *DownloadClientsCreate {
|
||||
dcc.mutation.SetImplementation(d)
|
||||
return dcc
|
||||
}
|
||||
|
||||
@@ -85,16 +85,16 @@ func (dcc *DownloadClientsCreate) SetNillableSettings(s *string) *DownloadClient
|
||||
return dcc
|
||||
}
|
||||
|
||||
// SetPriority sets the "priority" field.
|
||||
func (dcc *DownloadClientsCreate) SetPriority(s string) *DownloadClientsCreate {
|
||||
dcc.mutation.SetPriority(s)
|
||||
// SetPriority1 sets the "priority1" field.
|
||||
func (dcc *DownloadClientsCreate) SetPriority1(i int) *DownloadClientsCreate {
|
||||
dcc.mutation.SetPriority1(i)
|
||||
return dcc
|
||||
}
|
||||
|
||||
// SetNillablePriority sets the "priority" field if the given value is not nil.
|
||||
func (dcc *DownloadClientsCreate) SetNillablePriority(s *string) *DownloadClientsCreate {
|
||||
if s != nil {
|
||||
dcc.SetPriority(*s)
|
||||
// SetNillablePriority1 sets the "priority1" field if the given value is not nil.
|
||||
func (dcc *DownloadClientsCreate) SetNillablePriority1(i *int) *DownloadClientsCreate {
|
||||
if i != nil {
|
||||
dcc.SetPriority1(*i)
|
||||
}
|
||||
return dcc
|
||||
}
|
||||
@@ -188,9 +188,9 @@ func (dcc *DownloadClientsCreate) defaults() {
|
||||
v := downloadclients.DefaultSettings
|
||||
dcc.mutation.SetSettings(v)
|
||||
}
|
||||
if _, ok := dcc.mutation.Priority(); !ok {
|
||||
v := downloadclients.DefaultPriority
|
||||
dcc.mutation.SetPriority(v)
|
||||
if _, ok := dcc.mutation.Priority1(); !ok {
|
||||
v := downloadclients.DefaultPriority1
|
||||
dcc.mutation.SetPriority1(v)
|
||||
}
|
||||
if _, ok := dcc.mutation.RemoveCompletedDownloads(); !ok {
|
||||
v := downloadclients.DefaultRemoveCompletedDownloads
|
||||
@@ -217,6 +217,11 @@ func (dcc *DownloadClientsCreate) check() error {
|
||||
if _, ok := dcc.mutation.Implementation(); !ok {
|
||||
return &ValidationError{Name: "implementation", err: errors.New(`ent: missing required field "DownloadClients.implementation"`)}
|
||||
}
|
||||
if v, ok := dcc.mutation.Implementation(); ok {
|
||||
if err := downloadclients.ImplementationValidator(v); err != nil {
|
||||
return &ValidationError{Name: "implementation", err: fmt.Errorf(`ent: validator failed for field "DownloadClients.implementation": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := dcc.mutation.URL(); !ok {
|
||||
return &ValidationError{Name: "url", err: errors.New(`ent: missing required field "DownloadClients.url"`)}
|
||||
}
|
||||
@@ -229,8 +234,13 @@ func (dcc *DownloadClientsCreate) check() error {
|
||||
if _, ok := dcc.mutation.Settings(); !ok {
|
||||
return &ValidationError{Name: "settings", err: errors.New(`ent: missing required field "DownloadClients.settings"`)}
|
||||
}
|
||||
if _, ok := dcc.mutation.Priority(); !ok {
|
||||
return &ValidationError{Name: "priority", err: errors.New(`ent: missing required field "DownloadClients.priority"`)}
|
||||
if _, ok := dcc.mutation.Priority1(); !ok {
|
||||
return &ValidationError{Name: "priority1", err: errors.New(`ent: missing required field "DownloadClients.priority1"`)}
|
||||
}
|
||||
if v, ok := dcc.mutation.Priority1(); ok {
|
||||
if err := downloadclients.Priority1Validator(v); err != nil {
|
||||
return &ValidationError{Name: "priority1", err: fmt.Errorf(`ent: validator failed for field "DownloadClients.priority1": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := dcc.mutation.RemoveCompletedDownloads(); !ok {
|
||||
return &ValidationError{Name: "remove_completed_downloads", err: errors.New(`ent: missing required field "DownloadClients.remove_completed_downloads"`)}
|
||||
@@ -276,7 +286,7 @@ func (dcc *DownloadClientsCreate) createSpec() (*DownloadClients, *sqlgraph.Crea
|
||||
_node.Name = value
|
||||
}
|
||||
if value, ok := dcc.mutation.Implementation(); ok {
|
||||
_spec.SetField(downloadclients.FieldImplementation, field.TypeString, value)
|
||||
_spec.SetField(downloadclients.FieldImplementation, field.TypeEnum, value)
|
||||
_node.Implementation = value
|
||||
}
|
||||
if value, ok := dcc.mutation.URL(); ok {
|
||||
@@ -295,9 +305,9 @@ func (dcc *DownloadClientsCreate) createSpec() (*DownloadClients, *sqlgraph.Crea
|
||||
_spec.SetField(downloadclients.FieldSettings, field.TypeString, value)
|
||||
_node.Settings = value
|
||||
}
|
||||
if value, ok := dcc.mutation.Priority(); ok {
|
||||
_spec.SetField(downloadclients.FieldPriority, field.TypeString, value)
|
||||
_node.Priority = value
|
||||
if value, ok := dcc.mutation.Priority1(); ok {
|
||||
_spec.SetField(downloadclients.FieldPriority1, field.TypeInt, value)
|
||||
_node.Priority1 = value
|
||||
}
|
||||
if value, ok := dcc.mutation.RemoveCompletedDownloads(); ok {
|
||||
_spec.SetField(downloadclients.FieldRemoveCompletedDownloads, field.TypeBool, value)
|
||||
|
||||
@@ -56,15 +56,15 @@ func (dcu *DownloadClientsUpdate) SetNillableName(s *string) *DownloadClientsUpd
|
||||
}
|
||||
|
||||
// SetImplementation sets the "implementation" field.
|
||||
func (dcu *DownloadClientsUpdate) SetImplementation(s string) *DownloadClientsUpdate {
|
||||
dcu.mutation.SetImplementation(s)
|
||||
func (dcu *DownloadClientsUpdate) SetImplementation(d downloadclients.Implementation) *DownloadClientsUpdate {
|
||||
dcu.mutation.SetImplementation(d)
|
||||
return dcu
|
||||
}
|
||||
|
||||
// SetNillableImplementation sets the "implementation" field if the given value is not nil.
|
||||
func (dcu *DownloadClientsUpdate) SetNillableImplementation(s *string) *DownloadClientsUpdate {
|
||||
if s != nil {
|
||||
dcu.SetImplementation(*s)
|
||||
func (dcu *DownloadClientsUpdate) SetNillableImplementation(d *downloadclients.Implementation) *DownloadClientsUpdate {
|
||||
if d != nil {
|
||||
dcu.SetImplementation(*d)
|
||||
}
|
||||
return dcu
|
||||
}
|
||||
@@ -125,20 +125,27 @@ func (dcu *DownloadClientsUpdate) SetNillableSettings(s *string) *DownloadClient
|
||||
return dcu
|
||||
}
|
||||
|
||||
// SetPriority sets the "priority" field.
|
||||
func (dcu *DownloadClientsUpdate) SetPriority(s string) *DownloadClientsUpdate {
|
||||
dcu.mutation.SetPriority(s)
|
||||
// SetPriority1 sets the "priority1" field.
|
||||
func (dcu *DownloadClientsUpdate) SetPriority1(i int) *DownloadClientsUpdate {
|
||||
dcu.mutation.ResetPriority1()
|
||||
dcu.mutation.SetPriority1(i)
|
||||
return dcu
|
||||
}
|
||||
|
||||
// SetNillablePriority sets the "priority" field if the given value is not nil.
|
||||
func (dcu *DownloadClientsUpdate) SetNillablePriority(s *string) *DownloadClientsUpdate {
|
||||
if s != nil {
|
||||
dcu.SetPriority(*s)
|
||||
// SetNillablePriority1 sets the "priority1" field if the given value is not nil.
|
||||
func (dcu *DownloadClientsUpdate) SetNillablePriority1(i *int) *DownloadClientsUpdate {
|
||||
if i != nil {
|
||||
dcu.SetPriority1(*i)
|
||||
}
|
||||
return dcu
|
||||
}
|
||||
|
||||
// AddPriority1 adds i to the "priority1" field.
|
||||
func (dcu *DownloadClientsUpdate) AddPriority1(i int) *DownloadClientsUpdate {
|
||||
dcu.mutation.AddPriority1(i)
|
||||
return dcu
|
||||
}
|
||||
|
||||
// SetRemoveCompletedDownloads sets the "remove_completed_downloads" field.
|
||||
func (dcu *DownloadClientsUpdate) SetRemoveCompletedDownloads(b bool) *DownloadClientsUpdate {
|
||||
dcu.mutation.SetRemoveCompletedDownloads(b)
|
||||
@@ -213,7 +220,25 @@ func (dcu *DownloadClientsUpdate) ExecX(ctx context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (dcu *DownloadClientsUpdate) check() error {
|
||||
if v, ok := dcu.mutation.Implementation(); ok {
|
||||
if err := downloadclients.ImplementationValidator(v); err != nil {
|
||||
return &ValidationError{Name: "implementation", err: fmt.Errorf(`ent: validator failed for field "DownloadClients.implementation": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := dcu.mutation.Priority1(); ok {
|
||||
if err := downloadclients.Priority1Validator(v); err != nil {
|
||||
return &ValidationError{Name: "priority1", err: fmt.Errorf(`ent: validator failed for field "DownloadClients.priority1": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (dcu *DownloadClientsUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
if err := dcu.check(); err != nil {
|
||||
return n, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(downloadclients.Table, downloadclients.Columns, sqlgraph.NewFieldSpec(downloadclients.FieldID, field.TypeInt))
|
||||
if ps := dcu.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
@@ -229,7 +254,7 @@ func (dcu *DownloadClientsUpdate) sqlSave(ctx context.Context) (n int, err error
|
||||
_spec.SetField(downloadclients.FieldName, field.TypeString, value)
|
||||
}
|
||||
if value, ok := dcu.mutation.Implementation(); ok {
|
||||
_spec.SetField(downloadclients.FieldImplementation, field.TypeString, value)
|
||||
_spec.SetField(downloadclients.FieldImplementation, field.TypeEnum, value)
|
||||
}
|
||||
if value, ok := dcu.mutation.URL(); ok {
|
||||
_spec.SetField(downloadclients.FieldURL, field.TypeString, value)
|
||||
@@ -243,8 +268,11 @@ func (dcu *DownloadClientsUpdate) sqlSave(ctx context.Context) (n int, err error
|
||||
if value, ok := dcu.mutation.Settings(); ok {
|
||||
_spec.SetField(downloadclients.FieldSettings, field.TypeString, value)
|
||||
}
|
||||
if value, ok := dcu.mutation.Priority(); ok {
|
||||
_spec.SetField(downloadclients.FieldPriority, field.TypeString, value)
|
||||
if value, ok := dcu.mutation.Priority1(); ok {
|
||||
_spec.SetField(downloadclients.FieldPriority1, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := dcu.mutation.AddedPriority1(); ok {
|
||||
_spec.AddField(downloadclients.FieldPriority1, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := dcu.mutation.RemoveCompletedDownloads(); ok {
|
||||
_spec.SetField(downloadclients.FieldRemoveCompletedDownloads, field.TypeBool, value)
|
||||
@@ -304,15 +332,15 @@ func (dcuo *DownloadClientsUpdateOne) SetNillableName(s *string) *DownloadClient
|
||||
}
|
||||
|
||||
// SetImplementation sets the "implementation" field.
|
||||
func (dcuo *DownloadClientsUpdateOne) SetImplementation(s string) *DownloadClientsUpdateOne {
|
||||
dcuo.mutation.SetImplementation(s)
|
||||
func (dcuo *DownloadClientsUpdateOne) SetImplementation(d downloadclients.Implementation) *DownloadClientsUpdateOne {
|
||||
dcuo.mutation.SetImplementation(d)
|
||||
return dcuo
|
||||
}
|
||||
|
||||
// SetNillableImplementation sets the "implementation" field if the given value is not nil.
|
||||
func (dcuo *DownloadClientsUpdateOne) SetNillableImplementation(s *string) *DownloadClientsUpdateOne {
|
||||
if s != nil {
|
||||
dcuo.SetImplementation(*s)
|
||||
func (dcuo *DownloadClientsUpdateOne) SetNillableImplementation(d *downloadclients.Implementation) *DownloadClientsUpdateOne {
|
||||
if d != nil {
|
||||
dcuo.SetImplementation(*d)
|
||||
}
|
||||
return dcuo
|
||||
}
|
||||
@@ -373,20 +401,27 @@ func (dcuo *DownloadClientsUpdateOne) SetNillableSettings(s *string) *DownloadCl
|
||||
return dcuo
|
||||
}
|
||||
|
||||
// SetPriority sets the "priority" field.
|
||||
func (dcuo *DownloadClientsUpdateOne) SetPriority(s string) *DownloadClientsUpdateOne {
|
||||
dcuo.mutation.SetPriority(s)
|
||||
// SetPriority1 sets the "priority1" field.
|
||||
func (dcuo *DownloadClientsUpdateOne) SetPriority1(i int) *DownloadClientsUpdateOne {
|
||||
dcuo.mutation.ResetPriority1()
|
||||
dcuo.mutation.SetPriority1(i)
|
||||
return dcuo
|
||||
}
|
||||
|
||||
// SetNillablePriority sets the "priority" field if the given value is not nil.
|
||||
func (dcuo *DownloadClientsUpdateOne) SetNillablePriority(s *string) *DownloadClientsUpdateOne {
|
||||
if s != nil {
|
||||
dcuo.SetPriority(*s)
|
||||
// SetNillablePriority1 sets the "priority1" field if the given value is not nil.
|
||||
func (dcuo *DownloadClientsUpdateOne) SetNillablePriority1(i *int) *DownloadClientsUpdateOne {
|
||||
if i != nil {
|
||||
dcuo.SetPriority1(*i)
|
||||
}
|
||||
return dcuo
|
||||
}
|
||||
|
||||
// AddPriority1 adds i to the "priority1" field.
|
||||
func (dcuo *DownloadClientsUpdateOne) AddPriority1(i int) *DownloadClientsUpdateOne {
|
||||
dcuo.mutation.AddPriority1(i)
|
||||
return dcuo
|
||||
}
|
||||
|
||||
// SetRemoveCompletedDownloads sets the "remove_completed_downloads" field.
|
||||
func (dcuo *DownloadClientsUpdateOne) SetRemoveCompletedDownloads(b bool) *DownloadClientsUpdateOne {
|
||||
dcuo.mutation.SetRemoveCompletedDownloads(b)
|
||||
@@ -474,7 +509,25 @@ func (dcuo *DownloadClientsUpdateOne) ExecX(ctx context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (dcuo *DownloadClientsUpdateOne) check() error {
|
||||
if v, ok := dcuo.mutation.Implementation(); ok {
|
||||
if err := downloadclients.ImplementationValidator(v); err != nil {
|
||||
return &ValidationError{Name: "implementation", err: fmt.Errorf(`ent: validator failed for field "DownloadClients.implementation": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := dcuo.mutation.Priority1(); ok {
|
||||
if err := downloadclients.Priority1Validator(v); err != nil {
|
||||
return &ValidationError{Name: "priority1", err: fmt.Errorf(`ent: validator failed for field "DownloadClients.priority1": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (dcuo *DownloadClientsUpdateOne) sqlSave(ctx context.Context) (_node *DownloadClients, err error) {
|
||||
if err := dcuo.check(); err != nil {
|
||||
return _node, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(downloadclients.Table, downloadclients.Columns, sqlgraph.NewFieldSpec(downloadclients.FieldID, field.TypeInt))
|
||||
id, ok := dcuo.mutation.ID()
|
||||
if !ok {
|
||||
@@ -507,7 +560,7 @@ func (dcuo *DownloadClientsUpdateOne) sqlSave(ctx context.Context) (_node *Downl
|
||||
_spec.SetField(downloadclients.FieldName, field.TypeString, value)
|
||||
}
|
||||
if value, ok := dcuo.mutation.Implementation(); ok {
|
||||
_spec.SetField(downloadclients.FieldImplementation, field.TypeString, value)
|
||||
_spec.SetField(downloadclients.FieldImplementation, field.TypeEnum, value)
|
||||
}
|
||||
if value, ok := dcuo.mutation.URL(); ok {
|
||||
_spec.SetField(downloadclients.FieldURL, field.TypeString, value)
|
||||
@@ -521,8 +574,11 @@ func (dcuo *DownloadClientsUpdateOne) sqlSave(ctx context.Context) (_node *Downl
|
||||
if value, ok := dcuo.mutation.Settings(); ok {
|
||||
_spec.SetField(downloadclients.FieldSettings, field.TypeString, value)
|
||||
}
|
||||
if value, ok := dcuo.mutation.Priority(); ok {
|
||||
_spec.SetField(downloadclients.FieldPriority, field.TypeString, value)
|
||||
if value, ok := dcuo.mutation.Priority1(); ok {
|
||||
_spec.SetField(downloadclients.FieldPriority1, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := dcuo.mutation.AddedPriority1(); ok {
|
||||
_spec.AddField(downloadclients.FieldPriority1, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := dcuo.mutation.RemoveCompletedDownloads(); ok {
|
||||
_spec.SetField(downloadclients.FieldRemoveCompletedDownloads, field.TypeBool, value)
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"polaris/ent/blacklist"
|
||||
"polaris/ent/downloadclients"
|
||||
"polaris/ent/episode"
|
||||
"polaris/ent/history"
|
||||
@@ -81,6 +82,7 @@ var (
|
||||
func checkColumn(table, column string) error {
|
||||
initCheck.Do(func() {
|
||||
columnCheck = sql.NewColumnCheck(map[string]func(string) bool{
|
||||
blacklist.Table: blacklist.ValidColumn,
|
||||
downloadclients.Table: downloadclients.ValidColumn,
|
||||
episode.Table: episode.ValidColumn,
|
||||
history.Table: history.ValidColumn,
|
||||
|
||||
@@ -33,9 +33,11 @@ type History struct {
|
||||
DownloadClientID int `json:"download_client_id,omitempty"`
|
||||
// IndexerID holds the value of the "indexer_id" field.
|
||||
IndexerID int `json:"indexer_id,omitempty"`
|
||||
// Link holds the value of the "link" field.
|
||||
Link string `json:"link,omitempty"`
|
||||
// Status holds the value of the "status" field.
|
||||
Status history.Status `json:"status,omitempty"`
|
||||
// Saved holds the value of the "saved" field.
|
||||
// deprecated
|
||||
Saved string `json:"saved,omitempty"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
@@ -47,7 +49,7 @@ func (*History) scanValues(columns []string) ([]any, error) {
|
||||
switch columns[i] {
|
||||
case history.FieldID, history.FieldMediaID, history.FieldEpisodeID, history.FieldSize, history.FieldDownloadClientID, history.FieldIndexerID:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case history.FieldSourceTitle, history.FieldTargetDir, history.FieldStatus, history.FieldSaved:
|
||||
case history.FieldSourceTitle, history.FieldTargetDir, history.FieldLink, history.FieldStatus, history.FieldSaved:
|
||||
values[i] = new(sql.NullString)
|
||||
case history.FieldDate:
|
||||
values[i] = new(sql.NullTime)
|
||||
@@ -120,6 +122,12 @@ func (h *History) assignValues(columns []string, values []any) error {
|
||||
} else if value.Valid {
|
||||
h.IndexerID = int(value.Int64)
|
||||
}
|
||||
case history.FieldLink:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field link", values[i])
|
||||
} else if value.Valid {
|
||||
h.Link = value.String
|
||||
}
|
||||
case history.FieldStatus:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field status", values[i])
|
||||
@@ -192,6 +200,9 @@ func (h *History) String() string {
|
||||
builder.WriteString("indexer_id=")
|
||||
builder.WriteString(fmt.Sprintf("%v", h.IndexerID))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("link=")
|
||||
builder.WriteString(h.Link)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("status=")
|
||||
builder.WriteString(fmt.Sprintf("%v", h.Status))
|
||||
builder.WriteString(", ")
|
||||
|
||||
@@ -29,6 +29,8 @@ const (
|
||||
FieldDownloadClientID = "download_client_id"
|
||||
// FieldIndexerID holds the string denoting the indexer_id field in the database.
|
||||
FieldIndexerID = "indexer_id"
|
||||
// FieldLink holds the string denoting the link field in the database.
|
||||
FieldLink = "link"
|
||||
// FieldStatus holds the string denoting the status field in the database.
|
||||
FieldStatus = "status"
|
||||
// FieldSaved holds the string denoting the saved field in the database.
|
||||
@@ -48,6 +50,7 @@ var Columns = []string{
|
||||
FieldSize,
|
||||
FieldDownloadClientID,
|
||||
FieldIndexerID,
|
||||
FieldLink,
|
||||
FieldStatus,
|
||||
FieldSaved,
|
||||
}
|
||||
@@ -141,6 +144,11 @@ func ByIndexerID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldIndexerID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLink orders the results by the link field.
|
||||
func ByLink(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLink, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByStatus orders the results by the status field.
|
||||
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldStatus, opts...).ToFunc()
|
||||
|
||||
@@ -94,6 +94,11 @@ func IndexerID(v int) predicate.History {
|
||||
return predicate.History(sql.FieldEQ(FieldIndexerID, v))
|
||||
}
|
||||
|
||||
// Link applies equality check predicate on the "link" field. It's identical to LinkEQ.
|
||||
func Link(v string) predicate.History {
|
||||
return predicate.History(sql.FieldEQ(FieldLink, v))
|
||||
}
|
||||
|
||||
// Saved applies equality check predicate on the "saved" field. It's identical to SavedEQ.
|
||||
func Saved(v string) predicate.History {
|
||||
return predicate.History(sql.FieldEQ(FieldSaved, v))
|
||||
@@ -499,6 +504,81 @@ func IndexerIDNotNil() predicate.History {
|
||||
return predicate.History(sql.FieldNotNull(FieldIndexerID))
|
||||
}
|
||||
|
||||
// LinkEQ applies the EQ predicate on the "link" field.
|
||||
func LinkEQ(v string) predicate.History {
|
||||
return predicate.History(sql.FieldEQ(FieldLink, v))
|
||||
}
|
||||
|
||||
// LinkNEQ applies the NEQ predicate on the "link" field.
|
||||
func LinkNEQ(v string) predicate.History {
|
||||
return predicate.History(sql.FieldNEQ(FieldLink, v))
|
||||
}
|
||||
|
||||
// LinkIn applies the In predicate on the "link" field.
|
||||
func LinkIn(vs ...string) predicate.History {
|
||||
return predicate.History(sql.FieldIn(FieldLink, vs...))
|
||||
}
|
||||
|
||||
// LinkNotIn applies the NotIn predicate on the "link" field.
|
||||
func LinkNotIn(vs ...string) predicate.History {
|
||||
return predicate.History(sql.FieldNotIn(FieldLink, vs...))
|
||||
}
|
||||
|
||||
// LinkGT applies the GT predicate on the "link" field.
|
||||
func LinkGT(v string) predicate.History {
|
||||
return predicate.History(sql.FieldGT(FieldLink, v))
|
||||
}
|
||||
|
||||
// LinkGTE applies the GTE predicate on the "link" field.
|
||||
func LinkGTE(v string) predicate.History {
|
||||
return predicate.History(sql.FieldGTE(FieldLink, v))
|
||||
}
|
||||
|
||||
// LinkLT applies the LT predicate on the "link" field.
|
||||
func LinkLT(v string) predicate.History {
|
||||
return predicate.History(sql.FieldLT(FieldLink, v))
|
||||
}
|
||||
|
||||
// LinkLTE applies the LTE predicate on the "link" field.
|
||||
func LinkLTE(v string) predicate.History {
|
||||
return predicate.History(sql.FieldLTE(FieldLink, v))
|
||||
}
|
||||
|
||||
// LinkContains applies the Contains predicate on the "link" field.
|
||||
func LinkContains(v string) predicate.History {
|
||||
return predicate.History(sql.FieldContains(FieldLink, v))
|
||||
}
|
||||
|
||||
// LinkHasPrefix applies the HasPrefix predicate on the "link" field.
|
||||
func LinkHasPrefix(v string) predicate.History {
|
||||
return predicate.History(sql.FieldHasPrefix(FieldLink, v))
|
||||
}
|
||||
|
||||
// LinkHasSuffix applies the HasSuffix predicate on the "link" field.
|
||||
func LinkHasSuffix(v string) predicate.History {
|
||||
return predicate.History(sql.FieldHasSuffix(FieldLink, v))
|
||||
}
|
||||
|
||||
// LinkIsNil applies the IsNil predicate on the "link" field.
|
||||
func LinkIsNil() predicate.History {
|
||||
return predicate.History(sql.FieldIsNull(FieldLink))
|
||||
}
|
||||
|
||||
// LinkNotNil applies the NotNil predicate on the "link" field.
|
||||
func LinkNotNil() predicate.History {
|
||||
return predicate.History(sql.FieldNotNull(FieldLink))
|
||||
}
|
||||
|
||||
// LinkEqualFold applies the EqualFold predicate on the "link" field.
|
||||
func LinkEqualFold(v string) predicate.History {
|
||||
return predicate.History(sql.FieldEqualFold(FieldLink, v))
|
||||
}
|
||||
|
||||
// LinkContainsFold applies the ContainsFold predicate on the "link" field.
|
||||
func LinkContainsFold(v string) predicate.History {
|
||||
return predicate.History(sql.FieldContainsFold(FieldLink, v))
|
||||
}
|
||||
|
||||
// StatusEQ applies the EQ predicate on the "status" field.
|
||||
func StatusEQ(v Status) predicate.History {
|
||||
return predicate.History(sql.FieldEQ(FieldStatus, v))
|
||||
|
||||
@@ -100,6 +100,20 @@ func (hc *HistoryCreate) SetNillableIndexerID(i *int) *HistoryCreate {
|
||||
return hc
|
||||
}
|
||||
|
||||
// SetLink sets the "link" field.
|
||||
func (hc *HistoryCreate) SetLink(s string) *HistoryCreate {
|
||||
hc.mutation.SetLink(s)
|
||||
return hc
|
||||
}
|
||||
|
||||
// SetNillableLink sets the "link" field if the given value is not nil.
|
||||
func (hc *HistoryCreate) SetNillableLink(s *string) *HistoryCreate {
|
||||
if s != nil {
|
||||
hc.SetLink(*s)
|
||||
}
|
||||
return hc
|
||||
}
|
||||
|
||||
// SetStatus sets the "status" field.
|
||||
func (hc *HistoryCreate) SetStatus(h history.Status) *HistoryCreate {
|
||||
hc.mutation.SetStatus(h)
|
||||
@@ -244,6 +258,10 @@ func (hc *HistoryCreate) createSpec() (*History, *sqlgraph.CreateSpec) {
|
||||
_spec.SetField(history.FieldIndexerID, field.TypeInt, value)
|
||||
_node.IndexerID = value
|
||||
}
|
||||
if value, ok := hc.mutation.Link(); ok {
|
||||
_spec.SetField(history.FieldLink, field.TypeString, value)
|
||||
_node.Link = value
|
||||
}
|
||||
if value, ok := hc.mutation.Status(); ok {
|
||||
_spec.SetField(history.FieldStatus, field.TypeEnum, value)
|
||||
_node.Status = value
|
||||
|
||||
@@ -193,6 +193,26 @@ func (hu *HistoryUpdate) ClearIndexerID() *HistoryUpdate {
|
||||
return hu
|
||||
}
|
||||
|
||||
// SetLink sets the "link" field.
|
||||
func (hu *HistoryUpdate) SetLink(s string) *HistoryUpdate {
|
||||
hu.mutation.SetLink(s)
|
||||
return hu
|
||||
}
|
||||
|
||||
// SetNillableLink sets the "link" field if the given value is not nil.
|
||||
func (hu *HistoryUpdate) SetNillableLink(s *string) *HistoryUpdate {
|
||||
if s != nil {
|
||||
hu.SetLink(*s)
|
||||
}
|
||||
return hu
|
||||
}
|
||||
|
||||
// ClearLink clears the value of the "link" field.
|
||||
func (hu *HistoryUpdate) ClearLink() *HistoryUpdate {
|
||||
hu.mutation.ClearLink()
|
||||
return hu
|
||||
}
|
||||
|
||||
// SetStatus sets the "status" field.
|
||||
func (hu *HistoryUpdate) SetStatus(h history.Status) *HistoryUpdate {
|
||||
hu.mutation.SetStatus(h)
|
||||
@@ -329,6 +349,12 @@ func (hu *HistoryUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
if hu.mutation.IndexerIDCleared() {
|
||||
_spec.ClearField(history.FieldIndexerID, field.TypeInt)
|
||||
}
|
||||
if value, ok := hu.mutation.Link(); ok {
|
||||
_spec.SetField(history.FieldLink, field.TypeString, value)
|
||||
}
|
||||
if hu.mutation.LinkCleared() {
|
||||
_spec.ClearField(history.FieldLink, field.TypeString)
|
||||
}
|
||||
if value, ok := hu.mutation.Status(); ok {
|
||||
_spec.SetField(history.FieldStatus, field.TypeEnum, value)
|
||||
}
|
||||
@@ -523,6 +549,26 @@ func (huo *HistoryUpdateOne) ClearIndexerID() *HistoryUpdateOne {
|
||||
return huo
|
||||
}
|
||||
|
||||
// SetLink sets the "link" field.
|
||||
func (huo *HistoryUpdateOne) SetLink(s string) *HistoryUpdateOne {
|
||||
huo.mutation.SetLink(s)
|
||||
return huo
|
||||
}
|
||||
|
||||
// SetNillableLink sets the "link" field if the given value is not nil.
|
||||
func (huo *HistoryUpdateOne) SetNillableLink(s *string) *HistoryUpdateOne {
|
||||
if s != nil {
|
||||
huo.SetLink(*s)
|
||||
}
|
||||
return huo
|
||||
}
|
||||
|
||||
// ClearLink clears the value of the "link" field.
|
||||
func (huo *HistoryUpdateOne) ClearLink() *HistoryUpdateOne {
|
||||
huo.mutation.ClearLink()
|
||||
return huo
|
||||
}
|
||||
|
||||
// SetStatus sets the "status" field.
|
||||
func (huo *HistoryUpdateOne) SetStatus(h history.Status) *HistoryUpdateOne {
|
||||
huo.mutation.SetStatus(h)
|
||||
@@ -689,6 +735,12 @@ func (huo *HistoryUpdateOne) sqlSave(ctx context.Context) (_node *History, err e
|
||||
if huo.mutation.IndexerIDCleared() {
|
||||
_spec.ClearField(history.FieldIndexerID, field.TypeInt)
|
||||
}
|
||||
if value, ok := huo.mutation.Link(); ok {
|
||||
_spec.SetField(history.FieldLink, field.TypeString, value)
|
||||
}
|
||||
if huo.mutation.LinkCleared() {
|
||||
_spec.ClearField(history.FieldLink, field.TypeString)
|
||||
}
|
||||
if value, ok := huo.mutation.Status(); ok {
|
||||
_spec.SetField(history.FieldStatus, field.TypeEnum, value)
|
||||
}
|
||||
|
||||
@@ -8,6 +8,18 @@ import (
|
||||
"polaris/ent"
|
||||
)
|
||||
|
||||
// The BlacklistFunc type is an adapter to allow the use of ordinary
|
||||
// function as Blacklist mutator.
|
||||
type BlacklistFunc func(context.Context, *ent.BlacklistMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f BlacklistFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
if mv, ok := m.(*ent.BlacklistMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.BlacklistMutation", m)
|
||||
}
|
||||
|
||||
// The DownloadClientsFunc type is an adapter to allow the use of ordinary
|
||||
// function as DownloadClients mutator.
|
||||
type DownloadClientsFunc func(context.Context, *ent.DownloadClientsMutation) (ent.Value, error)
|
||||
|
||||
@@ -131,6 +131,7 @@ const (
|
||||
Resolution720p Resolution = "720p"
|
||||
Resolution1080p Resolution = "1080p"
|
||||
Resolution2160p Resolution = "2160p"
|
||||
ResolutionAny Resolution = "any"
|
||||
)
|
||||
|
||||
func (r Resolution) String() string {
|
||||
@@ -140,7 +141,7 @@ func (r Resolution) String() string {
|
||||
// ResolutionValidator is a validator for the "resolution" field enum values. It is called by the builders before save.
|
||||
func ResolutionValidator(r Resolution) error {
|
||||
switch r {
|
||||
case Resolution720p, Resolution1080p, Resolution2160p:
|
||||
case Resolution720p, Resolution1080p, Resolution2160p, ResolutionAny:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("media: invalid enum value for resolution field: %q", r)
|
||||
|
||||
@@ -8,17 +8,30 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// BlacklistsColumns holds the columns for the "blacklists" table.
|
||||
BlacklistsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "type", Type: field.TypeEnum, Enums: []string{"media", "torrent"}},
|
||||
{Name: "value", Type: field.TypeJSON},
|
||||
{Name: "notes", Type: field.TypeString, Nullable: true},
|
||||
}
|
||||
// BlacklistsTable holds the schema information for the "blacklists" table.
|
||||
BlacklistsTable = &schema.Table{
|
||||
Name: "blacklists",
|
||||
Columns: BlacklistsColumns,
|
||||
PrimaryKey: []*schema.Column{BlacklistsColumns[0]},
|
||||
}
|
||||
// DownloadClientsColumns holds the columns for the "download_clients" table.
|
||||
DownloadClientsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "enable", Type: field.TypeBool},
|
||||
{Name: "name", Type: field.TypeString},
|
||||
{Name: "implementation", Type: field.TypeString},
|
||||
{Name: "implementation", Type: field.TypeEnum, Enums: []string{"transmission", "qbittorrent"}},
|
||||
{Name: "url", Type: field.TypeString},
|
||||
{Name: "user", Type: field.TypeString, Default: ""},
|
||||
{Name: "password", Type: field.TypeString, Default: ""},
|
||||
{Name: "settings", Type: field.TypeString, Default: ""},
|
||||
{Name: "priority", Type: field.TypeString, Default: ""},
|
||||
{Name: "priority1", Type: field.TypeInt, Default: 1},
|
||||
{Name: "remove_completed_downloads", Type: field.TypeBool, Default: true},
|
||||
{Name: "remove_failed_downloads", Type: field.TypeBool, Default: true},
|
||||
{Name: "tags", Type: field.TypeString, Default: ""},
|
||||
@@ -67,6 +80,7 @@ var (
|
||||
{Name: "size", Type: field.TypeInt, Default: 0},
|
||||
{Name: "download_client_id", Type: field.TypeInt, Nullable: true},
|
||||
{Name: "indexer_id", Type: field.TypeInt, Nullable: true},
|
||||
{Name: "link", Type: field.TypeString, Nullable: true},
|
||||
{Name: "status", Type: field.TypeEnum, Enums: []string{"running", "success", "fail", "uploading", "seeding"}},
|
||||
{Name: "saved", Type: field.TypeString, Nullable: true},
|
||||
}
|
||||
@@ -121,7 +135,7 @@ var (
|
||||
{Name: "overview", Type: field.TypeString},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
{Name: "air_date", Type: field.TypeString, Default: ""},
|
||||
{Name: "resolution", Type: field.TypeEnum, Enums: []string{"720p", "1080p", "2160p"}, Default: "1080p"},
|
||||
{Name: "resolution", Type: field.TypeEnum, Enums: []string{"720p", "1080p", "2160p", "any"}, Default: "1080p"},
|
||||
{Name: "storage_id", Type: field.TypeInt, Nullable: true},
|
||||
{Name: "target_dir", Type: field.TypeString, Nullable: true},
|
||||
{Name: "download_history_episodes", Type: field.TypeBool, Nullable: true, Default: false},
|
||||
@@ -179,6 +193,7 @@ var (
|
||||
}
|
||||
// Tables holds all the tables in the schema.
|
||||
Tables = []*schema.Table{
|
||||
BlacklistsTable,
|
||||
DownloadClientsTable,
|
||||
EpisodesTable,
|
||||
HistoriesTable,
|
||||
|
||||
637
ent/mutation.go
637
ent/mutation.go
@@ -6,6 +6,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"polaris/ent/blacklist"
|
||||
"polaris/ent/downloadclients"
|
||||
"polaris/ent/episode"
|
||||
"polaris/ent/history"
|
||||
@@ -33,6 +34,7 @@ const (
|
||||
OpUpdateOne = ent.OpUpdateOne
|
||||
|
||||
// Node types.
|
||||
TypeBlacklist = "Blacklist"
|
||||
TypeDownloadClients = "DownloadClients"
|
||||
TypeEpisode = "Episode"
|
||||
TypeHistory = "History"
|
||||
@@ -44,6 +46,462 @@ const (
|
||||
TypeStorage = "Storage"
|
||||
)
|
||||
|
||||
// BlacklistMutation represents an operation that mutates the Blacklist nodes in the graph.
|
||||
type BlacklistMutation struct {
|
||||
config
|
||||
op Op
|
||||
typ string
|
||||
id *int
|
||||
_type *blacklist.Type
|
||||
value *schema.BlacklistValue
|
||||
notes *string
|
||||
clearedFields map[string]struct{}
|
||||
done bool
|
||||
oldValue func(context.Context) (*Blacklist, error)
|
||||
predicates []predicate.Blacklist
|
||||
}
|
||||
|
||||
var _ ent.Mutation = (*BlacklistMutation)(nil)
|
||||
|
||||
// blacklistOption allows management of the mutation configuration using functional options.
|
||||
type blacklistOption func(*BlacklistMutation)
|
||||
|
||||
// newBlacklistMutation creates new mutation for the Blacklist entity.
|
||||
func newBlacklistMutation(c config, op Op, opts ...blacklistOption) *BlacklistMutation {
|
||||
m := &BlacklistMutation{
|
||||
config: c,
|
||||
op: op,
|
||||
typ: TypeBlacklist,
|
||||
clearedFields: make(map[string]struct{}),
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(m)
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// withBlacklistID sets the ID field of the mutation.
|
||||
func withBlacklistID(id int) blacklistOption {
|
||||
return func(m *BlacklistMutation) {
|
||||
var (
|
||||
err error
|
||||
once sync.Once
|
||||
value *Blacklist
|
||||
)
|
||||
m.oldValue = func(ctx context.Context) (*Blacklist, error) {
|
||||
once.Do(func() {
|
||||
if m.done {
|
||||
err = errors.New("querying old values post mutation is not allowed")
|
||||
} else {
|
||||
value, err = m.Client().Blacklist.Get(ctx, id)
|
||||
}
|
||||
})
|
||||
return value, err
|
||||
}
|
||||
m.id = &id
|
||||
}
|
||||
}
|
||||
|
||||
// withBlacklist sets the old Blacklist of the mutation.
|
||||
func withBlacklist(node *Blacklist) blacklistOption {
|
||||
return func(m *BlacklistMutation) {
|
||||
m.oldValue = func(context.Context) (*Blacklist, error) {
|
||||
return node, nil
|
||||
}
|
||||
m.id = &node.ID
|
||||
}
|
||||
}
|
||||
|
||||
// Client returns a new `ent.Client` from the mutation. If the mutation was
|
||||
// executed in a transaction (ent.Tx), a transactional client is returned.
|
||||
func (m BlacklistMutation) Client() *Client {
|
||||
client := &Client{config: m.config}
|
||||
client.init()
|
||||
return client
|
||||
}
|
||||
|
||||
// Tx returns an `ent.Tx` for mutations that were executed in transactions;
|
||||
// it returns an error otherwise.
|
||||
func (m BlacklistMutation) Tx() (*Tx, error) {
|
||||
if _, ok := m.driver.(*txDriver); !ok {
|
||||
return nil, errors.New("ent: mutation is not running in a transaction")
|
||||
}
|
||||
tx := &Tx{config: m.config}
|
||||
tx.init()
|
||||
return tx, nil
|
||||
}
|
||||
|
||||
// ID returns the ID value in the mutation. Note that the ID is only available
|
||||
// if it was provided to the builder or after it was returned from the database.
|
||||
func (m *BlacklistMutation) ID() (id int, exists bool) {
|
||||
if m.id == nil {
|
||||
return
|
||||
}
|
||||
return *m.id, true
|
||||
}
|
||||
|
||||
// IDs queries the database and returns the entity ids that match the mutation's predicate.
|
||||
// That means, if the mutation is applied within a transaction with an isolation level such
|
||||
// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
|
||||
// or updated by the mutation.
|
||||
func (m *BlacklistMutation) IDs(ctx context.Context) ([]int, error) {
|
||||
switch {
|
||||
case m.op.Is(OpUpdateOne | OpDeleteOne):
|
||||
id, exists := m.ID()
|
||||
if exists {
|
||||
return []int{id}, nil
|
||||
}
|
||||
fallthrough
|
||||
case m.op.Is(OpUpdate | OpDelete):
|
||||
return m.Client().Blacklist.Query().Where(m.predicates...).IDs(ctx)
|
||||
default:
|
||||
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
|
||||
}
|
||||
}
|
||||
|
||||
// SetType sets the "type" field.
|
||||
func (m *BlacklistMutation) SetType(b blacklist.Type) {
|
||||
m._type = &b
|
||||
}
|
||||
|
||||
// GetType returns the value of the "type" field in the mutation.
|
||||
func (m *BlacklistMutation) GetType() (r blacklist.Type, exists bool) {
|
||||
v := m._type
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldType returns the old "type" field's value of the Blacklist entity.
|
||||
// If the Blacklist 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 *BlacklistMutation) OldType(ctx context.Context) (v blacklist.Type, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldType is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldType requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldType: %w", err)
|
||||
}
|
||||
return oldValue.Type, nil
|
||||
}
|
||||
|
||||
// ResetType resets all changes to the "type" field.
|
||||
func (m *BlacklistMutation) ResetType() {
|
||||
m._type = nil
|
||||
}
|
||||
|
||||
// SetValue sets the "value" field.
|
||||
func (m *BlacklistMutation) SetValue(sv schema.BlacklistValue) {
|
||||
m.value = &sv
|
||||
}
|
||||
|
||||
// Value returns the value of the "value" field in the mutation.
|
||||
func (m *BlacklistMutation) Value() (r schema.BlacklistValue, exists bool) {
|
||||
v := m.value
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldValue returns the old "value" field's value of the Blacklist entity.
|
||||
// If the Blacklist 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 *BlacklistMutation) OldValue(ctx context.Context) (v schema.BlacklistValue, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldValue is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldValue requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldValue: %w", err)
|
||||
}
|
||||
return oldValue.Value, nil
|
||||
}
|
||||
|
||||
// ResetValue resets all changes to the "value" field.
|
||||
func (m *BlacklistMutation) ResetValue() {
|
||||
m.value = nil
|
||||
}
|
||||
|
||||
// SetNotes sets the "notes" field.
|
||||
func (m *BlacklistMutation) SetNotes(s string) {
|
||||
m.notes = &s
|
||||
}
|
||||
|
||||
// Notes returns the value of the "notes" field in the mutation.
|
||||
func (m *BlacklistMutation) Notes() (r string, exists bool) {
|
||||
v := m.notes
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldNotes returns the old "notes" field's value of the Blacklist entity.
|
||||
// If the Blacklist 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 *BlacklistMutation) OldNotes(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldNotes is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldNotes requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldNotes: %w", err)
|
||||
}
|
||||
return oldValue.Notes, nil
|
||||
}
|
||||
|
||||
// ClearNotes clears the value of the "notes" field.
|
||||
func (m *BlacklistMutation) ClearNotes() {
|
||||
m.notes = nil
|
||||
m.clearedFields[blacklist.FieldNotes] = struct{}{}
|
||||
}
|
||||
|
||||
// NotesCleared returns if the "notes" field was cleared in this mutation.
|
||||
func (m *BlacklistMutation) NotesCleared() bool {
|
||||
_, ok := m.clearedFields[blacklist.FieldNotes]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetNotes resets all changes to the "notes" field.
|
||||
func (m *BlacklistMutation) ResetNotes() {
|
||||
m.notes = nil
|
||||
delete(m.clearedFields, blacklist.FieldNotes)
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the BlacklistMutation builder.
|
||||
func (m *BlacklistMutation) Where(ps ...predicate.Blacklist) {
|
||||
m.predicates = append(m.predicates, ps...)
|
||||
}
|
||||
|
||||
// WhereP appends storage-level predicates to the BlacklistMutation builder. Using this method,
|
||||
// users can use type-assertion to append predicates that do not depend on any generated package.
|
||||
func (m *BlacklistMutation) WhereP(ps ...func(*sql.Selector)) {
|
||||
p := make([]predicate.Blacklist, len(ps))
|
||||
for i := range ps {
|
||||
p[i] = ps[i]
|
||||
}
|
||||
m.Where(p...)
|
||||
}
|
||||
|
||||
// Op returns the operation name.
|
||||
func (m *BlacklistMutation) Op() Op {
|
||||
return m.op
|
||||
}
|
||||
|
||||
// SetOp allows setting the mutation operation.
|
||||
func (m *BlacklistMutation) SetOp(op Op) {
|
||||
m.op = op
|
||||
}
|
||||
|
||||
// Type returns the node type of this mutation (Blacklist).
|
||||
func (m *BlacklistMutation) Type() string {
|
||||
return m.typ
|
||||
}
|
||||
|
||||
// Fields returns all fields that were changed during this mutation. Note that in
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *BlacklistMutation) Fields() []string {
|
||||
fields := make([]string, 0, 3)
|
||||
if m._type != nil {
|
||||
fields = append(fields, blacklist.FieldType)
|
||||
}
|
||||
if m.value != nil {
|
||||
fields = append(fields, blacklist.FieldValue)
|
||||
}
|
||||
if m.notes != nil {
|
||||
fields = append(fields, blacklist.FieldNotes)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
// Field returns the value of a field with the given name. The second boolean
|
||||
// return value indicates that this field was not set, or was not defined in the
|
||||
// schema.
|
||||
func (m *BlacklistMutation) Field(name string) (ent.Value, bool) {
|
||||
switch name {
|
||||
case blacklist.FieldType:
|
||||
return m.GetType()
|
||||
case blacklist.FieldValue:
|
||||
return m.Value()
|
||||
case blacklist.FieldNotes:
|
||||
return m.Notes()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// OldField returns the old value of the field from the database. An error is
|
||||
// returned if the mutation operation is not UpdateOne, or the query to the
|
||||
// database failed.
|
||||
func (m *BlacklistMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
||||
switch name {
|
||||
case blacklist.FieldType:
|
||||
return m.OldType(ctx)
|
||||
case blacklist.FieldValue:
|
||||
return m.OldValue(ctx)
|
||||
case blacklist.FieldNotes:
|
||||
return m.OldNotes(ctx)
|
||||
}
|
||||
return nil, fmt.Errorf("unknown Blacklist field %s", name)
|
||||
}
|
||||
|
||||
// SetField sets the value of a field with the given name. It returns an error if
|
||||
// the field is not defined in the schema, or if the type mismatched the field
|
||||
// type.
|
||||
func (m *BlacklistMutation) SetField(name string, value ent.Value) error {
|
||||
switch name {
|
||||
case blacklist.FieldType:
|
||||
v, ok := value.(blacklist.Type)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetType(v)
|
||||
return nil
|
||||
case blacklist.FieldValue:
|
||||
v, ok := value.(schema.BlacklistValue)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetValue(v)
|
||||
return nil
|
||||
case blacklist.FieldNotes:
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetNotes(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Blacklist field %s", name)
|
||||
}
|
||||
|
||||
// AddedFields returns all numeric fields that were incremented/decremented during
|
||||
// this mutation.
|
||||
func (m *BlacklistMutation) AddedFields() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddedField returns the numeric value that was incremented/decremented on a field
|
||||
// with the given name. The second boolean return value indicates that this field
|
||||
// was not set, or was not defined in the schema.
|
||||
func (m *BlacklistMutation) AddedField(name string) (ent.Value, bool) {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// AddField adds the value to the field with the given name. It returns an error if
|
||||
// the field is not defined in the schema, or if the type mismatched the field
|
||||
// type.
|
||||
func (m *BlacklistMutation) AddField(name string, value ent.Value) error {
|
||||
switch name {
|
||||
}
|
||||
return fmt.Errorf("unknown Blacklist numeric field %s", name)
|
||||
}
|
||||
|
||||
// ClearedFields returns all nullable fields that were cleared during this
|
||||
// mutation.
|
||||
func (m *BlacklistMutation) ClearedFields() []string {
|
||||
var fields []string
|
||||
if m.FieldCleared(blacklist.FieldNotes) {
|
||||
fields = append(fields, blacklist.FieldNotes)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
// FieldCleared returns a boolean indicating if a field with the given name was
|
||||
// cleared in this mutation.
|
||||
func (m *BlacklistMutation) FieldCleared(name string) bool {
|
||||
_, ok := m.clearedFields[name]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ClearField clears the value of the field with the given name. It returns an
|
||||
// error if the field is not defined in the schema.
|
||||
func (m *BlacklistMutation) ClearField(name string) error {
|
||||
switch name {
|
||||
case blacklist.FieldNotes:
|
||||
m.ClearNotes()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Blacklist nullable field %s", name)
|
||||
}
|
||||
|
||||
// ResetField resets all changes in the mutation for the field with the given name.
|
||||
// It returns an error if the field is not defined in the schema.
|
||||
func (m *BlacklistMutation) ResetField(name string) error {
|
||||
switch name {
|
||||
case blacklist.FieldType:
|
||||
m.ResetType()
|
||||
return nil
|
||||
case blacklist.FieldValue:
|
||||
m.ResetValue()
|
||||
return nil
|
||||
case blacklist.FieldNotes:
|
||||
m.ResetNotes()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Blacklist field %s", name)
|
||||
}
|
||||
|
||||
// AddedEdges returns all edge names that were set/added in this mutation.
|
||||
func (m *BlacklistMutation) AddedEdges() []string {
|
||||
edges := make([]string, 0, 0)
|
||||
return edges
|
||||
}
|
||||
|
||||
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
|
||||
// name in this mutation.
|
||||
func (m *BlacklistMutation) AddedIDs(name string) []ent.Value {
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemovedEdges returns all edge names that were removed in this mutation.
|
||||
func (m *BlacklistMutation) RemovedEdges() []string {
|
||||
edges := make([]string, 0, 0)
|
||||
return edges
|
||||
}
|
||||
|
||||
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
||||
// the given name in this mutation.
|
||||
func (m *BlacklistMutation) RemovedIDs(name string) []ent.Value {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ClearedEdges returns all edge names that were cleared in this mutation.
|
||||
func (m *BlacklistMutation) ClearedEdges() []string {
|
||||
edges := make([]string, 0, 0)
|
||||
return edges
|
||||
}
|
||||
|
||||
// EdgeCleared returns a boolean which indicates if the edge with the given name
|
||||
// was cleared in this mutation.
|
||||
func (m *BlacklistMutation) EdgeCleared(name string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// ClearEdge clears the value of the edge with the given name. It returns an error
|
||||
// if that edge is not defined in the schema.
|
||||
func (m *BlacklistMutation) ClearEdge(name string) error {
|
||||
return fmt.Errorf("unknown Blacklist unique edge %s", name)
|
||||
}
|
||||
|
||||
// ResetEdge resets all changes to the edge with the given name in this mutation.
|
||||
// It returns an error if the edge is not defined in the schema.
|
||||
func (m *BlacklistMutation) ResetEdge(name string) error {
|
||||
return fmt.Errorf("unknown Blacklist edge %s", name)
|
||||
}
|
||||
|
||||
// DownloadClientsMutation represents an operation that mutates the DownloadClients nodes in the graph.
|
||||
type DownloadClientsMutation struct {
|
||||
config
|
||||
@@ -52,12 +510,13 @@ type DownloadClientsMutation struct {
|
||||
id *int
|
||||
enable *bool
|
||||
name *string
|
||||
implementation *string
|
||||
implementation *downloadclients.Implementation
|
||||
url *string
|
||||
user *string
|
||||
password *string
|
||||
settings *string
|
||||
priority *string
|
||||
priority1 *int
|
||||
addpriority1 *int
|
||||
remove_completed_downloads *bool
|
||||
remove_failed_downloads *bool
|
||||
tags *string
|
||||
@@ -238,12 +697,12 @@ func (m *DownloadClientsMutation) ResetName() {
|
||||
}
|
||||
|
||||
// SetImplementation sets the "implementation" field.
|
||||
func (m *DownloadClientsMutation) SetImplementation(s string) {
|
||||
m.implementation = &s
|
||||
func (m *DownloadClientsMutation) SetImplementation(d downloadclients.Implementation) {
|
||||
m.implementation = &d
|
||||
}
|
||||
|
||||
// Implementation returns the value of the "implementation" field in the mutation.
|
||||
func (m *DownloadClientsMutation) Implementation() (r string, exists bool) {
|
||||
func (m *DownloadClientsMutation) Implementation() (r downloadclients.Implementation, exists bool) {
|
||||
v := m.implementation
|
||||
if v == nil {
|
||||
return
|
||||
@@ -254,7 +713,7 @@ func (m *DownloadClientsMutation) Implementation() (r string, exists bool) {
|
||||
// OldImplementation returns the old "implementation" field's value of the DownloadClients entity.
|
||||
// If the DownloadClients 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 *DownloadClientsMutation) OldImplementation(ctx context.Context) (v string, err error) {
|
||||
func (m *DownloadClientsMutation) OldImplementation(ctx context.Context) (v downloadclients.Implementation, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldImplementation is only allowed on UpdateOne operations")
|
||||
}
|
||||
@@ -417,40 +876,60 @@ func (m *DownloadClientsMutation) ResetSettings() {
|
||||
m.settings = nil
|
||||
}
|
||||
|
||||
// SetPriority sets the "priority" field.
|
||||
func (m *DownloadClientsMutation) SetPriority(s string) {
|
||||
m.priority = &s
|
||||
// SetPriority1 sets the "priority1" field.
|
||||
func (m *DownloadClientsMutation) SetPriority1(i int) {
|
||||
m.priority1 = &i
|
||||
m.addpriority1 = nil
|
||||
}
|
||||
|
||||
// Priority returns the value of the "priority" field in the mutation.
|
||||
func (m *DownloadClientsMutation) Priority() (r string, exists bool) {
|
||||
v := m.priority
|
||||
// Priority1 returns the value of the "priority1" field in the mutation.
|
||||
func (m *DownloadClientsMutation) Priority1() (r int, exists bool) {
|
||||
v := m.priority1
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldPriority returns the old "priority" field's value of the DownloadClients entity.
|
||||
// OldPriority1 returns the old "priority1" field's value of the DownloadClients entity.
|
||||
// If the DownloadClients 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 *DownloadClientsMutation) OldPriority(ctx context.Context) (v string, err error) {
|
||||
func (m *DownloadClientsMutation) OldPriority1(ctx context.Context) (v int, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldPriority is only allowed on UpdateOne operations")
|
||||
return v, errors.New("OldPriority1 is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldPriority requires an ID field in the mutation")
|
||||
return v, errors.New("OldPriority1 requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldPriority: %w", err)
|
||||
return v, fmt.Errorf("querying old value for OldPriority1: %w", err)
|
||||
}
|
||||
return oldValue.Priority, nil
|
||||
return oldValue.Priority1, nil
|
||||
}
|
||||
|
||||
// ResetPriority resets all changes to the "priority" field.
|
||||
func (m *DownloadClientsMutation) ResetPriority() {
|
||||
m.priority = nil
|
||||
// AddPriority1 adds i to the "priority1" field.
|
||||
func (m *DownloadClientsMutation) AddPriority1(i int) {
|
||||
if m.addpriority1 != nil {
|
||||
*m.addpriority1 += i
|
||||
} else {
|
||||
m.addpriority1 = &i
|
||||
}
|
||||
}
|
||||
|
||||
// AddedPriority1 returns the value that was added to the "priority1" field in this mutation.
|
||||
func (m *DownloadClientsMutation) AddedPriority1() (r int, exists bool) {
|
||||
v := m.addpriority1
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ResetPriority1 resets all changes to the "priority1" field.
|
||||
func (m *DownloadClientsMutation) ResetPriority1() {
|
||||
m.priority1 = nil
|
||||
m.addpriority1 = nil
|
||||
}
|
||||
|
||||
// SetRemoveCompletedDownloads sets the "remove_completed_downloads" field.
|
||||
@@ -617,8 +1096,8 @@ func (m *DownloadClientsMutation) Fields() []string {
|
||||
if m.settings != nil {
|
||||
fields = append(fields, downloadclients.FieldSettings)
|
||||
}
|
||||
if m.priority != nil {
|
||||
fields = append(fields, downloadclients.FieldPriority)
|
||||
if m.priority1 != nil {
|
||||
fields = append(fields, downloadclients.FieldPriority1)
|
||||
}
|
||||
if m.remove_completed_downloads != nil {
|
||||
fields = append(fields, downloadclients.FieldRemoveCompletedDownloads)
|
||||
@@ -651,8 +1130,8 @@ func (m *DownloadClientsMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.Password()
|
||||
case downloadclients.FieldSettings:
|
||||
return m.Settings()
|
||||
case downloadclients.FieldPriority:
|
||||
return m.Priority()
|
||||
case downloadclients.FieldPriority1:
|
||||
return m.Priority1()
|
||||
case downloadclients.FieldRemoveCompletedDownloads:
|
||||
return m.RemoveCompletedDownloads()
|
||||
case downloadclients.FieldRemoveFailedDownloads:
|
||||
@@ -682,8 +1161,8 @@ func (m *DownloadClientsMutation) OldField(ctx context.Context, name string) (en
|
||||
return m.OldPassword(ctx)
|
||||
case downloadclients.FieldSettings:
|
||||
return m.OldSettings(ctx)
|
||||
case downloadclients.FieldPriority:
|
||||
return m.OldPriority(ctx)
|
||||
case downloadclients.FieldPriority1:
|
||||
return m.OldPriority1(ctx)
|
||||
case downloadclients.FieldRemoveCompletedDownloads:
|
||||
return m.OldRemoveCompletedDownloads(ctx)
|
||||
case downloadclients.FieldRemoveFailedDownloads:
|
||||
@@ -714,7 +1193,7 @@ func (m *DownloadClientsMutation) SetField(name string, value ent.Value) error {
|
||||
m.SetName(v)
|
||||
return nil
|
||||
case downloadclients.FieldImplementation:
|
||||
v, ok := value.(string)
|
||||
v, ok := value.(downloadclients.Implementation)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
@@ -748,12 +1227,12 @@ func (m *DownloadClientsMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetSettings(v)
|
||||
return nil
|
||||
case downloadclients.FieldPriority:
|
||||
v, ok := value.(string)
|
||||
case downloadclients.FieldPriority1:
|
||||
v, ok := value.(int)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetPriority(v)
|
||||
m.SetPriority1(v)
|
||||
return nil
|
||||
case downloadclients.FieldRemoveCompletedDownloads:
|
||||
v, ok := value.(bool)
|
||||
@@ -783,13 +1262,21 @@ func (m *DownloadClientsMutation) SetField(name string, value ent.Value) error {
|
||||
// AddedFields returns all numeric fields that were incremented/decremented during
|
||||
// this mutation.
|
||||
func (m *DownloadClientsMutation) AddedFields() []string {
|
||||
return nil
|
||||
var fields []string
|
||||
if m.addpriority1 != nil {
|
||||
fields = append(fields, downloadclients.FieldPriority1)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
// AddedField returns the numeric value that was incremented/decremented on a field
|
||||
// with the given name. The second boolean return value indicates that this field
|
||||
// was not set, or was not defined in the schema.
|
||||
func (m *DownloadClientsMutation) AddedField(name string) (ent.Value, bool) {
|
||||
switch name {
|
||||
case downloadclients.FieldPriority1:
|
||||
return m.AddedPriority1()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
|
||||
@@ -798,6 +1285,13 @@ func (m *DownloadClientsMutation) AddedField(name string) (ent.Value, bool) {
|
||||
// type.
|
||||
func (m *DownloadClientsMutation) AddField(name string, value ent.Value) error {
|
||||
switch name {
|
||||
case downloadclients.FieldPriority1:
|
||||
v, ok := value.(int)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.AddPriority1(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown DownloadClients numeric field %s", name)
|
||||
}
|
||||
@@ -846,8 +1340,8 @@ func (m *DownloadClientsMutation) ResetField(name string) error {
|
||||
case downloadclients.FieldSettings:
|
||||
m.ResetSettings()
|
||||
return nil
|
||||
case downloadclients.FieldPriority:
|
||||
m.ResetPriority()
|
||||
case downloadclients.FieldPriority1:
|
||||
m.ResetPriority1()
|
||||
return nil
|
||||
case downloadclients.FieldRemoveCompletedDownloads:
|
||||
m.ResetRemoveCompletedDownloads()
|
||||
@@ -1851,6 +2345,7 @@ type HistoryMutation struct {
|
||||
adddownload_client_id *int
|
||||
indexer_id *int
|
||||
addindexer_id *int
|
||||
link *string
|
||||
status *history.Status
|
||||
saved *string
|
||||
clearedFields map[string]struct{}
|
||||
@@ -2387,6 +2882,55 @@ func (m *HistoryMutation) ResetIndexerID() {
|
||||
delete(m.clearedFields, history.FieldIndexerID)
|
||||
}
|
||||
|
||||
// SetLink sets the "link" field.
|
||||
func (m *HistoryMutation) SetLink(s string) {
|
||||
m.link = &s
|
||||
}
|
||||
|
||||
// Link returns the value of the "link" field in the mutation.
|
||||
func (m *HistoryMutation) Link() (r string, exists bool) {
|
||||
v := m.link
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldLink returns the old "link" field's value of the History entity.
|
||||
// If the History 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 *HistoryMutation) OldLink(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldLink is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldLink requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldLink: %w", err)
|
||||
}
|
||||
return oldValue.Link, nil
|
||||
}
|
||||
|
||||
// ClearLink clears the value of the "link" field.
|
||||
func (m *HistoryMutation) ClearLink() {
|
||||
m.link = nil
|
||||
m.clearedFields[history.FieldLink] = struct{}{}
|
||||
}
|
||||
|
||||
// LinkCleared returns if the "link" field was cleared in this mutation.
|
||||
func (m *HistoryMutation) LinkCleared() bool {
|
||||
_, ok := m.clearedFields[history.FieldLink]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetLink resets all changes to the "link" field.
|
||||
func (m *HistoryMutation) ResetLink() {
|
||||
m.link = nil
|
||||
delete(m.clearedFields, history.FieldLink)
|
||||
}
|
||||
|
||||
// SetStatus sets the "status" field.
|
||||
func (m *HistoryMutation) SetStatus(h history.Status) {
|
||||
m.status = &h
|
||||
@@ -2506,7 +3050,7 @@ func (m *HistoryMutation) Type() string {
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *HistoryMutation) Fields() []string {
|
||||
fields := make([]string, 0, 10)
|
||||
fields := make([]string, 0, 11)
|
||||
if m.media_id != nil {
|
||||
fields = append(fields, history.FieldMediaID)
|
||||
}
|
||||
@@ -2531,6 +3075,9 @@ func (m *HistoryMutation) Fields() []string {
|
||||
if m.indexer_id != nil {
|
||||
fields = append(fields, history.FieldIndexerID)
|
||||
}
|
||||
if m.link != nil {
|
||||
fields = append(fields, history.FieldLink)
|
||||
}
|
||||
if m.status != nil {
|
||||
fields = append(fields, history.FieldStatus)
|
||||
}
|
||||
@@ -2561,6 +3108,8 @@ func (m *HistoryMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.DownloadClientID()
|
||||
case history.FieldIndexerID:
|
||||
return m.IndexerID()
|
||||
case history.FieldLink:
|
||||
return m.Link()
|
||||
case history.FieldStatus:
|
||||
return m.Status()
|
||||
case history.FieldSaved:
|
||||
@@ -2590,6 +3139,8 @@ func (m *HistoryMutation) OldField(ctx context.Context, name string) (ent.Value,
|
||||
return m.OldDownloadClientID(ctx)
|
||||
case history.FieldIndexerID:
|
||||
return m.OldIndexerID(ctx)
|
||||
case history.FieldLink:
|
||||
return m.OldLink(ctx)
|
||||
case history.FieldStatus:
|
||||
return m.OldStatus(ctx)
|
||||
case history.FieldSaved:
|
||||
@@ -2659,6 +3210,13 @@ func (m *HistoryMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetIndexerID(v)
|
||||
return nil
|
||||
case history.FieldLink:
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetLink(v)
|
||||
return nil
|
||||
case history.FieldStatus:
|
||||
v, ok := value.(history.Status)
|
||||
if !ok {
|
||||
@@ -2775,6 +3333,9 @@ func (m *HistoryMutation) ClearedFields() []string {
|
||||
if m.FieldCleared(history.FieldIndexerID) {
|
||||
fields = append(fields, history.FieldIndexerID)
|
||||
}
|
||||
if m.FieldCleared(history.FieldLink) {
|
||||
fields = append(fields, history.FieldLink)
|
||||
}
|
||||
if m.FieldCleared(history.FieldSaved) {
|
||||
fields = append(fields, history.FieldSaved)
|
||||
}
|
||||
@@ -2801,6 +3362,9 @@ func (m *HistoryMutation) ClearField(name string) error {
|
||||
case history.FieldIndexerID:
|
||||
m.ClearIndexerID()
|
||||
return nil
|
||||
case history.FieldLink:
|
||||
m.ClearLink()
|
||||
return nil
|
||||
case history.FieldSaved:
|
||||
m.ClearSaved()
|
||||
return nil
|
||||
@@ -2836,6 +3400,9 @@ func (m *HistoryMutation) ResetField(name string) error {
|
||||
case history.FieldIndexerID:
|
||||
m.ResetIndexerID()
|
||||
return nil
|
||||
case history.FieldLink:
|
||||
m.ResetLink()
|
||||
return nil
|
||||
case history.FieldStatus:
|
||||
m.ResetStatus()
|
||||
return nil
|
||||
|
||||
@@ -6,6 +6,9 @@ import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// Blacklist is the predicate function for blacklist builders.
|
||||
type Blacklist func(*sql.Selector)
|
||||
|
||||
// DownloadClients is the predicate function for downloadclients builders.
|
||||
type DownloadClients func(*sql.Selector)
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"polaris/ent/blacklist"
|
||||
"polaris/ent/downloadclients"
|
||||
"polaris/ent/episode"
|
||||
"polaris/ent/history"
|
||||
@@ -18,6 +19,12 @@ import (
|
||||
// (default values, validators, hooks and policies) and stitches it
|
||||
// to their package variables.
|
||||
func init() {
|
||||
blacklistFields := schema.Blacklist{}.Fields()
|
||||
_ = blacklistFields
|
||||
// blacklistDescValue is the schema descriptor for value field.
|
||||
blacklistDescValue := blacklistFields[1].Descriptor()
|
||||
// blacklist.DefaultValue holds the default value on creation for the value field.
|
||||
blacklist.DefaultValue = blacklistDescValue.Default.(schema.BlacklistValue)
|
||||
downloadclientsFields := schema.DownloadClients{}.Fields()
|
||||
_ = downloadclientsFields
|
||||
// downloadclientsDescUser is the schema descriptor for user field.
|
||||
@@ -32,10 +39,12 @@ func init() {
|
||||
downloadclientsDescSettings := downloadclientsFields[6].Descriptor()
|
||||
// downloadclients.DefaultSettings holds the default value on creation for the settings field.
|
||||
downloadclients.DefaultSettings = downloadclientsDescSettings.Default.(string)
|
||||
// downloadclientsDescPriority is the schema descriptor for priority field.
|
||||
downloadclientsDescPriority := downloadclientsFields[7].Descriptor()
|
||||
// downloadclients.DefaultPriority holds the default value on creation for the priority field.
|
||||
downloadclients.DefaultPriority = downloadclientsDescPriority.Default.(string)
|
||||
// downloadclientsDescPriority1 is the schema descriptor for priority1 field.
|
||||
downloadclientsDescPriority1 := downloadclientsFields[7].Descriptor()
|
||||
// downloadclients.DefaultPriority1 holds the default value on creation for the priority1 field.
|
||||
downloadclients.DefaultPriority1 = downloadclientsDescPriority1.Default.(int)
|
||||
// downloadclients.Priority1Validator is a validator for the "priority1" field. It is called by the builders before save.
|
||||
downloadclients.Priority1Validator = downloadclientsDescPriority1.Validators[0].(func(int) error)
|
||||
// downloadclientsDescRemoveCompletedDownloads is the schema descriptor for remove_completed_downloads field.
|
||||
downloadclientsDescRemoveCompletedDownloads := downloadclientsFields[8].Descriptor()
|
||||
// downloadclients.DefaultRemoveCompletedDownloads holds the default value on creation for the remove_completed_downloads field.
|
||||
|
||||
30
ent/schema/blacklist.go
Normal file
30
ent/schema/blacklist.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// Blacklist holds the schema definition for the Blacklist entity.
|
||||
type Blacklist struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Fields of the Blacklist.
|
||||
func (Blacklist) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Enum("type").Values("media", "torrent"),
|
||||
field.JSON("value", BlacklistValue{}).Default(BlacklistValue{}),
|
||||
field.String("notes").Optional(),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the Blacklist.
|
||||
func (Blacklist) Edges() []ent.Edge {
|
||||
return nil
|
||||
}
|
||||
|
||||
type BlacklistValue struct {
|
||||
TmdbID int `json:"tmdb_id"`
|
||||
TorrentHash string `json:"torrent_hash"`
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
@@ -15,12 +17,20 @@ func (DownloadClients) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Bool("enable"),
|
||||
field.String("name"),
|
||||
field.String("implementation"),
|
||||
field.Enum("implementation").Values("transmission", "qbittorrent"),
|
||||
field.String("url"),
|
||||
field.String("user").Default(""),
|
||||
field.String("password").Default(""),
|
||||
field.String("settings").Default(""),
|
||||
field.String("priority").Default(""),
|
||||
field.Int("priority1").Default(1).Validate(func(i int) error {
|
||||
if i > 50 {
|
||||
return errors.ErrUnsupported
|
||||
}
|
||||
if i <= 0 {
|
||||
return errors.ErrUnsupported
|
||||
}
|
||||
return nil
|
||||
}),
|
||||
field.Bool("remove_completed_downloads").Default(true),
|
||||
field.Bool("remove_failed_downloads").Default(true),
|
||||
field.String("tags").Default(""),
|
||||
|
||||
@@ -21,8 +21,9 @@ func (History) Fields() []ent.Field {
|
||||
field.Int("size").Default(0),
|
||||
field.Int("download_client_id").Optional(),
|
||||
field.Int("indexer_id").Optional(),
|
||||
field.String("link").Optional(), //should be magnet link
|
||||
field.Enum("status").Values("running", "success", "fail", "uploading", "seeding"),
|
||||
field.String("saved").Optional(),
|
||||
field.String("saved").Optional().Comment("deprecated"), //deprecated
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ func (Media) Fields() []ent.Field {
|
||||
field.String("overview"),
|
||||
field.Time("created_at").Default(time.Now()),
|
||||
field.String("air_date").Default(""),
|
||||
field.Enum("resolution").Values("720p", "1080p", "2160p").Default("1080p"),
|
||||
field.Enum("resolution").Values("720p", "1080p", "2160p", "any").Default("1080p"),
|
||||
field.Int("storage_id").Optional(),
|
||||
field.String("target_dir").Optional(),
|
||||
field.Bool("download_history_episodes").Optional().Default(false).Comment("tv series only"),
|
||||
|
||||
@@ -12,6 +12,8 @@ import (
|
||||
// Tx is a transactional client that is created by calling Client.Tx().
|
||||
type Tx struct {
|
||||
config
|
||||
// Blacklist is the client for interacting with the Blacklist builders.
|
||||
Blacklist *BlacklistClient
|
||||
// DownloadClients is the client for interacting with the DownloadClients builders.
|
||||
DownloadClients *DownloadClientsClient
|
||||
// Episode is the client for interacting with the Episode builders.
|
||||
@@ -161,6 +163,7 @@ func (tx *Tx) Client() *Client {
|
||||
}
|
||||
|
||||
func (tx *Tx) init() {
|
||||
tx.Blacklist = NewBlacklistClient(tx.config)
|
||||
tx.DownloadClients = NewDownloadClientsClient(tx.config)
|
||||
tx.Episode = NewEpisodeClient(tx.config)
|
||||
tx.History = NewHistoryClient(tx.config)
|
||||
@@ -179,7 +182,7 @@ func (tx *Tx) init() {
|
||||
// of them in order to commit or rollback the transaction.
|
||||
//
|
||||
// If a closed transaction is embedded in one of the generated entities, and the entity
|
||||
// applies a query, for example: DownloadClients.QueryXXX(), the query will be executed
|
||||
// applies a query, for example: Blacklist.QueryXXX(), the query will be executed
|
||||
// through the driver which created this transaction.
|
||||
//
|
||||
// Note that txDriver is not goroutine safe.
|
||||
|
||||
12
entrypoint.sh
Normal file
12
entrypoint.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
groupadd -g ${PGID} abc1
|
||||
useradd abc1 -u ${PUID} -g ${PGID} -m -s /bin/bash
|
||||
|
||||
## 重设权限
|
||||
chown -R "${PUID}:${PGID}" /app/data
|
||||
|
||||
umask ${UMASK:-022}
|
||||
|
||||
cd /app
|
||||
exec gosu "${PUID}:${PGID}" /app/polaris
|
||||
40
go.mod
40
go.mod
@@ -1,36 +1,56 @@
|
||||
module polaris
|
||||
|
||||
go 1.22.4
|
||||
go 1.23
|
||||
|
||||
toolchain go1.23.1
|
||||
|
||||
require (
|
||||
entgo.io/ent v0.13.1
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1
|
||||
github.com/mattn/go-sqlite3 v1.14.16
|
||||
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
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/PuerkitoBio/goquery v1.9.2
|
||||
github.com/anacrolix/torrent v1.57.1
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
|
||||
github.com/gin-contrib/zap v1.1.3
|
||||
github.com/ncruces/go-sqlite3 v0.18.4
|
||||
github.com/nikoksr/notify v1.0.0
|
||||
github.com/stretchr/testify v1.9.0
|
||||
golift.io/starr v1.0.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/BurntSushi/toml v1.4.0 // indirect
|
||||
github.com/PuerkitoBio/goquery v1.9.2 // indirect
|
||||
github.com/DATA-DOG/go-sqlmock v1.5.2 // indirect
|
||||
github.com/anacrolix/generics v0.0.3-0.20240902042256-7fb2702ef0ca // indirect
|
||||
github.com/anacrolix/missinggo v1.3.0 // indirect
|
||||
github.com/anacrolix/missinggo/v2 v2.7.4 // indirect
|
||||
github.com/andybalholm/cascadia v1.3.2 // indirect
|
||||
github.com/blinkbean/dingtalk v1.1.3 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 // indirect
|
||||
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible // indirect
|
||||
github.com/go-test/deep v1.0.4 // indirect
|
||||
github.com/gregdel/pushover v1.3.1 // indirect
|
||||
github.com/huandu/xstrings v1.3.2 // indirect
|
||||
github.com/minio/sha256-simd v1.0.0 // indirect
|
||||
github.com/mr-tron/base58 v1.2.0 // indirect
|
||||
github.com/multiformats/go-multihash v0.2.3 // indirect
|
||||
github.com/multiformats/go-varint v0.0.6 // indirect
|
||||
github.com/ncruces/julianday v1.0.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/stretchr/objx v0.5.2 // indirect
|
||||
github.com/technoweenie/multipartstreamer v1.0.1 // indirect
|
||||
golang.org/x/sync v0.7.0 // indirect
|
||||
github.com/tetratelabs/wazero v1.8.0 // indirect
|
||||
golang.org/x/sync v0.8.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
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -75,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.25.0
|
||||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
|
||||
golang.org/x/mod v0.19.0 // indirect
|
||||
golang.org/x/sys v0.22.0
|
||||
golang.org/x/text v0.16.0 // indirect
|
||||
golang.org/x/crypto v0.27.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
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
|
||||
287
go.sum
287
go.sum
@@ -1,25 +1,75 @@
|
||||
ariga.io/atlas v0.19.1-0.20240203083654-5948b60a8e43 h1:GwdJbXydHCYPedeeLt4x/lrlIISQ4JTH1mRWuE5ZZ14=
|
||||
ariga.io/atlas v0.19.1-0.20240203083654-5948b60a8e43/go.mod h1:uj3pm+hUTVN/X5yfdBexHlZv+1Xu5u5ZbZx7+CDavNU=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
crawshaw.io/iox v0.0.0-20181124134642-c51c3df30797/go.mod h1:sXBiorCo8c46JlQV3oXPKINnZ8mcqnye1EkVkqsectk=
|
||||
crawshaw.io/sqlite v0.3.2/go.mod h1:igAO5JulrQ1DbdZdtVq48mnZUBAPOeFzer7VhDWNtW4=
|
||||
entgo.io/ent v0.13.1 h1:uD8QwN1h6SNphdCCzmkMN3feSUzNnVvV/WIkHKMbzOE=
|
||||
entgo.io/ent v0.13.1/go.mod h1:qCEmo+biw3ccBn9OyL4ZK5dfpwg++l1Gxwac5B1206A=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
|
||||
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
|
||||
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
|
||||
github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
|
||||
github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU=
|
||||
github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU=
|
||||
github.com/PuerkitoBio/goquery v1.9.2 h1:4/wZksC3KgkQw7SQgkKotmKljk0M6V8TUvA8Wb4yPeE=
|
||||
github.com/PuerkitoBio/goquery v1.9.2/go.mod h1:GHPCaP0ODyyxqcNoFGYlAprUFH81NuRPd0GX3Zu2Mvk=
|
||||
github.com/RoaringBitmap/roaring v0.4.7/go.mod h1:8khRDP4HmeXns4xIj9oGrKSz7XTQiJx2zgh7AcNke4w=
|
||||
github.com/RoaringBitmap/roaring v0.4.17/go.mod h1:D3qVegWTmfCaX4Bl5CrBE9hfrSrrXIr8KVNvRsDi1NI=
|
||||
github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo=
|
||||
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
|
||||
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
|
||||
github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8=
|
||||
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/anacrolix/dht/v2 v2.19.2-0.20221121215055-066ad8494444 h1:8V0K09lrGoeT2KRJNOtspA7q+OMxGwQqK/Ug0IiaaRE=
|
||||
github.com/anacrolix/dht/v2 v2.19.2-0.20221121215055-066ad8494444/go.mod h1:MctKM1HS5YYDb3F30NGJxLE+QPuqWoT5ReW/4jt8xew=
|
||||
github.com/anacrolix/envpprof v0.0.0-20180404065416-323002cec2fa/go.mod h1:KgHhUaQMc8cC0+cEflSgCFNFbKwi5h54gqtVn8yhP7c=
|
||||
github.com/anacrolix/envpprof v1.0.0/go.mod h1:KgHhUaQMc8cC0+cEflSgCFNFbKwi5h54gqtVn8yhP7c=
|
||||
github.com/anacrolix/envpprof v1.1.0/go.mod h1:My7T5oSqVfEn4MD4Meczkw/f5lSIndGAKu/0SM/rkf4=
|
||||
github.com/anacrolix/generics v0.0.3-0.20240902042256-7fb2702ef0ca h1:aiiGqSQWjtVNdi8zUMfA//IrM8fPkv2bWwZVPbDe0wg=
|
||||
github.com/anacrolix/generics v0.0.3-0.20240902042256-7fb2702ef0ca/go.mod h1:MN3ve08Z3zSV/rTuX/ouI4lNdlfTxgdafQJiLzyNRB8=
|
||||
github.com/anacrolix/log v0.3.0/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU=
|
||||
github.com/anacrolix/log v0.6.0/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU=
|
||||
github.com/anacrolix/missinggo v1.1.0/go.mod h1:MBJu3Sk/k3ZfGYcS7z18gwfu72Ey/xopPFJJbTi5yIo=
|
||||
github.com/anacrolix/missinggo v1.1.2-0.20190815015349-b888af804467/go.mod h1:MBJu3Sk/k3ZfGYcS7z18gwfu72Ey/xopPFJJbTi5yIo=
|
||||
github.com/anacrolix/missinggo v1.2.1/go.mod h1:J5cMhif8jPmFoC3+Uvob3OXXNIhOUikzMt+uUjeM21Y=
|
||||
github.com/anacrolix/missinggo v1.3.0 h1:06HlMsudotL7BAELRZs0yDZ4yVXsHXGi323QBjAVASw=
|
||||
github.com/anacrolix/missinggo v1.3.0/go.mod h1:bqHm8cE8xr+15uVfMG3BFui/TxyB6//H5fwlq/TeqMc=
|
||||
github.com/anacrolix/missinggo/perf v1.0.0/go.mod h1:ljAFWkBuzkO12MQclXzZrosP5urunoLS0Cbvb4V0uMQ=
|
||||
github.com/anacrolix/missinggo/v2 v2.2.0/go.mod h1:o0jgJoYOyaoYQ4E2ZMISVa9c88BbUBVQQW4QeRkNCGY=
|
||||
github.com/anacrolix/missinggo/v2 v2.5.1/go.mod h1:WEjqh2rmKECd0t1VhQkLGTdIWXO6f6NLjp5GlMZ+6FA=
|
||||
github.com/anacrolix/missinggo/v2 v2.7.4 h1:47h5OXoPV8JbA/ACA+FLwKdYbAinuDO8osc2Cu9xkxg=
|
||||
github.com/anacrolix/missinggo/v2 v2.7.4/go.mod h1:vVO5FEziQm+NFmJesc7StpkquZk+WJFCaL0Wp//2sa0=
|
||||
github.com/anacrolix/stm v0.2.0/go.mod h1:zoVQRvSiGjGoTmbM0vSLIiaKjWtNPeTvXUSdJQA4hsg=
|
||||
github.com/anacrolix/tagflag v0.0.0-20180109131632-2146c8d41bf0/go.mod h1:1m2U/K6ZT+JZG0+bdMK6qauP49QT4wE5pmhJXOKKCHw=
|
||||
github.com/anacrolix/tagflag v1.0.0/go.mod h1:1m2U/K6ZT+JZG0+bdMK6qauP49QT4wE5pmhJXOKKCHw=
|
||||
github.com/anacrolix/tagflag v1.1.0/go.mod h1:Scxs9CV10NQatSmbyjqmqmeQNwGzlNe0CMUMIxqHIG8=
|
||||
github.com/anacrolix/torrent v1.57.1 h1:CS8rYfC2Oe15NPBhwCNs/3WBY6HiBCPDFpY+s9aFHbA=
|
||||
github.com/anacrolix/torrent v1.57.1/go.mod h1:NNBg4lP2/us9Hp5+cLNcZRILM69cNoKIkqMGqr9AuR0=
|
||||
github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss=
|
||||
github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
|
||||
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
|
||||
github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw=
|
||||
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
|
||||
github.com/benbjohnson/immutable v0.2.0/go.mod h1:uc6OHo6PN2++n98KHLxW8ef4W42ylHiQSENghE1ezxI=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/blinkbean/dingtalk v1.1.3 h1:MbidFZYom7DTFHD/YIs+eaI7kRy52kmWE/sy0xjo6E4=
|
||||
github.com/blinkbean/dingtalk v1.1.3/go.mod h1:9BaLuGSBqY3vT5hstValh48DbsKO7vaHaJnG9pXwbto=
|
||||
github.com/bradfitz/iter v0.0.0-20140124041915-454541ec3da2/go.mod h1:PyRFw1Lt2wKX4ZVSQ2mk+PeDa1rxyObEDlApuIsUKuo=
|
||||
github.com/bradfitz/iter v0.0.0-20190303215204-33e6a9893b0c/go.mod h1:PyRFw1Lt2wKX4ZVSQ2mk+PeDa1rxyObEDlApuIsUKuo=
|
||||
github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 h1:GKTyiRCL6zVf5wWaqKnf+7Qs6GbEPfd4iMOitWzXJx8=
|
||||
github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8/go.mod h1:spo1JLcs67NmW1aVLEgtA8Yy1elc+X8y5SRW1sFW4Og=
|
||||
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
|
||||
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
|
||||
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
|
||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
|
||||
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
||||
@@ -30,8 +80,15 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
|
||||
github.com/dustin/go-humanize v0.0.0-20180421182945-02af3965c54e/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
|
||||
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
|
||||
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
|
||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
|
||||
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
|
||||
github.com/gabriel-vasile/mimetype v1.4.4 h1:QjV6pZ7/XZ7ryI2KuyeEDE8wnh7fHP9YnQy+R0LnH8I=
|
||||
@@ -44,6 +101,16 @@ github.com/gin-contrib/zap v1.1.3 h1:9e/U9fYd4/OBfmSEBs5hHZq114uACn7bpuzvCkcJySA
|
||||
github.com/gin-contrib/zap v1.1.3/go.mod h1:+BD/6NYZKJyUpqVoJEvgeq9GLz8pINEQvak9LHNOTSE=
|
||||
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
|
||||
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||
github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE=
|
||||
github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE=
|
||||
github.com/glycerine/go-unsnap-stream v0.0.0-20190901134440-81cf024a9e0a/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE=
|
||||
github.com/glycerine/goconvey v0.0.0-20180728074245-46e3a41ad493/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24=
|
||||
github.com/glycerine/goconvey v0.0.0-20190315024820-982ee783a72e/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24=
|
||||
github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4=
|
||||
github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
@@ -54,26 +121,54 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8=
|
||||
github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible h1:2cauKuaELYAEARXRkq2LrJ0yDDv1rW7+wrTEdVL3uaU=
|
||||
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible/go.mod h1:qf9acutJ8cwBUhm1bqgz6Bei9/C/c93FPDljKWwsOgM=
|
||||
github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
|
||||
github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
|
||||
github.com/go-test/deep v1.0.4 h1:u2CU3YKy9I2pmu9pX0eq50wCgjfGIt539SqR7FbHiho=
|
||||
github.com/go-test/deep v1.0.4/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/btree v0.0.0-20180124185431-e89373fe6b4a/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20190309154008-847fc94819f9/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
|
||||
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gregdel/pushover v1.3.1 h1:4bMLITOZ15+Zpi6qqoGqOPuVHCwSUvMCgVnN5Xhilfo=
|
||||
github.com/gregdel/pushover v1.3.1/go.mod h1:EcaO66Nn1StkpEm1iKtBTV3d2A16SoMsVER1PthX7to=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/hashicorp/hcl/v2 v2.13.0 h1:0Apadu1w6M11dyGFxWnmhhcMjkbAiKCv7G1r/2QgCNc=
|
||||
@@ -82,14 +177,30 @@ github.com/hekmon/cunits/v2 v2.1.0 h1:k6wIjc4PlacNOHwKEMBgWV2/c8jyD4eRMs5mR1BBhI
|
||||
github.com/hekmon/cunits/v2 v2.1.0/go.mod h1:9r1TycXYXaTmEWlAIfFV8JT+Xo59U96yUJAYHxzii2M=
|
||||
github.com/hekmon/transmissionrpc/v3 v3.0.0 h1:0Fb11qE0IBh4V4GlOwHNYpqpjcYDp5GouolwrpmcUDQ=
|
||||
github.com/hekmon/transmissionrpc/v3 v3.0.0/go.mod h1:38SlNhFzinVUuY87wGj3acOmRxeYZAZfrj6Re7UgCDg=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo=
|
||||
github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4=
|
||||
github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
||||
github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw=
|
||||
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
||||
github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible h1:jdpOPRN1zP63Td1hDQbZW73xKmzDvZHzVdNYxhnTMDA=
|
||||
github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible/go.mod h1:1c7szIrayyPPB/987hsnvNzLushdWf4o/79s3P08L8A=
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46/go.mod h1:yyMNCyc/Ib3bDTKd379tNMpB/7/H5TjM2Y9QJ5THLbE=
|
||||
github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
@@ -105,10 +216,11 @@ github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0V
|
||||
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
|
||||
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
||||
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
|
||||
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g=
|
||||
github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM=
|
||||
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM=
|
||||
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
@@ -116,49 +228,98 @@ github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
|
||||
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
|
||||
github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg=
|
||||
github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw=
|
||||
github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U=
|
||||
github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM=
|
||||
github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2W/KhfNY=
|
||||
github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM=
|
||||
github.com/natefinch/lumberjack v2.0.0+incompatible/go.mod h1:Wi9p2TTF5DG5oU+6YfsmYQpsTIOm0B1VNzQg9Mw6nPk=
|
||||
github.com/ncruces/go-sqlite3 v0.18.4 h1:Je8o3y33MDwPYY/Cacas8yCsuoUzpNY/AgoSlN2ekyE=
|
||||
github.com/ncruces/go-sqlite3 v0.18.4/go.mod h1:4HLag13gq1k10s4dfGBhMfRVsssJRT9/5hYqVM9RUYo=
|
||||
github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt7M=
|
||||
github.com/ncruces/julianday v1.0.0/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvza5fFc9G7g=
|
||||
github.com/nikoksr/notify v1.0.0 h1:qe9/6FRsWdxBgQgWcpvQ0sv8LRGJZDpRB4TkL2uNdO8=
|
||||
github.com/nikoksr/notify v1.0.0/go.mod h1:hPaaDt30d6LAA7/5nb0e48Bp/MctDfycCSs8VEgN29I=
|
||||
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
|
||||
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
||||
github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
|
||||
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
|
||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||
github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
|
||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
|
||||
github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
|
||||
github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
|
||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46/go.mod h1:uAQ5PCi+MFsC7HjREoAz1BU+Mq60+05gifQSsHSDG/8=
|
||||
github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
|
||||
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
|
||||
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
|
||||
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/assertions v0.0.0-20190215210624-980c5ac6f3ac/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
|
||||
github.com/smartystreets/goconvey v0.0.0-20190306220146-200a235640ff/go.mod h1:KSQcGKpxUMHk3nbYzs/tIBAM2iDooCn0BmttHOJEbLs=
|
||||
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
|
||||
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
|
||||
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
|
||||
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
|
||||
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
|
||||
github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
|
||||
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
|
||||
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
|
||||
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
|
||||
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
@@ -170,15 +331,25 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8
|
||||
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
|
||||
github.com/technoweenie/multipartstreamer v1.0.1 h1:XRztA5MXiR1TIRHxH2uNxXxaIkKQDeX7m2XsSOlQEnM=
|
||||
github.com/technoweenie/multipartstreamer v1.0.1/go.mod h1:jNVxdtShOxzAsukZwTSw6MDx5eUJoiEBsSvzDU9uzog=
|
||||
github.com/tetratelabs/wazero v1.8.0 h1:iEKu0d4c2Pd+QSRieYbnQC9yiFlMS9D+Jr0LsRmcF4g=
|
||||
github.com/tetratelabs/wazero v1.8.0/go.mod h1:yAI0XTsMBhREkM/YDAK/zNou3GoiAce1P6+rp/wQhjs=
|
||||
github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
|
||||
github.com/tinylib/msgp v1.1.0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
|
||||
github.com/tinylib/msgp v1.1.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
|
||||
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
|
||||
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
|
||||
github.com/willf/bitset v1.1.9/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
|
||||
github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
github.com/zclconf/go-cty v1.8.0 h1:s4AvqaeQzJIu3ndv4gVIhplVD0krU+bgrcLSVUnaWuA=
|
||||
github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
|
||||
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
@@ -188,17 +359,32 @@ go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
|
||||
golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
|
||||
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
|
||||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
|
||||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
|
||||
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/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=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8=
|
||||
golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
|
||||
golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
@@ -207,12 +393,29 @@ 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/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=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
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.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
||||
golang.org/x/sync v0.8.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=
|
||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
@@ -220,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.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
|
||||
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
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/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=
|
||||
@@ -233,30 +436,62 @@ 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.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
|
||||
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
|
||||
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
|
||||
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg=
|
||||
golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golift.io/starr v1.0.0 h1:IDSaSL+ZYxdLT/Lg//dg/iwZ39LHO3D5CmbLCOgSXbI=
|
||||
golift.io/starr v1.0.0/go.mod h1:xnUwp4vK62bDvozW9QHUYc08m6kjwaZnGw3Db65fQHw=
|
||||
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
|
||||
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
|
||||
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
lukechampine.com/blake3 v1.1.6 h1:H3cROdztr7RCfoaTpGZFQsrqvweFLrqS73j7L7cmR5c=
|
||||
lukechampine.com/blake3 v1.1.6/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA=
|
||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
||||
|
||||
11
pkg/doc.go
11
pkg/doc.go
@@ -6,12 +6,15 @@ type Torrent interface {
|
||||
Stop() error
|
||||
Start() error
|
||||
Remove() error
|
||||
Save() string
|
||||
//Save() string
|
||||
Exists() bool
|
||||
SeedRatio() (float64, error)
|
||||
GetHash() string
|
||||
//Reload() error
|
||||
}
|
||||
|
||||
type Downloader interface {
|
||||
GetAll() ([]Torrent, error)
|
||||
Download(link, dir string) (Torrent, error)
|
||||
}
|
||||
|
||||
type Storage interface {
|
||||
|
||||
}
|
||||
32
pkg/go-qbittorrent/.dockerignore
Normal file
32
pkg/go-qbittorrent/.dockerignore
Normal file
@@ -0,0 +1,32 @@
|
||||
# Include any files or directories that you don't want to be copied to your
|
||||
# container here (e.g., local build artifacts, temporary files, etc.).
|
||||
#
|
||||
# For more help, visit the .dockerignore file reference guide at
|
||||
# https://docs.docker.com/engine/reference/builder/#dockerignore-file
|
||||
|
||||
**/.DS_Store
|
||||
**/.classpath
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/bin
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
||||
1
pkg/go-qbittorrent/.gitignore
vendored
Normal file
1
pkg/go-qbittorrent/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
./main.go
|
||||
19
pkg/go-qbittorrent/README.md
Normal file
19
pkg/go-qbittorrent/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
go-qbittorrent
|
||||
==================
|
||||
|
||||
Golang wrapper for qBittorrent Web API (for versions above v4.1) forked from [superturkey650](https://github.com/superturkey650/go-qbittorrent) version (only supporting older API version)
|
||||
|
||||
This wrapper is based on the methods described in [qBittorrent's Official Web API](https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)>)
|
||||
|
||||
Some methods are only supported in qBittorent's latest version (v4.5 when writing).
|
||||
|
||||
It'll be best if you upgrade your client to a latest version.
|
||||
|
||||
An example can be found in main.go
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
The best way is to install with go get::
|
||||
|
||||
$ go get github.com/simon-ding/go-qbittorrent/qbt
|
||||
260
pkg/go-qbittorrent/docs.txt
Normal file
260
pkg/go-qbittorrent/docs.txt
Normal file
@@ -0,0 +1,260 @@
|
||||
PACKAGE DOCUMENTATION
|
||||
|
||||
package qbt
|
||||
import "/Users/me/Repos/go/src/go-qbittorrent/qbt"
|
||||
|
||||
|
||||
TYPES
|
||||
|
||||
type BasicTorrent struct {
|
||||
AddedOn int `json:"added_on"`
|
||||
Category string `json:"category"`
|
||||
CompletionOn int64 `json:"completion_on"`
|
||||
Dlspeed int `json:"dlspeed"`
|
||||
Eta int `json:"eta"`
|
||||
ForceStart bool `json:"force_start"`
|
||||
Hash string `json:"hash"`
|
||||
Name string `json:"name"`
|
||||
NumComplete int `json:"num_complete"`
|
||||
NumIncomplete int `json:"num_incomplete"`
|
||||
NumLeechs int `json:"num_leechs"`
|
||||
NumSeeds int `json:"num_seeds"`
|
||||
Priority int `json:"priority"`
|
||||
Progress int `json:"progress"`
|
||||
Ratio int `json:"ratio"`
|
||||
SavePath string `json:"save_path"`
|
||||
SeqDl bool `json:"seq_dl"`
|
||||
Size int `json:"size"`
|
||||
State string `json:"state"`
|
||||
SuperSeeding bool `json:"super_seeding"`
|
||||
Upspeed int `json:"upspeed"`
|
||||
}
|
||||
BasicTorrent holds a basic torrent object from qbittorrent
|
||||
|
||||
type Client struct {
|
||||
URL string
|
||||
Authenticated bool
|
||||
Session string //replace with session type
|
||||
Jar http.CookieJar
|
||||
// contains filtered or unexported fields
|
||||
}
|
||||
Client creates a connection to qbittorrent and performs requests
|
||||
|
||||
func NewClient(url string) *Client
|
||||
NewClient creates a new client connection to qbittorrent
|
||||
|
||||
func (c *Client) AddTrackers(infoHash string, trackers string) (*http.Response, error)
|
||||
AddTrackers adds trackers to a specific torrent
|
||||
|
||||
func (c *Client) DecreasePriority(infoHashList []string) (*http.Response, error)
|
||||
DecreasePriority decreases the priority of a list of torrents
|
||||
|
||||
func (c *Client) DeletePermanently(infoHashList []string) (*http.Response, error)
|
||||
DeletePermanently deletes all files for a list of torrents
|
||||
|
||||
func (c *Client) DeleteTemp(infoHashList []string) (*http.Response, error)
|
||||
DeleteTemp deletes the temporary files for a list of torrents
|
||||
|
||||
func (c *Client) DownloadFromFile(file string, options map[string]string) (*http.Response, error)
|
||||
DownloadFromFile downloads a torrent from a file
|
||||
|
||||
func (c *Client) DownloadFromLink(link string, options map[string]string) (*http.Response, error)
|
||||
DownloadFromLink starts downloading a torrent from a link
|
||||
|
||||
func (c *Client) ForceStart(infoHashList []string, value bool) (*http.Response, error)
|
||||
ForceStart force starts a list of torrents
|
||||
|
||||
func (c *Client) GetAlternativeSpeedStatus() (status bool, err error)
|
||||
GetAlternativeSpeedStatus gets the alternative speed status of your
|
||||
qbittorrent client
|
||||
|
||||
func (c *Client) GetGlobalDownloadLimit() (limit int, err error)
|
||||
GetGlobalDownloadLimit gets the global download limit of your
|
||||
qbittorrent client
|
||||
|
||||
func (c *Client) GetGlobalUploadLimit() (limit int, err error)
|
||||
GetGlobalUploadLimit gets the global upload limit of your qbittorrent
|
||||
client
|
||||
|
||||
func (c *Client) GetTorrentDownloadLimit(infoHashList []string) (limits map[string]string, err error)
|
||||
GetTorrentDownloadLimit gets the download limit for a list of torrents
|
||||
|
||||
func (c *Client) GetTorrentUploadLimit(infoHashList []string) (limits map[string]string, err error)
|
||||
GetTorrentUploadLimit gets the upload limit for a list of torrents
|
||||
|
||||
func (c *Client) IncreasePriority(infoHashList []string) (*http.Response, error)
|
||||
IncreasePriority increases the priority of a list of torrents
|
||||
|
||||
func (c *Client) Login(username string, password string) (loggedIn bool, err error)
|
||||
Login logs you in to the qbittorrent client
|
||||
|
||||
func (c *Client) Logout() (loggedOut bool, err error)
|
||||
Logout logs you out of the qbittorrent client
|
||||
|
||||
func (c *Client) Pause(infoHash string) (*http.Response, error)
|
||||
Pause pauses a specific torrent
|
||||
|
||||
func (c *Client) PauseAll() (*http.Response, error)
|
||||
PauseAll pauses all torrents
|
||||
|
||||
func (c *Client) PauseMultiple(infoHashList []string) (*http.Response, error)
|
||||
PauseMultiple pauses a list of torrents
|
||||
|
||||
func (c *Client) Recheck(infoHashList []string) (*http.Response, error)
|
||||
Recheck rechecks a list of torrents
|
||||
|
||||
func (c *Client) Resume(infoHash string) (*http.Response, error)
|
||||
Resume resumes a specific torrent
|
||||
|
||||
func (c *Client) ResumeAll(infoHashList []string) (*http.Response, error)
|
||||
ResumeAll resumes all torrents
|
||||
|
||||
func (c *Client) ResumeMultiple(infoHashList []string) (*http.Response, error)
|
||||
ResumeMultiple resumes a list of torrents
|
||||
|
||||
func (c *Client) SetCategory(infoHashList []string, category string) (*http.Response, error)
|
||||
SetCategory sets the category for a list of torrents
|
||||
|
||||
func (c *Client) SetFilePriority(infoHash string, fileID string, priority string) (*http.Response, error)
|
||||
SetFilePriority sets the priority for a specific torrent file
|
||||
|
||||
func (c *Client) SetGlobalDownloadLimit(limit string) (*http.Response, error)
|
||||
SetGlobalDownloadLimit sets the global download limit of your
|
||||
qbittorrent client
|
||||
|
||||
func (c *Client) SetGlobalUploadLimit(limit string) (*http.Response, error)
|
||||
SetGlobalUploadLimit sets the global upload limit of your qbittorrent
|
||||
client
|
||||
|
||||
func (c *Client) SetLabel(infoHashList []string, label string) (*http.Response, error)
|
||||
SetLabel sets the labels for a list of torrents
|
||||
|
||||
func (c *Client) SetMaxPriority(infoHashList []string) (*http.Response, error)
|
||||
SetMaxPriority sets the max priority for a list of torrents
|
||||
|
||||
func (c *Client) SetMinPriority(infoHashList []string) (*http.Response, error)
|
||||
SetMinPriority sets the min priority for a list of torrents
|
||||
|
||||
func (c *Client) SetPreferences(params map[string]string) (*http.Response, error)
|
||||
SetPreferences sets the preferences of your qbittorrent client
|
||||
|
||||
func (c *Client) SetTorrentDownloadLimit(infoHashList []string, limit string) (*http.Response, error)
|
||||
SetTorrentDownloadLimit sets the download limit for a list of torrents
|
||||
|
||||
func (c *Client) SetTorrentUploadLimit(infoHashList []string, limit string) (*http.Response, error)
|
||||
SetTorrentUploadLimit sets the upload limit of a list of torrents
|
||||
|
||||
func (c *Client) Shutdown() (shuttingDown bool, err error)
|
||||
Shutdown shuts down the qbittorrent client
|
||||
|
||||
func (c *Client) Sync(rid string) (Sync, error)
|
||||
Sync syncs main data of qbittorrent
|
||||
|
||||
func (c *Client) ToggleAlternativeSpeed() (*http.Response, error)
|
||||
ToggleAlternativeSpeed toggles the alternative speed of your qbittorrent
|
||||
client
|
||||
|
||||
func (c *Client) ToggleFirstLastPiecePriority(infoHashList []string) (*http.Response, error)
|
||||
ToggleFirstLastPiecePriority toggles first last piece priority of a list
|
||||
of torrents
|
||||
|
||||
func (c *Client) ToggleSequentialDownload(infoHashList []string) (*http.Response, error)
|
||||
ToggleSequentialDownload toggles the download sequence of a list of
|
||||
torrents
|
||||
|
||||
func (c *Client) Torrent(infoHash string) (Torrent, error)
|
||||
Torrent gets a specific torrent
|
||||
|
||||
func (c *Client) TorrentFiles(infoHash string) ([]TorrentFile, error)
|
||||
TorrentFiles gets the files of a specifc torrent
|
||||
|
||||
func (c *Client) TorrentTrackers(infoHash string) ([]Tracker, error)
|
||||
TorrentTrackers gets all trackers for a specific torrent
|
||||
|
||||
func (c *Client) TorrentWebSeeds(infoHash string) ([]WebSeed, error)
|
||||
TorrentWebSeeds gets seeders for a specific torrent
|
||||
|
||||
func (c *Client) Torrents(filters map[string]string) (torrentList []BasicTorrent, err error)
|
||||
Torrents gets a list of all torrents in qbittorrent matching your filter
|
||||
|
||||
type Sync struct {
|
||||
Categories []string `json:"categories"`
|
||||
FullUpdate bool `json:"full_update"`
|
||||
Rid int `json:"rid"`
|
||||
ServerState struct {
|
||||
ConnectionStatus string `json:"connection_status"`
|
||||
DhtNodes int `json:"dht_nodes"`
|
||||
DlInfoData int `json:"dl_info_data"`
|
||||
DlInfoSpeed int `json:"dl_info_speed"`
|
||||
DlRateLimit int `json:"dl_rate_limit"`
|
||||
Queueing bool `json:"queueing"`
|
||||
RefreshInterval int `json:"refresh_interval"`
|
||||
UpInfoData int `json:"up_info_data"`
|
||||
UpInfoSpeed int `json:"up_info_speed"`
|
||||
UpRateLimit int `json:"up_rate_limit"`
|
||||
UseAltSpeedLimits bool `json:"use_alt_speed_limits"`
|
||||
} `json:"server_state"`
|
||||
Torrents map[string]Torrent `json:"torrents"`
|
||||
}
|
||||
Sync holds the sync response struct
|
||||
|
||||
type Torrent struct {
|
||||
AdditionDate int `json:"addition_date"`
|
||||
Comment string `json:"comment"`
|
||||
CompletionDate int `json:"completion_date"`
|
||||
CreatedBy string `json:"created_by"`
|
||||
CreationDate int `json:"creation_date"`
|
||||
DlLimit int `json:"dl_limit"`
|
||||
DlSpeed int `json:"dl_speed"`
|
||||
DlSpeedAvg int `json:"dl_speed_avg"`
|
||||
Eta int `json:"eta"`
|
||||
LastSeen int `json:"last_seen"`
|
||||
NbConnections int `json:"nb_connections"`
|
||||
NbConnectionsLimit int `json:"nb_connections_limit"`
|
||||
Peers int `json:"peers"`
|
||||
PeersTotal int `json:"peers_total"`
|
||||
PieceSize int `json:"piece_size"`
|
||||
PiecesHave int `json:"pieces_have"`
|
||||
PiecesNum int `json:"pieces_num"`
|
||||
Reannounce int `json:"reannounce"`
|
||||
SavePath string `json:"save_path"`
|
||||
SeedingTime int `json:"seeding_time"`
|
||||
Seeds int `json:"seeds"`
|
||||
SeedsTotal int `json:"seeds_total"`
|
||||
ShareRatio float64 `json:"share_ratio"`
|
||||
TimeElapsed int `json:"time_elapsed"`
|
||||
TotalDownloaded int `json:"total_downloaded"`
|
||||
TotalDownloadedSession int `json:"total_downloaded_session"`
|
||||
TotalSize int `json:"total_size"`
|
||||
TotalUploaded int `json:"total_uploaded"`
|
||||
TotalUploadedSession int `json:"total_uploaded_session"`
|
||||
TotalWasted int `json:"total_wasted"`
|
||||
UpLimit int `json:"up_limit"`
|
||||
UpSpeed int `json:"up_speed"`
|
||||
UpSpeedAvg int `json:"up_speed_avg"`
|
||||
}
|
||||
Torrent holds a torrent object from qbittorrent
|
||||
|
||||
type TorrentFile struct {
|
||||
IsSeed bool `json:"is_seed"`
|
||||
Name string `json:"name"`
|
||||
Priority int `json:"priority"`
|
||||
Progress int `json:"progress"`
|
||||
Size int `json:"size"`
|
||||
}
|
||||
TorrentFile holds a torrent file object from qbittorrent
|
||||
|
||||
type Tracker struct {
|
||||
Msg string `json:"msg"`
|
||||
NumPeers int `json:"num_peers"`
|
||||
Status string `json:"status"`
|
||||
URL string `json:"url"`
|
||||
}
|
||||
Tracker holds a tracker object from qbittorrent
|
||||
|
||||
type WebSeed struct {
|
||||
URL string `json:"url"`
|
||||
}
|
||||
WebSeed holds a webseed object from qbittorrent
|
||||
|
||||
|
||||
66
pkg/go-qbittorrent/go-qbittorrent.go
Normal file
66
pkg/go-qbittorrent/go-qbittorrent.go
Normal file
@@ -0,0 +1,66 @@
|
||||
package qbittorrent
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"polaris/pkg/go-qbittorrent/qbt"
|
||||
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// connect to qbittorrent client
|
||||
qb := qbt.NewClient("http://localhost:8181")
|
||||
|
||||
// login to the client
|
||||
loginOpts := qbt.LoginOptions{
|
||||
Username: "username",
|
||||
Password: "password",
|
||||
}
|
||||
err := qb.Login(loginOpts)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
// ********************
|
||||
// DOWNLOAD A TORRENT *
|
||||
// ********************
|
||||
|
||||
// were not using any filters so the options map is empty
|
||||
downloadOpts := qbt.DownloadOptions{}
|
||||
// set the path to the file
|
||||
//path := "/Users/me/Downloads/Source.Code.2011.1080p.BluRay.H264.AAC-RARBG-[rarbg.to].torrent"
|
||||
links := []string{"http://rarbg.to/download.php?id=9buc5hp&h=d73&f=Courage.the.Cowardly.Dog.1999.S01.1080p.AMZN.WEBRip.DD2.0.x264-NOGRP%5Brartv%5D-[rarbg.to].torrent"}
|
||||
// download the torrent using the file
|
||||
// the wrapper will handle opening and closing the file for you
|
||||
err = qb.DownloadLinks(links, downloadOpts)
|
||||
|
||||
if err != nil {
|
||||
fmt.Println("[-] Download torrent from link")
|
||||
fmt.Println(err)
|
||||
} else {
|
||||
fmt.Println("[+] Download torrent from link")
|
||||
}
|
||||
|
||||
// ******************
|
||||
// GET ALL TORRENTS *
|
||||
// ******************
|
||||
torrentsOpts := qbt.TorrentsOptions{}
|
||||
filter := "inactive"
|
||||
sort := "name"
|
||||
hash := "d739f78a12b241ba62719b1064701ffbb45498a8"
|
||||
torrentsOpts.Filter = &filter
|
||||
torrentsOpts.Sort = &sort
|
||||
torrentsOpts.Hashes = []string{hash}
|
||||
torrents, err := qb.Torrents(torrentsOpts)
|
||||
if err != nil {
|
||||
fmt.Println("[-] Get torrent list")
|
||||
fmt.Println(err)
|
||||
} else {
|
||||
fmt.Println("[+] Get torrent list")
|
||||
if len(torrents) > 0 {
|
||||
spew.Dump(torrents[0])
|
||||
} else {
|
||||
fmt.Println("No torrents found")
|
||||
}
|
||||
}
|
||||
}
|
||||
1138
pkg/go-qbittorrent/qbt/api.go
Normal file
1138
pkg/go-qbittorrent/qbt/api.go
Normal file
File diff suppressed because it is too large
Load Diff
387
pkg/go-qbittorrent/qbt/models.go
Normal file
387
pkg/go-qbittorrent/qbt/models.go
Normal file
@@ -0,0 +1,387 @@
|
||||
package qbt
|
||||
|
||||
// BasicTorrent holds a basic torrent object from qbittorrent
|
||||
type BasicTorrent struct {
|
||||
Category string `json:"category"`
|
||||
CompletionOn int64 `json:"completion_on"`
|
||||
Dlspeed int `json:"dlspeed"`
|
||||
Eta int `json:"eta"`
|
||||
ForceStart bool `json:"force_start"`
|
||||
Hash string `json:"hash"`
|
||||
Name string `json:"name"`
|
||||
NumComplete int `json:"num_complete"`
|
||||
NumIncomplete int `json:"num_incomplete"`
|
||||
NumLeechs int `json:"num_leechs"`
|
||||
NumSeeds int `json:"num_seeds"`
|
||||
Priority int `json:"priority"`
|
||||
Progress int `json:"progress"`
|
||||
Ratio int `json:"ratio"`
|
||||
SavePath string `json:"save_path"`
|
||||
SeqDl bool `json:"seq_dl"`
|
||||
Size int `json:"size"`
|
||||
State string `json:"state"`
|
||||
SuperSeeding bool `json:"super_seeding"`
|
||||
Upspeed int `json:"upspeed"`
|
||||
FirstLastPiecePriority bool `json:"f_l_piece_prio"`
|
||||
}
|
||||
|
||||
// Torrent holds a torrent object from qbittorrent
|
||||
// with more information than BasicTorrent
|
||||
type Torrent struct {
|
||||
AdditionDate int `json:"addition_date"`
|
||||
Comment string `json:"comment"`
|
||||
CompletionDate int `json:"completion_date"`
|
||||
CreatedBy string `json:"created_by"`
|
||||
CreationDate int `json:"creation_date"`
|
||||
DlLimit int `json:"dl_limit"`
|
||||
DlSpeed int `json:"dl_speed"`
|
||||
DlSpeedAvg int `json:"dl_speed_avg"`
|
||||
Eta int `json:"eta"`
|
||||
LastSeen int `json:"last_seen"`
|
||||
NbConnections int `json:"nb_connections"`
|
||||
NbConnectionsLimit int `json:"nb_connections_limit"`
|
||||
Peers int `json:"peers"`
|
||||
PeersTotal int `json:"peers_total"`
|
||||
PieceSize int `json:"piece_size"`
|
||||
PiecesHave int `json:"pieces_have"`
|
||||
PiecesNum int `json:"pieces_num"`
|
||||
Reannounce int `json:"reannounce"`
|
||||
SavePath string `json:"save_path"`
|
||||
SeedingTime int `json:"seeding_time"`
|
||||
Seeds int `json:"seeds"`
|
||||
SeedsTotal int `json:"seeds_total"`
|
||||
ShareRatio float64 `json:"share_ratio"`
|
||||
TimeElapsed int `json:"time_elapsed"`
|
||||
TotalDl int `json:"total_downloaded"`
|
||||
TotalDlSession int `json:"total_downloaded_session"`
|
||||
TotalSize int `json:"total_size"`
|
||||
TotalUl int `json:"total_uploaded"`
|
||||
TotalUlSession int `json:"total_uploaded_session"`
|
||||
TotalWasted int `json:"total_wasted"`
|
||||
UpLimit int `json:"up_limit"`
|
||||
UpSpeed int `json:"up_speed"`
|
||||
UpSpeedAvg int `json:"up_speed_avg"`
|
||||
}
|
||||
|
||||
type TorrentInfo struct {
|
||||
AddedOn int64 `json:"added_on"`
|
||||
AmountLeft int64 `json:"amount_left"`
|
||||
AutoTmm bool `json:"auto_tmm"`
|
||||
Availability int64 `json:"availability"`
|
||||
Category string `json:"category"`
|
||||
Completed int64 `json:"completed"`
|
||||
CompletionOn int64 `json:"completion_on"`
|
||||
ContentPath string `json:"content_path"`
|
||||
DlLimit int64 `json:"dl_limit"`
|
||||
Dlspeed int64 `json:"dlspeed"`
|
||||
Downloaded int64 `json:"downloaded"`
|
||||
DownloadedSession int64 `json:"downloaded_session"`
|
||||
Eta int64 `json:"eta"`
|
||||
FLPiecePrio bool `json:"f_l_piece_prio"`
|
||||
ForceStart bool `json:"force_start"`
|
||||
Hash string `json:"hash"`
|
||||
LastActivity int64 `json:"last_activity"`
|
||||
MagnetURI string `json:"magnet_uri"`
|
||||
MaxRatio float64 `json:"max_ratio"`
|
||||
MaxSeedingTime int64 `json:"max_seeding_time"`
|
||||
Name string `json:"name"`
|
||||
NumComplete int64 `json:"num_complete"`
|
||||
NumIncomplete int64 `json:"num_incomplete"`
|
||||
NumLeechs int64 `json:"num_leechs"`
|
||||
NumSeeds int64 `json:"num_seeds"`
|
||||
Priority int64 `json:"priority"`
|
||||
Progress float64 `json:"progress"`
|
||||
Ratio float64 `json:"ratio"`
|
||||
RatioLimit int64 `json:"ratio_limit"`
|
||||
SavePath string `json:"save_path"`
|
||||
SeedingTimeLimit int64 `json:"seeding_time_limit"`
|
||||
SeenComplete int64 `json:"seen_complete"`
|
||||
SeqDl bool `json:"seq_dl"`
|
||||
Size int64 `json:"size"`
|
||||
State string `json:"state"`
|
||||
SuperSeeding bool `json:"super_seeding"`
|
||||
Tags string `json:"tags"`
|
||||
TimeActive int64 `json:"time_active"`
|
||||
TotalSize int64 `json:"total_size"`
|
||||
Tracker string `json:"tracker"`
|
||||
TrackersCount int64 `json:"trackers_count"`
|
||||
UpLimit int64 `json:"up_limit"`
|
||||
Uploaded int64 `json:"uploaded"`
|
||||
UploadedSession int64 `json:"uploaded_session"`
|
||||
Upspeed int64 `json:"upspeed"`
|
||||
}
|
||||
|
||||
// Tracker holds a tracker object from qbittorrent
|
||||
type Tracker struct {
|
||||
Msg string `json:"msg"`
|
||||
NumPeers int `json:"num_peers"`
|
||||
NumSeeds int `json:"num_seeds"`
|
||||
NumLeeches int `json:"num_leeches"`
|
||||
NumDownloaded int `json:"num_downloaded"`
|
||||
Tier int `json:"tier"`
|
||||
Status int `json:"status"`
|
||||
URL string `json:"url"`
|
||||
}
|
||||
|
||||
// WebSeed holds a webseed object from qbittorrent
|
||||
type WebSeed struct {
|
||||
URL string `json:"url"`
|
||||
}
|
||||
|
||||
// TorrentFile holds a torrent file object from qbittorrent
|
||||
type TorrentFile struct {
|
||||
Index int `json:"index"`
|
||||
IsSeed bool `json:"is_seed"`
|
||||
Name string `json:"name"`
|
||||
Availability float32 `json:"availability"`
|
||||
Priority int `json:"priority"`
|
||||
Progress int `json:"progress"`
|
||||
Size int `json:"size"`
|
||||
PieceRange []int `json:"piece_range"`
|
||||
}
|
||||
|
||||
// Sync holds the sync response struct which contains
|
||||
// the server state and a map of infohashes to Torrents
|
||||
type Sync struct {
|
||||
Categories []string `json:"categories"`
|
||||
FullUpdate bool `json:"full_update"`
|
||||
Rid int `json:"rid"`
|
||||
ServerState struct {
|
||||
ConnectionStatus string `json:"connection_status"`
|
||||
DhtNodes int `json:"dht_nodes"`
|
||||
DlInfoData int `json:"dl_info_data"`
|
||||
DlInfoSpeed int `json:"dl_info_speed"`
|
||||
DlRateLimit int `json:"dl_rate_limit"`
|
||||
Queueing bool `json:"queueing"`
|
||||
RefreshInterval int `json:"refresh_interval"`
|
||||
UpInfoData int `json:"up_info_data"`
|
||||
UpInfoSpeed int `json:"up_info_speed"`
|
||||
UpRateLimit int `json:"up_rate_limit"`
|
||||
UseAltSpeedLimits bool `json:"use_alt_speed_limits"`
|
||||
} `json:"server_state"`
|
||||
Torrents map[string]Torrent `json:"torrents"`
|
||||
}
|
||||
|
||||
type BuildInfo struct {
|
||||
QTVersion string `json:"qt"`
|
||||
LibtorrentVersion string `json:"libtorrent"`
|
||||
BoostVersion string `json:"boost"`
|
||||
OpenSSLVersion string `json:"openssl"`
|
||||
AppBitness string `json:"bitness"`
|
||||
}
|
||||
|
||||
type Preferences struct {
|
||||
Locale string `json:"locale"`
|
||||
CreateSubfolderEnabled bool `json:"create_subfolder_enabled"`
|
||||
StartPausedEnabled bool `json:"start_paused_enabled"`
|
||||
AutoDeleteMode int `json:"auto_delete_mode"`
|
||||
PreallocateAll bool `json:"preallocate_all"`
|
||||
IncompleteFilesExt bool `json:"incomplete_files_ext"`
|
||||
AutoTMMEnabled bool `json:"auto_tmm_enabled"`
|
||||
TorrentChangedTMMEnabled bool `json:"torrent_changed_tmm_enabled"`
|
||||
SavePathChangedTMMEnabled bool `json:"save_path_changed_tmm_enabled"`
|
||||
CategoryChangedTMMEnabled bool `json:"category_changed_tmm_enabled"`
|
||||
SavePath string `json:"save_path"`
|
||||
TempPathEnabled bool `json:"temp_path_enabled"`
|
||||
TempPath string `json:"temp_path"`
|
||||
ScanDirs map[string]interface{} `json:"scan_dirs"`
|
||||
ExportDir string `json:"export_dir"`
|
||||
ExportDirFin string `json:"export_dir_fin"`
|
||||
MailNotificationEnabled string `json:"mail_notification_enabled"`
|
||||
MailNotificationSender string `json:"mail_notification_sender"`
|
||||
MailNotificationEmail string `json:"mail_notification_email"`
|
||||
MailNotificationSMPTP string `json:"mail_notification_smtp"`
|
||||
MailNotificationSSLEnabled bool `json:"mail_notification_ssl_enabled"`
|
||||
MailNotificationAuthEnabled bool `json:"mail_notification_auth_enabled"`
|
||||
MailNotificationUsername string `json:"mail_notification_username"`
|
||||
MailNotificationPassword string `json:"mail_notification_password"`
|
||||
AutorunEnabled bool `json:"autorun_enabled"`
|
||||
AutorunProgram string `json:"autorun_program"`
|
||||
QueueingEnabled bool `json:"queueing_enabled"`
|
||||
MaxActiveDls int `json:"max_active_downloads"`
|
||||
MaxActiveTorrents int `json:"max_active_torrents"`
|
||||
MaxActiveUls int `json:"max_active_uploads"`
|
||||
DontCountSlowTorrents bool `json:"dont_count_slow_torrents"`
|
||||
SlowTorrentDlRateThreshold int `json:"slow_torrent_dl_rate_threshold"`
|
||||
SlowTorrentUlRateThreshold int `json:"slow_torrent_ul_rate_threshold"`
|
||||
SlowTorrentInactiveTimer int `json:"slow_torrent_inactive_timer"`
|
||||
MaxRatioEnabled bool `json:"max_ratio_enabled"`
|
||||
MaxRatio float64 `json:"max_ratio"`
|
||||
MaxRatioAct bool `json:"max_ratio_act"`
|
||||
ListenPort int `json:"listen_port"`
|
||||
UPNP bool `json:"upnp"`
|
||||
RandomPort bool `json:"random_port"`
|
||||
DlLimit int `json:"dl_limit"`
|
||||
UlLimit int `json:"up_limit"`
|
||||
MaxConnections int `json:"max_connec"`
|
||||
MaxConnectionsPerTorrent int `json:"max_connec_per_torrent"`
|
||||
MaxUls int `json:"max_uploads"`
|
||||
MaxUlsPerTorrent int `json:"max_uploads_per_torrent"`
|
||||
UTPEnabled bool `json:"enable_utp"`
|
||||
LimitUTPRate bool `json:"limit_utp_rate"`
|
||||
LimitTCPOverhead bool `json:"limit_tcp_overhead"`
|
||||
LimitLANPeers bool `json:"limit_lan_peers"`
|
||||
AltDlLimit int `json:"alt_dl_limit"`
|
||||
AltUlLimit int `json:"alt_up_limit"`
|
||||
SchedulerEnabled bool `json:"scheduler_enabled"`
|
||||
ScheduleFromHour int `json:"schedule_from_hour"`
|
||||
ScheduleFromMin int `json:"schedule_from_min"`
|
||||
ScheduleToHour int `json:"schedule_to_hour"`
|
||||
ScheduleToMin int `json:"schedule_to_min"`
|
||||
SchedulerDays int `json:"scheduler_days"`
|
||||
DHTEnabled bool `json:"dht"`
|
||||
DHTSameAsBT bool `json:"dhtSameAsBT"`
|
||||
DHTPort int `json:"dht_port"`
|
||||
PexEnabled bool `json:"pex"`
|
||||
LSDEnabled bool `json:"lsd"`
|
||||
Encryption int `json:"encryption"`
|
||||
AnonymousMode bool `json:"anonymous_mode"`
|
||||
ProxyType int `json:"proxy_type"`
|
||||
ProxyIP string `json:"proxy_ip"`
|
||||
ProxyPort int `json:"proxy_port"`
|
||||
ProxyPeerConnections bool `json:"proxy_peer_connections"`
|
||||
ForceProxy bool `json:"force_proxy"`
|
||||
ProxyAuthEnabled bool `json:"proxy_auth_enabled"`
|
||||
ProxyUsername string `json:"proxy_username"`
|
||||
ProxyPassword string `json:"proxy_password"`
|
||||
IPFilterEnabled bool `json:"ip_filter_enabled"`
|
||||
IPFilterPath string `json:"ip_filter_path"`
|
||||
IPFilterTrackers string `json:"ip_filter_trackers"`
|
||||
WebUIDomainList string `json:"web_ui_domain_list"`
|
||||
WebUIAddress string `json:"web_ui_address"`
|
||||
WebUIPort int `json:"web_ui_port"`
|
||||
WebUIUPNPEnabled bool `json:"web_ui_upnp"`
|
||||
WebUIUsername string `json:"web_ui_username"`
|
||||
WebUIPassword string `json:"web_ui_password"`
|
||||
WebUICSRFProtectionEnabled bool `json:"web_ui_csrf_protection_enabled"`
|
||||
WebUIClickjackingProtectionEnabled bool `json:"web_ui_clickjacking_protection_enabled"`
|
||||
BypassLocalAuth bool `json:"bypass_local_auth"`
|
||||
BypassAuthSubnetWhitelistEnabled bool `json:"bypass_auth_subnet_whitelist_enabled"`
|
||||
BypassAuthSubnetWhitelist string `json:"bypass_auth_subnet_whitelist"`
|
||||
AltWebUIEnabled bool `json:"alternative_webui_enabled"`
|
||||
AltWebUIPath string `json:"alternative_webui_path"`
|
||||
UseHTTPS bool `json:"use_https"`
|
||||
SSLKey string `json:"ssl_key"`
|
||||
SSLCert string `json:"ssl_cert"`
|
||||
DynDNSEnabled bool `json:"dyndns_enabled"`
|
||||
DynDNSService int `json:"dyndns_service"`
|
||||
DynDNSUsername string `json:"dyndns_username"`
|
||||
DynDNSPassword string `json:"dyndns_password"`
|
||||
DynDNSDomain string `json:"dyndns_domain"`
|
||||
RSSRefreshInterval int `json:"rss_refresh_interval"`
|
||||
RSSMaxArtPerFeed int `json:"rss_max_articles_per_feed"`
|
||||
RSSProcessingEnabled bool `json:"rss_processing_enabled"`
|
||||
RSSAutoDlEnabled bool `json:"rss_auto_downloading_enabled"`
|
||||
}
|
||||
|
||||
// Log
|
||||
type Log struct {
|
||||
ID int `json:"id"`
|
||||
Message string `json:"message"`
|
||||
Timestamp int `json:"timestamp"`
|
||||
Type int `json:"type"`
|
||||
}
|
||||
|
||||
// PeerLog
|
||||
type PeerLog struct {
|
||||
ID int `json:"id"`
|
||||
IP string `json:"ip"`
|
||||
Blocked bool `json:"blocked"`
|
||||
Timestamp int `json:"timestamp"`
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
// Info
|
||||
type Info struct {
|
||||
ConnectionStatus string `json:"connection_status"`
|
||||
DHTNodes int `json:"dht_nodes"`
|
||||
DlInfoData int `json:"dl_info_data"`
|
||||
DlInfoSpeed int `json:"dl_info_speed"`
|
||||
DlRateLimit int `json:"dl_rate_limit"`
|
||||
UlInfoData int `json:"up_info_data"`
|
||||
UlInfoSpeed int `json:"up_info_speed"`
|
||||
UlRateLimit int `json:"up_rate_limit"`
|
||||
Queueing bool `json:"queueing"`
|
||||
UseAltSpeedLimits bool `json:"use_alt_speed_limits"`
|
||||
RefreshInterval int `json:"refresh_interval"`
|
||||
}
|
||||
|
||||
type TorrentsOptions struct {
|
||||
Filter *string // all, downloading, completed, paused, active, inactive => optional
|
||||
Category *string // => optional
|
||||
Sort *string // => optional
|
||||
Reverse *bool // => optional
|
||||
Limit *int // => optional (no negatives)
|
||||
Offset *int // => optional (negatives allowed)
|
||||
Hashes []string // separated by | => optional
|
||||
}
|
||||
|
||||
// Category of torrent
|
||||
type Category struct {
|
||||
Name string `json:"name"`
|
||||
SavePath string `json:"savePath"`
|
||||
}
|
||||
|
||||
// Categories mapping
|
||||
type Categories struct {
|
||||
Category map[string]Category
|
||||
}
|
||||
|
||||
// LoginOptions contains all options for /login endpoint
|
||||
type LoginOptions struct {
|
||||
Username string
|
||||
Password string
|
||||
}
|
||||
|
||||
// AddTrackersOptions contains all options for /addTrackers endpoint
|
||||
type AddTrackersOptions struct {
|
||||
Hash string
|
||||
Trackers []string
|
||||
}
|
||||
|
||||
// EditTrackerOptions contains all options for /editTracker endpoint
|
||||
type EditTrackerOptions struct {
|
||||
Hash string
|
||||
OrigURL string
|
||||
NewURL string
|
||||
}
|
||||
|
||||
// RemoveTrackersOptions contains all options for /removeTrackers endpoint
|
||||
type RemoveTrackersOptions struct {
|
||||
Hash string
|
||||
Trackers []string
|
||||
}
|
||||
|
||||
type DownloadOptions struct {
|
||||
Savepath *string
|
||||
Cookie *string
|
||||
Category *string
|
||||
SkipHashChecking *bool
|
||||
Paused *bool
|
||||
RootFolder *bool
|
||||
Rename *string
|
||||
UploadSpeedLimit *int
|
||||
DownloadSpeedLimit *int
|
||||
SequentialDownload *bool
|
||||
AutomaticTorrentManagement *bool
|
||||
FirstLastPiecePriority *bool
|
||||
}
|
||||
|
||||
type InfoOptions struct {
|
||||
Filter *string
|
||||
Category *string
|
||||
Sort *string
|
||||
Reverse *bool
|
||||
Limit *int
|
||||
Offset *int
|
||||
Hashes []string
|
||||
}
|
||||
|
||||
type PriorityValues int
|
||||
|
||||
const (
|
||||
Do_not_download PriorityValues = 0
|
||||
Normal_priority PriorityValues = 1
|
||||
High_priority PriorityValues = 6
|
||||
Maximal_priority PriorityValues = 7
|
||||
)
|
||||
24
pkg/go-qbittorrent/tools/tools.go
Normal file
24
pkg/go-qbittorrent/tools/tools.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package tools
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
)
|
||||
|
||||
// PrintResponse prints the body of a response
|
||||
func PrintResponse(body io.ReadCloser) {
|
||||
r, _ := io.ReadAll(body)
|
||||
fmt.Println("response: " + string(r))
|
||||
}
|
||||
|
||||
// PrintRequest prints a request
|
||||
func PrintRequest(req *http.Request) error {
|
||||
r, err := httputil.DumpRequest(req, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println("request: " + string(r))
|
||||
return nil
|
||||
}
|
||||
@@ -37,6 +37,7 @@ func ParseDoulist(doulistUrl string) (*importlist.Response, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var items []importlist.Item
|
||||
doc.Find("div[class=doulist-item]").Each(func(i int, selection *goquery.Selection) {
|
||||
titleDiv := selection.Find("div[class=title]")
|
||||
link := titleDiv.Find("div>a")
|
||||
@@ -64,18 +65,26 @@ func ParseDoulist(doulistUrl string) (*importlist.Response, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
_, err := parseDetailPage(strings.TrimSpace(href))
|
||||
if err != nil {
|
||||
log.Errorf("get detail page: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
item := importlist.Item{
|
||||
Title: strings.TrimSpace(link.Text()),
|
||||
Year: year,
|
||||
}
|
||||
items = append(items, item)
|
||||
_ = item
|
||||
println(link.Text(), href)
|
||||
//println(link.Text(), href)
|
||||
})
|
||||
return nil, nil
|
||||
|
||||
return &importlist.Response{Items: items}, nil
|
||||
}
|
||||
|
||||
func parseDetailPage(url string) (string, error) {
|
||||
println(url)
|
||||
req, err := http.NewRequest("GET", url, nil)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -95,6 +104,14 @@ func parseDetailPage(url string) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
doc.Find("div[class='subject clearfix']").Each(func(i int, se *goquery.Selection) {
|
||||
println(se.Text())
|
||||
se.Children().Get(1)
|
||||
imdb := se.Find("div[class='info']").First().Children().Last()
|
||||
println(imdb.Text())
|
||||
})
|
||||
|
||||
_ = doc
|
||||
return "", nil
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ import (
|
||||
)
|
||||
|
||||
func TestParseDoulist(t *testing.T) {
|
||||
r, err := ParseDoulist("https://www.douban.com/doulist/166422/")
|
||||
r, err := ParseDoulist("https://www.douban.com/doulist/81580/")
|
||||
log.Info(r, err)
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package metadata
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"polaris/pkg/utils"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -14,6 +15,26 @@ type MovieMetadata struct {
|
||||
IsQingban bool
|
||||
}
|
||||
|
||||
func (m *MovieMetadata) IsAcceptable(names... string) bool {
|
||||
for _, name := range names {
|
||||
re := regexp.MustCompile(`[^\p{L}\w\s]`)
|
||||
name = re.ReplaceAllString(strings.ToLower(name), " ")
|
||||
name2 := re.ReplaceAllString(strings.ToLower(m.Name), " ")
|
||||
name = strings.Join(strings.Fields(name), " ")
|
||||
name2 = strings.Join(strings.Fields(name2), " ")
|
||||
if utils.IsASCII(name) { //ascii name should match words
|
||||
re := regexp.MustCompile(`\b` + name + `\b`)
|
||||
return re.MatchString(name2)
|
||||
}
|
||||
|
||||
if strings.Contains(name2, name) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
func ParseMovie(name string) *MovieMetadata {
|
||||
name = strings.Join(strings.Fields(name), " ") //remove unnessary spaces
|
||||
name = strings.ToLower(strings.TrimSpace(name))
|
||||
|
||||
@@ -2,6 +2,7 @@ package metadata
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"polaris/log"
|
||||
"polaris/pkg/utils"
|
||||
"regexp"
|
||||
"strconv"
|
||||
@@ -17,6 +18,29 @@ type Metadata struct {
|
||||
IsSeasonPack bool
|
||||
}
|
||||
|
||||
func (m *Metadata) IsAcceptable(names... string) bool {
|
||||
for _, name := range names {
|
||||
re := regexp.MustCompile(`[^\p{L}\w\s]`)
|
||||
name = re.ReplaceAllString(strings.ToLower(name), " ")
|
||||
nameCN := re.ReplaceAllString(strings.ToLower(m.NameCn), " ")
|
||||
nameEN := re.ReplaceAllString(strings.ToLower(m.NameEn), " ")
|
||||
name = strings.Join(strings.Fields(name), " ")
|
||||
nameCN = strings.Join(strings.Fields(nameCN), " ")
|
||||
nameEN = strings.Join(strings.Fields(nameEN), " ")
|
||||
if utils.IsASCII(name) { //ascii name should match words
|
||||
re := regexp.MustCompile(`\b` + name + `\b`)
|
||||
return re.MatchString(nameCN) || re.MatchString(nameEN)
|
||||
}
|
||||
|
||||
if strings.Contains(nameCN, name) || strings.Contains(nameEN, name) {
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
func ParseTv(name string) *Metadata {
|
||||
name = strings.ToLower(name)
|
||||
name = strings.ReplaceAll(name, "\u200b", "") //remove unicode hidden character
|
||||
@@ -170,7 +194,7 @@ func parseChineseName(name string) *Metadata {
|
||||
}
|
||||
|
||||
//episode number
|
||||
re1 := regexp.MustCompile(`\[\d{1,2}\]`)
|
||||
re1 := regexp.MustCompile(`\[\d{1,3}\]`)
|
||||
episodeMatches1 := re1.FindAllString(name, -1)
|
||||
if len(episodeMatches1) > 0 { //[11] [1080p]
|
||||
epNum := strings.TrimRight(strings.TrimLeft(episodeMatches1[0], "["), "]")
|
||||
@@ -228,12 +252,17 @@ func parseChineseName(name string) *Metadata {
|
||||
}
|
||||
meta.Season = n
|
||||
} else {
|
||||
seasonRe1 := regexp.MustCompile(`第.{1}季`)
|
||||
seasonRe1 := regexp.MustCompile(`第.{1,2}季`)
|
||||
seasonMatches := seasonRe1.FindAllString(name, -1)
|
||||
if len(seasonMatches) > 0 {
|
||||
se := []rune(seasonMatches[0])
|
||||
seNum := se[1]
|
||||
meta.Season = chinese2Num[string(seNum)]
|
||||
m1 := []rune(seasonMatches[0])
|
||||
seNum := m1[1 : len(m1)-1]
|
||||
n, err := strconv.Atoi(string(seNum))
|
||||
if err != nil {
|
||||
log.Warnf("parse season number %v error: %v, try to parse using chinese", seNum, err)
|
||||
n = chinese2Num[string(seNum)]
|
||||
}
|
||||
meta.Season = n
|
||||
|
||||
}
|
||||
}
|
||||
@@ -245,24 +274,29 @@ func parseChineseName(name string) *Metadata {
|
||||
}
|
||||
|
||||
//tv name
|
||||
title := name
|
||||
|
||||
fields := strings.FieldsFunc(title, func(r rune) bool {
|
||||
fields := strings.FieldsFunc(name, func(r rune) bool {
|
||||
return r == '[' || r == ']' || r == '【' || r == '】'
|
||||
})
|
||||
title = ""
|
||||
titleCn := ""
|
||||
title := ""
|
||||
for _, p := range fields { //寻找匹配的最长的字符串,最有可能是名字
|
||||
if len([]rune(p)) > len([]rune(title)) {
|
||||
if utils.ContainsChineseChar(p) && len([]rune(p)) > len([]rune(titleCn)) { //最长含中文字符串
|
||||
titleCn = p
|
||||
}
|
||||
if len([]rune(p)) > len([]rune(title)) { //最长字符串
|
||||
title = p
|
||||
}
|
||||
}
|
||||
re := regexp.MustCompile(`[^\p{L}\w\s]`)
|
||||
title = re.ReplaceAllString(strings.TrimSpace(strings.ToLower(title)), "")
|
||||
title = re.ReplaceAllString(strings.TrimSpace(strings.ToLower(title)), "") //去除标点符号
|
||||
titleCn = re.ReplaceAllString(strings.TrimSpace(strings.ToLower(titleCn)), "")
|
||||
|
||||
meta.NameCn = title
|
||||
meta.NameCn = titleCn
|
||||
cnRe := regexp.MustCompile(`\p{Han}.*\p{Han}`)
|
||||
cnmatches := cnRe.FindAllString(title, -1)
|
||||
cnmatches := cnRe.FindAllString(titleCn, -1)
|
||||
|
||||
//titleCn中最长的中文字符
|
||||
if len(cnmatches) > 0 {
|
||||
for _, t := range cnmatches {
|
||||
if len([]rune(t)) > len([]rune(meta.NameCn)) {
|
||||
@@ -271,12 +305,13 @@ func parseChineseName(name string) *Metadata {
|
||||
}
|
||||
}
|
||||
|
||||
//匹配title中最长拉丁字符串
|
||||
enRe := regexp.MustCompile(`[[:ascii:]]*`)
|
||||
enM := enRe.FindAllString(title, -1)
|
||||
if len(enM) > 0 {
|
||||
for _, t := range enM {
|
||||
if len(t) > len(meta.NameEn) {
|
||||
meta.NameEn = strings.ToLower(t)
|
||||
meta.NameEn = strings.TrimSpace(strings.ToLower(t))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,11 +137,24 @@ func Test_ParseTV13(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_ParseTV14(t *testing.T) {
|
||||
s1 := ""
|
||||
s1 := "[GM-Team][国漫][斗破苍穹 第5季][Fights Break Sphere Ⅴ][2022][113][HEVC][GB][4K]"
|
||||
m := ParseTv(s1)
|
||||
log.Infof("results: %+v", m)
|
||||
assert.Equal(t, 2, m.Season)
|
||||
assert.Equal(t, 01, m.Episode)
|
||||
assert.Equal(t, 5, m.Season)
|
||||
assert.Equal(t, 113, m.Episode)
|
||||
assert.Equal(t, false, m.IsSeasonPack)
|
||||
assert.Equal(t, "720p", m.Resolution)
|
||||
//assert.Equal(t, "720p", m.Resolution)
|
||||
}
|
||||
//
|
||||
|
||||
func Test_ParseTV15(t *testing.T) {
|
||||
s1 := "[7³ACG] 剧场版 回转企鹅罐 [前篇] 你的列车是生存战略/RE:cycle of the PENGUINDRUM Zenpen [简繁字幕] BDrip 1080p x265 FLAC"
|
||||
m := ParseTv(s1)
|
||||
log.Infof("results: %+v", m)
|
||||
b := m.IsAcceptable("The Penguin")
|
||||
assert.False(t, b)
|
||||
//assert.Equal(t, 1, m.Season)
|
||||
//assert.Equal(t, 113, m.Episode)
|
||||
//assert.Equal(t, false, m.IsSeasonPack)
|
||||
//assert.Equal(t, "720p", m.Resolution)
|
||||
}
|
||||
65
pkg/prowlarr/prowlarr.go
Normal file
65
pkg/prowlarr/prowlarr.go
Normal file
@@ -0,0 +1,65 @@
|
||||
package prowlarr
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"polaris/db"
|
||||
"polaris/ent"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"golift.io/starr"
|
||||
"golift.io/starr/prowlarr"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
p *prowlarr.Prowlarr
|
||||
apiKey string
|
||||
url string
|
||||
}
|
||||
|
||||
func New(apiKey, url string) *Client {
|
||||
c := starr.New(apiKey, url, 10*time.Second)
|
||||
p := prowlarr.New(c)
|
||||
return &Client{p: p, apiKey: apiKey, url: url}
|
||||
}
|
||||
|
||||
func (c *Client) GetIndexers() ([]*db.TorznabInfo, error) {
|
||||
ins, err := c.p.GetIndexers()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var indexers []*db.TorznabInfo
|
||||
for _, in := range ins {
|
||||
if !in.Enable {
|
||||
continue
|
||||
}
|
||||
seedRatio := 0.0
|
||||
for _, f := range in.Fields {
|
||||
if f.Name == "torrentBaseSettings.seedRatio" && f.Value != nil {
|
||||
if r, ok := f.Value.(float64); ok {
|
||||
seedRatio = r
|
||||
}
|
||||
}
|
||||
}
|
||||
setting := db.TorznabSetting{
|
||||
URL: fmt.Sprintf("%s/%d/api", strings.TrimSuffix(c.url, "/"), in.ID),
|
||||
ApiKey: c.apiKey,
|
||||
}
|
||||
data, _ := json.Marshal(&setting)
|
||||
|
||||
entIndexer := ent.Indexers{
|
||||
Name: in.Name,
|
||||
Implementation: "torznab",
|
||||
Priority: 128 - int(in.Priority),
|
||||
SeedRatio: float32(seedRatio),
|
||||
Settings: string(data),
|
||||
}
|
||||
|
||||
indexers = append(indexers, &db.TorznabInfo{
|
||||
Indexers: &entIndexer,
|
||||
TorznabSetting: setting,
|
||||
})
|
||||
}
|
||||
return indexers, nil
|
||||
}
|
||||
13
pkg/prowlarr/prowlarr_test.go
Normal file
13
pkg/prowlarr/prowlarr_test.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package prowlarr
|
||||
|
||||
import (
|
||||
"polaris/log"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test111(t *testing.T) {
|
||||
c := New("", "http://10.0.0.8:9696/")
|
||||
apis , err := c.GetIndexers()
|
||||
log.Infof("errors: %v", err)
|
||||
log.Infof("indexers: %+v", apis[0])
|
||||
}
|
||||
204
pkg/qbittorrent/qbittorrent.go
Normal file
204
pkg/qbittorrent/qbittorrent.go
Normal file
@@ -0,0 +1,204 @@
|
||||
package qbittorrent
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"polaris/pkg"
|
||||
"polaris/pkg/go-qbittorrent/qbt"
|
||||
"polaris/pkg/utils"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
const btCategory = "polaris"
|
||||
|
||||
type Info struct {
|
||||
URL string
|
||||
User string
|
||||
Password string
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
c *qbt.Client
|
||||
category string
|
||||
Info
|
||||
}
|
||||
|
||||
func NewClient(url, user, pass string) (*Client, error) {
|
||||
// connect to qbittorrent client
|
||||
qb := qbt.NewClient(url)
|
||||
|
||||
// login to the client
|
||||
loginOpts := qbt.LoginOptions{
|
||||
Username: user,
|
||||
Password: pass,
|
||||
}
|
||||
err := qb.Login(loginOpts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Client{c: qb, category: btCategory, Info: Info{URL: url, User: user, Password: pass}}, nil
|
||||
}
|
||||
|
||||
func (c *Client) GetAll() ([]pkg.Torrent, error) {
|
||||
tt, err := c.c.Torrents(qbt.TorrentsOptions{Category: &c.category})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "get torrents")
|
||||
}
|
||||
var res []pkg.Torrent
|
||||
for _, t := range tt {
|
||||
t1 := &Torrent{
|
||||
c: c.c,
|
||||
hash: t.Hash,
|
||||
//Info: c.Info,
|
||||
}
|
||||
res = append(res, t1)
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (c *Client) Download(link, dir string) (pkg.Torrent, error) {
|
||||
magnet, err := utils.Link2Magnet(link)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("converting link to magnet error, link: %v, error: %v", link, err)
|
||||
}
|
||||
|
||||
hash, err := utils.MagnetHash(magnet)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "get hash")
|
||||
}
|
||||
err = c.c.DownloadLinks([]string{magnet}, qbt.DownloadOptions{Savepath: &dir, Category: &c.category})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "qbt download")
|
||||
}
|
||||
return &Torrent{hash: hash, c: c.c}, nil
|
||||
|
||||
}
|
||||
|
||||
func NewTorrent(info Info, link string) (*Torrent, error) {
|
||||
c, err := NewClient(info.URL, info.User, info.Password)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
magnet, err := utils.Link2Magnet(link)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("converting link to magnet error, link: %v, error: %v", link, err)
|
||||
}
|
||||
|
||||
hash, err := utils.MagnetHash(magnet)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
t := &Torrent{
|
||||
c: c.c,
|
||||
hash: hash,
|
||||
}
|
||||
if !t.Exists() {
|
||||
return nil, errors.Errorf("torrent not exist: %v", magnet)
|
||||
}
|
||||
return t, nil
|
||||
}
|
||||
|
||||
type Torrent struct {
|
||||
c *qbt.Client
|
||||
hash string
|
||||
//info Info
|
||||
}
|
||||
|
||||
func (t *Torrent) GetHash() string {
|
||||
return t.hash
|
||||
}
|
||||
|
||||
func (t *Torrent) getTorrent() (*qbt.TorrentInfo, error) {
|
||||
all, err := t.c.Torrents(qbt.TorrentsOptions{Hashes: []string{t.hash}})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(all) == 0 {
|
||||
return nil, fmt.Errorf("no such torrent: %v", t.hash)
|
||||
}
|
||||
return &all[0], nil
|
||||
}
|
||||
|
||||
func (t *Torrent) Name() (string, error) {
|
||||
dir, err := t.getTorrentBaseNameOrDir()
|
||||
if err != nil { //use torrent name
|
||||
qb, err := t.getTorrent()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return qb.Name, nil
|
||||
}
|
||||
return dir, nil
|
||||
}
|
||||
|
||||
// https://github.com/qbittorrent/qBittorrent/issues/13572
|
||||
func (t *Torrent) getTorrentBaseNameOrDir() (string, error) {
|
||||
files, err := t.c.TorrentFiles(t.hash)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if len(files) == 0 {
|
||||
return "", errors.Wrap(err, "no file")
|
||||
}
|
||||
name := files[0].Name
|
||||
dir := strings.Split(name, string(os.PathSeparator))[0]
|
||||
return dir, nil
|
||||
}
|
||||
|
||||
func (t *Torrent) Progress() (int, error) {
|
||||
qb, err := t.getTorrent()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
p := qb.Progress * 100
|
||||
if p >= 100 {
|
||||
return 100, nil
|
||||
}
|
||||
if int(p) == 100 {
|
||||
return 99, nil
|
||||
}
|
||||
|
||||
return int(p), nil
|
||||
}
|
||||
|
||||
func (t *Torrent) Stop() error {
|
||||
return t.c.Pause([]string{t.hash})
|
||||
}
|
||||
|
||||
func (t *Torrent) Start() error {
|
||||
ok, err := t.c.Resume([]string{t.hash})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !ok {
|
||||
return fmt.Errorf("status not 200")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *Torrent) Remove() error {
|
||||
ok, err := t.c.Delete([]string{t.hash}, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !ok {
|
||||
return fmt.Errorf("status not 200")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *Torrent) Exists() bool {
|
||||
_, err := t.getTorrent()
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func (t *Torrent) SeedRatio() (float64, error) {
|
||||
qb, err := t.getTorrent()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return qb.Ratio, nil
|
||||
}
|
||||
20
pkg/qbittorrent/qbittorrent_test.go
Normal file
20
pkg/qbittorrent/qbittorrent_test.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package qbittorrent
|
||||
|
||||
import (
|
||||
"polaris/log"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test1(t *testing.T) {
|
||||
c, err := NewClient("http://10.0.0.8:8081/", "", "")
|
||||
if err != nil {
|
||||
log.Errorf("new client error: %v", err)
|
||||
t.Fail()
|
||||
}
|
||||
all, err := c.GetAll()
|
||||
for _, t := range all {
|
||||
name, _ := t.Name()
|
||||
log.Infof("torrent: %+v", name)
|
||||
}
|
||||
|
||||
}
|
||||
1
pkg/thirdparty/doc.go
vendored
Normal file
1
pkg/thirdparty/doc.go
vendored
Normal file
@@ -0,0 +1 @@
|
||||
package thirdparty
|
||||
@@ -1,8 +1,14 @@
|
||||
package torznab
|
||||
|
||||
import (
|
||||
"polaris/log"
|
||||
"polaris/pkg/cache"
|
||||
"time"
|
||||
)
|
||||
|
||||
var cc = cache.NewCache[string, *Response](time.Minute * 30)
|
||||
var cc = cache.NewCache[string, []Result](time.Minute * 30)
|
||||
|
||||
func CleanCache() {
|
||||
log.Debugf("clean all torznab caches")
|
||||
cc = cache.NewCache[string, []Result](time.Minute * 30)
|
||||
}
|
||||
@@ -80,6 +80,11 @@ func (r *Response) ToResults(indexer *db.TorznabInfo) []Result {
|
||||
if slices.Contains(item.Category, "3000") { //exclude audio files
|
||||
continue
|
||||
}
|
||||
// link, err := utils.Link2Magnet(item.Link) //TODO time consuming operation
|
||||
// if err != nil {
|
||||
// log.Warnf("converting link to magnet error, error: %v, link: %v", err, item.Link)
|
||||
// continue
|
||||
// }
|
||||
r := Result{
|
||||
Name: item.Title,
|
||||
Link: item.Link,
|
||||
@@ -135,15 +140,18 @@ func Search(indexer *db.TorznabInfo, keyWord string) ([]Result, error) {
|
||||
|
||||
cacheRes, ok := cc.Get(key)
|
||||
if !ok {
|
||||
log.Debugf("not found in cache, need query again: %v", key)
|
||||
res, err := doRequest(req)
|
||||
if err != nil {
|
||||
cc.Set(key, &Response{})
|
||||
cc.Set(key, nil)
|
||||
return nil, errors.Wrap(err, "do http request")
|
||||
}
|
||||
cacheRes = res
|
||||
cacheRes = res.ToResults(indexer)
|
||||
cc.Set(key, cacheRes)
|
||||
} else {
|
||||
log.Debugf("found cache match for key: %v", key)
|
||||
}
|
||||
return cacheRes.ToResults(indexer), nil
|
||||
return cacheRes, nil
|
||||
}
|
||||
|
||||
func doRequest(req *http.Request) (*Response, error) {
|
||||
|
||||
@@ -2,12 +2,11 @@ package transmission
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"polaris/log"
|
||||
"strings"
|
||||
"polaris/pkg"
|
||||
"polaris/pkg/utils"
|
||||
|
||||
"github.com/hekmon/transmissionrpc/v3"
|
||||
"github.com/pkg/errors"
|
||||
@@ -45,76 +44,82 @@ type Client struct {
|
||||
cfg Config
|
||||
}
|
||||
|
||||
func (c *Client) GetAll() ([]*Torrent, error) {
|
||||
func (c *Client) GetAll() ([]pkg.Torrent, error) {
|
||||
all, err := c.c.TorrentGetAll(context.TODO())
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "get all")
|
||||
}
|
||||
var torrents []*Torrent
|
||||
var torrents []pkg.Torrent
|
||||
for _, t := range all {
|
||||
torrents = append(torrents, &Torrent{
|
||||
Hash: *t.HashString,
|
||||
c: c.c,
|
||||
Config: c.cfg,
|
||||
hash: *t.HashString,
|
||||
c: c.c,
|
||||
//cfg: c.cfg,
|
||||
})
|
||||
}
|
||||
return torrents, nil
|
||||
}
|
||||
|
||||
func (c *Client) Download(link, dir string) (*Torrent, error) {
|
||||
if strings.HasPrefix(link, "http") {
|
||||
client := &http.Client{
|
||||
CheckRedirect: func(req *http.Request, via []*http.Request) error {
|
||||
return http.ErrUseLastResponse
|
||||
},
|
||||
}
|
||||
resp, err:=client.Get(link)
|
||||
if err == nil {
|
||||
if resp.StatusCode == http.StatusFound {
|
||||
loc, err := resp.Location()
|
||||
if err == nil {
|
||||
link = loc.String()
|
||||
log.Warnf("transimision redirect to url: %v", link)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
t, err := c.c.TorrentAdd(context.TODO(), transmissionrpc.TorrentAddPayload{
|
||||
Filename: &link,
|
||||
DownloadDir: &dir,
|
||||
})
|
||||
log.Infof("get torrent info: %+v", t)
|
||||
if t.HashString == nil {
|
||||
return nil, fmt.Errorf("download torrent error: %v", link)
|
||||
func (c *Client) Download(link, dir string) (pkg.Torrent, error) {
|
||||
magnet, err := utils.Link2Magnet(link)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("converting link to magnet error, link: %v, error: %v", link, err)
|
||||
}
|
||||
|
||||
hash, err := utils.MagnetHash(magnet)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "get hash")
|
||||
}
|
||||
|
||||
t, err := c.c.TorrentAdd(context.TODO(), transmissionrpc.TorrentAddPayload{
|
||||
Filename: &magnet,
|
||||
DownloadDir: &dir,
|
||||
})
|
||||
log.Debugf("get torrent info: %+v", t)
|
||||
|
||||
return &Torrent{
|
||||
Hash: *t.HashString,
|
||||
c: c.c,
|
||||
Config: c.cfg,
|
||||
hash: hash,
|
||||
c: c.c,
|
||||
//cfg: c.cfg,
|
||||
}, err
|
||||
}
|
||||
|
||||
func NewTorrent(cfg Config, link string) (*Torrent, error) {
|
||||
c, err := NewClient(cfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
magnet, err := utils.Link2Magnet(link)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("converting link to magnet error, link: %v, error: %v", link, err)
|
||||
}
|
||||
|
||||
hash, err := utils.MagnetHash(magnet)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
t := &Torrent{
|
||||
c: c.c,
|
||||
hash: hash,
|
||||
//cfg: cfg,
|
||||
}
|
||||
if !t.Exists() {
|
||||
return nil, errors.Errorf("torrent not exist: %v", magnet)
|
||||
}
|
||||
return t, nil
|
||||
}
|
||||
|
||||
type Torrent struct {
|
||||
//t *transmissionrpc.Torrent
|
||||
c *transmissionrpc.Client
|
||||
Hash string `json:"hash"`
|
||||
Config
|
||||
}
|
||||
|
||||
func (t *Torrent) reloadClient() error {
|
||||
c, err := NewClient(t.Config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.c = c.c
|
||||
return nil
|
||||
c *transmissionrpc.Client
|
||||
hash string
|
||||
//cfg Config
|
||||
}
|
||||
|
||||
func (t *Torrent) getTorrent() (transmissionrpc.Torrent, error) {
|
||||
r, err := t.c.TorrentGetAllForHashes(context.TODO(), []string{t.Hash})
|
||||
r, err := t.c.TorrentGetAllForHashes(context.TODO(), []string{t.hash})
|
||||
if err != nil {
|
||||
log.Errorf("get torrent info for error: %v", err)
|
||||
}
|
||||
@@ -125,14 +130,13 @@ func (t *Torrent) getTorrent() (transmissionrpc.Torrent, error) {
|
||||
}
|
||||
|
||||
func (t *Torrent) Exists() bool {
|
||||
r, err := t.c.TorrentGetAllForHashes(context.TODO(), []string{t.Hash})
|
||||
r, err := t.c.TorrentGetAllForHashes(context.TODO(), []string{t.hash})
|
||||
if err != nil {
|
||||
log.Errorf("get torrent info for error: %v", err)
|
||||
}
|
||||
return len(r) > 0
|
||||
}
|
||||
|
||||
|
||||
func (t *Torrent) Name() (string, error) {
|
||||
tt, err := t.getTorrent()
|
||||
if err != nil {
|
||||
@@ -164,7 +168,7 @@ func (t *Torrent) Progress() (int, error) {
|
||||
}
|
||||
|
||||
func (t *Torrent) Stop() error {
|
||||
return t.c.TorrentStopHashes(context.TODO(), []string{t.Hash})
|
||||
return t.c.TorrentStopHashes(context.TODO(), []string{t.hash})
|
||||
}
|
||||
|
||||
func (t *Torrent) SeedRatio() (float64, error) {
|
||||
@@ -179,7 +183,7 @@ func (t *Torrent) SeedRatio() (float64, error) {
|
||||
}
|
||||
|
||||
func (t *Torrent) Start() error {
|
||||
return t.c.TorrentStartHashes(context.TODO(), []string{t.Hash})
|
||||
return t.c.TorrentStartHashes(context.TODO(), []string{t.hash})
|
||||
}
|
||||
|
||||
func (t *Torrent) Remove() error {
|
||||
@@ -201,22 +205,6 @@ func (t *Torrent) Size() (int, error) {
|
||||
return int(tt.TotalSize.Byte()), nil
|
||||
}
|
||||
|
||||
func (t *Torrent) Save() string {
|
||||
|
||||
d, _ := json.Marshal(*t)
|
||||
return string(d)
|
||||
}
|
||||
|
||||
func ReloadTorrent(s string) (*Torrent, error) {
|
||||
var torrent = Torrent{}
|
||||
err := json.Unmarshal([]byte(s), &torrent)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = torrent.reloadClient()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "reload client")
|
||||
}
|
||||
return &torrent, nil
|
||||
func (t *Torrent) GetHash() string {
|
||||
return t.hash
|
||||
}
|
||||
|
||||
25
pkg/utils/linux.go
Normal file
25
pkg/utils/linux.go
Normal file
@@ -0,0 +1,25 @@
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package utils
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/unix"
|
||||
"math"
|
||||
"runtime"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func AvailableSpace(dir string) uint64 {
|
||||
if runtime.GOOS != "linux" {
|
||||
return math.MaxUint64
|
||||
}
|
||||
var stat unix.Statfs_t
|
||||
|
||||
unix.Statfs(dir, &stat)
|
||||
return stat.Bavail * uint64(stat.Bsize)
|
||||
}
|
||||
|
||||
func MaxPermission() {
|
||||
syscall.Umask(0) //max permission 0777
|
||||
}
|
||||
16
pkg/utils/other.go
Normal file
16
pkg/utils/other.go
Normal file
@@ -0,0 +1,16 @@
|
||||
//go:build !linux
|
||||
// +build !linux
|
||||
|
||||
package utils
|
||||
|
||||
import (
|
||||
"math"
|
||||
)
|
||||
|
||||
func AvailableSpace(dir string) uint64 {
|
||||
return math.MaxUint64
|
||||
}
|
||||
|
||||
func MaxPermission() {
|
||||
return
|
||||
}
|
||||
@@ -2,16 +2,19 @@ package utils
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"github.com/anacrolix/torrent/metainfo"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
"golang.org/x/exp/rand"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func IsASCII(s string) bool {
|
||||
@@ -55,17 +58,17 @@ func RandString(n int) string {
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func IsNameAcceptable(name1, name2 string) bool {
|
||||
re := regexp.MustCompile(`[^\p{L}\w\s]`)
|
||||
name1 = re.ReplaceAllString(strings.ToLower(name1), " ")
|
||||
name2 = re.ReplaceAllString(strings.ToLower(name2), " ")
|
||||
name1 = strings.Join(strings.Fields(name1), " ")
|
||||
name2 = strings.Join(strings.Fields(name2), " ")
|
||||
if strings.Contains(name1, name2) || strings.Contains(name2, name1) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
// func IsNameAcceptable(name1, name2 string) bool {
|
||||
// re := regexp.MustCompile(`[^\p{L}\w\s]`)
|
||||
// name1 = re.ReplaceAllString(strings.ToLower(name1), " ")
|
||||
// name2 = re.ReplaceAllString(strings.ToLower(name2), " ")
|
||||
// name1 = strings.Join(strings.Fields(name1), " ")
|
||||
// name2 = strings.Join(strings.Fields(name2), " ")
|
||||
// if strings.Contains(name1, name2) || strings.Contains(name2, name1) {
|
||||
// return true
|
||||
// }
|
||||
// return false
|
||||
// }
|
||||
|
||||
func FindSeasonEpisodeNum(name string) (se int, ep int, err error) {
|
||||
seRe := regexp.MustCompile(`S\d+`)
|
||||
@@ -129,13 +132,6 @@ func SeasonId(seasonName string) (int, error) {
|
||||
return num, nil
|
||||
}
|
||||
|
||||
func AvailableSpace(dir string) uint64 {
|
||||
var stat unix.Statfs_t
|
||||
|
||||
unix.Statfs(dir, &stat)
|
||||
return stat.Bavail * uint64(stat.Bsize)
|
||||
}
|
||||
|
||||
func ChangeFileHash(name string) error {
|
||||
f, err := os.OpenFile(name, os.O_APPEND|os.O_WRONLY, 0655)
|
||||
if err != nil {
|
||||
@@ -183,3 +179,96 @@ func trimMapStringInterface(data interface{}) interface{} {
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/questions/39320371/how-start-web-server-to-open-page-in-browser-in-golang
|
||||
// openURL opens the specified URL in the default browser of the user.
|
||||
func OpenURL(url string) error {
|
||||
var cmd string
|
||||
var args []string
|
||||
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
cmd = "cmd"
|
||||
args = []string{"/c", "start"}
|
||||
case "darwin":
|
||||
cmd = "open"
|
||||
args = []string{url}
|
||||
default: // "linux", "freebsd", "openbsd", "netbsd"
|
||||
// Check if running under WSL
|
||||
if isWSL() {
|
||||
// Use 'cmd.exe /c start' to open the URL in the default Windows browser
|
||||
cmd = "cmd.exe"
|
||||
args = []string{"/c", "start", url}
|
||||
} else {
|
||||
// Use xdg-open on native Linux environments
|
||||
cmd = "xdg-open"
|
||||
args = []string{url}
|
||||
}
|
||||
}
|
||||
if len(args) > 1 {
|
||||
// args[0] is used for 'start' command argument, to prevent issues with URLs starting with a quote
|
||||
args = append(args[:1], append([]string{""}, args[1:]...)...)
|
||||
}
|
||||
return exec.Command(cmd, args...).Start()
|
||||
}
|
||||
|
||||
// isWSL checks if the Go program is running inside Windows Subsystem for Linux
|
||||
func isWSL() bool {
|
||||
releaseData, err := exec.Command("uname", "-r").Output()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return strings.Contains(strings.ToLower(string(releaseData)), "microsoft")
|
||||
}
|
||||
|
||||
func Link2Magnet(link string) (string, error) {
|
||||
if strings.HasPrefix(strings.ToLower(link), "magnet:") {
|
||||
return link, nil
|
||||
}
|
||||
client := &http.Client{
|
||||
CheckRedirect: func(req *http.Request, via []*http.Request) error {
|
||||
return http.ErrUseLastResponse //do not follow redirects
|
||||
},
|
||||
}
|
||||
|
||||
resp, err := client.Get(link)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "get link")
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode >= 300 && resp.StatusCode < 400 {
|
||||
//redirects
|
||||
tourl := resp.Header.Get("Location")
|
||||
return Link2Magnet(tourl)
|
||||
}
|
||||
info, err := metainfo.Load(resp.Body)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "parse response")
|
||||
}
|
||||
mg, err := info.MagnetV2()
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "convert magnet")
|
||||
}
|
||||
return mg.String(), nil
|
||||
}
|
||||
|
||||
|
||||
func MagnetHash(link string) (string, error) {
|
||||
if mi, err := metainfo.ParseMagnetV2Uri(link); err != nil {
|
||||
return "", errors.Errorf("magnet link is not valid: %v", err)
|
||||
} else {
|
||||
hash := ""
|
||||
if mi.InfoHash.Unwrap().HexString() != "" {
|
||||
hash = mi.InfoHash.Unwrap().HexString()
|
||||
} else {
|
||||
btmh := mi.V2InfoHash.Unwrap()
|
||||
if btmh.HexString() != "" {
|
||||
hash = btmh.HexString()
|
||||
}
|
||||
}
|
||||
if hash == "" {
|
||||
return "", errors.Errorf("magnet has no info hash: %v", link)
|
||||
}
|
||||
return hash, nil
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,10 @@ package server
|
||||
import (
|
||||
"fmt"
|
||||
"polaris/ent"
|
||||
"polaris/ent/blacklist"
|
||||
"polaris/ent/episode"
|
||||
"polaris/ent/history"
|
||||
"polaris/ent/schema"
|
||||
"polaris/log"
|
||||
"polaris/pkg/utils"
|
||||
"strconv"
|
||||
@@ -63,22 +65,35 @@ func (s *Server) GetAllActivities(c *gin.Context) (interface{}, error) {
|
||||
return activities, nil
|
||||
}
|
||||
|
||||
type removeActivityIn struct {
|
||||
ID int `json:"id"`
|
||||
Add2Blacklist bool `json:"add_2_blacklist"`
|
||||
}
|
||||
|
||||
func (s *Server) RemoveActivity(c *gin.Context) (interface{}, error) {
|
||||
ids := c.Param("id")
|
||||
id, err := strconv.Atoi(ids)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "convert")
|
||||
var in removeActivityIn
|
||||
if err := c.ShouldBindJSON(&in); err != nil {
|
||||
return nil, errors.Wrap(err, "bind json")
|
||||
}
|
||||
his := s.db.GetHistory(id)
|
||||
|
||||
his := s.db.GetHistory(in.ID)
|
||||
if his == nil {
|
||||
log.Errorf("no record of id: %d", id)
|
||||
log.Errorf("no record of id: %d", in.ID)
|
||||
return nil, nil
|
||||
}
|
||||
if in.Add2Blacklist && his.Link != "" {
|
||||
//should add to blacklist
|
||||
if err := s.addTorrent2Blacklist(his.Link); err != nil {
|
||||
return nil, errors.Errorf("add to blacklist: %v", err)
|
||||
} else {
|
||||
log.Infof("success add magnet link to blacklist: %v", his.Link)
|
||||
}
|
||||
}
|
||||
|
||||
if err := s.core.RemoveTaskAndTorrent(his.ID); err != nil {
|
||||
return nil, errors.Wrap(err, "remove torrent")
|
||||
}
|
||||
err = s.db.DeleteHistory(id)
|
||||
err := s.db.DeleteHistory(in.ID)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "db")
|
||||
}
|
||||
@@ -102,6 +117,28 @@ func (s *Server) RemoveActivity(c *gin.Context) (interface{}, error) {
|
||||
log.Infof("history record successful deleted: %v", his.SourceTitle)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *Server) addTorrent2Blacklist(link string) error {
|
||||
if link == "" {
|
||||
return nil
|
||||
}
|
||||
if hash, err := utils.MagnetHash(link); err != nil {
|
||||
return err
|
||||
} else {
|
||||
item := ent.Blacklist{
|
||||
Type: blacklist.TypeTorrent,
|
||||
Value: schema.BlacklistValue{
|
||||
TorrentHash: hash,
|
||||
},
|
||||
}
|
||||
err := s.db.AddBlacklistItem(&item)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "add to db")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Server) GetMediaDownloadHistory(c *gin.Context) (interface{}, error) {
|
||||
var ids = c.Param("id")
|
||||
id, err := strconv.Atoi(ids)
|
||||
@@ -123,7 +160,7 @@ type TorrentInfo struct {
|
||||
}
|
||||
|
||||
func (s *Server) GetAllTorrents(c *gin.Context) (interface{}, error) {
|
||||
trc, _, err := s.getDownloadClient()
|
||||
trc, _, err := s.core.GetDownloadClient()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "connect transmission")
|
||||
}
|
||||
@@ -140,7 +177,7 @@ func (s *Server) GetAllTorrents(c *gin.Context) (interface{}, error) {
|
||||
p, _ := t.Progress()
|
||||
infos = append(infos, TorrentInfo{
|
||||
Name: name,
|
||||
ID: t.Hash,
|
||||
ID: t.GetHash(),
|
||||
Progress: p,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -3,7 +3,10 @@ package core
|
||||
import (
|
||||
"polaris/db"
|
||||
"polaris/ent"
|
||||
"polaris/ent/downloadclients"
|
||||
"polaris/log"
|
||||
"polaris/pkg"
|
||||
"polaris/pkg/qbittorrent"
|
||||
"polaris/pkg/tmdb"
|
||||
"polaris/pkg/transmission"
|
||||
"polaris/pkg/utils"
|
||||
@@ -23,20 +26,20 @@ func NewClient(db *db.Client, language string) *Client {
|
||||
|
||||
type scheduler struct {
|
||||
cron string
|
||||
f func() error
|
||||
f func() error
|
||||
}
|
||||
type Client struct {
|
||||
db *db.Client
|
||||
cron *cron.Cron
|
||||
tasks map[int]*Task
|
||||
language string
|
||||
db *db.Client
|
||||
cron *cron.Cron
|
||||
tasks map[int]*Task
|
||||
language string
|
||||
schedulers utils.Map[string, scheduler]
|
||||
}
|
||||
|
||||
func (c *Client) registerCronJob(name string, cron string, f func() error) {
|
||||
c.schedulers.Store(name, scheduler{
|
||||
cron: cron,
|
||||
f: f,
|
||||
f: f,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -48,30 +51,67 @@ func (c *Client) Init() {
|
||||
func (c *Client) reloadTasks() {
|
||||
allTasks := c.db.GetRunningHistories()
|
||||
for _, t := range allTasks {
|
||||
torrent, err := transmission.ReloadTorrent(t.Saved)
|
||||
dl, err := c.db.GetDownloadClient(t.DownloadClientID)
|
||||
if err != nil {
|
||||
log.Errorf("relaod task %s failed: %v", t.SourceTitle, err)
|
||||
log.Warnf("no download client related: %v", t.SourceTitle)
|
||||
continue
|
||||
}
|
||||
if !torrent.Exists() { //只要种子还存在于客户端中,就重新加载,有可能是还在做种中
|
||||
continue
|
||||
|
||||
if dl.Implementation == downloadclients.ImplementationTransmission {
|
||||
to, err := transmission.NewTorrent(transmission.Config{
|
||||
URL: dl.URL,
|
||||
User: dl.User,
|
||||
Password: dl.Password,
|
||||
}, t.Link)
|
||||
if err != nil {
|
||||
log.Warnf("get task error: %v", err)
|
||||
continue
|
||||
}
|
||||
c.tasks[t.ID] = &Task{Torrent: to}
|
||||
} else if dl.Implementation == downloadclients.ImplementationQbittorrent {
|
||||
to, err := qbittorrent.NewTorrent(qbittorrent.Info{
|
||||
URL: dl.URL,
|
||||
User: dl.User,
|
||||
Password: dl.Password,
|
||||
}, t.Link)
|
||||
if err != nil {
|
||||
log.Warnf("get task error: %v", err)
|
||||
continue
|
||||
}
|
||||
c.tasks[t.ID] = &Task{Torrent: to}
|
||||
}
|
||||
log.Infof("reloading task: %d %s", t.ID, t.SourceTitle)
|
||||
c.tasks[t.ID] = &Task{Torrent: torrent}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) getDownloadClient() (*transmission.Client, *ent.DownloadClients, error) {
|
||||
tr := c.db.GetTransmission()
|
||||
trc, err := transmission.NewClient(transmission.Config{
|
||||
URL: tr.URL,
|
||||
User: tr.User,
|
||||
Password: tr.Password,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, nil, errors.Wrap(err, "connect transmission")
|
||||
func (c *Client) GetDownloadClient() (pkg.Downloader, *ent.DownloadClients, error) {
|
||||
downloaders := c.db.GetAllDonloadClients()
|
||||
for _, d := range downloaders {
|
||||
if !d.Enable {
|
||||
continue
|
||||
}
|
||||
if d.Implementation == downloadclients.ImplementationTransmission {
|
||||
trc, err := transmission.NewClient(transmission.Config{
|
||||
URL: d.URL,
|
||||
User: d.User,
|
||||
Password: d.Password,
|
||||
})
|
||||
if err != nil {
|
||||
log.Warnf("connect to download client error: %v", d.URL)
|
||||
continue
|
||||
}
|
||||
return trc, d, nil
|
||||
|
||||
} else if d.Implementation == downloadclients.ImplementationQbittorrent {
|
||||
qbt, err := qbittorrent.NewClient(d.URL, d.User, d.Password)
|
||||
if err != nil {
|
||||
log.Warnf("connect to download client error: %v", d.URL)
|
||||
continue
|
||||
}
|
||||
return qbt, d, nil
|
||||
}
|
||||
}
|
||||
return trc, tr, nil
|
||||
return nil, nil, errors.Errorf("no available download client")
|
||||
}
|
||||
|
||||
func (c *Client) TMDB() (*tmdb.Client, error) {
|
||||
|
||||
@@ -10,11 +10,13 @@ import (
|
||||
"path/filepath"
|
||||
"polaris/db"
|
||||
"polaris/ent"
|
||||
"polaris/ent/episode"
|
||||
"polaris/ent/importlist"
|
||||
"polaris/ent/media"
|
||||
"polaris/ent/schema"
|
||||
"polaris/log"
|
||||
"polaris/pkg/importlist/plexwatchlist"
|
||||
"polaris/pkg/metadata"
|
||||
"polaris/pkg/utils"
|
||||
"regexp"
|
||||
"strings"
|
||||
@@ -74,6 +76,7 @@ func (c *Client) periodicallyUpdateImportlist() error {
|
||||
if err != nil {
|
||||
log.Errorf("[update_import_lists] add movie to watchlist error: %v", err)
|
||||
} else {
|
||||
c.sendMsg(fmt.Sprintf("成功监控电影:%v", d.Title))
|
||||
log.Infof("[update_import_lists] add movie to watchlist success")
|
||||
}
|
||||
} else if len(tmdbRes.TvResults) > 0 {
|
||||
@@ -93,6 +96,7 @@ func (c *Client) periodicallyUpdateImportlist() error {
|
||||
if err != nil {
|
||||
log.Errorf("[update_import_lists] add tv to watchlist error: %v", err)
|
||||
} else {
|
||||
c.sendMsg(fmt.Sprintf("成功监控电视剧:%v", d.Name))
|
||||
log.Infof("[update_import_lists] add tv to watchlist success")
|
||||
}
|
||||
|
||||
@@ -299,6 +303,9 @@ func (c *Client) AddMovie2Watchlist(in AddWatchlistIn) (interface{}, error) {
|
||||
if err := c.downloadBackdrop(detail.BackdropPath, r.ID); err != nil {
|
||||
log.Errorf("download backdrop error: %v", err)
|
||||
}
|
||||
if err := c.checkMovieFolder(r); err != nil {
|
||||
log.Warnf("check movie folder error: %v", err)
|
||||
}
|
||||
}()
|
||||
|
||||
log.Infof("add movie %s to watchlist success", detail.Title)
|
||||
@@ -306,6 +313,33 @@ 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)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
files, err := storageImpl.ReadDir(m.TargetDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ep, err := c.db.GetMovieDummyEpisode(m.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _,f := range files {
|
||||
if f.IsDir() || f.Size() < 100 * 1000 * 1000 /* 100M */{ //忽略路径和小于100M的文件
|
||||
continue
|
||||
}
|
||||
meta := metadata.ParseMovie(f.Name())
|
||||
if meta.IsAcceptable(m.NameCn) || meta.IsAcceptable(m.NameEn) {
|
||||
log.Infof("found already downloaded movie: %v", f.Name())
|
||||
c.db.SetEpisodeStatus(ep.ID, episode.StatusDownloaded)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func IsJav(detail *tmdb.MovieDetails) bool {
|
||||
if detail.Adult && len(detail.ProductionCountries) > 0 && strings.ToUpper(detail.ProductionCountries[0].Iso3166_1) == "JP" {
|
||||
return true
|
||||
@@ -425,7 +459,9 @@ func (c *Client) SuggestedSeriesFolderName(tmdbId int) (string, error) {
|
||||
if err != nil {
|
||||
log.Errorf("get en tv detail error: %v", err)
|
||||
} else {
|
||||
info.NameEN = stripExtraCharacters(en.Name)
|
||||
if en.Name != name { //sometimes en name is in chinese
|
||||
info.NameEN = stripExtraCharacters(en.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
year := strings.Split(d.FirstAirDate, "-")[0]
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func (c *Client) DownloadEpisodeTorrent(r1 torznab.Result, seriesId, seasonNum, episodeNum int) (*string, error) {
|
||||
trc, dlc, err := c.getDownloadClient()
|
||||
trc, dlc, err := c.GetDownloadClient()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "connect transmission")
|
||||
}
|
||||
@@ -44,7 +44,12 @@ func (c *Client) DownloadEpisodeTorrent(r1 torznab.Result, seriesId, seasonNum,
|
||||
} else { //season package download
|
||||
ep = &ent.Episode{}
|
||||
}
|
||||
torrent, err := trc.Download(r1.Link, downloadDir)
|
||||
magnet, err := utils.Link2Magnet(r1.Link)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("converting link to magnet error, link: %v, error: %v", r1.Link, err)
|
||||
}
|
||||
|
||||
torrent, err := trc.Download(magnet, downloadDir)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "downloading")
|
||||
}
|
||||
@@ -59,7 +64,8 @@ func (c *Client) DownloadEpisodeTorrent(r1 torznab.Result, seriesId, seasonNum,
|
||||
TargetDir: dir,
|
||||
Status: history.StatusRunning,
|
||||
Size: r1.Size,
|
||||
Saved: torrent.Save(),
|
||||
//Saved: torrent.Save(),
|
||||
Link: magnet,
|
||||
DownloadClientID: dlc.ID,
|
||||
IndexerID: r1.IndexerId,
|
||||
})
|
||||
@@ -102,12 +108,16 @@ func (c *Client) SearchAndDownload(seriesId, seasonNum, episodeNum int) (*string
|
||||
}
|
||||
|
||||
func (c *Client) DownloadMovie(m *ent.Media, link, name string, size int, indexerID int) (*string, error) {
|
||||
trc, dlc, err := c.getDownloadClient()
|
||||
trc, dlc, err := c.GetDownloadClient()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "connect transmission")
|
||||
}
|
||||
magnet, err := utils.Link2Magnet(link)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("converting link to magnet error, link: %v, error: %v", link, err)
|
||||
}
|
||||
|
||||
torrent, err := trc.Download(link, c.db.GetDownloadDir())
|
||||
torrent, err := trc.Download(magnet, c.db.GetDownloadDir())
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "downloading")
|
||||
}
|
||||
@@ -125,7 +135,8 @@ func (c *Client) DownloadMovie(m *ent.Media, link, name string, size int, indexe
|
||||
TargetDir: m.TargetDir,
|
||||
Status: history.StatusRunning,
|
||||
Size: size,
|
||||
Saved: torrent.Save(),
|
||||
//Saved: torrent.Save(),
|
||||
Link: magnet,
|
||||
DownloadClientID: dlc.ID,
|
||||
IndexerID: indexerID,
|
||||
})
|
||||
|
||||
@@ -341,7 +341,7 @@ func (c *Client) DownloadMovieByID(id int) (string, error) {
|
||||
}
|
||||
|
||||
func (c *Client) downloadMovieSingleEpisode(ep *ent.Episode, targetDir string) (string, error) {
|
||||
trc, dlc, err := c.getDownloadClient()
|
||||
trc, dlc, err := c.GetDownloadClient()
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "connect transmission")
|
||||
}
|
||||
@@ -363,7 +363,13 @@ func (c *Client) downloadMovieSingleEpisode(ep *ent.Episode, targetDir string) (
|
||||
}
|
||||
r1 := res[0]
|
||||
log.Infof("begin download torrent resource: %v", r1.Name)
|
||||
torrent, err := trc.Download(r1.Link, c.db.GetDownloadDir())
|
||||
|
||||
magnet, err := utils.Link2Magnet(r1.Link)
|
||||
if err != nil {
|
||||
return "", errors.Errorf("converting link to magnet error, link: %v, error: %v", r1.Link, err)
|
||||
}
|
||||
|
||||
torrent, err := trc.Download(magnet, c.db.GetDownloadDir())
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "downloading")
|
||||
}
|
||||
@@ -376,7 +382,8 @@ func (c *Client) downloadMovieSingleEpisode(ep *ent.Episode, targetDir string) (
|
||||
TargetDir: targetDir,
|
||||
Status: history.StatusRunning,
|
||||
Size: r1.Size,
|
||||
Saved: torrent.Save(),
|
||||
//Saved: torrent.Save(),
|
||||
Link: magnet,
|
||||
DownloadClientID: dlc.ID,
|
||||
IndexerID: r1.IndexerId,
|
||||
})
|
||||
@@ -440,7 +447,7 @@ func (c *Client) checkSeiesNewSeason(media *ent.Media) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) isSeedRatioLimitReached(indexId int, t pkg.Torrent)(float64,bool) {
|
||||
func (c *Client) isSeedRatioLimitReached(indexId int, t pkg.Torrent) (float64, bool) {
|
||||
indexer, err := c.db.GetIndexer(indexId)
|
||||
if err != nil {
|
||||
return 0, true
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"polaris/ent/media"
|
||||
"polaris/log"
|
||||
"polaris/pkg/metadata"
|
||||
"polaris/pkg/prowlarr"
|
||||
"polaris/pkg/torznab"
|
||||
"regexp"
|
||||
"slices"
|
||||
"sort"
|
||||
"strconv"
|
||||
@@ -47,7 +47,7 @@ func SearchTvSeries(db1 *db.Client, param *SearchParam) ([]torznab.Result, error
|
||||
}
|
||||
|
||||
if !imdbIDMatchExact(series.ImdbID, r.ImdbId) { //imdb id not exact match, check file name
|
||||
if !torrentNameOk(series, r.Name) {
|
||||
if !torrentNameOk(series, meta) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,10 @@ func SearchTvSeries(db1 *db.Client, param *SearchParam) ([]torznab.Result, error
|
||||
} else if len(param.Episodes) == 0 && !meta.IsSeasonPack { //want season pack, but not season pack
|
||||
continue
|
||||
}
|
||||
if param.CheckResolution && meta.Resolution != series.Resolution.String() {
|
||||
|
||||
if param.CheckResolution &&
|
||||
series.Resolution != media.ResolutionAny &&
|
||||
meta.Resolution != series.Resolution.String() {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -106,26 +109,35 @@ func imdbIDMatchExact(id1, id2 string) bool {
|
||||
}
|
||||
|
||||
func torrentSizeOk(detail *db.MediaDetails, torrentSize int, param *SearchParam) bool {
|
||||
if param.CheckFileSize {
|
||||
multiplier := 1 //大小倍数,正常为1,如果是季包则为季内集数
|
||||
if detail.MediaType == media.MediaTypeTv && len(param.Episodes) == 0 { //tv season pack
|
||||
multiplier = seasonEpisodeCount(detail, param.SeasonNum)
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
multiplier := 1 //大小倍数,正常为1,如果是季包则为季内集数
|
||||
if detail.MediaType == media.MediaTypeTv && len(param.Episodes) == 0 { //tv season pack
|
||||
multiplier = seasonEpisodeCount(detail, param.SeasonNum)
|
||||
}
|
||||
|
||||
if param.CheckFileSize { //check file size when trigger automatic download
|
||||
if detail.Limiter.SizeMin > 0 { //min size
|
||||
sizeMin := detail.Limiter.SizeMin * multiplier
|
||||
if torrentSize < sizeMin { //比最小要求的大小还要小
|
||||
if torrentSize < sizeMin { //比最小要求的大小还要小, min size not qualify
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if detail.Limiter.SizeMax > 0 { //max size
|
||||
sizeMax := detail.Limiter.SizeMax * multiplier
|
||||
if torrentSize > sizeMax { //larger than max size wanted
|
||||
if torrentSize > sizeMax { //larger than max size wanted, max size not qualify
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
return torrentSize > defaultMinSize*multiplier
|
||||
}
|
||||
|
||||
func seasonEpisodeCount(detail *db.MediaDetails, seasonNum int) int {
|
||||
@@ -160,7 +172,7 @@ func SearchMovie(db1 *db.Client, param *SearchParam) ([]torznab.Result, error) {
|
||||
}
|
||||
|
||||
res := searchWithTorznab(db1, movieDetail.NameEn, movieDetail.NameCn, movieDetail.OriginalName)
|
||||
if movieDetail.Extras.IsJav(){
|
||||
if movieDetail.Extras.IsJav() {
|
||||
res1 := searchWithTorznab(db1, movieDetail.Extras.JavId)
|
||||
res = append(res, res1...)
|
||||
}
|
||||
@@ -177,7 +189,7 @@ func SearchMovie(db1 *db.Client, param *SearchParam) ([]torznab.Result, error) {
|
||||
}
|
||||
|
||||
if !imdbIDMatchExact(movieDetail.ImdbID, r.ImdbId) {
|
||||
if !torrentNameOk(movieDetail, r.Name) {
|
||||
if !torrentNameOk(movieDetail, meta) {
|
||||
continue
|
||||
}
|
||||
if !movieDetail.Extras.IsJav() {
|
||||
@@ -189,7 +201,9 @@ func SearchMovie(db1 *db.Client, param *SearchParam) ([]torznab.Result, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if param.CheckResolution && meta.Resolution != movieDetail.Resolution.String() {
|
||||
if param.CheckResolution &&
|
||||
movieDetail.Resolution != media.ResolutionAny &&
|
||||
meta.Resolution != movieDetail.Resolution.String() {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -217,6 +231,17 @@ func searchWithTorznab(db *db.Client, queries ...string) []torznab.Result {
|
||||
|
||||
var res []torznab.Result
|
||||
allTorznab := db.GetAllTorznabInfo()
|
||||
|
||||
p, err := db.GetProwlarrSetting()
|
||||
if err == nil { //prowlarr exists
|
||||
c := prowlarr.New(p.ApiKey, p.URL)
|
||||
all, err := c.GetIndexers()
|
||||
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
|
||||
|
||||
@@ -300,19 +325,13 @@ func dedup(list []torznab.Result) []torznab.Result {
|
||||
return res
|
||||
}
|
||||
|
||||
func torrentNameOk(detail *db.MediaDetails, torrentName string) bool {
|
||||
if detail.Extras.IsJav() && isNameAcceptable(torrentName, detail.Extras.JavId) {
|
||||
return true
|
||||
}
|
||||
return isNameAcceptable(torrentName, detail.NameCn) || isNameAcceptable(torrentName, detail.NameEn) ||
|
||||
isNameAcceptable(torrentName, detail.OriginalName)
|
||||
type NameTester interface {
|
||||
IsAcceptable(names ...string) bool
|
||||
}
|
||||
|
||||
func isNameAcceptable(torrentName, wantedName string) bool {
|
||||
re := regexp.MustCompile(`[^\p{L}\w\s]`)
|
||||
torrentName = re.ReplaceAllString(strings.ToLower(torrentName), " ")
|
||||
wantedName = re.ReplaceAllString(strings.ToLower(wantedName), " ")
|
||||
torrentName = strings.Join(strings.Fields(torrentName), " ")
|
||||
wantedName = strings.Join(strings.Fields(wantedName), " ")
|
||||
return strings.Contains(torrentName, wantedName)
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -70,13 +70,15 @@ func (s *Server) Serve() error {
|
||||
setting.POST("/parse/movie", HttpHandler(s.ParseMovie))
|
||||
setting.POST("/monitoring", HttpHandler(s.ChangeEpisodeMonitoring))
|
||||
setting.POST("/cron/trigger", HttpHandler(s.TriggerCronJob))
|
||||
setting.GET("/prowlarr", HttpHandler(s.GetProwlarrSetting))
|
||||
setting.POST("/prowlarr", HttpHandler(s.SaveProwlarrSetting))
|
||||
}
|
||||
activity := api.Group("/activity")
|
||||
{
|
||||
activity.GET("/", HttpHandler(s.GetAllActivities))
|
||||
activity.DELETE("/:id", HttpHandler(s.RemoveActivity))
|
||||
activity.POST("/delete", HttpHandler(s.RemoveActivity))
|
||||
activity.GET("/media/:id", HttpHandler(s.GetMediaDownloadHistory))
|
||||
activity.GET("/torrents", HttpHandler(s.GetAllTorrents))
|
||||
//activity.GET("/torrents", HttpHandler(s.GetAllTorrents))
|
||||
}
|
||||
|
||||
tv := api.Group("/media")
|
||||
|
||||
@@ -6,7 +6,11 @@ import (
|
||||
"html/template"
|
||||
"polaris/db"
|
||||
"polaris/ent"
|
||||
"polaris/ent/downloadclients"
|
||||
"polaris/log"
|
||||
"polaris/pkg/prowlarr"
|
||||
"polaris/pkg/qbittorrent"
|
||||
"polaris/pkg/torznab"
|
||||
"polaris/pkg/transmission"
|
||||
"polaris/pkg/utils"
|
||||
"strconv"
|
||||
@@ -34,7 +38,7 @@ func (s *Server) SetSetting(c *gin.Context) (interface{}, error) {
|
||||
return nil, errors.Wrap(err, "bind json")
|
||||
}
|
||||
utils.TrimFields(&in)
|
||||
|
||||
|
||||
log.Infof("set setting input: %+v", in)
|
||||
if in.TmdbApiKey != "" {
|
||||
if err := s.db.SetSetting(db.SettingTmdbApiKey, in.TmdbApiKey); err != nil {
|
||||
@@ -54,18 +58,23 @@ func (s *Server) SetSetting(c *gin.Context) (interface{}, error) {
|
||||
}
|
||||
}
|
||||
if in.TvNamingFormat != "" {
|
||||
if _, err := template.New("test").Parse(in.TvNamingFormat);err != nil {
|
||||
if _, err := template.New("test").Parse(in.TvNamingFormat); err != nil {
|
||||
return nil, errors.Wrap(err, "tv format")
|
||||
}
|
||||
|
||||
s.db.SetSetting(db.SettingTvNamingFormat, in.TvNamingFormat)
|
||||
} else {
|
||||
s.db.SetSetting(db.SettingTvNamingFormat, "")
|
||||
}
|
||||
|
||||
if in.MovieNamingFormat != "" {
|
||||
if _, err := template.New("test").Parse(in.MovieNamingFormat);err != nil {
|
||||
if _, err := template.New("test").Parse(in.MovieNamingFormat); err != nil {
|
||||
return nil, errors.Wrap(err, "movie format")
|
||||
}
|
||||
|
||||
s.db.SetSetting(db.SettingMovieNamingFormat, in.MovieNamingFormat)
|
||||
} else {
|
||||
s.db.SetSetting(db.SettingMovieNamingFormat, "")
|
||||
}
|
||||
|
||||
plexmatchEnabled := s.db.GetSetting(db.SettingPlexMatchEnabled)
|
||||
@@ -164,6 +173,8 @@ func (s *Server) AddTorznabInfo(c *gin.Context) (interface{}, error) {
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "add ")
|
||||
}
|
||||
|
||||
torznab.CleanCache() //need to clean exist cache, so next request will do actaul query
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -185,25 +196,13 @@ func (s *Server) GetAllIndexers(c *gin.Context) (interface{}, error) {
|
||||
return indexers, nil
|
||||
}
|
||||
|
||||
func (s *Server) getDownloadClient() (*transmission.Client, *ent.DownloadClients, error) {
|
||||
tr := s.db.GetTransmission()
|
||||
trc, err := transmission.NewClient(transmission.Config{
|
||||
URL: tr.URL,
|
||||
User: tr.User,
|
||||
Password: tr.Password,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, nil, errors.Wrap(err, "connect transmission")
|
||||
}
|
||||
return trc, tr, nil
|
||||
}
|
||||
|
||||
type downloadClientIn struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
URL string `json:"url" binding:"required"`
|
||||
User string `json:"user"`
|
||||
Password string `json:"password"`
|
||||
Implementation string `json:"implementation" binding:"required"`
|
||||
Priority int `json:"priority"`
|
||||
}
|
||||
|
||||
func (s *Server) AddDownloadClient(c *gin.Context) (interface{}, error) {
|
||||
@@ -212,17 +211,35 @@ func (s *Server) AddDownloadClient(c *gin.Context) (interface{}, error) {
|
||||
return nil, errors.Wrap(err, "bind json")
|
||||
}
|
||||
utils.TrimFields(&in)
|
||||
//test connection
|
||||
_, err := transmission.NewClient(transmission.Config{
|
||||
URL: in.URL,
|
||||
User: in.User,
|
||||
Password: in.Password,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "tranmission setting")
|
||||
if in.Priority == 0 {
|
||||
in.Priority = 1 //make default
|
||||
}
|
||||
if err := s.db.SaveTransmission(in.Name, in.URL, in.User, in.Password); err != nil {
|
||||
return nil, errors.Wrap(err, "save transmission")
|
||||
//test connection
|
||||
if in.Implementation == downloadclients.ImplementationTransmission.String() {
|
||||
_, err := transmission.NewClient(transmission.Config{
|
||||
URL: in.URL,
|
||||
User: in.User,
|
||||
Password: in.Password,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "tranmission setting")
|
||||
}
|
||||
|
||||
} else if in.Implementation == downloadclients.ImplementationQbittorrent.String() {
|
||||
_, err := qbittorrent.NewClient(in.URL, in.User, in.Password)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "qbittorrent")
|
||||
}
|
||||
}
|
||||
if err := s.db.SaveDownloader(&ent.DownloadClients{
|
||||
Name: in.Name,
|
||||
Implementation: downloadclients.Implementation(in.Implementation),
|
||||
Priority1: in.Priority,
|
||||
URL: in.URL,
|
||||
User: in.User,
|
||||
Password: in.Password,
|
||||
}); err != nil {
|
||||
return nil, errors.Wrap(err, "save downloader")
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
@@ -287,3 +304,26 @@ func (s *Server) TriggerCronJob(c *gin.Context) (interface{}, error) {
|
||||
}
|
||||
return "success", nil
|
||||
}
|
||||
|
||||
func (s *Server) GetProwlarrSetting(c *gin.Context) (interface{}, error) {
|
||||
se, err :=s.db.GetProwlarrSetting()
|
||||
if err != nil {
|
||||
return &db.ProwlarrSetting{}, nil
|
||||
}
|
||||
return se, nil
|
||||
}
|
||||
func (s *Server) SaveProwlarrSetting(c *gin.Context) (interface{}, error) {
|
||||
var in db.ProwlarrSetting
|
||||
if err := c.ShouldBindJSON(&in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := prowlarr.New(in.ApiKey, in.URL)
|
||||
if _, err := client.GetIndexers(); err != nil {
|
||||
return nil, errors.Wrap(err, "connect to prowlarr error")
|
||||
}
|
||||
err := s.db.SaveProwlarrSetting(&in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return "success", nil
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ class _ActivityPageState extends ConsumerState<ActivityPage>
|
||||
trailing: selectedTab == 0
|
||||
? IconButton(
|
||||
tooltip: "删除任务",
|
||||
onPressed: () => onDelete()(ac.id!.toString()),
|
||||
onPressed: () => onDelete()(ac.id!),
|
||||
icon: const Icon(Icons.delete))
|
||||
: const Text("-"),
|
||||
),
|
||||
@@ -155,7 +155,7 @@ class _ActivityPageState extends ConsumerState<ActivityPage>
|
||||
);
|
||||
}
|
||||
|
||||
Function(String) onDelete() {
|
||||
Function(int) onDelete() {
|
||||
return (id) {
|
||||
final f = ref
|
||||
.read(activitiesDataProvider("active").notifier)
|
||||
|
||||
@@ -16,7 +16,8 @@ import 'package:ui/welcome_page.dart';
|
||||
import 'package:ui/widgets/utils.dart';
|
||||
|
||||
void main() {
|
||||
initializeDateFormatting().then((_) => runApp(MyApp()));
|
||||
initializeDateFormatting()
|
||||
.then((_) => runApp(const ProviderScope(child: MyApp())));
|
||||
}
|
||||
|
||||
class MyApp extends ConsumerStatefulWidget {
|
||||
@@ -45,15 +46,17 @@ CustomTransitionPage buildPageWithDefaultTransition<T>({
|
||||
|
||||
class _MyAppState extends ConsumerState<MyApp> {
|
||||
// This widget is the root of your application.
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var padding = isSmallScreen(context) ? 5.0 : 20.0;
|
||||
// GoRouter configuration
|
||||
final shellRoute = ShellRoute(
|
||||
builder: (BuildContext context, GoRouterState state, Widget child) {
|
||||
return SelectionArea(
|
||||
child: MainSkeleton(
|
||||
body: Padding(
|
||||
padding: EdgeInsets.all(isSmallScreen(context) ? 5 : 20),
|
||||
padding: EdgeInsets.only(left: padding, right: padding, top: 5, bottom: 5),
|
||||
child: child),
|
||||
),
|
||||
);
|
||||
@@ -125,28 +128,26 @@ class _MyAppState extends ConsumerState<MyApp> {
|
||||
],
|
||||
);
|
||||
|
||||
return ProviderScope(
|
||||
child: MaterialApp.router(
|
||||
title: 'Polaris 影视追踪下载',
|
||||
theme: ThemeData(
|
||||
fontFamily: "NotoSansSC",
|
||||
colorScheme: ColorScheme.fromSeed(
|
||||
seedColor: Colors.blueAccent,
|
||||
brightness: Brightness.dark,
|
||||
surface: Colors.black87),
|
||||
useMaterial3: true,
|
||||
//scaffoldBackgroundColor: Color.fromARGB(255, 26, 24, 24)
|
||||
tooltipTheme: TooltipThemeData(
|
||||
textStyle: const TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black54,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
)),
|
||||
routerConfig: router,
|
||||
),
|
||||
return MaterialApp.router(
|
||||
title: 'Polaris 影视追踪下载',
|
||||
theme: ThemeData(
|
||||
fontFamily: "NotoSansSC",
|
||||
colorScheme: ColorScheme.fromSeed(
|
||||
seedColor: Colors.blueAccent,
|
||||
brightness: Brightness.dark,
|
||||
surface: Colors.black87),
|
||||
useMaterial3: true,
|
||||
//scaffoldBackgroundColor: Color.fromARGB(255, 26, 24, 24)
|
||||
tooltipTheme: TooltipThemeData(
|
||||
textStyle: const TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black54,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
)),
|
||||
routerConfig: router,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -190,7 +191,7 @@ class _MainSkeletonState extends State<MainSkeleton> {
|
||||
// the App.build method, and use it to set our appbar title.
|
||||
title: TextButton(
|
||||
onPressed: () => context.go(WelcomePage.routeTv),
|
||||
child: Text(
|
||||
child: const Text(
|
||||
"Polaris",
|
||||
overflow: TextOverflow.clip,
|
||||
style: TextStyle(fontSize: 28),
|
||||
|
||||
@@ -30,6 +30,7 @@ class APIs {
|
||||
static final logoutUrl = "$_baseUrl/api/v1/setting/logout";
|
||||
static final loginSettingUrl = "$_baseUrl/api/v1/setting/auth";
|
||||
static final activityUrl = "$_baseUrl/api/v1/activity/";
|
||||
static final activityDeleteUrl = "$_baseUrl/api/v1/activity/delete";
|
||||
static final activityMediaUrl = "$_baseUrl/api/v1/activity/media/";
|
||||
static final imagesUrl = "$_baseUrl/api/v1/img";
|
||||
static final logsBaseUrl = "$_baseUrl/api/v1/logs/";
|
||||
@@ -39,6 +40,7 @@ class APIs {
|
||||
static final addImportlistUrl = "$_baseUrl/api/v1/importlist/add";
|
||||
static final deleteImportlistUrl = "$_baseUrl/api/v1/importlist/delete";
|
||||
static final getAllImportlists = "$_baseUrl/api/v1/importlist/";
|
||||
static final prowlarrUrl = "$_baseUrl/api/v1/setting/prowlarr";
|
||||
|
||||
static final notifierAllUrl = "$_baseUrl/api/v1/notifier/all";
|
||||
static final notifierDeleteUrl = "$_baseUrl/api/v1/notifier/id/";
|
||||
|
||||
@@ -4,9 +4,8 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:ui/providers/APIs.dart';
|
||||
import 'package:ui/providers/server_response.dart';
|
||||
|
||||
var activitiesDataProvider =
|
||||
AsyncNotifierProvider.autoDispose.family<ActivityData, List<Activity>, String>(
|
||||
ActivityData.new);
|
||||
var activitiesDataProvider = AsyncNotifierProvider.autoDispose
|
||||
.family<ActivityData, List<Activity>, String>(ActivityData.new);
|
||||
|
||||
var mediaHistoryDataProvider = FutureProvider.autoDispose.family(
|
||||
(ref, arg) async {
|
||||
@@ -24,7 +23,8 @@ var mediaHistoryDataProvider = FutureProvider.autoDispose.family(
|
||||
},
|
||||
);
|
||||
|
||||
class ActivityData extends AutoDisposeFamilyAsyncNotifier<List<Activity>, String> {
|
||||
class ActivityData
|
||||
extends AutoDisposeFamilyAsyncNotifier<List<Activity>, String> {
|
||||
@override
|
||||
FutureOr<List<Activity>> build(String arg) async {
|
||||
if (arg == "active") {
|
||||
@@ -47,9 +47,12 @@ class ActivityData extends AutoDisposeFamilyAsyncNotifier<List<Activity>, String
|
||||
return activities;
|
||||
}
|
||||
|
||||
Future<void> deleteActivity(String id) async {
|
||||
final dio = await APIs.getDio();
|
||||
var resp = await dio.delete("${APIs.activityUrl}$id");
|
||||
Future<void> deleteActivity(int id) async {
|
||||
final dio = APIs.getDio();
|
||||
var resp = await dio.post(APIs.activityDeleteUrl, data: {
|
||||
"id": id,
|
||||
"add_2_blacklist": false,
|
||||
});
|
||||
final sp = ServerResponse.fromJson(resp.data);
|
||||
if (sp.code != 0) {
|
||||
throw sp.message;
|
||||
|
||||
@@ -25,6 +25,10 @@ var importlistProvider =
|
||||
AsyncNotifierProvider.autoDispose<ImportListData, List<ImportList>>(
|
||||
ImportListData.new);
|
||||
|
||||
var prowlarrSettingDataProvider =
|
||||
AsyncNotifierProvider.autoDispose<ProwlarrSettingData, ProwlarrSetting>(
|
||||
ProwlarrSettingData.new);
|
||||
|
||||
class EditSettingData extends AutoDisposeAsyncNotifier<GeneralSetting> {
|
||||
@override
|
||||
FutureOr<GeneralSetting> build() async {
|
||||
@@ -243,6 +247,7 @@ class DownloadClient {
|
||||
String? password;
|
||||
bool? removeCompletedDownloads;
|
||||
bool? removeFailedDownloads;
|
||||
int? priority;
|
||||
DownloadClient(
|
||||
{this.id,
|
||||
this.enable,
|
||||
@@ -252,6 +257,7 @@ class DownloadClient {
|
||||
this.user,
|
||||
this.password,
|
||||
this.removeCompletedDownloads = true,
|
||||
this.priority = 1,
|
||||
this.removeFailedDownloads = true});
|
||||
|
||||
DownloadClient.fromJson(Map<String, dynamic> json) {
|
||||
@@ -262,6 +268,7 @@ class DownloadClient {
|
||||
url = json['url'];
|
||||
user = json['user'];
|
||||
password = json['password'];
|
||||
priority = json["priority1"];
|
||||
removeCompletedDownloads = json["remove_completed_downloads"] ?? false;
|
||||
removeFailedDownloads = json["remove_failed_downloads"] ?? false;
|
||||
}
|
||||
@@ -275,6 +282,7 @@ class DownloadClient {
|
||||
data['url'] = url;
|
||||
data['user'] = user;
|
||||
data['password'] = password;
|
||||
data["priority"] = priority;
|
||||
data["remove_completed_downloads"] = removeCompletedDownloads;
|
||||
data["remove_failed_downloads"] = removeFailedDownloads;
|
||||
return data;
|
||||
@@ -499,3 +507,38 @@ class ImportListData extends AutoDisposeAsyncNotifier<List<ImportList>> {
|
||||
ref.invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
class ProwlarrSetting {
|
||||
final String apiKey;
|
||||
final String url;
|
||||
ProwlarrSetting({required this.apiKey, required this.url});
|
||||
factory ProwlarrSetting.fromJson(Map<String, dynamic> json) {
|
||||
return ProwlarrSetting(apiKey: json["api_key"], url: json["url"]);
|
||||
}
|
||||
|
||||
Map<String, dynamic> tojson() => {"api_key": apiKey, "url": url};
|
||||
}
|
||||
|
||||
class ProwlarrSettingData extends AutoDisposeAsyncNotifier<ProwlarrSetting> {
|
||||
@override
|
||||
FutureOr<ProwlarrSetting> build() async {
|
||||
final dio = APIs.getDio();
|
||||
var resp = await dio.get(APIs.prowlarrUrl);
|
||||
var sp = ServerResponse.fromJson(resp.data);
|
||||
if (sp.code != 0) {
|
||||
throw sp.message;
|
||||
}
|
||||
var se = ProwlarrSetting.fromJson(sp.data);
|
||||
return se;
|
||||
}
|
||||
|
||||
Future<void> save(ProwlarrSetting ps) async {
|
||||
final dio = APIs.getDio();
|
||||
var resp = await dio.post(APIs.prowlarrUrl, data: ps.tojson());
|
||||
var sp = ServerResponse.fromJson(resp.data);
|
||||
if (sp.code != 0) {
|
||||
throw sp.message;
|
||||
}
|
||||
ref.invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ class _SubmitSearchResultState extends ConsumerState<SubmitSearchResult> {
|
||||
name: "resolution",
|
||||
decoration: const InputDecoration(labelText: "清晰度"),
|
||||
items: const [
|
||||
DropdownMenuItem(value: "any", child: Text("不限")),
|
||||
DropdownMenuItem(value: "720p", child: Text("720p")),
|
||||
DropdownMenuItem(value: "1080p", child: Text("1080p")),
|
||||
DropdownMenuItem(value: "2160p", child: Text("2160p")),
|
||||
|
||||
@@ -53,9 +53,10 @@ class _DownloaderState extends ConsumerState<DownloaderSettings> {
|
||||
"url": client.url,
|
||||
"user": client.user,
|
||||
"password": client.password,
|
||||
"impl": "transmission",
|
||||
"impl": client.implementation,
|
||||
"remove_completed_downloads": client.removeCompletedDownloads,
|
||||
"remove_failed_downloads": client.removeFailedDownloads,
|
||||
"priority": client.priority.toString(),
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -70,7 +71,10 @@ class _DownloaderState extends ConsumerState<DownloaderSettings> {
|
||||
items: const [
|
||||
DropdownMenuItem(
|
||||
value: "transmission", child: Text("Transmission")),
|
||||
DropdownMenuItem(
|
||||
value: "qbittorrent", child: Text("qBittorrent")),
|
||||
],
|
||||
validator: FormBuilderValidators.required(),
|
||||
),
|
||||
FormBuilderTextField(
|
||||
name: "name",
|
||||
@@ -84,6 +88,11 @@ class _DownloaderState extends ConsumerState<DownloaderSettings> {
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: FormBuilderValidators.required(),
|
||||
),
|
||||
FormBuilderTextField(
|
||||
name: "priority",
|
||||
decoration: const InputDecoration(labelText: "优先级", helperText: "1-50, 1最高优先级,50最低优先级"),
|
||||
validator: FormBuilderValidators.integer(),
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction),
|
||||
FormBuilderSwitch(
|
||||
name: "remove_completed_downloads",
|
||||
title: const Text("任务完成后删除")),
|
||||
@@ -146,6 +155,7 @@ class _DownloaderState extends ConsumerState<DownloaderSettings> {
|
||||
url: values["url"],
|
||||
user: _enableAuth ? values["user"] : null,
|
||||
password: _enableAuth ? values["password"] : null,
|
||||
priority: int.parse(values["priority"]),
|
||||
removeCompletedDownloads: values["remove_completed_downloads"],
|
||||
removeFailedDownloads: values["remove_failed_downloads"]));
|
||||
} else {
|
||||
|
||||
72
ui/lib/settings/prowlarr.dart
Normal file
72
ui/lib/settings/prowlarr.dart
Normal file
@@ -0,0 +1,72 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||
import 'package:ui/providers/settings.dart';
|
||||
import 'package:ui/widgets/progress_indicator.dart';
|
||||
import 'package:ui/widgets/utils.dart';
|
||||
import 'package:ui/widgets/widgets.dart';
|
||||
|
||||
class ProwlarrSettingPage extends ConsumerStatefulWidget {
|
||||
const ProwlarrSettingPage({super.key});
|
||||
@override
|
||||
ConsumerState<ConsumerStatefulWidget> createState() {
|
||||
return ProwlarrSettingState();
|
||||
}
|
||||
}
|
||||
|
||||
class ProwlarrSettingState extends ConsumerState<ProwlarrSettingPage> {
|
||||
final _formKey = GlobalKey<FormBuilderState>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
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},
|
||||
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(),
|
||||
),
|
||||
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"]))
|
||||
.then((v) => showSnakeBar("更新成功"));
|
||||
showLoadingWithFuture(f);
|
||||
}
|
||||
},
|
||||
child: const Padding(padding: EdgeInsets.all(10), child: Text("保存"),)),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
error: (err, trace) => Text("$err"),
|
||||
loading: () => const MyProgressIndicator());
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import 'package:ui/settings/general.dart';
|
||||
import 'package:ui/settings/importlist.dart';
|
||||
import 'package:ui/settings/indexer.dart';
|
||||
import 'package:ui/settings/notifier.dart';
|
||||
import 'package:ui/settings/prowlarr.dart';
|
||||
import 'package:ui/settings/storage.dart';
|
||||
|
||||
class SystemSettingsPage extends ConsumerStatefulWidget {
|
||||
@@ -25,6 +26,7 @@ class _SystemSettingsPageState extends ConsumerState<SystemSettingsPage> {
|
||||
children: [
|
||||
getExpansionTile("常规", const GeneralSettings()),
|
||||
getExpansionTile("索引器", const IndexerSettings()),
|
||||
getExpansionTile("Prowlarr 设置", const ProwlarrSettingPage()),
|
||||
getExpansionTile("下载器", const DownloaderSettings()),
|
||||
getExpansionTile("存储", const StorageSettings()),
|
||||
getExpansionTile("通知客户端", const NotifierSettings()),
|
||||
|
||||
@@ -98,8 +98,8 @@ class MediaCard extends StatelessWidget {
|
||||
LinearProgressIndicator(
|
||||
value: 1,
|
||||
color: item.downloadedNum! >= item.monitoredNum!
|
||||
? Colors.green
|
||||
: Colors.blue,
|
||||
? Colors.teal
|
||||
: Colors.lightGreen,
|
||||
),
|
||||
Text(
|
||||
item.name!,
|
||||
|
||||
@@ -38,7 +38,7 @@ class _DetailCardState extends ConsumerState<DetailCard> {
|
||||
margin: const EdgeInsets.all(4),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: Container(
|
||||
constraints: BoxConstraints(maxHeight: 400),
|
||||
constraints: const BoxConstraints(maxHeight: 400),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
@@ -52,7 +52,7 @@ class _DetailCardState extends ConsumerState<DetailCard> {
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
screenWidth < 600
|
||||
? SizedBox()
|
||||
? const SizedBox()
|
||||
: Flexible(
|
||||
flex: 2,
|
||||
child: Padding(
|
||||
@@ -72,14 +72,14 @@ class _DetailCardState extends ConsumerState<DetailCard> {
|
||||
children: [
|
||||
//const Text(""),
|
||||
Text(
|
||||
"${widget.details.name} ${widget.details.name != widget.details.originalName ? widget.details.originalName : ''} (${widget.details.airDate!.split("-")[0]})",
|
||||
"${widget.details.name} ${widget.details.name != widget.details.originalName ? widget.details.originalName : ''} ${widget.details.airDate == null ? "" : (widget.details.airDate!.split("-")[0])}",
|
||||
style: const TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
height: 2.5),
|
||||
),
|
||||
const Divider(thickness: 1, height: 1),
|
||||
Text(
|
||||
const Text(
|
||||
"",
|
||||
style: TextStyle(height: 0.2),
|
||||
),
|
||||
@@ -93,14 +93,14 @@ class _DetailCardState extends ConsumerState<DetailCard> {
|
||||
label: Text(
|
||||
"${widget.details.storage!.name}: ${widget.details.mediaType == "tv" ? widget.details.storage!.tvPath : widget.details.storage!.moviePath}"
|
||||
"${widget.details.targetDir}"),
|
||||
padding: EdgeInsets.all(0),
|
||||
padding: const EdgeInsets.all(0),
|
||||
),
|
||||
Chip(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
shape: ContinuousRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(100.0)),
|
||||
label: Text("${widget.details.resolution}"),
|
||||
padding: EdgeInsets.all(0),
|
||||
padding: const EdgeInsets.all(0),
|
||||
),
|
||||
widget.details.limiter != null &&
|
||||
widget.details.limiter!.sizeMax > 0
|
||||
@@ -109,13 +109,13 @@ class _DetailCardState extends ConsumerState<DetailCard> {
|
||||
shape: ContinuousRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(100.0)),
|
||||
padding: EdgeInsets.all(0),
|
||||
padding: const EdgeInsets.all(0),
|
||||
label: Text(
|
||||
"${(widget.details.limiter!.sizeMin).readableFileSize()} - ${(widget.details.limiter!.sizeMax).readableFileSize()}"))
|
||||
: const SizedBox(),
|
||||
MenuAnchor(
|
||||
style:
|
||||
MenuStyle(alignment: Alignment.bottomRight),
|
||||
style: const MenuStyle(
|
||||
alignment: Alignment.bottomRight),
|
||||
menuChildren: [
|
||||
ActionChip.elevated(
|
||||
onPressed: () => launchUrl(url),
|
||||
@@ -124,10 +124,10 @@ class _DetailCardState extends ConsumerState<DetailCard> {
|
||||
shape: ContinuousRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(100.0)),
|
||||
padding: EdgeInsets.all(0),
|
||||
label: Text("TMDB")),
|
||||
padding: const EdgeInsets.all(0),
|
||||
label: const Text("TMDB")),
|
||||
isBlank(widget.details.imdbid)
|
||||
? SizedBox()
|
||||
? const SizedBox()
|
||||
: ActionChip.elevated(
|
||||
onPressed: () => launchUrl(imdbUrl),
|
||||
backgroundColor: Colors.indigo[700],
|
||||
@@ -135,8 +135,8 @@ class _DetailCardState extends ConsumerState<DetailCard> {
|
||||
shape: ContinuousRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(100.0)),
|
||||
padding: EdgeInsets.all(0),
|
||||
label: Text("IMDB"),
|
||||
padding: const EdgeInsets.all(0),
|
||||
label: const Text("IMDB"),
|
||||
)
|
||||
],
|
||||
builder: (context, controller, child) {
|
||||
@@ -152,8 +152,8 @@ class _DetailCardState extends ConsumerState<DetailCard> {
|
||||
shape: ContinuousRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(100.0)),
|
||||
padding: EdgeInsets.all(0),
|
||||
label: Text("外部链接"));
|
||||
padding: const EdgeInsets.all(0),
|
||||
label: const Text("外部链接"));
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -170,7 +170,7 @@ class _DetailCardState extends ConsumerState<DetailCard> {
|
||||
children: [
|
||||
downloadButton(),
|
||||
editIcon(),
|
||||
deleteIcon(),
|
||||
deleteIcon(context),
|
||||
],
|
||||
)
|
||||
],
|
||||
@@ -185,14 +185,14 @@ class _DetailCardState extends ConsumerState<DetailCard> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget deleteIcon() {
|
||||
Widget deleteIcon(BuildContext oriContext) {
|
||||
return IconButton(
|
||||
tooltip: widget.details.mediaType == "tv" ? "删除剧集" : "删除电影",
|
||||
onPressed: () => showConfirmDialog(),
|
||||
onPressed: () => showConfirmDialog(oriContext),
|
||||
icon: const Icon(Icons.delete));
|
||||
}
|
||||
|
||||
Future<void> showConfirmDialog() {
|
||||
Future<void> showConfirmDialog(BuildContext oriContext) {
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
@@ -210,9 +210,13 @@ class _DetailCardState extends ConsumerState<DetailCard> {
|
||||
.read(mediaDetailsProvider(widget.details.id.toString())
|
||||
.notifier)
|
||||
.delete()
|
||||
.then((v) => context.go(widget.details.mediaType == "tv"
|
||||
.then((v) {
|
||||
if (oriContext.mounted) {
|
||||
oriContext.go(widget.details.mediaType == "tv"
|
||||
? WelcomePage.routeTv
|
||||
: WelcomePage.routeMoivie));
|
||||
: WelcomePage.routeMoivie);
|
||||
}
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Text("确认"))
|
||||
@@ -263,6 +267,7 @@ class _DetailCardState extends ConsumerState<DetailCard> {
|
||||
name: "resolution",
|
||||
decoration: const InputDecoration(labelText: "清晰度"),
|
||||
items: const [
|
||||
DropdownMenuItem(value: "any", child: Text("不限")),
|
||||
DropdownMenuItem(value: "720p", child: Text("720p")),
|
||||
DropdownMenuItem(value: "1080p", child: Text("1080p")),
|
||||
DropdownMenuItem(value: "2160p", child: Text("2160p")),
|
||||
@@ -292,7 +297,11 @@ class _DetailCardState extends ConsumerState<DetailCard> {
|
||||
.notifier)
|
||||
.edit(values["resolution"], values["target_dir"],
|
||||
values["limiter"])
|
||||
.then((v) => Navigator.of(context).pop());
|
||||
.then((v) {
|
||||
if (context.mounted) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
label: const Text("确认"))
|
||||
|
||||
@@ -69,18 +69,18 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: dio
|
||||
sha256: e17f6b3097b8c51b72c74c9f071a605c47bcc8893839bd66732457a5ebe73714
|
||||
sha256: "5598aa796bbf4699afd5c67c0f5f6e2ed542afc956884b9cd58c306966efc260"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "5.5.0+1"
|
||||
version: "5.7.0"
|
||||
dio_web_adapter:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dio_web_adapter
|
||||
sha256: "36c5b2d79eb17cdae41e974b7a8284fec631651d2a6f39a8a2ff22327e90aeac"
|
||||
sha256: "33259a9276d6cea88774a0000cfae0d861003497755969c92faa223108620dc8"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
version: "2.0.0"
|
||||
equatable:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -106,26 +106,26 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_adaptive_scaffold
|
||||
sha256: "56d4d81fe88ecffe8ae96b8d89a1ae793c0a85035bb9b74ff28f20eea0cdbdc2"
|
||||
sha256: "8c515a2cb8abb3a567f8e77f10b33f47bb6fcadfe31f62364e0aca36280cdf93"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.1.11+1"
|
||||
version: "0.3.1"
|
||||
flutter_form_builder:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_form_builder
|
||||
sha256: "447f8808f68070f7df968e8063aada3c9d2e90e789b5b70f3b44e4b315212656"
|
||||
sha256: c278ef69b08957d484f83413f0e77b656a39b7a7bb4eb8a295da3a820ecc6545
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "9.3.0"
|
||||
version: "9.5.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c"
|
||||
sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
version: "5.0.0"
|
||||
flutter_localizations:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@@ -143,10 +143,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_riverpod
|
||||
sha256: "0f1974eff5bbe774bf1d870e406fc6f29e3d6f1c46bd9c58e7172ff68a785d7d"
|
||||
sha256: "6eda4e247774474c715a0805a2fb8e3cd55fbae4ead641e063c95b4bd5f3b317"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.5.1"
|
||||
version: "2.6.0"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -177,10 +177,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: go_router
|
||||
sha256: ddc16d34b0d74cb313986918c0f0885a7ba2fc24d8fb8419de75f0015144ccfe
|
||||
sha256: "6f1b756f6e863259a99135ff3c95026c3cdca17d10ebef2bba2261a25ddc8bbc"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "14.2.3"
|
||||
version: "14.3.0"
|
||||
http_parser:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -265,18 +265,18 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235"
|
||||
sha256: "3315600f3fb3b135be672bf4a178c55f274bebe368325ae18462c89ac1e3b413"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
version: "5.0.0"
|
||||
logging:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: logging
|
||||
sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
|
||||
sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.3.0"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -345,18 +345,18 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: quiver
|
||||
sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47
|
||||
sha256: ea0b925899e64ecdfbf9c7becb60d5b50e706ade44a85b2363be2a22d88117d2
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.2.1"
|
||||
version: "3.2.2"
|
||||
riverpod:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: riverpod
|
||||
sha256: f21b32ffd26a36555e501b04f4a5dca43ed59e16343f1a30c13632b2351dfa4d
|
||||
sha256: bd6e656a764e3d27f211975626e0c4f9b8d06ab16acf3c7ba7a8061e09744c75
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.5.1"
|
||||
version: "2.6.0"
|
||||
sign_in_button:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -454,26 +454,26 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
|
||||
sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.3.2"
|
||||
version: "1.4.0"
|
||||
url_launcher:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: url_launcher
|
||||
sha256: "21b704ce5fa560ea9f3b525b43601c678728ba46725bab9b01187b4831377ed3"
|
||||
sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "6.3.0"
|
||||
version: "6.3.1"
|
||||
url_launcher_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_android
|
||||
sha256: "94d8ad05f44c6d4e2ffe5567ab4d741b82d62e3c8e288cc1fcea45965edf47c9"
|
||||
sha256: "8fc3bae0b68c02c47c5c86fa8bfa74471d42687b0eded01b78de87872db745e2"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "6.3.8"
|
||||
version: "6.3.12"
|
||||
url_launcher_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -486,18 +486,18 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_linux
|
||||
sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811
|
||||
sha256: e2b9622b4007f97f504cd64c0128309dfb978ae66adbe944125ed9e1750f06af
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.1.1"
|
||||
version: "3.2.0"
|
||||
url_launcher_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_macos
|
||||
sha256: "9a1a42d5d2d95400c795b2914c36fdcb525870c752569438e4ebb09a2b5d90de"
|
||||
sha256: "769549c999acdb42b8bcfa7c43d72bf79a382ca7441ab18a808e101149daf672"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.2.0"
|
||||
version: "3.2.1"
|
||||
url_launcher_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -518,10 +518,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_windows
|
||||
sha256: "49c10f879746271804767cb45551ec5592cdab00ee105c06dddde1a98f73b185"
|
||||
sha256: "44cf3aabcedde30f2dba119a9dea3b0f2672fbe6fa96e85536251d678216b3c4"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.1.2"
|
||||
version: "3.1.3"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -542,10 +542,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web
|
||||
sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062
|
||||
sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
version: "1.1.0"
|
||||
sdks:
|
||||
dart: ">=3.4.3 <4.0.0"
|
||||
flutter: ">=3.22.0"
|
||||
dart: ">=3.5.0 <4.0.0"
|
||||
flutter: ">=3.24.0"
|
||||
|
||||
@@ -41,7 +41,7 @@ dependencies:
|
||||
quiver: ^3.2.1
|
||||
flutter_login: ^5.0.0
|
||||
intl: ^0.19.0
|
||||
flutter_adaptive_scaffold: ^0.1.11+1
|
||||
flutter_adaptive_scaffold: ^0.3.1
|
||||
flutter_form_builder: ^9.3.0
|
||||
form_builder_validators: ^11.0.0
|
||||
url_launcher: ^6.3.0
|
||||
@@ -57,7 +57,7 @@ dev_dependencies:
|
||||
# activated in the `analysis_options.yaml` file located at the root of your
|
||||
# package. See that file for information about deactivating specific lint
|
||||
# rules and activating additional ones.
|
||||
flutter_lints: ^4.0.0
|
||||
flutter_lints: ^5.0.0
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
Reference in New Issue
Block a user