format cleanup to avoid lint error

This commit is contained in:
Kerry Cao 2025-01-27 22:30:22 -05:00
parent 7be5496305
commit 8e32d68877
8 changed files with 31 additions and 35 deletions

View file

@ -6,24 +6,34 @@ public enum FFMpegVersions : ushort
{ {
[Description("https://ffbinaries.com/api/v1/version/latest")] [Description("https://ffbinaries.com/api/v1/version/latest")]
Latest, Latest,
[Description("https://ffbinaries.com/api/v1/version/6.1")] [Description("https://ffbinaries.com/api/v1/version/6.1")]
V6_1, V6_1,
[Description("https://ffbinaries.com/api/v1/version/5.1")] [Description("https://ffbinaries.com/api/v1/version/5.1")]
V5_1, V5_1,
[Description("https://ffbinaries.com/api/v1/version/4.4.1")] [Description("https://ffbinaries.com/api/v1/version/4.4.1")]
V4_4_1, V4_4_1,
[Description("https://ffbinaries.com/api/v1/version/4.2.1")] [Description("https://ffbinaries.com/api/v1/version/4.2.1")]
V4_2_1, V4_2_1,
[Description("https://ffbinaries.com/api/v1/version/4.2")] [Description("https://ffbinaries.com/api/v1/version/4.2")]
V4_2, V4_2,
[Description("https://ffbinaries.com/api/v1/version/4.1")] [Description("https://ffbinaries.com/api/v1/version/4.1")]
V4_1, V4_1,
[Description("https://ffbinaries.com/api/v1/version/4.0")] [Description("https://ffbinaries.com/api/v1/version/4.0")]
V4_0, V4_0,
[Description("https://ffbinaries.com/api/v1/version/3.4")] [Description("https://ffbinaries.com/api/v1/version/3.4")]
V3_4, V3_4,
[Description("https://ffbinaries.com/api/v1/version/3.3")] [Description("https://ffbinaries.com/api/v1/version/3.3")]
V3_3, V3_3,
[Description("https://ffbinaries.com/api/v1/version/3.2")] [Description("https://ffbinaries.com/api/v1/version/3.2")]
V3_2 V3_2
} }

View file

@ -8,9 +8,10 @@ internal static class EnumExtensions
{ {
var field = enumValue.GetType().GetField(enumValue.ToString()); var field = enumValue.GetType().GetField(enumValue.ToString());
if (field == null) if (field == null)
{
return enumValue.ToString(); return enumValue.ToString();
}
var attributes = field.GetCustomAttributes(typeof(DescriptionAttribute), false);
if (Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) is DescriptionAttribute attribute) if (Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) is DescriptionAttribute attribute)
{ {
return attribute.Description; return attribute.Description;

View file

@ -15,7 +15,7 @@
<PackageTags>ffmpeg ffprobe convert video audio mediafile resize analyze download</PackageTags> <PackageTags>ffmpeg ffprobe convert video audio mediafile resize analyze download</PackageTags>
<Authors>Malte Rosenbjerg, Vlad Jerca, Max Bagryantsev, Kerry Cao</Authors> <Authors>Malte Rosenbjerg, Vlad Jerca, Max Bagryantsev, Kerry Cao</Authors>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\FFMpegCore\FFMpegCore.csproj"/> <ProjectReference Include="..\FFMpegCore\FFMpegCore.csproj"/>
</ItemGroup> </ItemGroup>

View file

@ -20,13 +20,13 @@ public class FFMpegDownloader
{ {
// get all available versions // get all available versions
var versionInfo = await FFbinariesService.GetVersionInfo(version); var versionInfo = await FFbinariesService.GetVersionInfo(version);
// get the download info for the current platform // get the download info for the current platform
var downloadInfo = versionInfo.BinaryInfo?.GetCompatibleDownloadInfo(platformOverride) ?? var downloadInfo = versionInfo.BinaryInfo?.GetCompatibleDownloadInfo(platformOverride) ??
throw new FFMpegDownloaderException("Failed to get compatible download info"); throw new FFMpegDownloaderException("Failed to get compatible download info");
var successList = new List<string>(); var successList = new List<string>();
// download ffmpeg if selected // download ffmpeg if selected
if (binaries.HasFlag(FFMpegBinaries.FFMpeg) && downloadInfo.FFMpeg is not null) if (binaries.HasFlag(FFMpegBinaries.FFMpeg) && downloadInfo.FFMpeg is not null)
{ {
@ -51,4 +51,3 @@ public class FFMpegDownloader
return successList; return successList;
} }
} }

View file

@ -6,29 +6,21 @@ namespace FFMpegCore.Extensions.Downloader.Models;
internal record BinaryInfo internal record BinaryInfo
{ {
[JsonPropertyName("windows-64")] [JsonPropertyName("windows-64")] public DownloadInfo? Windows64 { get; set; }
public DownloadInfo? Windows64 { get; set; }
[JsonPropertyName("windows-32")] [JsonPropertyName("windows-32")] public DownloadInfo? Windows32 { get; set; }
public DownloadInfo? Windows32 { get; set; }
[JsonPropertyName("linux-32")] [JsonPropertyName("linux-32")] public DownloadInfo? Linux32 { get; set; }
public DownloadInfo? Linux32 { get; set; }
[JsonPropertyName("linux-64")] [JsonPropertyName("linux-64")] public DownloadInfo? Linux64 { get; set; }
public DownloadInfo? Linux64 { get; set; }
[JsonPropertyName("linux-armhf")] [JsonPropertyName("linux-armhf")] public DownloadInfo? LinuxArmhf { get; set; }
public DownloadInfo? LinuxArmhf { get; set; }
[JsonPropertyName("linux-armel")] [JsonPropertyName("linux-armel")] public DownloadInfo? LinuxArmel { get; set; }
public DownloadInfo? LinuxArmel { get; set; }
[JsonPropertyName("linux-arm64")] [JsonPropertyName("linux-arm64")] public DownloadInfo? LinuxArm64 { get; set; }
public DownloadInfo? LinuxArm64 { get; set; }
[JsonPropertyName("osx-64")] [JsonPropertyName("osx-64")] public DownloadInfo? Osx64 { get; set; }
public DownloadInfo? Osx64 { get; set; }
/// <summary> /// <summary>
/// Automatically get the compatible download info for current os and architecture /// Automatically get the compatible download info for current os and architecture

View file

@ -4,12 +4,9 @@ namespace FFMpegCore.Extensions.Downloader.Models;
internal record DownloadInfo internal record DownloadInfo
{ {
[JsonPropertyName("ffmpeg")] [JsonPropertyName("ffmpeg")] public string? FFMpeg { get; set; }
public string? FFMpeg { get; set; }
[JsonPropertyName("ffprobe")] [JsonPropertyName("ffprobe")] public string? FFProbe { get; set; }
public string? FFProbe { get; set; }
[JsonPropertyName("ffplay")] [JsonPropertyName("ffplay")] public string? FFPlay { get; set; }
public string? FFPlay { get; set; }
} }

View file

@ -4,12 +4,9 @@ namespace FFMpegCore.Extensions.Downloader.Models;
internal record VersionInfo internal record VersionInfo
{ {
[JsonPropertyName("version")] [JsonPropertyName("version")] public string? Version { get; set; }
public string? Version { get; set; }
[JsonPropertyName("permalink")] [JsonPropertyName("permalink")] public string? Permalink { get; set; }
public string? Permalink { get; set; }
[JsonPropertyName("bin")] [JsonPropertyName("bin")] public BinaryInfo? BinaryInfo { get; set; }
public BinaryInfo? BinaryInfo { get; set; }
} }

View file

@ -37,7 +37,7 @@ internal class FFbinariesService
return versionInfo ?? return versionInfo ??
throw new FFMpegDownloaderException($"Failed to deserialize version info from {versionUri}", jsonString); throw new FFMpegDownloaderException($"Failed to deserialize version info from {versionUri}", jsonString);
} }
/// <summary> /// <summary>
/// Download file from uri /// Download file from uri
/// </summary> /// </summary>