-
Notifications
You must be signed in to change notification settings - Fork 0
/
struct.go
76 lines (64 loc) · 1.53 KB
/
struct.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package main
import (
"encoding/json"
"time"
"github.com/dhowden/tag"
)
type FieldCase int
const (
raw FieldCase = iota
lower
title
upper
)
type AudioFile struct {
filename, artist, albumArtist, album, title, year string
track, disc int
discTracks *map[int]int
time time.Duration
cover *tag.Picture
}
type FormData struct {
albumDirectory, coverPath string
extractCover, separateFiles bool
outputPath string
verbose, quiet bool
}
type VideoData struct {
formData FormData
audioFiles []AudioFile
imageFiles []string
discTracks map[int]int
}
type Timestamp struct {
Artist string `json:"artist"`
AlbumArtist string `json:"albumArtist"`
Title string `json:"title"`
Time string `json:"time"`
Disc int `json:"disc"`
Track int `json:"track"`
OverallTrack int `json:"overallTrack"`
}
func (t Timestamp) String() (s string) {
b, err := json.Marshal(t)
if err != nil {
panic(err)
}
return string(b)
}
type FmtTimestamp struct {
r, a, s, t string
d, n, w int
}
func (t Timestamp) toFmtTimestamp() FmtTimestamp {
return FmtTimestamp{t.Artist, t.Artist, t.Title, t.Time, t.Disc, t.Track, t.OverallTrack}
}
type renderOptions struct {
fCase FieldCase
padding int
ifExistsRight bool
ifExists string
mode rune
dominantArtist string
multDiscs bool
}