示例#1
0
func TestLoad(t *testing.T) {
	os.Args = append(os.Args, "-l=fr", "-r=\"^.+[\\.]$\"", "$HOME/Media")
	f, err := ioutil.TempFile("", "testConf")
	if err != nil {
		t.Error("Unable to create temp file!")
	}

	f.Write([]byte(`[Main]
        Language=cn
        NameFormatting={{format}}
        NewPath=$HOME`))

	c := config.Load(f.Name())

	if c.Language != "fr" {
		t.Errorf("Wrong Language: %v should be %v", c.Language, "fr")
	}
	if c.NameFormatting != "{{format}}" {
		t.Errorf("Wrong NameFormatting: %v should be %v", c.NameFormatting, "{{format}}")
	}
	if c.Path != "$HOME/Media" {
		t.Errorf("Wrong Path: %v should be %v\n", c.Path, "$HOME/Media")
	}
	if c.NewPath != "$HOME" {
		t.Errorf("Wrong NewPath: %v should be %v\n", c.NewPath, "$HOME")
	}
}
示例#2
0
func TestGetEpisode(t *testing.T) {
	c := config.Load("")
	c.Path = "$HOME/Heroes.101.LoL-x264.mp4"
	c.NameFormatting = "{{.SeriesName}}.{{.SeasonNb}}x{{.EpisodeNb}}.{{.EpisodeName}}"
	c.NewPath = "/mnt/media/Multimédia/Séries TV/{{.SeriesName}}/Saison {{.SeasonNb}}/"
	c.Move = true
	tvr := New(c.Language, c.NameFormatting, c.NewPath, c.Regex, c.Move)
	// ep, _ := tvr.getEpisode("Heroes.S01E05.Lol-h264.mp4")
	tvr.Rename(c.Path)
}