Files
TorrServerJellyfin/server/web/api/ffprobe.go
Evgeni a91e6eb11b Added Https service. Fix for #188 How enable https? (#312)
* https service added on port 8091 default

* https port check

* format

* readme

* readme

* readme

* readme

---------

Co-authored-by: evfedoto <evfedoto@cisco.com>
Co-authored-by: nikk <tsynik@gmail.com>
2023-11-13 02:50:11 +03:00

36 lines
682 B
Go

package api
import (
"errors"
"fmt"
"net/http"
"server/ffprobe"
sets "server/settings"
"github.com/gin-gonic/gin"
)
func ffp(c *gin.Context) {
hash := c.Param("hash")
indexStr := c.Param("id")
if hash == "" || indexStr == "" {
c.AbortWithError(http.StatusNotFound, errors.New("link should not be empty"))
return
}
link := "http://127.0.0.1:" + sets.Port + "/play/" + hash + "/" + indexStr
if sets.Ssl {
link = "https://127.0.0.1:" + sets.SslPort + "/play/" + hash + "/" + indexStr
}
data, err := ffprobe.ProbeUrl(link)
if err != nil {
c.AbortWithError(http.StatusBadRequest, fmt.Errorf("error getting data: %v", err))
return
}
c.JSON(200, data)
}