Feat: more source support

pull/156/head
zijiren233 10 months ago
parent 8917f0e86b
commit bf88c7de21

@ -15,7 +15,7 @@ type dbVersion struct {
Upgrade func(*gorm.DB) error Upgrade func(*gorm.DB) error
} }
const CurrentVersion = "0.0.7" const CurrentVersion = "0.0.8"
var models = []any{ var models = []any{
new(model.Setting), new(model.Setting),
@ -67,6 +67,9 @@ var dbVersions = map[string]dbVersion{
}, },
}, },
"0.0.7": { "0.0.7": {
NextVersion: "0.0.8",
},
"0.0.8": {
NextVersion: "", NextVersion: "",
}, },
} }

@ -28,6 +28,7 @@ func (m *Movie) BeforeCreate(tx *gorm.DB) error {
type BaseMovie struct { type BaseMovie struct {
Url string `gorm:"type:varchar(8192)" json:"url"` 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"` Name string `gorm:"not null;type:varchar(256)" json:"name"`
Live bool `json:"live"` Live bool `json:"live"`
Proxy bool `json:"proxy"` Proxy bool `json:"proxy"`

@ -1157,6 +1157,9 @@ func genVendorMovie(ctx context.Context, user *op.User, opMovie *op.Movie, userA
} else { } else {
movie.Base.Url = fmt.Sprintf("/api/movie/proxy/%s/%s?token=%s", movie.RoomID, movie.ID, userToken) movie.Base.Url = fmt.Sprintf("/api/movie/proxy/%s/%s?token=%s", movie.RoomID, movie.ID, userToken)
movie.Base.Type = "mpd" 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()) srt, err := bmc.Subtitle.Get(ctx, user.BilibiliCache())
if err != nil { if err != nil {

Loading…
Cancel
Save