mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 12:44:46 +01:00
Add auto dl of ffprobe
This commit is contained in:
parent
4fe20da148
commit
265d67b1f9
@ -24,7 +24,9 @@
|
|||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=assa/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=assa/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cuda/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cuda/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Downloader/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Downloader/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Ffmpeg/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=ffprobe/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=ffprobe/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Fmpeg/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Immersive/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Immersive/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Matroska/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Matroska/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nikse/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nikse/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
@ -169,7 +169,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var form = new DownloadFfmpeg { AutoClose = true })
|
using (var form = new DownloadFfmpeg("FFmpeg") { AutoClose = true })
|
||||||
{
|
{
|
||||||
if (form.ShowDialog(this) == DialogResult.OK && !string.IsNullOrEmpty(form.FFmpegPath))
|
if (form.ShowDialog(this) == DialogResult.OK && !string.IsNullOrEmpty(form.FFmpegPath))
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
|
|
||||||
checkBoxExtractTimeCodes.Text = LanguageSettings.Current.AddWaveformBatch.ExtractTimeCodes;
|
checkBoxExtractTimeCodes.Text = LanguageSettings.Current.AddWaveformBatch.ExtractTimeCodes;
|
||||||
checkBoxExtractTimeCodes.Left = checkBoxGenerateShotChanges.Left - checkBoxExtractTimeCodes.Width - 20;
|
checkBoxExtractTimeCodes.Left = checkBoxGenerateShotChanges.Left - checkBoxExtractTimeCodes.Width - 20;
|
||||||
checkBoxExtractTimeCodes.Visible = BeautifyTimeCodes.BeautifyTimeCodes.IsFfProbeAvailable();
|
checkBoxExtractTimeCodes.Visible = BeautifyTimeCodes.BeautifyTimeCodes.IsFfProbeAvailable(this);
|
||||||
|
|
||||||
if (checkBoxExtractTimeCodes.Visible)
|
if (checkBoxExtractTimeCodes.Visible)
|
||||||
{
|
{
|
||||||
@ -308,7 +308,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var form = new DownloadFfmpeg())
|
using (var form = new DownloadFfmpeg("FFmpeg"))
|
||||||
{
|
{
|
||||||
if (form.ShowDialog(this) == DialogResult.OK && !string.IsNullOrEmpty(form.FFmpegPath))
|
if (form.ShowDialog(this) == DialogResult.OK && !string.IsNullOrEmpty(form.FFmpegPath))
|
||||||
{
|
{
|
||||||
|
@ -128,11 +128,11 @@ namespace Nikse.SubtitleEdit.Forms.BeautifyTimeCodes
|
|||||||
//
|
//
|
||||||
// panelExtractTimeCodes
|
// panelExtractTimeCodes
|
||||||
//
|
//
|
||||||
this.panelExtractTimeCodes.Controls.Add(this.buttonCancelTimeCodes);
|
|
||||||
this.panelExtractTimeCodes.Controls.Add(this.labelExtractTimeCodesProgress);
|
this.panelExtractTimeCodes.Controls.Add(this.labelExtractTimeCodesProgress);
|
||||||
this.panelExtractTimeCodes.Controls.Add(this.progressBarExtractTimeCodes);
|
this.panelExtractTimeCodes.Controls.Add(this.progressBarExtractTimeCodes);
|
||||||
this.panelExtractTimeCodes.Controls.Add(this.buttonExtractTimeCodes);
|
this.panelExtractTimeCodes.Controls.Add(this.buttonExtractTimeCodes);
|
||||||
this.panelExtractTimeCodes.Controls.Add(this.labelTimeCodesStatus);
|
this.panelExtractTimeCodes.Controls.Add(this.labelTimeCodesStatus);
|
||||||
|
this.panelExtractTimeCodes.Controls.Add(this.buttonCancelTimeCodes);
|
||||||
this.panelExtractTimeCodes.Location = new System.Drawing.Point(0, 27);
|
this.panelExtractTimeCodes.Location = new System.Drawing.Point(0, 27);
|
||||||
this.panelExtractTimeCodes.Name = "panelExtractTimeCodes";
|
this.panelExtractTimeCodes.Name = "panelExtractTimeCodes";
|
||||||
this.panelExtractTimeCodes.Size = new System.Drawing.Size(546, 78);
|
this.panelExtractTimeCodes.Size = new System.Drawing.Size(546, 78);
|
||||||
|
@ -85,7 +85,7 @@ namespace Nikse.SubtitleEdit.Forms.BeautifyTimeCodes
|
|||||||
_shotChanges = shotChanges;
|
_shotChanges = shotChanges;
|
||||||
|
|
||||||
// Check if ffprobe is available
|
// Check if ffprobe is available
|
||||||
if (!IsFfProbeAvailable())
|
if (!IsFfProbeAvailable(this))
|
||||||
{
|
{
|
||||||
checkBoxExtractExactTimeCodes.Enabled = false;
|
checkBoxExtractExactTimeCodes.Enabled = false;
|
||||||
checkBoxExtractExactTimeCodes.Checked = false;
|
checkBoxExtractExactTimeCodes.Checked = false;
|
||||||
@ -322,12 +322,34 @@ namespace Nikse.SubtitleEdit.Forms.BeautifyTimeCodes
|
|||||||
_abortTimeCodes = true;
|
_abortTimeCodes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsFfProbeAvailable()
|
public static bool IsFfProbeAvailable(Form parentForm)
|
||||||
{
|
{
|
||||||
return !Configuration.IsRunningOnWindows || (
|
if (!Configuration.IsRunningOnWindows)
|
||||||
!string.IsNullOrWhiteSpace(Configuration.Settings.General.FFmpegLocation)
|
{
|
||||||
&& File.Exists(Path.Combine(Path.GetDirectoryName(Configuration.Settings.General.FFmpegLocation), "ffprobe.exe"))
|
return true;
|
||||||
);
|
}
|
||||||
|
|
||||||
|
var ffprobeExists = !string.IsNullOrWhiteSpace(Configuration.Settings.General.FFmpegLocation)
|
||||||
|
&& File.Exists(Path.Combine(Path.GetDirectoryName(Configuration.Settings.General.FFmpegLocation), "ffprobe.exe"));
|
||||||
|
|
||||||
|
if (!ffprobeExists)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show(string.Format(LanguageSettings.Current.Settings.DownloadX, "ffprobe"), "Subtitle Edit", MessageBoxButtons.YesNoCancel) != DialogResult.Yes)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var form = new DownloadFfmpeg("ffprobe"))
|
||||||
|
{
|
||||||
|
if (form.ShowDialog(parentForm) == DialogResult.OK)
|
||||||
|
{
|
||||||
|
return !string.IsNullOrWhiteSpace(Configuration.Settings.General.FFmpegLocation)
|
||||||
|
&& File.Exists(Path.Combine(Path.GetDirectoryName(Configuration.Settings.General.FFmpegLocation), "ffprobe.exe"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ffprobeExists;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,13 +14,15 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
public string FFmpegPath { get; internal set; }
|
public string FFmpegPath { get; internal set; }
|
||||||
public bool AutoClose { get; internal set; }
|
public bool AutoClose { get; internal set; }
|
||||||
private readonly CancellationTokenSource _cancellationTokenSource;
|
private readonly CancellationTokenSource _cancellationTokenSource;
|
||||||
|
private readonly string _title;
|
||||||
|
|
||||||
public DownloadFfmpeg()
|
public DownloadFfmpeg(string title)
|
||||||
{
|
{
|
||||||
UiUtil.PreInitialize(this);
|
UiUtil.PreInitialize(this);
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
UiUtil.FixFonts(this);
|
UiUtil.FixFonts(this);
|
||||||
Text = string.Format(LanguageSettings.Current.Settings.DownloadX, "FFmpeg");
|
_title = title;
|
||||||
|
Text = string.Format(LanguageSettings.Current.Settings.DownloadX, title);
|
||||||
buttonOK.Text = LanguageSettings.Current.General.Ok;
|
buttonOK.Text = LanguageSettings.Current.General.Ok;
|
||||||
buttonCancel.Text = LanguageSettings.Current.General.Cancel;
|
buttonCancel.Text = LanguageSettings.Current.General.Cancel;
|
||||||
UiUtil.FixLargeFonts(this, buttonOK);
|
UiUtil.FixLargeFonts(this, buttonOK);
|
||||||
@ -49,6 +51,10 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
private void DownloadFfmpeg_Shown(object sender, EventArgs e)
|
private void DownloadFfmpeg_Shown(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var url = "https://github.com/SubtitleEdit/support-files/raw/master/ffpmeg/ffmpeg-" + IntPtr.Size * 8 + ".zip";
|
var url = "https://github.com/SubtitleEdit/support-files/raw/master/ffpmeg/ffmpeg-" + IntPtr.Size * 8 + ".zip";
|
||||||
|
if (_title.Contains("ffprobe", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
url = "https://github.com/SubtitleEdit/support-files/releases/download/ffprove-6.0/ffprobe.zip";
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -133,7 +139,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
}
|
}
|
||||||
|
|
||||||
buttonOK.Enabled = true;
|
buttonOK.Enabled = true;
|
||||||
labelPleaseWait.Text = string.Format(LanguageSettings.Current.SettingsFfmpeg.XDownloadOk, "ffmpeg");
|
labelPleaseWait.Text = string.Format(LanguageSettings.Current.SettingsFfmpeg.XDownloadOk, _title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -377,7 +377,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
|
|
||||||
private void buttonDownloadFfmpeg_Click(object sender, EventArgs e)
|
private void buttonDownloadFfmpeg_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using (var form = new DownloadFfmpeg())
|
using (var form = new DownloadFfmpeg("FFmpeg"))
|
||||||
{
|
{
|
||||||
if (form.ShowDialog(this) == DialogResult.OK && !string.IsNullOrEmpty(form.FFmpegPath))
|
if (form.ShowDialog(this) == DialogResult.OK && !string.IsNullOrEmpty(form.FFmpegPath))
|
||||||
{
|
{
|
||||||
|
@ -35198,7 +35198,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var form = new DownloadFfmpeg())
|
using (var form = new DownloadFfmpeg("FFmpeg"))
|
||||||
{
|
{
|
||||||
if (form.ShowDialog(this) == DialogResult.OK && !string.IsNullOrEmpty(form.FFmpegPath))
|
if (form.ShowDialog(this) == DialogResult.OK && !string.IsNullOrEmpty(form.FFmpegPath))
|
||||||
{
|
{
|
||||||
@ -35672,6 +35672,17 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(_videoFileName))
|
||||||
|
{
|
||||||
|
MessageBox.Show(LanguageSettings.Current.General.NoVideoLoaded);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!RequireFfmpegOk())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (onlySelectedLines)
|
if (onlySelectedLines)
|
||||||
{
|
{
|
||||||
var selectedIndices = SubtitleListview1.GetSelectedIndices();
|
var selectedIndices = SubtitleListview1.GetSelectedIndices();
|
||||||
|
@ -3046,7 +3046,7 @@ namespace Nikse.SubtitleEdit.Forms.Options
|
|||||||
|
|
||||||
private void buttonDownloadFfmpeg_Click(object sender, EventArgs e)
|
private void buttonDownloadFfmpeg_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using (var form = new DownloadFfmpeg())
|
using (var form = new DownloadFfmpeg("FFmpeg"))
|
||||||
{
|
{
|
||||||
if (form.ShowDialog(this) == DialogResult.OK && !string.IsNullOrEmpty(form.FFmpegPath))
|
if (form.ShowDialog(this) == DialogResult.OK && !string.IsNullOrEmpty(form.FFmpegPath))
|
||||||
{
|
{
|
||||||
|
@ -419,7 +419,7 @@ namespace Nikse.SubtitleEdit.Forms.ShotChanges
|
|||||||
|
|
||||||
private void buttonDownloadFfmpeg_Click(object sender, EventArgs e)
|
private void buttonDownloadFfmpeg_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using (var form = new DownloadFfmpeg())
|
using (var form = new DownloadFfmpeg("FFmpeg"))
|
||||||
{
|
{
|
||||||
if (form.ShowDialog(this) == DialogResult.OK && !string.IsNullOrEmpty(form.FFmpegPath))
|
if (form.ShowDialog(this) == DialogResult.OK && !string.IsNullOrEmpty(form.FFmpegPath))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user