mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2026-02-05 01:58:36 -06:00
FF-240 - added recording of metadata info to files
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>FileFlows.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
|
||||
<FileVersion>1.0.0.169</FileVersion>
|
||||
<ProductVersion>1.0.0.169</ProductVersion>
|
||||
<FileVersion>1.0.0.170</FileVersion>
|
||||
<ProductVersion>1.0.0.170</ProductVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<Company>FileFlows</Company>
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace FileFlows.AudioNodes
|
||||
public string[] Genres { get; set; }
|
||||
public string Encoder { get; set; }
|
||||
public long Duration { get; set; }
|
||||
public long BitRate { get; set; }
|
||||
public long Bitrate { get; set; }
|
||||
public string Codec { get; set; }
|
||||
public long Channels { get; set; }
|
||||
public long Frequency { get; set; }
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace FileFlows.AudioNodes
|
||||
{
|
||||
br = br.Substring(0, br.IndexOf(" "));
|
||||
if (long.TryParse(br, out long value))
|
||||
mi.BitRate = value;
|
||||
mi.Bitrate = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<FileVersion>1.0.0.169</FileVersion>
|
||||
<ProductVersion>1.0.0.169</ProductVersion>
|
||||
<FileVersion>1.0.0.170</FileVersion>
|
||||
<ProductVersion>1.0.0.170</ProductVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<Company>FileFlows</Company>
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace FileFlows.AudioNodes
|
||||
{ "mi.Album", "Album" },
|
||||
{ "mi.Artist", "Artist" },
|
||||
{ "mi.ArtistThe", "Artist, The" },
|
||||
{ "mi.BitRate", 845 },
|
||||
{ "mi.Bitrate", 845 },
|
||||
{ "mi.Channels", 2 },
|
||||
{ "mi.Codec", "flac" },
|
||||
{ "mi.Date", new DateTime(2020, 05, 23) },
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace FileFlows.AudioNodes
|
||||
variables.AddOrUpdate("audio.ArtistThe", AudioInfo.Artist);
|
||||
|
||||
variables.AddOrUpdate("audio.Album", AudioInfo.Album);
|
||||
variables.AddOrUpdate("audio.BitRate", AudioInfo.BitRate);
|
||||
variables.AddOrUpdate("audio.Bitrate", AudioInfo.Bitrate);
|
||||
variables.AddOrUpdate("audio.Channels", AudioInfo.Channels);
|
||||
variables.AddOrUpdate("audio.Codec", AudioInfo.Codec);
|
||||
variables.AddOrUpdate("audio.Date", AudioInfo.Date);
|
||||
@@ -74,9 +74,45 @@ namespace FileFlows.AudioNodes
|
||||
variables.AddOrUpdate("audio.Disc", AudioInfo.Disc < 1 ? 1 : AudioInfo.Disc);
|
||||
variables.AddOrUpdate("audio.TotalDiscs", AudioInfo.TotalDiscs < 1 ? 1 : AudioInfo.TotalDiscs);
|
||||
|
||||
|
||||
if (args.OriginalMetadata == null)
|
||||
{
|
||||
args.OriginalMetadata = new Dictionary<string, object>();
|
||||
args.OriginalMetadata.Add("Duration", AudioInfo.Duration);
|
||||
args.OriginalMetadata.Add("Codec", AudioInfo.Codec);
|
||||
args.OriginalMetadata.Add("Bitrate", AudioInfo.Bitrate);
|
||||
args.OriginalMetadata.Add("Channels", AudioInfo.Channels);
|
||||
AddIfSet(args.OriginalMetadata, "Date", AudioInfo.Date);
|
||||
AddIfSet(args.OriginalMetadata, "Frequency", AudioInfo.Frequency);
|
||||
AddIfSet(args.OriginalMetadata, "Encoder", AudioInfo.Encoder);
|
||||
AddIfSet(args.OriginalMetadata, "Genres", AudioInfo.Genres);
|
||||
AddIfSet(args.OriginalMetadata, "Language", AudioInfo.Language);
|
||||
AddIfSet(args.OriginalMetadata, "Title", AudioInfo.Title);
|
||||
AddIfSet(args.OriginalMetadata, "Track", AudioInfo.Track);
|
||||
AddIfSet(args.OriginalMetadata, "Disc", AudioInfo.Disc);
|
||||
AddIfSet(args.OriginalMetadata, "TotalDiscs", AudioInfo.TotalDiscs);
|
||||
}
|
||||
|
||||
args.UpdateVariables(variables);
|
||||
}
|
||||
|
||||
private void AddIfSet(Dictionary<string, object> dict, string name, object value)
|
||||
{
|
||||
if (value == null)
|
||||
return;
|
||||
if (value is string sValue && string.IsNullOrWhiteSpace(sValue))
|
||||
return;
|
||||
if (value is int iValue && iValue < 1)
|
||||
return;
|
||||
if (value is TimeSpan tsValue && tsValue.TotalSeconds < 1)
|
||||
return;
|
||||
if (value is DateTime dtValue && dtValue.Year <= 1900)
|
||||
return;
|
||||
if (value is IEnumerable<string> strList && strList.Any() == false)
|
||||
return;
|
||||
dict.Add(name, value);
|
||||
}
|
||||
|
||||
protected AudioInfo GetAudioInfo(NodeParameters args)
|
||||
{
|
||||
if (args.Parameters.ContainsKey(Audio_INFO) == false)
|
||||
|
||||
@@ -156,13 +156,13 @@ namespace FileFlows.AudioNodes
|
||||
{
|
||||
if (SkipIfCodecMatches)
|
||||
{
|
||||
args.Logger?.ILog($"Audio file already '{Codec}' at bitrate '{AudioInfo.BitRate}', and set to skip if codec matches");
|
||||
args.Logger?.ILog($"Audio file already '{Codec}' at bitrate '{AudioInfo.Bitrate}', and set to skip if codec matches");
|
||||
return 2;
|
||||
}
|
||||
|
||||
if(AudioInfo.BitRate <= Bitrate)
|
||||
if(AudioInfo.Bitrate <= Bitrate)
|
||||
{
|
||||
args.Logger?.ILog($"Audio file already '{Codec}' at bitrate '{AudioInfo.BitRate}'");
|
||||
args.Logger?.ILog($"Audio file already '{Codec}' at bitrate '{AudioInfo.Bitrate}'");
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<FileVersion>1.0.0.169</FileVersion>
|
||||
<ProductVersion>1.0.0.169</ProductVersion>
|
||||
<FileVersion>1.0.0.170</FileVersion>
|
||||
<ProductVersion>1.0.0.170</ProductVersion>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<Company>FileFlows</Company>
|
||||
<Authors>John Andrews</Authors>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<FileVersion>1.0.0.169</FileVersion>
|
||||
<ProductVersion>1.0.0.169</ProductVersion>
|
||||
<FileVersion>1.0.0.170</FileVersion>
|
||||
<ProductVersion>1.0.0.170</ProductVersion>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<Company>FileFlows</Company>
|
||||
<Authors>John Andrews</Authors>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<FileVersion>1.0.0.169</FileVersion>
|
||||
<ProductVersion>1.0.0.169</ProductVersion>
|
||||
<FileVersion>1.0.0.170</FileVersion>
|
||||
<ProductVersion>1.0.0.170</ProductVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<Company>FileFlows</Company>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>FileFlows.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
|
||||
<FileVersion>1.0.0.169</FileVersion>
|
||||
<ProductVersion>1.0.0.169</ProductVersion>
|
||||
<FileVersion>1.0.0.170</FileVersion>
|
||||
<ProductVersion>1.0.0.170</ProductVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<Company>FileFlows</Company>
|
||||
|
||||
@@ -45,7 +45,15 @@ public class ComicConverter: Node
|
||||
currentFormat = currentFormat[1..]; // remove the dot
|
||||
currentFormat = currentFormat.ToLower();
|
||||
|
||||
if(currentFormat == Format)
|
||||
|
||||
if (args.OriginalMetadata == null)
|
||||
{
|
||||
args.OriginalMetadata = new Dictionary<string, object>();
|
||||
args.OriginalMetadata.Add("Format", currentFormat);
|
||||
args.OriginalMetadata.Add("Pages", GetPageCount(currentFormat, args.WorkingFile));
|
||||
}
|
||||
|
||||
if (currentFormat == Format)
|
||||
{
|
||||
args.Logger?.ILog($"Already in the target format of '{Format}'");
|
||||
return 2;
|
||||
@@ -63,6 +71,20 @@ public class ComicConverter: Node
|
||||
return 1;
|
||||
}
|
||||
|
||||
private int GetPageCount(string format, string workingFile)
|
||||
{
|
||||
if (format == null)
|
||||
return 0;
|
||||
format = format.ToLower().Trim();
|
||||
switch (format)
|
||||
{
|
||||
case "pdf":
|
||||
return Helpers.PdfHelper.GetPageCount(workingFile);
|
||||
default:
|
||||
return Helpers.GenericExtractor.GetImageCount(workingFile);
|
||||
}
|
||||
}
|
||||
|
||||
private string CreateComic(NodeParameters args, string directory, string format)
|
||||
{
|
||||
string file = Path.Combine(args.TempPath, Guid.NewGuid().ToString() + "." + format);
|
||||
|
||||
@@ -25,4 +25,10 @@ internal class GenericExtractor
|
||||
if (args?.PartPercentageUpdate != null)
|
||||
args?.PartPercentageUpdate(halfProgress ? 50 : 100);
|
||||
}
|
||||
|
||||
internal static int GetImageCount(string workingFile)
|
||||
{
|
||||
var rgxImages = new Regex(@"\.(jpeg|jpg|jpe|png|bmp|tiff|webp|gif)$");
|
||||
return ArchiveFactory.GetFileParts(workingFile).Where(x => rgxImages.IsMatch(x)).Count();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,4 +115,16 @@ internal class PdfHelper
|
||||
if (args?.PartPercentageUpdate != null)
|
||||
args?.PartPercentageUpdate(100);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of pages in a PDF
|
||||
/// </summary>
|
||||
/// <param name="pdfFile">the PDF file</param>
|
||||
/// <returns>the number of pages in the PDF</returns>
|
||||
internal static int GetPageCount(string pdfFile)
|
||||
{
|
||||
using var library = DocLib.Instance;
|
||||
using var docReader = library.GetDocReader(pdfFile, new PageDimensions(1080, 1920));
|
||||
return docReader.GetPageCount();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>FileFlows.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
|
||||
<FileVersion>1.0.0.169</FileVersion>
|
||||
<ProductVersion>1.0.0.169</ProductVersion>
|
||||
<FileVersion>1.0.0.170</FileVersion>
|
||||
<ProductVersion>1.0.0.170</ProductVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<Company>FileFlows</Company>
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<FileVersion>1.0.0.169</FileVersion>
|
||||
<ProductVersion>1.0.0.169</ProductVersion>
|
||||
<FileVersion>1.0.0.170</FileVersion>
|
||||
<ProductVersion>1.0.0.170</ProductVersion>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<Company>FileFlows</Company>
|
||||
<Authors>John Andrews</Authors>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>FileFlows.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
|
||||
<FileVersion>1.0.0.169</FileVersion>
|
||||
<ProductVersion>1.0.0.169</ProductVersion>
|
||||
<FileVersion>1.0.0.170</FileVersion>
|
||||
<ProductVersion>1.0.0.170</ProductVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<Company>FileFlows</Company>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -5,8 +5,8 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>FileFlows.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
|
||||
<FileVersion>1.0.0.169</FileVersion>
|
||||
<ProductVersion>1.0.0.169</ProductVersion>
|
||||
<FileVersion>1.0.0.170</FileVersion>
|
||||
<ProductVersion>1.0.0.170</ProductVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<Company>FileFlows</Company>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>FileFlows.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
|
||||
<FileVersion>1.0.0.169</FileVersion>
|
||||
<ProductVersion>1.0.0.169</ProductVersion>
|
||||
<FileVersion>1.0.0.170</FileVersion>
|
||||
<ProductVersion>1.0.0.170</ProductVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<Company>FileFlows</Company>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<FileVersion>1.0.0.169</FileVersion>
|
||||
<ProductVersion>1.0.0.169</ProductVersion>
|
||||
<FileVersion>1.0.0.170</FileVersion>
|
||||
<ProductVersion>1.0.0.170</ProductVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<Company>FileFlows</Company>
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace FileFlows.MusicNodes
|
||||
{ "mi.Album", "Album" },
|
||||
{ "mi.Artist", "Artist" },
|
||||
{ "mi.ArtistThe", "Artist, The" },
|
||||
{ "mi.BitRate", 845 },
|
||||
{ "mi.Bitrate", 845 },
|
||||
{ "mi.Channels", 2 },
|
||||
{ "mi.Codec", "flac" },
|
||||
{ "mi.Date", new DateTime(2020, 05, 23) },
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace FileFlows.MusicNodes
|
||||
public string[] Genres { get; set; }
|
||||
public string Encoder { get; set; }
|
||||
public long Duration { get; set; }
|
||||
public long BitRate { get; set; }
|
||||
public long Bitrate { get; set; }
|
||||
public string Codec { get; set; }
|
||||
public long Channels { get; set; }
|
||||
public long Frequency { get; set; }
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace FileFlows.MusicNodes
|
||||
{
|
||||
br = br.Substring(0, br.IndexOf(" "));
|
||||
if (long.TryParse(br, out long value))
|
||||
mi.BitRate = value;
|
||||
mi.Bitrate = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<FileVersion>1.0.0.169</FileVersion>
|
||||
<ProductVersion>1.0.0.169</ProductVersion>
|
||||
<FileVersion>1.0.0.170</FileVersion>
|
||||
<ProductVersion>1.0.0.170</ProductVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<Company>FileFlows</Company>
|
||||
|
||||
@@ -152,13 +152,13 @@ namespace FileFlows.MusicNodes
|
||||
{
|
||||
if (SkipIfCodecMatches)
|
||||
{
|
||||
args.Logger?.ILog($"Music file already '{Codec}' at bitrate '{musicInfo.BitRate}', and set to skip if codec matches");
|
||||
args.Logger?.ILog($"Music file already '{Codec}' at bitrate '{musicInfo.Bitrate}', and set to skip if codec matches");
|
||||
return 2;
|
||||
}
|
||||
|
||||
if(musicInfo.BitRate <= Bitrate)
|
||||
if(musicInfo.Bitrate <= Bitrate)
|
||||
{
|
||||
args.Logger?.ILog($"Music file already '{Codec}' at bitrate '{musicInfo.BitRate}'");
|
||||
args.Logger?.ILog($"Music file already '{Codec}' at bitrate '{musicInfo.Bitrate}'");
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace FileFlows.MusicNodes
|
||||
variables.AddOrUpdate("mi.ArtistThe", musicInfo.Artist);
|
||||
|
||||
variables.AddOrUpdate("mi.Album", musicInfo.Album);
|
||||
variables.AddOrUpdate("mi.BitRate", musicInfo.BitRate);
|
||||
variables.AddOrUpdate("mi.Bitrate", musicInfo.Bitrate);
|
||||
variables.AddOrUpdate("mi.Channels", musicInfo.Channels);
|
||||
variables.AddOrUpdate("mi.Codec", musicInfo.Codec);
|
||||
variables.AddOrUpdate("mi.Date", musicInfo.Date);
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>FileFlows.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
|
||||
<FileVersion>1.0.0.169</FileVersion>
|
||||
<ProductVersion>1.0.0.169</ProductVersion>
|
||||
<FileVersion>1.0.0.170</FileVersion>
|
||||
<ProductVersion>1.0.0.170</ProductVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<Company>FileFlows</Company>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<FileVersion>1.0.0.169</FileVersion>
|
||||
<ProductVersion>1.0.0.169</ProductVersion>
|
||||
<FileVersion>1.0.0.170</FileVersion>
|
||||
<ProductVersion>1.0.0.170</ProductVersion>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<Company>FileFlows</Company>
|
||||
<Authors>John Andrews</Authors>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<FileVersion>1.0.0.169</FileVersion>
|
||||
<ProductVersion>1.0.0.169</ProductVersion>
|
||||
<FileVersion>1.0.0.170</FileVersion>
|
||||
<ProductVersion>1.0.0.170</ProductVersion>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<Company>FileFlows</Company>
|
||||
<Authors>John Andrews</Authors>
|
||||
|
||||
@@ -113,6 +113,41 @@ namespace FileFlows.VideoNodes
|
||||
variables.AddOrUpdate("vi.Resolution", videoInfo.VideoStreams[0].Width + "x" + videoInfo.VideoStreams[0].Height);
|
||||
|
||||
args.UpdateVariables(variables);
|
||||
|
||||
if(args.OriginalMetadata == null)
|
||||
{
|
||||
args.OriginalMetadata = new Dictionary<string, object>();
|
||||
args.OriginalMetadata.Add("Duration", videoInfo.VideoStreams[0].Duration);
|
||||
foreach (var (stream, i) in videoInfo.VideoStreams.Select((value, i) => (value, i)))
|
||||
{
|
||||
string prefix = "Video" + (i == 0 ? "" : " " + (i + 1)) + " ";
|
||||
args.OriginalMetadata.Add(prefix + "Codec", stream.Codec);
|
||||
args.OriginalMetadata.Add(prefix + "Resolution", stream.Width + "x" + stream.Height + (stream.HDR ? " (HDR)" : string.Empty));
|
||||
if(stream.Bitrate > 0)
|
||||
args.OriginalMetadata.Add(prefix + "Bitrate", stream.Bitrate);
|
||||
}
|
||||
foreach (var (stream, i) in videoInfo.AudioStreams.Select((value, i) => (value, i)))
|
||||
{
|
||||
string prefix = "Audio" + (i == 0 ? "" : " " + (i + 1)) + " ";
|
||||
args.OriginalMetadata.Add(prefix + "Codec", stream.Codec);
|
||||
args.OriginalMetadata.Add(prefix + "Channels", stream.Channels);
|
||||
if (string.IsNullOrEmpty(stream.Title) == false)
|
||||
args.OriginalMetadata.Add(prefix + "Title", stream.Title);
|
||||
if(string.IsNullOrEmpty(stream.Language) == false)
|
||||
args.OriginalMetadata.Add(prefix + "Language", stream.Language);
|
||||
if (stream.Bitrate > 0)
|
||||
args.OriginalMetadata.Add(prefix + "Bitrate", stream.Bitrate);
|
||||
}
|
||||
foreach (var (strream, i) in videoInfo.SubtitleStreams.Select((value, i) => (value, i)))
|
||||
{
|
||||
string prefix = "Audio" + (i == 0 ? "" : " " + (i + 1)) + " ";
|
||||
args.OriginalMetadata.Add(prefix + "Codec", strream.Codec);
|
||||
if (string.IsNullOrEmpty(strream.Title) == false)
|
||||
args.OriginalMetadata.Add(prefix + "Title", strream.Title);
|
||||
if (string.IsNullOrEmpty(strream.Language) == false)
|
||||
args.OriginalMetadata.Add(prefix + "Language", strream.Language);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected VideoInfo GetVideoInfo(NodeParameters args, bool refreshIfFileChanged = true)
|
||||
|
||||
Reference in New Issue
Block a user