mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Remove obsolete hash functions regarding waveform
This commit is contained in:
parent
6debeee381
commit
0e492d3178
@ -16,32 +16,11 @@ namespace Nikse.SubtitleEdit.Core
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
|
||||
var old = GetSceneChangesFileNameOld(videoFileName); // remove old file name check in 3.5.8...
|
||||
if (File.Exists(old))
|
||||
{
|
||||
return old;
|
||||
}
|
||||
|
||||
var newFileName = MovieHasher.GenerateHash(videoFileName) + ".scenechanges";
|
||||
newFileName = Path.Combine(dir, newFileName);
|
||||
return newFileName;
|
||||
}
|
||||
|
||||
private static string GetSceneChangesFileNameOld(string videoFileName)
|
||||
{
|
||||
var dir = Configuration.SceneChangesDirectory.TrimEnd(Path.DirectorySeparatorChar);
|
||||
if (!Directory.Exists(dir))
|
||||
{
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
|
||||
var file = new FileInfo(videoFileName);
|
||||
var newFileName = Utilities.Sha256Hash(file.Name + file.Length + file.CreationTimeUtc.ToShortDateString()) + ".scenechanges";
|
||||
newFileName = newFileName.RemoveChar('=').RemoveChar('/').RemoveChar(',').RemoveChar('?').RemoveChar('*').RemoveChar('+').RemoveChar('\\');
|
||||
newFileName = Path.Combine(dir, newFileName);
|
||||
return newFileName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load scene changes from file
|
||||
/// </summary>
|
||||
|
@ -2747,16 +2747,6 @@ namespace Nikse.SubtitleEdit.Core
|
||||
return lines;
|
||||
}
|
||||
|
||||
public static string Sha256Hash(string value)
|
||||
{
|
||||
using (var hasher = new System.Security.Cryptography.SHA256Managed())
|
||||
{
|
||||
var bytes = Encoding.UTF8.GetBytes(value);
|
||||
var hash = hasher.ComputeHash(bytes);
|
||||
return Convert.ToBase64String(hash, 0, hash.Length);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool QualifiesForMerge(Paragraph p, Paragraph next, double maximumMillisecondsBetweenLines, int maximumTotalLength, bool onlyContinuationLines)
|
||||
{
|
||||
if (p?.Text != null && next?.Text != null)
|
||||
|
@ -346,33 +346,6 @@ namespace Nikse.SubtitleEdit.Core
|
||||
#region Movie Hasher -
|
||||
|
||||
public static string GetPeakWaveFileName(string videofileName)
|
||||
{
|
||||
var old = GetPeakWaveFileNameOld(videofileName);
|
||||
if (File.Exists(old))
|
||||
{
|
||||
return old;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var dir = Configuration.WaveformsDirectory.TrimEnd(Path.DirectorySeparatorChar);
|
||||
if (!Directory.Exists(dir))
|
||||
{
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
|
||||
var wavePeakName = MovieHasher.GenerateHash(videofileName) + ".wav";
|
||||
return Path.Combine(dir, wavePeakName);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return old;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Movie Hasher
|
||||
|
||||
private static string GetPeakWaveFileNameOld(string videoFileName)
|
||||
{
|
||||
var dir = Configuration.WaveformsDirectory.TrimEnd(Path.DirectorySeparatorChar);
|
||||
if (!Directory.Exists(dir))
|
||||
@ -380,13 +353,12 @@ namespace Nikse.SubtitleEdit.Core
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
|
||||
var file = new FileInfo(videoFileName);
|
||||
var wavePeakName = Utilities.Sha256Hash(file.Name + file.Length + file.CreationTimeUtc.ToShortDateString()) + ".wav";
|
||||
wavePeakName = wavePeakName.RemoveChar('=').RemoveChar('/').RemoveChar(',').RemoveChar('?').RemoveChar('*').RemoveChar('+').RemoveChar('\\');
|
||||
wavePeakName = Path.Combine(dir, wavePeakName);
|
||||
return wavePeakName;
|
||||
var wavePeakName = MovieHasher.GenerateHash(videofileName) + ".wav";
|
||||
return Path.Combine(dir, wavePeakName);
|
||||
}
|
||||
|
||||
#endregion Movie Hasher
|
||||
|
||||
public static bool IsFileValidForVisualizer(string fileName)
|
||||
{
|
||||
if (!fileName.EndsWith(".wav", StringComparison.OrdinalIgnoreCase))
|
||||
@ -860,30 +832,6 @@ namespace Nikse.SubtitleEdit.Core
|
||||
private readonly double[] _magnitude2;
|
||||
|
||||
public static string GetSpectrogramFolder(string videoFileName)
|
||||
{
|
||||
var old = GetSpectrogramFolderOld(videoFileName);
|
||||
if (Directory.Exists(old))
|
||||
{
|
||||
return old;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var dir = Configuration.SpectrogramsDirectory.TrimEnd(Path.DirectorySeparatorChar);
|
||||
if (!Directory.Exists(dir))
|
||||
{
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
|
||||
return Path.Combine(dir, MovieHasher.GenerateHash(videoFileName));
|
||||
}
|
||||
catch
|
||||
{
|
||||
return old;
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetSpectrogramFolderOld(string videoFileName)
|
||||
{
|
||||
var dir = Configuration.SpectrogramsDirectory.TrimEnd(Path.DirectorySeparatorChar);
|
||||
if (!Directory.Exists(dir))
|
||||
@ -891,11 +839,7 @@ namespace Nikse.SubtitleEdit.Core
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
|
||||
var file = new FileInfo(videoFileName);
|
||||
var name = Utilities.Sha256Hash(file.Name + file.Length + file.CreationTimeUtc.ToShortDateString());
|
||||
name = name.RemoveChar('=').RemoveChar('/').RemoveChar(',').RemoveChar('?').RemoveChar('*').RemoveChar('+').RemoveChar('\\');
|
||||
name = Path.Combine(dir, name);
|
||||
return name;
|
||||
return Path.Combine(dir, MovieHasher.GenerateHash(videoFileName));
|
||||
}
|
||||
|
||||
public SpectrogramDrawer(int nfft)
|
||||
|
Loading…
Reference in New Issue
Block a user