musicindex: cache tarballs by default

overridable with the -r command line option
This commit is contained in:
Jeremy Baxter 2026-01-05 01:04:55 +13:00
parent a392a5fc4c
commit 3f892331f6
3 changed files with 46 additions and 39 deletions

View file

@ -16,11 +16,13 @@ const version = "0-pre"
var addr *string
var port *uint16
var regenerate *bool
var showVersion *bool
func main() {
addr = getopt.String('a', "0.0.0.0")
port = getopt.Uint16('p', 8000)
regenerate = getopt.Bool('r')
showVersion = getopt.Bool('V')
if err := getopt.Getopt(nil); err != nil {
util.Die(err.Error())
@ -33,7 +35,7 @@ func main() {
args := getopt.Args()
if len(args) != 1 {
fmt.Fprintf(os.Stderr, "usage: %s [-V] [-a address] [-p port] directory\n", os.Args[0])
fmt.Fprintf(os.Stderr, "usage: %s [-rV] [-a address] [-p port] directory\n", os.Args[0])
os.Exit(1)
}
@ -42,7 +44,7 @@ func main() {
log.Printf("This is records %s\n", version)
log.Println("https://git.baxters.nz/jeremy/records")
musicindex.Init(mediaDir)
musicindex.Init(mediaDir, *regenerate)
var artistCount, albumCount, songCount int
artistCount = len(musicindex.Artists())