From bf88c7de2114cb8075fbc4849450fa869c734b03 Mon Sep 17 00:00:00 2001 From: zijiren233 Date: Fri, 10 May 2024 13:57:13 +0800 Subject: [PATCH] Feat: more source support --- internal/db/update.go | 5 ++++- internal/model/movie.go | 1 + server/handlers/movie.go | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/db/update.go b/internal/db/update.go index 495240e..87fc8c7 100644 --- a/internal/db/update.go +++ b/internal/db/update.go @@ -15,7 +15,7 @@ type dbVersion struct { Upgrade func(*gorm.DB) error } -const CurrentVersion = "0.0.7" +const CurrentVersion = "0.0.8" var models = []any{ new(model.Setting), @@ -67,6 +67,9 @@ var dbVersions = map[string]dbVersion{ }, }, "0.0.7": { + NextVersion: "0.0.8", + }, + "0.0.8": { NextVersion: "", }, } diff --git a/internal/model/movie.go b/internal/model/movie.go index ce35a2b..f32ef27 100644 --- a/internal/model/movie.go +++ b/internal/model/movie.go @@ -28,6 +28,7 @@ func (m *Movie) BeforeCreate(tx *gorm.DB) error { type BaseMovie struct { Url string `gorm:"type:varchar(8192)" json:"url"` + MoreSource map[string]string `gorm:"serializer:fastjson;type:text" json:"moreSource"` Name string `gorm:"not null;type:varchar(256)" json:"name"` Live bool `json:"live"` Proxy bool `json:"proxy"` diff --git a/server/handlers/movie.go b/server/handlers/movie.go index 46ce7f2..a509dfd 100644 --- a/server/handlers/movie.go +++ b/server/handlers/movie.go @@ -1157,6 +1157,9 @@ func genVendorMovie(ctx context.Context, user *op.User, opMovie *op.Movie, userA } else { movie.Base.Url = fmt.Sprintf("/api/movie/proxy/%s/%s?token=%s", movie.RoomID, movie.ID, userToken) movie.Base.Type = "mpd" + movie.Base.MoreSource = map[string]string{ + "hevc": fmt.Sprintf("/api/movie/proxy/%s/%s?token=%s&t=hevc", movie.RoomID, movie.ID, userToken), + } } srt, err := bmc.Subtitle.Get(ctx, user.BilibiliCache()) if err != nil {