mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-28 06:52:35 +01:00
Work on Manzanita dvb (.idx) files - thx TheHulk :)
This commit is contained in:
parent
f40285619a
commit
81b80cda7d
@ -2931,6 +2931,18 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
if (ext == ".idx")
|
||||
{
|
||||
var tsParser = new ManzanitaTransportStreamParser();
|
||||
tsParser.Parse(fileName);
|
||||
var subtitles = tsParser.GetDvbSup();
|
||||
if (subtitles.Count > 0)
|
||||
{
|
||||
ImportSubtitleFromManzanitaTransportStream(fileName, subtitles);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (((ext == ".m2ts" || ext == ".ts" || ext == ".mts") && file.Length > 10000 && FileUtil.IsM2TransportStream(fileName)) ||
|
||||
(ext == ".textst" && FileUtil.IsMpeg2PrivateStream2(fileName)))
|
||||
{
|
||||
@ -14673,6 +14685,55 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool ImportSubtitleFromManzanitaTransportStream(string fileName, List<TransportStreamSubtitle> subtitles)
|
||||
{
|
||||
ShowStatus(_language.ParsingTransportStream);
|
||||
Refresh();
|
||||
|
||||
using (var formSubOcr = new VobSubOcr())
|
||||
{
|
||||
string language = null;
|
||||
formSubOcr.Initialize(subtitles, Configuration.Settings.VobSubOcr, fileName, language);
|
||||
if (formSubOcr.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
MakeHistoryForUndo(_language.BeforeImportingDvdSubtitle);
|
||||
|
||||
_subtitle.Paragraphs.Clear();
|
||||
SetCurrentFormat(Configuration.Settings.General.DefaultSubtitleFormat);
|
||||
foreach (var p in formSubOcr.SubtitleFromOcr.Paragraphs)
|
||||
{
|
||||
_subtitle.Paragraphs.Add(p);
|
||||
}
|
||||
|
||||
UpdateSourceView();
|
||||
SubtitleListview1.Fill(_subtitle, _subtitleOriginal);
|
||||
_subtitleListViewIndex = -1;
|
||||
SubtitleListview1.FirstVisibleIndex = -1;
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(0, true);
|
||||
|
||||
_fileName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(formSubOcr.FileName))
|
||||
{
|
||||
var currentFormat = GetCurrentSubtitleFormat();
|
||||
_fileName = Utilities.GetPathAndFileNameWithoutExtension(formSubOcr.FileName) + currentFormat.Extension;
|
||||
if (!Configuration.Settings.General.DisableVideoAutoLoading)
|
||||
{
|
||||
OpenVideo(fileName);
|
||||
}
|
||||
|
||||
_converted = true;
|
||||
}
|
||||
|
||||
SetTitle();
|
||||
Configuration.Settings.Save();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
_exitWhenLoaded = _loading;
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool ImportSubtitleFromMp4(string fileName)
|
||||
{
|
||||
var mp4Parser = new MP4Parser(fileName);
|
||||
|
Loading…
Reference in New Issue
Block a user