logic/anime_episode_filepath.go

23 lines
434 B
Go
Raw Normal View History

2023-01-13 10:39:59 +01:00
package logic
import (
"path/filepath"
"strings"
"git.milar.in/nyaanime/model"
)
func GetAnimeEpFilepath(animeEp model.AnimeEpisode, ext string) string {
tmplData := AnimePathPatternData{
Title: animeEp.Anime.Title,
Episode: animeEp.Episode,
Ext: ext,
}
b := new(strings.Builder)
if err := AnimeEpFilepathPattern.Execute(b, tmplData); err != nil {
panic(err)
}
return filepath.Join(AnimePath, b.String())
}