| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- package emby_helper
- import (
- "github.com/allanpk716/ChineseSubFinder/internal/pkg/settings"
- "testing"
- )
- var ec = settings.EmbySettings{
- AddressUrl: "http://192.168.50.252:8096",
- APIKey: "xxxxx",
- MaxRequestVideoNumber: 100,
- MoviePathsMapping: map[string]string{
- "X:\\电影": "/mnt/share1/电影",
- },
- SeriesPathsMapping: map[string]string{
- "X:\\连续剧": "/mnt/share1/连续剧",
- },
- }
- // TODO 暂不方便在其他环境进行单元测试
- func TestEmbyHelper_GetRecentlyAddVideoList(t *testing.T) {
- //embyConfig := settings.NewEmbySettings()
- //embyConfig.Enable = true
- //embyConfig.AddressUrl = "http://192.168.50.252:8096"
- //embyConfig.APIKey = "1"
- //embyConfig.SkipWatched = false
- //embyConfig.MaxRequestVideoNumber = 1000
- //embyConfig.MoviePathsMapping["X:\\电影"] = "/mnt/share1/电影"
- //embyConfig.MoviePathsMapping["X:\\连续剧"] = "/mnt/share1/连续剧"
- //
- //em := NewEmbyHelper(*embyConfig)
- //movieList, seriesList, err := em.GetRecentlyAddVideoListWithNoChineseSubtitle()
- //if err != nil {
- // t.Fatal(err)
- //}
- //println(len(movieList), len(seriesList))
- }
- // TODO 暂不方便在其他环境进行单元测试
- func TestEmbyHelper_RefreshEmbySubList(t *testing.T) {
- //config := config.GetConfig()
- //em := NewEmbyHelper(config.EmbyConfig)
- //bok, err := em.refreshEmbySubList()
- //if err != nil {
- // t.Fatal(err)
- //}
- //println(bok)
- }
- // TODO 暂不方便在其他环境进行单元测试
- func TestEmbyHelper_GetInternalEngSubAndExSub(t *testing.T) {
- //config := config.GetConfig()
- //em := NewEmbyHelper(config.EmbyConfig)
- //// 81873 -- R&M - S05E01
- //// R&M S05E10 2 org english, 5 简英 145499
- //// 基地 S01E03 166840
- //found, internalEngSub, exCh_EngSub, err := em.GetInternalEngSubAndExChineseEnglishSub("166840")
- //if err != nil {
- // t.Fatal(err)
- //}
- //if found == false {
- // t.Fatal("need found sub")
- //}
- //
- //println(internalEngSub[0].FileName, exCh_EngSub[0].FileName)
- }
- // TODO 暂不方便在其他环境进行单元测试
- func TestEmbyHelper_GetPlayedItemsSubtitle(t *testing.T) {
- //em := NewEmbyHelper(ec)
- //moviePhyFPathMap, seriesPhyFPathMap, err := em.GetPlayedItemsSubtitle()
- //if err != nil {
- // t.Fatal(err)
- //}
- //
- //for videoPhyPath, subPhyPath := range moviePhyFPathMap {
- // println(videoPhyPath, "--", subPhyPath)
- // if my_util.IsFile(videoPhyPath) == false {
- // t.Fatal("not found,", videoPhyPath)
- // }
- // if my_util.IsFile(subPhyPath) == false {
- // t.Fatal("not found,", subPhyPath)
- // }
- //}
- //
- //for videoPhyPath, subPhyPath := range seriesPhyFPathMap {
- // println(videoPhyPath, "--", subPhyPath)
- // if my_util.IsFile(videoPhyPath) == false {
- // t.Fatal("not found,", videoPhyPath)
- // }
- // if my_util.IsFile(subPhyPath) == false {
- // t.Fatal("not found,", subPhyPath)
- // }
- //}
- }
- func TestEmbyHelper_IsVideoPlayed(t *testing.T) {
- ////// 95813 -- 命运夜
- ////// 96564 -- The Bad Batch - S01E11
- ////// 108766 -- R&M - S05E06
- ////// 145499 -- R&M - S05E10
- //tmpSettings := settings.NewSettings()
- //tmpSettings.EmbySettings = &ec
- //em := NewEmbyHelper(log_helper.GetLogger4Tester(), tmpSettings)
- //played, err := em.IsVideoPlayed("145499")
- //if err != nil {
- // t.Fatal(err)
- //}
- //
- //if played == false {
- // t.Fatal("need played")
- //}
- }
|