Added sort function for subtitles by their locale

This commit is contained in:
bytedream 2022-02-23 22:32:20 +01:00
parent 3285d458be
commit bd19b34088

View file

@ -100,3 +100,15 @@ func (fbr FormatsByResolution) Less(i, j int) bool {
return iResX+iResY < jResX+jResY
}
type SubtitlesByLocale []*crunchyroll.Subtitle
func (sbl SubtitlesByLocale) Len() int {
return len(sbl)
}
func (sbl SubtitlesByLocale) Swap(i, j int) {
sbl[i], sbl[j] = sbl[j], sbl[i]
}
func (sbl SubtitlesByLocale) Less(i, j int) bool {
return sbl[i].Locale < sbl[j].Locale
}