From a2bd508f71956da4e04263fcb17c0afb4be81696 Mon Sep 17 00:00:00 2001 From: Akimio521 Date: Mon, 14 Oct 2024 20:40:59 +0800 Subject: [PATCH] =?UTF-8?q?style:=E4=BC=98=E5=8C=96=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/setup.go | 6 +++--- cmd/shutdown.go | 4 ++-- internal/handler/emby.go | 18 +++++++++--------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cmd/setup.go b/cmd/setup.go index ef8ac8b..e956fdf 100644 --- a/cmd/setup.go +++ b/cmd/setup.go @@ -2,7 +2,6 @@ package cmd import ( "MediaWarp/internal/router" - "fmt" "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" @@ -12,12 +11,13 @@ import ( func SetUP() { if isDebug { logger.ServiceLogger.SetLevel(logrus.DebugLevel) - fmt.Println("已启用调试模式") + logger.ServiceLogger.Warning("已启用调试模式") } else { gin.SetMode(gin.ReleaseMode) } + logger.ServiceLogger.Info("MediaWarp 监听端口:", cfg.Port) ginR := router.InitRouter() // 路由初始化 - fmt.Println("MediaWarp启动成功") + logger.ServiceLogger.Info("MediaWarp 启动成功") ginR.Run(cfg.ListenAddr()) // 启动服务 } diff --git a/cmd/shutdown.go b/cmd/shutdown.go index 4224cd4..6e79819 100644 --- a/cmd/shutdown.go +++ b/cmd/shutdown.go @@ -4,9 +4,9 @@ import "fmt" // MidaWarp退出函数 func ShutDown() { - fmt.Println("MediaWarp正在关闭...") + fmt.Println("MediaWarp 正在关闭...") // 其他操作... - fmt.Println("MediaWarp正常关闭") + fmt.Println("MediaWarp 正常关闭") } diff --git a/internal/handler/emby.go b/internal/handler/emby.go index 3c51c6a..d763ab9 100644 --- a/internal/handler/emby.go +++ b/internal/handler/emby.go @@ -64,11 +64,11 @@ func (embyServerHandler *EmbyServerHandler) VideosHandler(ctx *gin.Context) { // EmbyServer >= 4.9 ====> mediaSourceID = mediasource_31 mediaSourceID := ctx.Query("mediasourceid") - logger.ServiceLogger.Debug("请求ItemsServiceQueryItem:", mediaSourceID) + logger.ServiceLogger.Debug("请求 ItemsServiceQueryItem:", mediaSourceID) itemResponse, err := embyServerHandler.server.ItemsServiceQueryItem(strings.Replace(mediaSourceID, "mediasource_", "", 1), 1, "Path,MediaSources") // 查询item需要去除前缀仅保留数字部分 if err != nil { - logger.ServiceLogger.Warning("请求ItemsServiceQueryItem失败:", err) + logger.ServiceLogger.Warning("请求 ItemsServiceQueryItem 失败:", err) return } item := itemResponse.Items[0] @@ -80,13 +80,13 @@ func (embyServerHandler *EmbyServerHandler) VideosHandler(ctx *gin.Context) { if *mediasource.Protocol == emby.HTTP && cfg.HTTPStrm.Enable { for _, prefix := range cfg.HTTPStrm.PrefixList { if strings.HasPrefix(*item.Path, prefix) { - logger.ServiceLogger.Debug(item.Path, "匹配HTTPStrm路径:", prefix, "成功") - logger.ServiceLogger.Info("HTTP协议Strm重定向:", *mediasource.Path) + logger.ServiceLogger.Debug(item.Path, "匹配 HTTPStrm 路径:", prefix, " 成功") + logger.ServiceLogger.Info("HTTP 协议Strm 重定向:", *mediasource.Path) ctx.Redirect(http.StatusFound, *mediasource.Path) return } } - logger.ServiceLogger.Info("未匹配HTTPStrm路径:", *item.Path) + logger.ServiceLogger.Info("未匹配 HTTPStrm 路径:", *item.Path) isRedirect = false // 未匹配到 HTTPStrm 路径,但未启用,不进行后续重定向 } @@ -98,16 +98,16 @@ func (embyServerHandler *EmbyServerHandler) VideosHandler(ctx *gin.Context) { alistServer := service.GetAlistServer(alistStrmConfig.ADDR) fsGetData, err := alistServer.FsGet(*mediasource.Path) if err != nil { - logger.ServiceLogger.Warning("请求FsGet失败:", err) + logger.ServiceLogger.Warning("请求 FsGet 失败:", err) return } - logger.ServiceLogger.Info("AlistStrm重定向:", fsGetData.RawURL) + logger.ServiceLogger.Info("AlistStrm 重定向:", fsGetData.RawURL) ctx.Redirect(http.StatusFound, fsGetData.RawURL) return } } } - logger.ServiceLogger.Info("未匹配AlistStrm路径:", *item.Path) + logger.ServiceLogger.Info("未匹配 AlistStrm 路径:", *item.Path) isRedirect = false // 未匹配到 AlistStrm 路径,但未启用,不进行后续重定向 } @@ -123,7 +123,7 @@ func (embyServerHandler *EmbyServerHandler) VideosHandler(ctx *gin.Context) { // 用于修改播放器JS,实现跨域播放Strm func (embyServerHandler *EmbyServerHandler) ModifyBaseHtmlPlayerHandler(ctx *gin.Context) { version := ctx.Query("v") - logger.ServiceLogger.Debug("请求basehtmlplayer.js版本:", version) + logger.ServiceLogger.Debug("请求 basehtmlplayer.js 版本:", version) proxy := embyServerHandler.server.GetReverseProxy() proxy.ModifyResponse = func(rw *http.Response) error {