Set empty wave path for online videos in Waveforms folder

This commit is contained in:
OmrSi 2021-12-06 16:06:32 +02:00
parent 5ad9654704
commit dd21521c21

View File

@ -347,13 +347,14 @@ namespace Nikse.SubtitleEdit.Core.Common
public static string GetPeakWaveFileName(string videoFileName, int trackNumber = 0) public static string GetPeakWaveFileName(string videoFileName, int trackNumber = 0)
{ {
var dir = Configuration.WaveformsDirectory.TrimEnd(Path.DirectorySeparatorChar);
if (videoFileName != null && (videoFileName.StartsWith("http://", StringComparison.OrdinalIgnoreCase) || if (videoFileName != null && (videoFileName.StartsWith("http://", StringComparison.OrdinalIgnoreCase) ||
videoFileName.StartsWith("https://", StringComparison.OrdinalIgnoreCase))) videoFileName.StartsWith("https://", StringComparison.OrdinalIgnoreCase)))
{ {
return MovieHasher.GenerateHashFromString(videoFileName); return Path.Combine(dir, $"{MovieHasher.GenerateHashFromString(videoFileName)}.wav");
} }
var dir = Configuration.WaveformsDirectory.TrimEnd(Path.DirectorySeparatorChar);
if (!Directory.Exists(dir)) if (!Directory.Exists(dir))
{ {
Directory.CreateDirectory(dir); Directory.CreateDirectory(dir);