From 9997340353acc2d13197b2b80c27c7a0767ade1b Mon Sep 17 00:00:00 2001 From: da3dsoul Date: Tue, 16 Jan 2024 17:35:46 -0500 Subject: [PATCH] Cleanup --- Shoko.Commons | 2 +- Shoko.Server/Utilities/MediaInfoLib/MediaInfo.cs | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Shoko.Commons b/Shoko.Commons index 2c98b28c1..8b7eeb72e 160000 --- a/Shoko.Commons +++ b/Shoko.Commons @@ -1 +1 @@ -Subproject commit 2c98b28c1788f9e5effa85467cf70ddb2dce74d3 +Subproject commit 8b7eeb72ebb9b398aa972fc9a6f02f3a7d4a93f3 diff --git a/Shoko.Server/Utilities/MediaInfoLib/MediaInfo.cs b/Shoko.Server/Utilities/MediaInfoLib/MediaInfo.cs index 35b1b126e..3bccf9b61 100644 --- a/Shoko.Server/Utilities/MediaInfoLib/MediaInfo.cs +++ b/Shoko.Server/Utilities/MediaInfoLib/MediaInfo.cs @@ -9,7 +9,6 @@ using NLog; using Shoko.Models.MediaInfo; using Shoko.Server.Extensions; -using Shoko.Server.Settings; namespace Shoko.Server.Utilities.MediaInfoLib; @@ -17,7 +16,7 @@ public static class MediaInfo { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - private static MediaContainer GetMediaInfo_New(string filename) + private static MediaContainer GetMediaInfo_Internal(string filename) { try { @@ -79,7 +78,7 @@ private static MediaContainer GetMediaInfo_New(string filename) var languages = MediaInfoUtils.GetLanguageMapping(a.Language); if (languages == null) { - Logger.Error($"{filename} had a missing language code: {a.Language}"); + Logger.Warn($"{filename} had a missing language code: {a.Language}"); return; } @@ -117,10 +116,10 @@ private static Process GetProcess(string processName, string filename) private static string GetMediaInfoPathForOS() { var envVar = Environment.GetEnvironmentVariable("MEDIAINFO_PATH"); - var path = string.Empty; + string path; if (!string.IsNullOrEmpty(envVar)) { - // Allow spesifying an executable name other than "mediainfo" + // Allow specifying an executable name other than "mediainfo" if (!envVar.Contains(Path.DirectorySeparatorChar) && !envVar.Contains(Path.AltDirectorySeparatorChar)) return envVar; // Resolve the path from the application's data directory if the @@ -142,7 +141,7 @@ private static string GetMediaInfoPathForOS() var appPath = Path.Combine(exeDir, "MediaInfo", "MediaInfo.exe"); if (!File.Exists(appPath)) return null; - if (path == null) + if (settings.Import.MediaInfoPath == null) { settings.Import.MediaInfoPath = appPath; Utils.SettingsProvider.SaveSettings(); @@ -154,7 +153,7 @@ private static string GetMediaInfoPathForOS() public static MediaContainer GetMediaInfo(string filename) { MediaContainer m = null; - var mediaTask = Task.FromResult(GetMediaInfo_New(filename)); + var mediaTask = Task.FromResult(GetMediaInfo_Internal(filename)); var timeout = Utils.SettingsProvider.GetSettings().Import.MediaInfoTimeoutMinutes; if (timeout > 0) @@ -202,7 +201,7 @@ public static string GetVersion() } catch (Exception e) { - Logger.Error(e, "Unable to get MediaInfo verion"); + Logger.Error(e, "Unable to get MediaInfo version"); } return null;