From 78fd4e0ff16231b4ea5f7a0e074800717b15b841 Mon Sep 17 00:00:00 2001 From: zijiren233 Date: Tue, 26 Dec 2023 17:46:27 +0800 Subject: [PATCH] Feat: emby search --- go.mod | 4 ++-- go.sum | 8 ++++---- internal/vendor/alist.go | 4 ++++ server/handlers/vendors/vendorEmby/list.go | 4 +++- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 5b96287..d9680d2 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/soheilhy/cmux v0.1.5 github.com/spf13/cobra v1.8.0 - github.com/synctv-org/vendors v0.1.1-0.20231222143031-9a863227415f + github.com/synctv-org/vendors v0.2.2-0.20231226084816-6cd79508ca08 github.com/ulule/limiter/v3 v3.11.2 github.com/zencoder/go-dash/v3 v3.0.3 github.com/zijiren233/gencontainer v0.0.0-20231213075414-f7f4c8261dca @@ -40,7 +40,7 @@ require ( github.com/zijiren233/yaml-comment v0.2.1 go.etcd.io/etcd/client/v3 v3.5.11 golang.org/x/crypto v0.17.0 - golang.org/x/exp v0.0.0-20231219180239-dc181d75b848 + golang.org/x/exp v0.0.0-20231226003508-02704c960a9b golang.org/x/oauth2 v0.15.0 google.golang.org/grpc v1.60.1 google.golang.org/protobuf v1.32.0 diff --git a/go.sum b/go.sum index e1e5edb..ec2e30d 100644 --- a/go.sum +++ b/go.sum @@ -350,8 +350,8 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/synctv-org/vendors v0.1.1-0.20231222143031-9a863227415f h1:31x5Kdga//iexaMtQo8dU1mPaIBIHnt/CiU+fuRXsMI= -github.com/synctv-org/vendors v0.1.1-0.20231222143031-9a863227415f/go.mod h1:CkgeP0V9bce02Yfl053rDy3IdAeILaanRPpN58A4VPc= +github.com/synctv-org/vendors v0.2.2-0.20231226084816-6cd79508ca08 h1:jJ1xn6EInG8u02YUKDioF36Y9ab9IC9eA0Z3lQ8o7FU= +github.com/synctv-org/vendors v0.2.2-0.20231226084816-6cd79508ca08/go.mod h1:Q+KEUh8ZgCSMjY5rCfz44+7POlHcGttZ/bYFiTDVBds= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= 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= @@ -400,8 +400,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/exp v0.0.0-20231219180239-dc181d75b848 h1:+iq7lrkxmFNBM7xx+Rae2W6uyPfhPeDWD+n+JgppptE= -golang.org/x/exp v0.0.0-20231219180239-dc181d75b848/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= +golang.org/x/exp v0.0.0-20231226003508-02704c960a9b h1:kLiC65FbiHWFAOu+lxwNPujcsl8VYyTYYEZnsOO1WK4= +golang.org/x/exp v0.0.0-20231226003508-02704c960a9b/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= diff --git a/internal/vendor/alist.go b/internal/vendor/alist.go index b8a49e2..0b83232 100644 --- a/internal/vendor/alist.go +++ b/internal/vendor/alist.go @@ -70,3 +70,7 @@ func (a *grpcAlist) Login(ctx context.Context, req *alist.LoginReq) (*alist.Logi func (a *grpcAlist) Me(ctx context.Context, req *alist.MeReq) (*alist.MeResp, error) { return a.client.Me(ctx, req) } + +func (a *grpcAlist) FsSearch(ctx context.Context, req *alist.FsSearchReq) (*alist.FsSearchResp, error) { + return a.client.FsSearch(ctx, req) +} diff --git a/server/handlers/vendors/vendorEmby/list.go b/server/handlers/vendors/vendorEmby/list.go index a1fbced..89dcc96 100644 --- a/server/handlers/vendors/vendorEmby/list.go +++ b/server/handlers/vendors/vendorEmby/list.go @@ -15,7 +15,8 @@ import ( ) type ListReq struct { - Path string `json:"path"` + Path string `json:"path"` + Keywords string `json:"keywords"` } func (r *ListReq) Validate() error { @@ -71,6 +72,7 @@ func List(ctx *gin.Context) { Token: aucd.ApiKey, Limit: uint64(size), StartIndex: uint64((page - 1) * size), + SearchTerm: req.Keywords, }) if err != nil { ctx.AbortWithStatusJSON(http.StatusInternalServerError, model.NewApiErrorResp(err))