Signed-off-by: allan716 <[email protected]>
@@ -30,3 +30,28 @@ func (cb ControllerBase) CheckPathHandler(c *gin.Context) {
})
}
+
+func (cb ControllerBase) CheckEmbyPathHandler(c *gin.Context) {
+ var err error
+ defer func() {
+ // 统一的异常处理
+ cb.ErrorProcess(c, "CheckEmbyPathHandler", err)
+ }()
+ reqCheckPath := backend.ReqCheckEmbyPath{}
+ err = c.ShouldBindJSON(&reqCheckPath)
+ if err != nil {
+ return
+ }
+ // 需要使用 Emby 做列表转换,从发送过来的 emby_media_path 进行推算,拼接 cfs_media_path 地址,然后读取这个文件夹或者视频是否存在
+ // 暂定还是以最近的 Emby 视频列表,再去匹配
+ //if my_util.IsDir(reqCheckPath.Path) == true {
+ // c.JSON(http.StatusOK, backend.ReplyCheckEmbyPath{
+ // Valid: true,
+ // })
+ //} else {
+ // Valid: false,
+ //}
+}
@@ -24,6 +24,8 @@ func InitRouter(router *gin.Engine, cronHelper *cron_helper.CronHelper) {
router.POST("/check-path", cbBase.CheckPathHandler)
+ router.POST("/check-emby-path", cbBase.CheckEmbyPathHandler)
router.POST("/check-proxy", cbBase.CheckProxyHandler)
router.GET("/def-settings", cbBase.DefSettingsHandler)
@@ -504,6 +504,16 @@ func (em *EmbyHelper) GetInternalEngSubAndExChineseEnglishSub(videoId string) (b
return true, inSubList, exSubList, nil
+func (em *EmbyHelper) CheckPath(CFSMediaPath, EmbyMediaPath string) ([]string, error) {
+ // 获取最近的影片列表
+ items, err := em.embyApi.GetRecentlyItems()
+ return nil, err
type InputData struct {
Id string
Wg *sync.WaitGroup
@@ -0,0 +1,5 @@
+package backend
+type ReplyCheckEmbyPath struct {
+ MediaList []string `json:"media_list"`
@@ -0,0 +1,8 @@
+type ReqCheckEmbyPath struct {
+ AddressUrl string `json:"address_url" binding:"required"`
+ APIKey string `json:"api_key" binding:"required"`
+ CFSMediaPath string `json:"cfs_media_path" binding:"required"`
+ EmbyMediaPath string `json:"emby_media_path" binding:"required"`