mirror of
				https://github.com/zoriya/Kyoo.git
				synced 2025-11-03 19:17:16 -05:00 
			
		
		
		
	Use builtin max instead of custom one
This commit is contained in:
		
							parent
							
								
									83110374f8
								
							
						
					
					
						commit
						ea98598399
					
				@ -1,7 +1,6 @@
 | 
			
		||||
package src
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"cmp"
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io"
 | 
			
		||||
@ -168,13 +167,6 @@ func OrNull(str string) *string {
 | 
			
		||||
	return &str
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Max[T cmp.Ordered](x, y T) T {
 | 
			
		||||
	if x < y {
 | 
			
		||||
		return y
 | 
			
		||||
	}
 | 
			
		||||
	return x
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var SubtitleExtensions = map[string]string{
 | 
			
		||||
	"subrip": "srt",
 | 
			
		||||
	"ass":    "ass",
 | 
			
		||||
@ -316,7 +308,7 @@ func getInfo(path string, route string) (*MediaInfo, error) {
 | 
			
		||||
				Link:      link,
 | 
			
		||||
			}
 | 
			
		||||
		}),
 | 
			
		||||
		Chapters: Map(make([]Chapter, Max(chapters_end-chapters_begin, 1)-1), func(_ Chapter, i int) Chapter {
 | 
			
		||||
		Chapters: Map(make([]Chapter, max(chapters_end-chapters_begin, 1)-1), func(_ Chapter, i int) Chapter {
 | 
			
		||||
			return Chapter{
 | 
			
		||||
				StartTime: ParseTime(mi.GetI(mediainfo.StreamMenu, 0, int(chapters_begin)+i, mediainfo.InfoName)),
 | 
			
		||||
				// +1 is safe, the value at chapters_end contains the right duration
 | 
			
		||||
 | 
			
		||||
@ -68,7 +68,7 @@ func NewStream(file *FileStream, handle StreamHandle, ret *Stream) {
 | 
			
		||||
	ret.heads = make([]Head, 0)
 | 
			
		||||
 | 
			
		||||
	length, is_done := file.Keyframes.Length()
 | 
			
		||||
	ret.segments = make([]Segment, length, Max(length, 2000))
 | 
			
		||||
	ret.segments = make([]Segment, length, max(length, 2000))
 | 
			
		||||
	for seg := range ret.segments {
 | 
			
		||||
		ret.segments[seg].channel = make(chan struct{})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user