This commit is contained in:
ivandrofly 2014-05-24 12:24:10 +01:00
commit ce0921b39a
8 changed files with 84 additions and 28 deletions

View File

@ -0,0 +1,39 @@
<NoBreakAfterList>
<Item>a</Item>
<Item>a la</Item>
<Item>al</Item>
<Item>como</Item>
<Item>con</Item>
<Item>de</Item>
<Item>del</Item>
<Item>en</Item>
<Item>la</Item>
<Item>lo</Item>
<Item>los</Item>
<Item>me</Item>
<Item>muy</Item>
<Item>ni</Item>
<Item>nos</Item>
<Item>nos lo</Item>
<Item>para</Item>
<Item>para que te</Item>
<Item>pero</Item>
<Item>por</Item>
<Item>porque</Item>
<Item>que</Item>
<Item>que nos</Item>
<Item>y</Item>
<Item>y el</Item>
<Item>ya</Item>
<Item>para ti</Item>
<Item>se</Item>
<Item>sobre</Item>
<Item>mi</Item>
<Item>de tu</Item>
<Item>y me</Item>
<Item>un</Item>
<Item>es</Item>
<Item>te</Item>
<Item>el</Item>
<Item>o</Item>
</NoBreakAfterList>

View File

@ -1,7 +1,7 @@
Subtitle Edit Changelog
3.x.x (xth June 2014)
3.3.16 (xth June 2014)
* NEW:
* New shortcuts
* IMPROVED:
@ -26,6 +26,8 @@
* Fixed cut text in image export with right-align
* Fixed crash when doing OCR in batch
* Several fixes for "Fix common OCR errors" - thx matidio/Joel
* Fixed crash related to bad font tags in SSA/ASS - thx hhgyu
* Fixed error converting from DCinema interop to SMPTE
3.3.15 (13th April 2014)

View File

@ -378,19 +378,19 @@ namespace Nikse.SubtitleEdit.Forms
_fixActions.Add(new FixItem(_language.RemoveSpaceBetweenNumber, "1 100 -> 1100", delegate { RemoveSpaceBetweenNumbers(); }, ce.RemoveSpaceBetweenNumberTicked));
_fixActions.Add(new FixItem(_language.FixDialogsOnOneLine, "Hi John! - Hi Ida! > Hi John!" + Configuration.Settings.General.ListViewLineSeparatorString + "- Hi Ida!", delegate { DialogsOnOneLine(); }, ce.FixDialogsOnOneLineTicked));
if (_autoDetectGoogleLanguage == "tr")
if (Language == "tr")
{
_turkishAnsiIndex = _fixActions.Count;
_fixActions.Add(new FixItem(_language.FixTurkishAnsi, "Ý > İ, Ð > Ğ, Þ > Ş, ý > ı, ð > ğ, þ > ş", delegate { TurkishAnsiToUnicode(); }, ce.TurkishAnsiTicked));
}
if (_autoDetectGoogleLanguage == "da")
if (Language == "da")
{
_danishLetterIIndex = _fixActions.Count;
_fixActions.Add(new FixItem(_language.FixDanishLetterI, "Jeg synes i er søde. -> Jeg synes I er søde.", delegate { FixDanishLetterI(); }, ce.DanishLetterITicked));
}
if (_autoDetectGoogleLanguage == "es")
if (Language == "es")
{
_spanishInvertedQuestionAndExclamationMarksIndex = _fixActions.Count;
_fixActions.Add(new FixItem(_language.FixSpanishInvertedQuestionAndExclamationMarks, "Hablas bien castellano? -> ¿Hablas bien castellano?", delegate { FixSpanishInvertedQuestionAndExclamationMarks(); }, ce.SpanishInvertedQuestionAndExclamationMarksTicked));
@ -1604,7 +1604,7 @@ namespace Nikse.SubtitleEdit.Forms
string newText = p.Text;
if ("#♪♫".Contains(newText[0].ToString()) && !" <".Contains(newText[1].ToString()))
newText = newText.Insert(1, " ");
if ("#♪♫".Contains(newText[newText.Length - 1].ToString()) && !" >".Contains(newText[newText.Length - 2].ToString()))
if ("#♪♫".Contains(newText[newText.Length - 1].ToString()) && !" >".Contains(newText[newText.Length - 2].ToString()) && !newText.Substring(0, newText.Length-1).EndsWith(Environment.NewLine))
newText = newText.Insert(newText.Length - 1, " ");
if (newText != p.Text && AllowFix(p, fixAction))
{
@ -2376,7 +2376,7 @@ namespace Nikse.SubtitleEdit.Forms
!"0123456789".Contains(firstLetter) &&
isPrevEndOfLine)
{
bool isMatchInKnowAbbreviations = _autoDetectGoogleLanguage == "en" &&
bool isMatchInKnowAbbreviations = Language == "en" &&
(prevText.EndsWith(" o.r.") ||
prevText.EndsWith(" a.m.") ||
prevText.EndsWith(" p.m."));
@ -2385,6 +2385,10 @@ namespace Nikse.SubtitleEdit.Forms
{
if (IsTurkishLittleI(firstLetter))
p.Text = pre + GetTurkishUppercaseLetter(firstLetter) + text.Substring(1);
else if (Language == "en" && (text.StartsWith("l ") || text.StartsWith("l-I") || text.StartsWith("ls ") || text.StartsWith("lnterested") ||
text.StartsWith("lsn't ") || text.StartsWith("ldiot") || text.StartsWith("ln") || text.StartsWith("lm") ||
text.StartsWith("ls") || text.StartsWith("lt") || text.StartsWith("lf ") || text.StartsWith("lc"))) // l > I
p.Text = pre + "I" + text.Substring(1);
else
p.Text = pre + firstLetter.ToUpper() + text.Substring(1);
_totalFixes++;
@ -2451,7 +2455,7 @@ namespace Nikse.SubtitleEdit.Forms
!prevText.EndsWith("...") &&
isPrevEndOfLine)
{
bool isMatchInKnowAbbreviations = _autoDetectGoogleLanguage == "en" &&
bool isMatchInKnowAbbreviations = Language == "en" &&
(prevText.EndsWith(" o.r.") ||
prevText.EndsWith(" a.m.") ||
prevText.EndsWith(" p.m."));
@ -2460,6 +2464,10 @@ namespace Nikse.SubtitleEdit.Forms
{
if (IsTurkishLittleI(firstLetter))
text = pre + GetTurkishUppercaseLetter(firstLetter) + text.Substring(1);
else if (Language == "en" && (text.StartsWith("l ") || text.StartsWith("l-I") || text.StartsWith("ls ") || text.StartsWith("lnterested") ||
text.StartsWith("lsn't ") || text.StartsWith("ldiot") || text.StartsWith("ln") || text.StartsWith("lm") ||
text.StartsWith("ls") || text.StartsWith("lt") || text.StartsWith("lf ") || text.StartsWith("lc"))) // l > I
text = pre + "I" + text.Substring(1);
else
text = pre + firstLetter.ToUpper() + text.Substring(1);
_totalFixes++;
@ -2522,9 +2530,9 @@ namespace Nikse.SubtitleEdit.Forms
private bool IsTurkishLittleI(string firstLetter)
{
if (_encoding == Encoding.UTF8)
return _autoDetectGoogleLanguage == "tr" && (firstLetter.StartsWith("ı") || firstLetter.StartsWith("i"));
return Language == "tr" && (firstLetter.StartsWith("ı") || firstLetter.StartsWith("i"));
else
return _autoDetectGoogleLanguage == "tr" && (firstLetter.StartsWith("ý") || firstLetter.StartsWith("i"));
return Language == "tr" && (firstLetter.StartsWith("ý") || firstLetter.StartsWith("i"));
}
private string GetTurkishUppercaseLetter(string s)
@ -3150,7 +3158,7 @@ namespace Nikse.SubtitleEdit.Forms
string[] parts = Utilities.RemoveHtmlTags(text).Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
if (parts.Length == 2)
{
bool doAdd = parts[0].Trim().EndsWith(".") || parts[0].Trim().EndsWith("!") || parts[0].Trim().EndsWith("?") || _autoDetectGoogleLanguage == "ko";
bool doAdd = parts[0].Trim().EndsWith(".") || parts[0].Trim().EndsWith("!") || parts[0].Trim().EndsWith("?") || Language == "ko";
if (parts[0].Trim().StartsWith("-") && parts[1].Contains(":"))
doAdd = false;
@ -4364,8 +4372,7 @@ namespace Nikse.SubtitleEdit.Forms
}
else
{
if (listView1.Items[IndexAloneLowercaseIToUppercaseIEnglish].Checked &&
_autoDetectGoogleLanguage != "en")
if (listView1.Items[IndexAloneLowercaseIToUppercaseIEnglish].Checked && Language != "en")
{
if (MessageBox.Show(_language.FixLowercaseIToUppercaseICheckedButCurrentLanguageIsNotEnglish + Environment.NewLine +
Environment.NewLine +

View File

@ -23,7 +23,7 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
if (!InitializeSizeAndName(fs))
return;
if (Name == "stco") // 32-bit
if (Name == "stco") // 32-bit - chunk offset
{
Buffer = new byte[Size - 4];
fs.Read(Buffer, 0, Buffer.Length);
@ -155,7 +155,7 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
fs.Read(data, 2, 2);
textSize = GetUInt(data, 0); // don't get it exactly - seems like mp4box sometimes uses 2 bytes length field (first text record only)... handbrake uses 4 bytes
}
if (textSize > 0 && textSize < 200)
if (textSize > 0 && textSize < 500)
{
data = new byte[textSize];
fs.Read(data, 0, data.Length);
@ -185,9 +185,12 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
if (text.StartsWith("-") && !text.Contains(Environment.NewLine + "-"))
text = text.Remove(0, 1);
}
Texts.Add(text.Replace("\n", Environment.NewLine));
}
Texts.Add(text.Replace(Environment.NewLine, "\n").Replace("\n", Environment.NewLine));
}
else
{
Texts.Add(string.Empty);
}
}
}

View File

@ -138,6 +138,8 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
Configuration.Settings.SubtitleSettings.InitializeDCinameSettings(true);
xml.DocumentElement.SelectSingleNode("dcst:ContentTitleText", nsmgr).InnerText = ss.CurrentDCinemaMovieTitle;
if (string.IsNullOrEmpty(ss.CurrentDCinemaSubtitleId) || !ss.CurrentDCinemaSubtitleId.StartsWith("urn:uuid:"))
ss.CurrentDCinemaSubtitleId = "urn:uuid:" + Guid.NewGuid().ToString();
xml.DocumentElement.SelectSingleNode("dcst:Id", nsmgr).InnerText = ss.CurrentDCinemaSubtitleId;
xml.DocumentElement.SelectSingleNode("dcst:ReelNumber", nsmgr).InnerText = ss.CurrentDCinemaReelNumber;
xml.DocumentElement.SelectSingleNode("dcst:IssueDate", nsmgr).InnerText = ss.CurrentDCinemaIssueDate;

View File

@ -138,6 +138,8 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
Configuration.Settings.SubtitleSettings.InitializeDCinameSettings(true);
xml.DocumentElement.SelectSingleNode("dcst:ContentTitleText", nsmgr).InnerText = ss.CurrentDCinemaMovieTitle;
if (string.IsNullOrEmpty(ss.CurrentDCinemaSubtitleId) || !ss.CurrentDCinemaSubtitleId.StartsWith("urn:uuid:"))
ss.CurrentDCinemaSubtitleId = "urn:uuid:" + Guid.NewGuid().ToString();
xml.DocumentElement.SelectSingleNode("dcst:Id", nsmgr).InnerText = ss.CurrentDCinemaSubtitleId;
xml.DocumentElement.SelectSingleNode("dcst:ReelNumber", nsmgr).InnerText = ss.CurrentDCinemaReelNumber;
xml.DocumentElement.SelectSingleNode("dcst:IssueDate", nsmgr).InnerText = ss.CurrentDCinemaIssueDate;

View File

@ -368,15 +368,16 @@ namespace Test
Assert.AreEqual(target._subtitle.Paragraphs[0].Text, "(laughing/clapping)");
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixCommonOcrErrorsSlashIsL()
{
var target = GetFixCommonErrorsLib();
InitializeFixCommonErrorsLine(target, "The font is ita/ic!");
target.FixOcrErrorsViaReplaceList("eng");
Assert.AreEqual(target._subtitle.Paragraphs[0].Text, "The font is italic!"); // will fail if English dictionary is not found
}
//Auto-guess unknown words in "Fix common errors" is now disabled
//[TestMethod]
//[DeploymentItem("SubtitleEdit.exe")]
//public void FixCommonOcrErrorsSlashIsL()
//{
// var target = GetFixCommonErrorsLib();
// InitializeFixCommonErrorsLine(target, "The font is ita/ic!");
// target.FixOcrErrorsViaReplaceList("eng");
// Assert.AreEqual(target._subtitle.Paragraphs[0].Text, "The font is italic!"); // will fail if English dictionary is not found
//}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]

View File

@ -405,7 +405,7 @@ Dialogue: Marked=0,0:00:01.00,0:00:03.00,Default,NTP,0000,0000,0000,!Effect," +
var subtitle = new Subtitle();
subtitle.Paragraphs.Add(new Paragraph("<i>Italic</i>", 1000, 5000));
string text = target.ToText(subtitle, "title");
Assert.IsTrue(text.Contains("<Font Italic=\"yes\">Italic</Font>"));
Assert.IsTrue(text.Contains("<Font Italic=\"yes\""));
}
[TestMethod()]
@ -416,7 +416,7 @@ Dialogue: Marked=0,0:00:01.00,0:00:03.00,Default,NTP,0000,0000,0000,!Effect," +
var subtitle = new Subtitle();
subtitle.Paragraphs.Add(new Paragraph("<font color=\"#ff0000\"><i>Red</i></font>", 1000, 5000));
string text = target.ToText(subtitle, "title");
Assert.IsTrue(text.Contains("<Font Italic=\"yes\" Color=\"FFFF0000\">Red</Font>"));
Assert.IsTrue(text.Contains(" Italic=\"yes\"") && text.Contains(" Color=\"FFFF0000\""));
}
#endregion