MCPcopy Create free account
hub / github.com/capable-average/tagTonic / processBatchLyrics

Method processBatchLyrics

tui/batch.go:12–59  ·  view source on GitHub ↗
(filePaths []string, index int)

Source from the content-addressed store, hash-verified

10)
11
12func (a *App) processBatchLyrics(filePaths []string, index int) tea.Cmd {
13 if index >= len(filePaths) {
14 return nil
15 }
16
17 filePath := filePaths[index]
18
19 return func() tea.Msg {
20 te := mp3.NewTagEditor()
21 lf := fetcher.NewLyricsFetcher()
22
23 tags, err := te.ReadTags(filePath)
24 if err != nil {
25 return BatchProcessMsg{
26 FilePath: filePath,
27 Success: false,
28 Error: err,
29 }
30 }
31
32 lyrics, err := lf.Fetch(tags.Title, tags.Artist)
33 if err != nil {
34 return BatchProcessMsg{
35 FilePath: filePath,
36 Success: false,
37 Error: err,
38 }
39 }
40
41 updates := mp3.TagUpdates{
42 Lyrics: lyrics,
43 }
44 err = te.EditTags(filePath, updates)
45 if err != nil {
46 return BatchProcessMsg{
47 FilePath: filePath,
48 Success: false,
49 Error: err,
50 }
51 }
52
53 return BatchProcessMsg{
54 FilePath: filePath,
55 Success: true,
56 Error: nil,
57 }
58 }
59}
60
61func (a *App) processBatchArtwork(filePaths []string, index int) tea.Cmd {
62 if index >= len(filePaths) {

Callers 2

batchFetchLyricsMethod · 0.95
UpdateMethod · 0.95

Calls 5

ReadTagsMethod · 0.95
FetchMethod · 0.95
EditTagsMethod · 0.95
NewTagEditorFunction · 0.92
NewLyricsFetcherFunction · 0.92

Tested by

no test coverage detected