mirror of
https://github.com/navidrome/navidrome.git
synced 2024-09-11 20:12:54 +02:00
37 lines
758 B
Go
37 lines
758 B
Go
package cmd
|
|
|
|
import (
|
|
"github.com/navidrome/navidrome/conf"
|
|
"github.com/navidrome/navidrome/log"
|
|
"github.com/spf13/cobra"
|
|
"golang.org/x/net/context"
|
|
)
|
|
|
|
var fullRescan bool
|
|
|
|
func init() {
|
|
scanCmd.Flags().BoolVarP(&fullRescan, "full", "f", false, "check all subfolders, ignoring timestamps")
|
|
rootCmd.AddCommand(scanCmd)
|
|
}
|
|
|
|
var scanCmd = &cobra.Command{
|
|
Use: "scan",
|
|
Short: "Scan music folder",
|
|
Long: "Scan music folder for updates",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
runScanner()
|
|
},
|
|
}
|
|
|
|
func runScanner() {
|
|
conf.Server.DevPreCacheAlbumArtwork = false
|
|
|
|
scanner := GetScanner()
|
|
_ = scanner.RescanAll(context.Background(), fullRescan)
|
|
if fullRescan {
|
|
log.Info("Finished full rescan")
|
|
} else {
|
|
log.Info("Finished rescan")
|
|
}
|
|
}
|