From d97462799878582672e9889177f1015e7869b9fa Mon Sep 17 00:00:00 2001 From: Akhil Gupta Date: Sun, 31 Jan 2021 11:08:57 +0530 Subject: [PATCH] add track number --- service/podcastService.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/service/podcastService.go b/service/podcastService.go index 9e7ae60..75372ee 100644 --- a/service/podcastService.go +++ b/service/podcastService.go @@ -13,6 +13,7 @@ import ( "github.com/akhilrex/podgrab/db" id3 "github.com/akhilrex/podgrab/internal/id3" + v2 "github.com/akhilrex/podgrab/internal/id3/v2" "github.com/akhilrex/podgrab/model" strip "github.com/grokify/html-strip-tags-go" "go.uber.org/zap" @@ -521,9 +522,17 @@ func SetId3Tags(path string, item *db.PodcastItem) { file.SetAlbum(item.Podcast.Title) } if len(file.Comments()) == 0 { - file.SetComment(item.Summary) + ft := v2.V23FrameTypeMap["COMM"] + utextFrame := v2.NewUnsynchTextFrame(ft, "Comment", item.Summary) + file.AddFrames(utextFrame) } + + trackFrameType := v2.V23FrameTypeMap["TRCK"] + tracktextFrame := v2.NewTextFrame(trackFrameType, "1") + file.AddFrames(tracktextFrame) + file.SetGenre("Podcast") file.SetYear(strconv.Itoa(item.PubDate.Year())) + file.SetDate(item.PubDate.String()) defer file.Close() }