36 lines
722 B
Go
36 lines
722 B
Go
package nfo
|
|
|
|
import (
|
|
"encoding/xml"
|
|
"log"
|
|
"os"
|
|
|
|
"git.meatbag.se/varl/subsyt/internal/model"
|
|
)
|
|
|
|
func WriteEpisodeNFO(ep model.Episode, outPath string) {
|
|
log.Printf("writing episode nfo to '%s'\n", outPath)
|
|
|
|
xmlData, err := xml.MarshalIndent(ep, "", " ")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
complete := xml.Header + string(xmlData)
|
|
log.Printf("%s", complete)
|
|
os.WriteFile(outPath, xmlData, 0644)
|
|
}
|
|
|
|
func WriteShowInfo(show model.Show, out_path string) {
|
|
log.Printf("writing info from '%v' to '%s'\n", show, out_path)
|
|
|
|
xmlData, err := xml.MarshalIndent(show, "", " ")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
complete := xml.Header + string(xmlData)
|
|
log.Printf("%s", complete)
|
|
os.WriteFile(out_path, xmlData, 0644)
|
|
}
|