23 lines
434 B
Go
23 lines
434 B
Go
|
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())
|
||
|
}
|