downloader_test.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package internal
  2. import (
  3. "github.com/allanpk716/ChineseSubFinder/internal/pkg"
  4. "github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_formatter"
  5. "github.com/allanpk716/ChineseSubFinder/internal/types"
  6. "testing"
  7. )
  8. func TestDownloader_DownloadSub4Movie(t *testing.T) {
  9. var err error
  10. //dirRoot := "X:\\电影\\Spiral From the Book of Saw (2021)"
  11. //dirRoot := "X:\\电影\\Oslo (2021)"
  12. //dirRoot := "X:\\电影\\The Devil All the Time (2020)"
  13. //dirRoot := "X:\\电影\\21座桥 (2019)"
  14. //dirRoot := "X:\\电影\\An Invisible Sign (2010)"
  15. //dirRoot := "X:\\电影\\送你一朵小红花 (2020)"
  16. //dirRoot := "X:\\电影\\冰海陷落 (2018)"
  17. dirRoot := "X:\\电影\\The Boss Baby Family Business (2021)"
  18. //dirRoot := "X:\\电影"
  19. config := pkg.GetConfig()
  20. dl := NewDownloader(sub_formatter.GetSubFormatter(config.SubNameFormatter), types.ReqParam{
  21. SaveMultiSub: true,
  22. SubTypePriority: 1,
  23. EmbyConfig: config.EmbyConfig,
  24. })
  25. err = dl.GetUpdateVideoListFromEmby(config.MovieFolder, config.SeriesFolder)
  26. if err != nil {
  27. t.Fatal(err)
  28. }
  29. err = dl.DownloadSub4Movie(dirRoot)
  30. if err != nil {
  31. t.Fatal(err)
  32. }
  33. }
  34. func TestDownloader_DownloadSub4Series(t *testing.T) {
  35. var err error
  36. //dirRoot := "X:\\连续剧\\隐秘的角落 (2020)"
  37. //dirRoot := "X:\\连续剧\\The Bad Batch"
  38. dirRoot := "X:\\连续剧\\Loki"
  39. //dirRoot := "X:\\连续剧\\豪斯医生 (2004)"
  40. //dirRoot := "X:\\连续剧\\Why Women Kill"
  41. //dirRoot := "X:\\连续剧\\Mare of Easttown"
  42. //dirRoot := "X:\\连续剧\\瑞克和莫蒂 (2013)"
  43. //dirRoot := "X:\\连续剧\\黑钱胜地 (2017)"
  44. //dirRoot := "X:\\连续剧\\黑道家族 (1999)"
  45. //dirRoot := "X:\\连续剧\\黑镜 (2011)"
  46. //dirRoot := "X:\\连续剧\\黄石 (2018)"
  47. //dirRoot := "X:\\连续剧"
  48. config := pkg.GetConfig()
  49. // 如果需要调试 Emby 一定需要 dirRoot := "X:\\连续剧"
  50. dl := NewDownloader(sub_formatter.GetSubFormatter(config.SubNameFormatter), types.ReqParam{
  51. SaveMultiSub: true,
  52. SubTypePriority: 1,
  53. EmbyConfig: config.EmbyConfig,
  54. })
  55. err = dl.GetUpdateVideoListFromEmby(config.MovieFolder, config.SeriesFolder)
  56. if err != nil {
  57. t.Fatal(err)
  58. }
  59. err = dl.DownloadSub4Series(dirRoot)
  60. if err != nil {
  61. t.Fatal(err)
  62. }
  63. }
  64. func TestDownloader_GetUpdateVideoListFromEmby(t *testing.T) {
  65. var err error
  66. config := pkg.GetConfig()
  67. dl := NewDownloader(sub_formatter.GetSubFormatter(config.SubNameFormatter), types.ReqParam{
  68. SaveMultiSub: true,
  69. SubTypePriority: 1,
  70. EmbyConfig: config.EmbyConfig,
  71. })
  72. err = dl.GetUpdateVideoListFromEmby(config.MovieFolder, config.SeriesFolder)
  73. if err != nil {
  74. t.Fatal(err)
  75. }
  76. }