Skip to content

Commit b58d8b0

Browse files
Merge pull request #6
unbroke flags
2 parents 094ff2c + 1b08b01 commit b58d8b0

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

main.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,55 +20,55 @@ var command = []string{"custom"}
2020
var rsgainSemaphore chan int
2121

2222
func main() {
23-
albumMode := *flag.Bool("a", false, "Calculate album gain and peak.")
24-
skipExisting := *flag.Bool("S", false, "Don't scan files with existing ReplayGain information.")
25-
tagMode := *flag.String("s", "s", "Tagmode:\ns: scan only\ni: write tags\nd: delete tags")
26-
targetLoudness := *flag.Int("l", -18, "Use n LUFS as target loudness (-30 ≤ n ≤ -5), default: -18")
27-
clipMode := *flag.String("c", "n", "n: no clipping protection (default),\np: clipping protection enabled for positive gain values only,\na: Use max peak level n dB for clipping protection")
28-
quiet := *flag.Bool("q", false, "(rsgain) Don't print scanning status messages.")
29-
rsgainLimit := *flag.Int("r", 100, "Limit, how many rsgain instances can run at a time.")
23+
albumMode := flag.Bool("a", false, "Calculate album gain and peak.")
24+
skipExisting := flag.Bool("S", false, "Don't scan files with existing ReplayGain information.")
25+
tagMode := flag.String("s", "s", "Tagmode:\ns: scan only\ni: write tags\nd: delete tags")
26+
targetLoudness := flag.Int("l", -18, "Use n LUFS as target loudness (-30 ≤ n ≤ -5), default: -18")
27+
clipMode := flag.String("c", "n", "n: no clipping protection (default),\np: clipping protection enabled for positive gain values only,\na: Use max peak level n dB for clipping protection")
28+
quiet := flag.Bool("q", false, "(rsgain) Don't print scanning status messages.")
29+
rsgainLimit := flag.Int("r", 100, "Limit, how many rsgain instances can run at a time.")
3030
flag.Parse()
3131

3232
libraryRoot := flag.Arg(0)
3333

3434
// build the rsgain custom command and check values
3535

36-
if albumMode {
36+
if *albumMode {
3737
command = append(command, "-a")
3838
}
3939

40-
if skipExisting {
40+
if *skipExisting {
4141
command = append(command, "-S")
4242
}
4343

44-
if !slices.Contains([]string{"s", "d", "i"}, tagMode) {
45-
fmt.Printf("Invalid tagmode: %s", tagMode)
44+
if !slices.Contains([]string{"s", "d", "i"}, *tagMode) {
45+
fmt.Printf("Invalid tagmode: %s", *tagMode)
4646
os.Exit(2)
4747
}
48-
command = append(command, "-s", tagMode)
48+
command = append(command, "-s", *tagMode)
4949

50-
if !(-30 <= targetLoudness && targetLoudness <= -5) {
50+
if !(-30 <= *targetLoudness && *targetLoudness <= -5) {
5151
fmt.Println("Target loudness n needs to be -30 ≤ n ≤ -5")
5252
os.Exit(2)
5353
}
54-
command = append(command, "-l", strconv.Itoa(targetLoudness))
54+
command = append(command, "-l", strconv.Itoa(*targetLoudness))
5555

56-
if !slices.Contains([]string{"n", "p", "a"}, clipMode) {
57-
fmt.Printf("Invalid clip mode: %s", clipMode)
56+
if !slices.Contains([]string{"n", "p", "a"}, *clipMode) {
57+
fmt.Printf("Invalid clip mode: %s", *clipMode)
5858
os.Exit(2)
5959
}
60-
command = append(command, "-c", clipMode)
60+
command = append(command, "-c", *clipMode)
6161

6262
if libraryRoot == "" {
6363
fmt.Println("No library path specified.")
6464
os.Exit(2)
6565
}
6666

67-
if quiet {
67+
if *quiet {
6868
command = append(command, "-q")
6969
}
7070

71-
rsgainSemaphore = make(chan int, rsgainLimit)
71+
rsgainSemaphore = make(chan int, *rsgainLimit)
7272

7373
/* Used for debugging
7474
ctx, cancel := context.WithCancel(context.Background())
@@ -77,13 +77,13 @@ func main() {
7777

7878
// if root is just a file
7979
if isSupportedMusicFile(libraryRoot) {
80-
err := runRSGain([]string{libraryRoot}, quiet)
80+
err := runRSGain([]string{libraryRoot}, *quiet)
8181
if err != nil {
8282
errLog.Printf("Something went wrong scanning %s: '%s\n'", libraryRoot, err)
8383
}
8484
} else { // if we have a folder, scan them with WalkDir
8585
wg.Add(1)
86-
err := walker(libraryRoot, quiet)
86+
err := walker(libraryRoot, *quiet)
8787

8888
if err != nil {
8989
errLog.Printf("Error walking library folder: %s\n", err)

0 commit comments

Comments
 (0)