From a889a46fa09090c726d15f1fc657b23bd419866b Mon Sep 17 00:00:00 2001 From: Stevie Hryciw Date: Tue, 18 Oct 2022 17:24:51 -0700 Subject: [PATCH] Omit empty music tags from JSON --- zipserver/music_analyzer.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/zipserver/music_analyzer.go b/zipserver/music_analyzer.go index 3c182ce..5c1d5ec 100644 --- a/zipserver/music_analyzer.go +++ b/zipserver/music_analyzer.go @@ -84,17 +84,17 @@ type TrackInfo struct { // Below are provided directly by the tag package. - Title string - Album string - Artist string - AlbumArtist string - Composer string - Genre string - Year int - Track int - TrackTotal int - Disc int - DiscTotal int - Lyrics string - Comment string + Title string `json:",omitempty"` + Album string `json:",omitempty"` + Artist string `json:",omitempty"` + AlbumArtist string `json:",omitempty"` + Composer string `json:",omitempty"` + Genre string `json:",omitempty"` + Year int `json:",omitempty"` + Track int `json:",omitempty"` + TrackTotal int `json:",omitempty"` + Disc int `json:",omitempty"` + DiscTotal int `json:",omitempty"` + Lyrics string `json:",omitempty"` + Comment string `json:",omitempty"` }