downloader_test.go 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. package main
  2. import (
  3. "github.com/allanpk716/ChineseSubFinder/common"
  4. "github.com/allanpk716/ChineseSubFinder/model"
  5. "github.com/allanpk716/ChineseSubFinder/sub_parser/ass"
  6. "github.com/allanpk716/ChineseSubFinder/sub_parser/srt"
  7. "testing"
  8. )
  9. func TestDownloader_DownloadSub4Movie(t *testing.T) {
  10. var err error
  11. dirRoot := "X:\\电影\\Spiral From the Book of Saw (2021)"
  12. //dirRoot := "X:\\电影\\Oslo (2021)"
  13. //dirRoot := "X:\\电影\\The Devil All the Time (2020)"
  14. //dirRoot := "X:\\电影\\21座桥 (2019)"
  15. //dirRoot := "X:\\电影\\An Invisible Sign (2010)"
  16. //dirRoot := "X:\\电影\\送你一朵小红花 (2020)"
  17. //dirRoot := "X:\\电影\\冰海陷落 (2018)"
  18. //dirRoot := "X:\\电影"
  19. dl := NewDownloader(common.ReqParam{
  20. SaveMultiSub: true,
  21. SubTypePriority: 1,
  22. EmbyConfig: config.EmbyConfig,
  23. })
  24. err = dl.GetUpdateVideoListFromEmby(config.MovieFolder, config.SeriesFolder)
  25. if err != nil {
  26. t.Fatal(err)
  27. }
  28. err = dl.DownloadSub4Movie(dirRoot)
  29. if err != nil {
  30. t.Fatal(err)
  31. }
  32. }
  33. func TestDownloader_DownloadSub4Series(t *testing.T) {
  34. var err error
  35. //dirRoot := "X:\\连续剧\\隐秘的角落 (2020)"
  36. //dirRoot := "X:\\连续剧\\The Bad Batch"
  37. //dirRoot := "X:\\连续剧\\豪斯医生 (2004)"
  38. //dirRoot := "X:\\连续剧\\Why Women Kill"
  39. //dirRoot := "X:\\连续剧\\Mare of Easttown"
  40. //dirRoot := "X:\\连续剧\\瑞克和莫蒂 (2013)"
  41. //dirRoot := "X:\\连续剧\\黑钱胜地 (2017)"
  42. //dirRoot := "X:\\连续剧\\黑道家族 (1999)"
  43. //dirRoot := "X:\\连续剧\\黑镜 (2011)"
  44. //dirRoot := "X:\\连续剧\\黄石 (2018)"
  45. dirRoot := "X:\\连续剧"
  46. // 如果需要调试 Emby 一定需要 dirRoot := "X:\\连续剧"
  47. dl := NewDownloader(common.ReqParam{
  48. SaveMultiSub: true,
  49. SubTypePriority: 1,
  50. EmbyConfig: config.EmbyConfig,
  51. })
  52. err = dl.GetUpdateVideoListFromEmby(config.MovieFolder, config.SeriesFolder)
  53. if err != nil {
  54. t.Fatal(err)
  55. }
  56. err = dl.DownloadSub4Series(dirRoot)
  57. if err != nil {
  58. t.Fatal(err)
  59. }
  60. }
  61. func TestDownloader_GetUpdateVideoListFromEmby(t *testing.T) {
  62. var err error
  63. dl := NewDownloader(common.ReqParam{
  64. SaveMultiSub: true,
  65. SubTypePriority: 1,
  66. EmbyConfig: config.EmbyConfig,
  67. })
  68. err = dl.GetUpdateVideoListFromEmby(config.MovieFolder, config.SeriesFolder)
  69. if err != nil {
  70. t.Fatal(err)
  71. }
  72. }
  73. func TestDownloader_SubParserHub(t *testing.T) {
  74. //subFile := "X:\\连续剧\\瑞克和莫蒂 (2013)\\Season 4\\瑞克和莫蒂 - S04E01 - Rick and Morty.chs[zimuku].ass"
  75. //subFile := "X:\\连续剧\\瑞克和莫蒂 (2013)\\Season 1\\瑞克和莫蒂 - S01E01 - 试播集.en.ass"
  76. //subFile := "X:\\连续剧\\瑞克和莫蒂 (2013)\\Season 1\\瑞克和莫蒂 - S01E01 - 试播集.chs_en[zimuku].ass"
  77. //subFile := "X:\\连续剧\\瑞克和莫蒂 (2013)\\Season 4\\瑞克和莫蒂 - S04E01 - Rick and Morty.zh.srt"
  78. subFile := "X:\\连续剧\\黑钱胜地 (2017)\\Sub_S3E0\\[subhd]_0_Ozark.S03E07.iNTERNAL.720p.WEB.x264-GHOSTS.chs.eng.ass"
  79. subParserHub := model.NewSubParserHub(ass.NewParser(), srt.NewParser())
  80. subParserHub.IsSubHasChinese(subFile)
  81. }