소스 검색

修复从视频文件名获取视频信息模块的问题,需要更新外部的代码指向

Signed-off-by: 716 <[email protected]>
716 3 년 전
부모
커밋
838c86aa91
6개의 변경된 파일34개의 추가작업 그리고 8개의 파일을 삭제
  1. 15 0
      TestCode/test_ptn.go
  2. 8 0
      TestCode/test_ptn_test.go
  3. 5 2
      go.mod
  4. 2 2
      go.sum
  5. 1 1
      internal/logic/emby_helper/embyhelper.go
  6. 3 3
      internal/logic/pre_download_process/pre_download_proces.go

+ 15 - 0
TestCode/test_ptn.go

@@ -0,0 +1,15 @@
+package TestCode
+
+import PTN "github.com/middelink/go-parse-torrent-name"
+
+func getInfo() {
+	fileName := "1883 - S01E01 - 1883 WEBDL-1080p Proper.mkv"
+	//fileName := "1883 - S01E02 - Behind Us, A Cliff WEBDL-1080p Proper.mkv"
+
+	parse, err := PTN.Parse(fileName)
+	if err != nil {
+		return
+	}
+
+	println(parse.Season, parse.Episode)
+}

+ 8 - 0
TestCode/test_ptn_test.go

@@ -0,0 +1,8 @@
+package TestCode
+
+import "testing"
+
+func Test_getInfo(t *testing.T) {
+
+	getInfo()
+}

+ 5 - 2
go.mod

@@ -34,7 +34,7 @@ require (
 	github.com/lestrrat-go/strftime v1.0.4 // indirect
 	github.com/magiconair/properties v1.8.4 // indirect
 	github.com/mholt/archiver/v3 v3.5.0
-	github.com/middelink/go-parse-torrent-name v0.0.0-20190301154245-3ff4efacd4c4
+	github.com/middelink/go-parse-torrent-name v0.0.0-00010101000000-000000000000
 	github.com/mitchellh/mapstructure v1.4.1 // indirect
 	github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
 	github.com/nzlov/chardet v0.0.0-20190815145004-022cbcf483f9
@@ -119,4 +119,7 @@ require (
 	gopkg.in/warnings.v0 v0.1.2 // indirect
 )
 
-replace github.com/go-creed/sat => github.com/allanpk716/sat v0.0.0-20210622112535-2e00ce54a80b
+replace (
+	github.com/go-creed/sat => github.com/allanpk716/sat v0.0.0-20210622112535-2e00ce54a80b
+	github.com/middelink/go-parse-torrent-name => github.com/allanpk716/go-parse-torrent-name v0.0.0-20220212145434-430ea25cbba7
+)

+ 2 - 2
go.sum

@@ -52,6 +52,8 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF
 github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
 github.com/allanpk716/fake-useragent v0.2.1 h1:5EurHovAMGNwMZNbZ2cFOH8HsLdHwopnnKWCsV3PtNI=
 github.com/allanpk716/fake-useragent v0.2.1/go.mod h1:U3tmrxBYvSPeQKQ/9x59CXJPkHbU4x4eXw3ji5TDhPk=
+github.com/allanpk716/go-parse-torrent-name v0.0.0-20220212145434-430ea25cbba7 h1:5AYgeYsVjtDPG5sUS77lyeEPiRMduIKstLjkBLiVPRc=
+github.com/allanpk716/go-parse-torrent-name v0.0.0-20220212145434-430ea25cbba7/go.mod h1:H66QhXPJpUSdWschhL6u//v3ge96/qMnQ9mWp3efbxA=
 github.com/allanpk716/sat v0.0.0-20210622112535-2e00ce54a80b h1:vxXQuRgTH0D6aacl7Jyk4Kz8N4wbVTFn7M7Ib+/IFq4=
 github.com/allanpk716/sat v0.0.0-20210622112535-2e00ce54a80b/go.mod h1:ZxAhQ0ikMzjqeMbFeoMdCr6es8p10Y87F2nHkqNjSbY=
 github.com/andybalholm/brotli v1.0.0 h1:7UCwP93aiSfvWpapti8g88vVVGp2qqtGyePsSuDafo4=
@@ -381,8 +383,6 @@ github.com/mattn/go-sqlite3 v1.14.10/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4
 github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
 github.com/mholt/archiver/v3 v3.5.0 h1:nE8gZIrw66cu4osS/U7UW7YDuGMHssxKutU8IfWxwWE=
 github.com/mholt/archiver/v3 v3.5.0/go.mod h1:qqTTPUK/HZPFgFQ/TJ3BzvTpF/dPtFVJXdQbCmeMxwc=
-github.com/middelink/go-parse-torrent-name v0.0.0-20190301154245-3ff4efacd4c4 h1:C/VViMMbR/4Ti2aXrWpKy34S05cRaVd6EvV9BFR3qJ8=
-github.com/middelink/go-parse-torrent-name v0.0.0-20190301154245-3ff4efacd4c4/go.mod h1:H66QhXPJpUSdWschhL6u//v3ge96/qMnQ9mWp3efbxA=
 github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
 github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
 github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=

+ 1 - 1
internal/logic/emby_helper/embyhelper.go

@@ -207,7 +207,7 @@ func (em *EmbyHelper) findMappingPath(mixInfo *emby.EmbyMixInfo, isMovieOrSeries
 			return false
 		}
 		mixInfo.PhysicalVideoFileFullPath = strings.ReplaceAll(mixInfo.VideoInfo.Path, pathSlices[0].Path, nowPhRootPath)
-		mixInfo.PhysicalRootPath = mixInfo.Ancestors[ancestorIndex+1].Path
+		mixInfo.PhysicalRootPath = strings.ReplaceAll(mixInfo.Ancestors[ancestorIndex+1].Path, pathSlices[0].Path, nowPhRootPath)
 		// 这个剧集的文件夹
 		mixInfo.VideoFolderName = filepath.Base(mixInfo.Ancestors[ancestorIndex].Path)
 		mixInfo.VideoFileName = filepath.Base(mixInfo.VideoInfo.Path)

+ 3 - 3
internal/logic/pre_download_process/pre_download_proces.go

@@ -77,7 +77,7 @@ func (p *PreDownloadProcess) Init() *PreDownloadProcess {
 	} else {
 
 		// 获取到的更新时间不是当前的日期,那么本次也跳过本次
-		codeTime, err := time.Parse( "2006-01-02", updateTimeString)
+		codeTime, err := time.Parse("2006-01-02", updateTimeString)
 		if err != nil {
 			log_helper.GetLogger().Errorln("something_static.GetCodeFromWeb.time.Parse", err)
 			// 没有则需要清空
@@ -128,7 +128,7 @@ func (p *PreDownloadProcess) Check() *PreDownloadProcess {
 			p.gError = errors.New("UrlConnectednessTest Target Site " + url_connectedness_helper.BaiduUrl + ", " + err.Error())
 			return p
 		} else {
-			log_helper.GetLogger().Infoln("UrlConnectednessTest Target Site", url_connectedness_helper.BaiduUrl, "Speed:", proxySpeed, "Status:", proxyStatus)
+			log_helper.GetLogger().Infoln("UrlConnectednessTest Target Site", url_connectedness_helper.BaiduUrl, "Speed:", proxySpeed, "ms,", "Status:", proxyStatus)
 		}
 	} else {
 
@@ -139,7 +139,7 @@ func (p *PreDownloadProcess) Check() *PreDownloadProcess {
 			p.gError = errors.New("UrlConnectednessTest Target Site " + url_connectedness_helper.GoogleUrl + ", " + err.Error())
 			return p
 		} else {
-			log_helper.GetLogger().Infoln("UrlConnectednessTest Target Site", url_connectedness_helper.GoogleUrl, "Speed:", proxySpeed, "Status:", proxyStatus)
+			log_helper.GetLogger().Infoln("UrlConnectednessTest Target Site", url_connectedness_helper.GoogleUrl, "Speed:", proxySpeed, "ms,", "Status:", proxyStatus)
 		}
 	}
 	// ------------------------------------------------------------------------