Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
da3dsoul committed Jan 16, 2024
1 parent 7b2e2f5 commit 9997340
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Shoko.Commons
Submodule Shoko.Commons updated 1 files
+1 −1 Shoko.Models
15 changes: 7 additions & 8 deletions Shoko.Server/Utilities/MediaInfoLib/MediaInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
using NLog;
using Shoko.Models.MediaInfo;
using Shoko.Server.Extensions;
using Shoko.Server.Settings;

namespace Shoko.Server.Utilities.MediaInfoLib;

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
{
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
Expand All @@ -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();
Expand All @@ -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)
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 9997340

Please sign in to comment.