diff --git a/writer/csv.go b/writer/csv.go index e245d2c..df3403a 100644 --- a/writer/csv.go +++ b/writer/csv.go @@ -9,7 +9,6 @@ import ( var csvHeaders = []string{ "tvg-id", "group-title", - "group-title", "tvg-name", "duration", "tvg-logo", diff --git a/writer/m3u.go b/writer/m3u.go index fb67b7a..9f8e1fd 100644 --- a/writer/m3u.go +++ b/writer/m3u.go @@ -1,6 +1,8 @@ package writer import ( + "crypto/md5" + "encoding/hex" "github.com/hoshsadiq/m3ufilter/m3u" "io" "strconv" @@ -22,6 +24,12 @@ func writeM3U(w io.Writer, streams []*m3u.Stream) { } } +func GetMD5Hash(text string) string { + hasher := md5.New() + hasher.Write([]byte(text)) + return hex.EncodeToString(hasher.Sum(nil)) +} + func getStreamExtinf(stream *m3u.Stream) []byte { b := &strings.Builder{} b.WriteString("\n") @@ -32,6 +40,7 @@ func getStreamExtinf(stream *m3u.Stream) []byte { writeKV(b, "tvg-chno", stream.ChNo) } + writeKV(b, "CUID", GetMD5Hash(stream.Uri)) writeKV(b, "tvg-id", stream.Id) writeKV(b, "tvg-name", stream.Name) writeKV(b, "group-title", stream.Group)