feat: alist ali support raw stream

This commit is contained in:
zijiren233 2024-08-30 22:40:29 +08:00
parent aad84887bb
commit 279ff2bc2d
1 changed files with 17 additions and 0 deletions

View File

@ -1235,6 +1235,11 @@ func proxyVendorMovie(ctx *gin.Context, movie *op.Movie) {
case "":
ctx.Data(http.StatusOK, "audio/mpegurl", data.Ali.M3U8ListFile)
return
case "raw":
err := proxyURL(ctx, data.URL, nil)
if err != nil {
log.Errorf("proxy vendor movie error: %v", err)
}
case "subtitle":
idS := ctx.Query("id")
if idS == "" {
@ -1473,6 +1478,18 @@ func genVendorMovie(ctx context.Context, user *op.User, opMovie *op.Movie, userA
movie.MovieBase.Url = fmt.Sprintf("/api/movie/proxy/%s/%s?token=%s", movie.RoomID, movie.ID, userToken)
movie.MovieBase.Type = "m3u8"
rawUrl := data.URL
if movie.MovieBase.Proxy {
rawUrl = fmt.Sprintf("/api/movie/proxy/%s/%s?t=raw&token=%s", movie.RoomID, movie.ID, userToken)
}
movie.MovieBase.MoreSources = []*dbModel.MoreSource{
{
Name: "raw",
Type: utils.GetUrlExtension(data.URL),
Url: rawUrl,
},
}
for i, subt := range data.Subtitles {
if movie.MovieBase.Subtitles == nil {
movie.MovieBase.Subtitles = make(map[string]*dbModel.Subtitle, len(data.Subtitles))