Added patch to update AMV info
This commit is contained in:
parent
5a592c505b
commit
3bd192cbd3
36
patches/update-amv-info/update-amv-info.go
Normal file
36
patches/update-amv-info/update-amv-info.go
Normal file
@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"path"
|
||||
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/arn/stringutils"
|
||||
"github.com/animenotifier/arn/video"
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
func main() {
|
||||
color.Yellow("Updating AMV info")
|
||||
|
||||
defer color.Green("Finished.")
|
||||
defer arn.Node.Close()
|
||||
|
||||
for amv := range arn.StreamAMVs() {
|
||||
if amv.File == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
info, err := video.GetInfo(path.Join(arn.Root, "videos", "amvs", amv.File))
|
||||
|
||||
if err != nil {
|
||||
color.Red(err.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
color.Green(amv.Title.Canonical)
|
||||
stringutils.PrettyPrint(info)
|
||||
|
||||
amv.Info = *info
|
||||
amv.Save()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user