add: WebDL / TVRip media types and filename-token override
Source kind is now declared per-file via a `dvd` / `bluray` / `webdl` / `tvrip` token in the basename (case-insensitive, word-bounded). Matches the existing `tt…` / `tvm…` filename convention. When no token is present, falls back to the pixel-count guess in DetectMediaType, which still only chooses between DVD and Blu-ray. The parsed media type drives both ORIGINAL_MEDIA_TYPE in the muxed metadata and the CRF/preset profile used for encoding. EncodingConfig gains `webdl` and `tvrip` sub-blocks with conservative defaults (WebDL 30/3, TVRip 32/2); user can override in config.yaml. Manual updated with the new tokens, config fields, and pipeline description.
This commit is contained in:
@@ -19,9 +19,10 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
imdbRegex = regexp.MustCompile(`tt(\d+)`)
|
||||
tvmRegex = regexp.MustCompile(`(?i)tvm(\d+)`)
|
||||
seRegex = regexp.MustCompile(`(?i)s(\d+)e(\d+)`)
|
||||
imdbRegex = regexp.MustCompile(`tt(\d+)`)
|
||||
tvmRegex = regexp.MustCompile(`(?i)tvm(\d+)`)
|
||||
seRegex = regexp.MustCompile(`(?i)s(\d+)e(\d+)`)
|
||||
mediaTypeRegex = regexp.MustCompile(`(?i)\b(dvd|bluray|webdl|tvrip)\b`)
|
||||
)
|
||||
|
||||
type OMDbResponse struct {
|
||||
@@ -86,6 +87,28 @@ func parseInt(s string) int {
|
||||
return n
|
||||
}
|
||||
|
||||
// ParseMediaType looks for a `.dvd.` / `.bluray.` / `.webdl.` / `.tvrip.`
|
||||
// token (case-insensitive) in the filename and returns the matching MediaType.
|
||||
// Returns an empty MediaType if no token is found, so the caller can fall back
|
||||
// to the pixel-count heuristic.
|
||||
func ParseMediaType(filename string) types.MediaType {
|
||||
m := mediaTypeRegex.FindStringSubmatch(strings.TrimSuffix(filename, ".mkv"))
|
||||
if m == nil {
|
||||
return ""
|
||||
}
|
||||
switch strings.ToLower(m[1]) {
|
||||
case "dvd":
|
||||
return types.MediaTypeDVD
|
||||
case "bluray":
|
||||
return types.MediaTypeBluRay
|
||||
case "webdl":
|
||||
return types.MediaTypeWebDL
|
||||
case "tvrip":
|
||||
return types.MediaTypeTVRip
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (c *Client) FetchMovieMetadata(imdbID string) (*types.Metadata, error) {
|
||||
url := fmt.Sprintf("%s?i=%s&apikey=%s", omdbAPIURL, imdbID, c.omdbAPIKey)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user