An application to display the albumn cover of the track played in cmus.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: added some more doc comments

+23 -2
+23 -2
main.go
··· 1 + /* 2 + Cover-viewer notifies and display album cover art. 3 + This program is designed to be used with cmus. 4 + 5 + Usage: 6 + 7 + cover-viewer --mode [visualizer|notify] 8 + 9 + Flags: 10 + 11 + --mode [visualizer|notify] 12 + Runs cover-viewer in visualizer or notify. In visualizer mode it displays the 13 + album cover of the file read from the socket. In notify, reads cmus status line 14 + from stdin and sends the file path to the socket. 15 + --socket 16 + Allows to change the location of the UNIX socket used to send and read the cmus 17 + status line. 18 + */ 1 19 package main 2 20 3 21 import ( ··· 14 32 "github.com/dhowden/tag" 15 33 ) 16 34 35 + // cmusKeys is the set of keys that could appear in the cmus status line. 17 36 var cmusKeys = map[string]bool{ 18 37 "status": true, 19 38 "file": true, ··· 25 44 "duration": true, 26 45 } 27 46 47 + // lastPath indicates the path of the last file read to display the cover, 48 + // used to avoid read again the same file again. 28 49 var lastPath string 29 50 30 51 func main() { ··· 110 131 } 111 132 112 133 showCover(path) 113 - 114 134 lastPath = path 115 135 } 116 136 137 + // parseCmusLine reads the status line from cmus and parse it to extract the path to 138 + // the file 117 139 func parseCmusLine(input string) map[string]string { 118 140 parts := strings.Fields(input) 119 141 result := make(map[string]string) ··· 199 221 Height(features.WindowRows). 200 222 Scale(termimg.ScaleFit). 201 223 Print() 202 - 203 224 }