This commit is contained in:
parent
a53dbb0bec
commit
02ebcbc3d6
|
|
@ -56,6 +56,7 @@ func Generate(outDir string, title string, dryRun bool) {
|
|||
show := models.LoadShow(path)
|
||||
nfo.WriteShowInfo(show, filepath.Join(showDir, "tvshow.nfo"))
|
||||
showBanner(show, showDir)
|
||||
showFanart(show, showDir)
|
||||
case season.MatchString(path):
|
||||
ep := models.LoadEpisode(path)
|
||||
nfo.WriteEpisodeNFO(ep, path)
|
||||
|
|
@ -126,3 +127,20 @@ func showBanner(show models.Show, showDir string) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func showFanart(show models.Show, showDir string) {
|
||||
c := models.Thumbnail{}
|
||||
for index, thumb := range show.Thumbnails {
|
||||
log.Println(index, thumb)
|
||||
if thumb.Width > c.Width {
|
||||
log.Println("found fanart candidate", thumb)
|
||||
c = thumb
|
||||
}
|
||||
}
|
||||
|
||||
dl.Fetch(dl.Download{
|
||||
Url: c.Url,
|
||||
OutDir: showDir,
|
||||
Name: "fanart.jpg",
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,11 @@ type Show struct {
|
|||
}
|
||||
|
||||
type Thumbnail struct {
|
||||
Url string `json:"url" xml:"-"`
|
||||
Id string `json:"id" xml:"-"`
|
||||
Url string `json:"url" xml:"-"`
|
||||
Id string `json:"id" xml:"-"`
|
||||
Resolution string `json:"resolution" xml:"-"`
|
||||
Height int32 `json:"height" xml:"-"`
|
||||
Width int32 `json:"width" xml:"-"`
|
||||
}
|
||||
|
||||
func LoadShow(info_path string) Show {
|
||||
|
|
|
|||
Loading…
Reference in a new issue