From 10617df834cf41f468eacc290f42454a781da2b7 Mon Sep 17 00:00:00 2001 From: ByteDream Date: Mon, 31 Oct 2022 22:18:44 +0100 Subject: [PATCH] Fix archive sorting (#63) --- cli/commands/archive/archive.go | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/cli/commands/archive/archive.go b/cli/commands/archive/archive.go index 03ec3ac..4ac4f82 100644 --- a/cli/commands/archive/archive.go +++ b/cli/commands/archive/archive.go @@ -824,17 +824,22 @@ func archiveExtractEpisodes(url string) ([][]utils.FormatInformation, error) { } var infoFormat [][]utils.FormatInformation - for _, e := range eps { + var keys []int + for e := range eps { + keys = append(keys, e) + } + sort.Ints(keys) + + for _, k := range keys { var tmpFormatInfo []utils.FormatInformation - - var keys []int - for episodeNumber := range e { - keys = append(keys, episodeNumber) + var kkey []int + for ee := range eps[k] { + kkey = append(kkey, ee) } - sort.Ints(keys) + sort.Ints(kkey) - for _, key := range keys { - tmpFormatInfo = append(tmpFormatInfo, *e[key]) + for _, kk := range kkey { + tmpFormatInfo = append(tmpFormatInfo, *eps[k][kk]) } infoFormat = append(infoFormat, tmpFormatInfo)