Release list: filter by quality, codec, HDR, DV and language
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
+19
-16
@@ -63,22 +63,12 @@ func (f MediaFile) Attrs() FileAttrs {
|
||||
}
|
||||
}
|
||||
|
||||
codec := f.MediaInfo.VideoCodec + " " + names
|
||||
switch {
|
||||
case re265.MatchString(f.MediaInfo.VideoCodec):
|
||||
a.Codec = CodecX265
|
||||
case re264.MatchString(f.MediaInfo.VideoCodec):
|
||||
a.Codec = CodecX264
|
||||
case reAV1.MatchString(f.MediaInfo.VideoCodec):
|
||||
a.Codec = CodecAV1
|
||||
case f.MediaInfo.VideoCodec != "":
|
||||
// A codec we do not offer as a filter (VC-1, MPEG-2...): do not guess from the name.
|
||||
case re265.MatchString(codec):
|
||||
a.Codec = CodecX265
|
||||
case re264.MatchString(codec):
|
||||
a.Codec = CodecX264
|
||||
case reAV1.MatchString(codec):
|
||||
a.Codec = CodecAV1
|
||||
if f.MediaInfo.VideoCodec != "" {
|
||||
// A codec we do not offer as a filter (VC-1, MPEG-2...) stays empty
|
||||
// rather than being guessed from the name.
|
||||
a.Codec = codecOf(f.MediaInfo.VideoCodec)
|
||||
} else {
|
||||
a.Codec = codecOf(names)
|
||||
}
|
||||
|
||||
dr := f.MediaInfo.VideoDynamicRangeType + " " + f.MediaInfo.VideoDynamicRange
|
||||
@@ -101,3 +91,16 @@ func atoi(s string) (n int) {
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// codecOf finds a codec we offer as a filter in free text ("x265", "H.264", "HEVC"...).
|
||||
func codecOf(s string) string {
|
||||
switch {
|
||||
case re265.MatchString(s):
|
||||
return CodecX265
|
||||
case re264.MatchString(s):
|
||||
return CodecX264
|
||||
case reAV1.MatchString(s):
|
||||
return CodecAV1
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user