Skip to content

Commit

Permalink
IETF language processing, refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ptr727 committed Mar 22, 2023
1 parent e7a9135 commit 67f85ca
Show file tree
Hide file tree
Showing 34 changed files with 1,657 additions and 1,418 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"deinterlace",
"Emby",
"Jellyfin",
"Matroska",
"mediafiles",
"Plex",
"plexcleaner",
Expand Down
34 changes: 18 additions & 16 deletions PlexCleaner.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"RootPath": ".\\Tools\\",
// Tools directory relative to binary location
"RootRelative": true,
// Automatically check for new tools
// Automatically check for and update new tool versions
"AutoUpdate": false
},
// Convert options
Expand Down Expand Up @@ -68,8 +68,8 @@
".wmv",
".dv"
],
// Enable deinterlace
// Note deinterlace detection is not absolute
// Enable deinterlace of interlaced media
// Interlace detection is not absolute and uses interlaced frame counting
"DeInterlace": true,
// Enable re-encode
"ReEncode": true,
Expand All @@ -84,6 +84,10 @@
"Format": "mpeg4",
"Codec": "dx50"
},
{
"Format": "mpeg4",
"Codec": "xvid"
},
{
"Format": "msmpeg4v3",
"Codec": "div3"
Expand Down Expand Up @@ -113,7 +117,6 @@
}
],
// Re-encode matching audio codecs
// If the video format is not H264/5, video will automatically be converted to H264/5 to avoid audio sync issues
// Use FfProbe attribute naming, and the `printmediainfo` command to get media info
"ReEncodeAudioFormats": [
"flac",
Expand All @@ -129,24 +132,23 @@
// Set default language if tracks have an undefined language
"SetUnknownLanguage": true,
// Default track language
"DefaultLanguage": "eng",
// Use RFC 5646 format
"DefaultLanguage": "en",
// Enable removing of unwanted language tracks
"RemoveUnwantedLanguageTracks": true,
// Track languages to keep
// Use ISO 639-2 3 letter short form, see https://www.loc.gov/standards/iso639-2/php/code_list.php
// Use RFC 5646 format, see https://www.w3.org/International/articles/language-tags/
"KeepLanguages": [
"eng",
"afr",
"chi",
"ind"
"en",
"af",
"zh-Hans",
"id"
],
// Keep all tracks flagged as original language
"KeepOriginalLanguage": true,
// Enable removing of duplicate tracks of the same type and language
// Priority is given to tracks marked as Default
// Forced subtitle tracks are prioritized
// Subtitle tracks containing "SDH" in the title are de-prioritized
// Audio tracks containing "Commentary" in the title are de-prioritized
"RemoveDuplicateTracks": true,
// If no Default audio tracks are found, tracks are prioritized by codec type
"RemoveDuplicateTracks": false,
// Prioritized audio tracks by by codec type
// Use MkvMerge attribute naming, and the `printmediainfo` command to get media info
"PreferredAudioFormats": [
"truehd atmos",
Expand Down
126 changes: 80 additions & 46 deletions PlexCleaner.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@
},
"HandBrakeOptions": {
"$ref": "#/definitions/HandBrakeOptions"
},
"EnableH265Encoder": {
"type": "boolean"
},
"VideoEncodeQuality": {
"type": "integer"
},
"AudioEncodeCodec": {
"type": [
"string",
"null"
]
}
},
"required": [
Expand Down Expand Up @@ -84,10 +96,7 @@
"ProcessOptions": {
"type": "object",
"properties": {
"DeleteEmptyFolders": {
"type": "boolean"
},
"DeleteUnwantedExtensions": {
"KeepOriginalLanguage": {
"type": "boolean"
},
"KeepExtensions": {
Expand All @@ -99,9 +108,6 @@
]
}
},
"ReMux": {
"type": "boolean"
},
"ReMuxExtensions": {
"type": "array",
"items": {
Expand All @@ -111,12 +117,6 @@
]
}
},
"DeInterlace": {
"type": "boolean"
},
"ReEncode": {
"type": "boolean"
},
"ReEncodeVideo": {
"type": "array",
"items": {
Expand All @@ -132,15 +132,6 @@
]
}
},
"SetUnknownLanguage": {
"type": "boolean"
},
"DefaultLanguage": {
"type": "string"
},
"RemoveUnwantedLanguageTracks": {
"type": "boolean"
},
"KeepLanguages": {
"type": "array",
"items": {
Expand All @@ -150,9 +141,6 @@
]
}
},
"RemoveDuplicateTracks": {
"type": "boolean"
},
"PreferredAudioFormats": {
"type": "array",
"items": {
Expand All @@ -162,6 +150,60 @@
]
}
},
"FileIgnoreList": {
"type": "array",
"items": {
"type": [
"string",
"null"
]
}
},
"ReEncodeVideoFormats": {
"type": [
"string",
"null"
]
},
"ReEncodeVideoCodecs": {
"type": [
"string",
"null"
]
},
"ReEncodeVideoProfiles": {
"type": [
"string",
"null"
]
},
"DeleteEmptyFolders": {
"type": "boolean"
},
"DeleteUnwantedExtensions": {
"type": "boolean"
},
"ReMux": {
"type": "boolean"
},
"DeInterlace": {
"type": "boolean"
},
"ReEncode": {
"type": "boolean"
},
"SetUnknownLanguage": {
"type": "boolean"
},
"DefaultLanguage": {
"type": "string"
},
"RemoveUnwantedLanguageTracks": {
"type": "boolean"
},
"RemoveDuplicateTracks": {
"type": "boolean"
},
"RemoveTags": {
"type": "boolean"
},
Expand All @@ -176,39 +218,31 @@
},
"RestoreFileTimestamp": {
"type": "boolean"
},
"FileIgnoreList": {
"type": "array",
"items": {
"type": [
"string",
"null"
]
}
}
},
"required": [
"KeepOriginalLanguage",
"KeepExtensions",
"ReMuxExtensions",
"ReEncodeVideo",
"ReEncodeAudioFormats",
"KeepLanguages",
"PreferredAudioFormats",
"FileIgnoreList",
"DeleteEmptyFolders",
"DeleteUnwantedExtensions",
"KeepExtensions",
"ReMux",
"ReMuxExtensions",
"DeInterlace",
"ReEncode",
"ReEncodeVideo",
"ReEncodeAudioFormats",
"SetUnknownLanguage",
"DefaultLanguage",
"RemoveUnwantedLanguageTracks",
"KeepLanguages",
"RemoveDuplicateTracks",
"PreferredAudioFormats",
"RemoveTags",
"UseSidecarFiles",
"SidecarUpdateOnToolChange",
"Verify",
"RestoreFileTimestamp",
"FileIgnoreList"
"RestoreFileTimestamp"
]
},
"ToolsOptions": {
Expand Down Expand Up @@ -322,15 +356,15 @@
"type": "integer",
"default": 0
},
"ToolsOptions": {
"$ref": "#/definitions/ToolsOptions"
},
"ConvertOptions": {
"$ref": "#/definitions/ConvertOptions"
},
"ProcessOptions": {
"$ref": "#/definitions/ProcessOptions"
},
"ToolsOptions": {
"$ref": "#/definitions/ToolsOptions"
},
"MonitorOptions": {
"$ref": "#/definitions/MonitorOptions"
},
Expand All @@ -339,9 +373,9 @@
}
},
"required": [
"ToolsOptions",
"ConvertOptions",
"ProcessOptions",
"ToolsOptions",
"MonitorOptions",
"VerifyOptions"
]
Expand Down
3 changes: 2 additions & 1 deletion PlexCleaner/CommandLineOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public class CommandLineOptions

public static int Invoke()
{
// TODO: https://github.com/dotnet/command-line-api/issues/1781
// TODO: Remove first argument
// https://github.com/dotnet/command-line-api/issues/1781
RootCommand rootCommand = CreateRootCommand();
return rootCommand.Invoke(CommandLineStringSplitter.Instance.Split(Environment.CommandLine).ToArray()[1..]);
}
Expand Down
Loading

0 comments on commit 67f85ca

Please sign in to comment.