Skip to content

Commit 554ea8e

Browse files
authored
Merge pull request #6 from Sofronio/pr/4
0.0.3.4
2 parents d06223c + 6a71d69 commit 554ea8e

4 files changed

Lines changed: 77 additions & 63 deletions

File tree

YouTubeTimeLineGenerator/Form1.Designer.cs

Lines changed: 35 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

YouTubeTimeLineGenerator/Form1.cs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.ComponentModel;
44
using System.Data;
@@ -261,7 +261,17 @@ private void processXML()
261261
}
262262
}
263263
}
264+
private void processSingleword()
265+
{
266+
string patternSingleword = @"(.*\%(\n|\r|\r\n))(\w+)(\n|\r|\r\n)(\s(\n|\r|\r\n))";
267+
//\w+$(\n|\r|\r\n)\s
268+
//if (Regex.IsMatch(textBox_vtt.Text, patternSingleword))
269+
//{
270+
// this.Text = "go!";
271+
//}
272+
textBox_vtt.Text = Regex.Replace(textBox_vtt.Text, patternSingleword, "$1$3</c>$4$5");
264273

274+
}
265275
private void processVTT()
266276
{
267277

@@ -281,28 +291,20 @@ private void processVTT()
281291
//<(?<WordEnd>\d{2}:\d{2}:\d{2}.\d{3})? get WordEnd have 0 or one time "00:21:54.539", if it's the end, there would be no time;
282292
string patternContent = @"(?<Content>(\w+')?(\w+))(<\/?c.*?>)*<(?<WordEnd>\d{2}:\d{2}:\d{2}.\d{3})?";
283293

294+
295+
284296
string LineStart = "";
285297
string LineEnd = "";
286298
string sContent = "";
287299
string sWordStart = "";
288300
string sWordEnd = "";
289301
int sPosition = 0;
290302

291-
//Find the position that timeline start.
292-
int ContentStart = 0;
293-
foreach (var text in textBox_vtt.Lines)
294-
{
295-
if (Regex.IsMatch(text, patternTime))
296-
{
297-
break;
298-
}
299-
ContentStart++;
300-
}
303+
processSingleword();
301304

302-
//remove redundent spaces and returns.
303-
for (int i = ContentStart; i < textBox_vtt.Lines.Count(); i = i + 8)
305+
foreach (string rawLines in textBox_vtt.Lines)
304306
{
305-
if (Regex.IsMatch(l, patternContent)) sContent += l + "\r\n";
307+
if (Regex.IsMatch(rawLines, patternContent)) sContent += rawLines + "\r\n";
306308
}
307309

308310
textBox_vttResult.Text = sContent;
@@ -334,6 +336,10 @@ private void processVTT()
334336
sWordStart = sWordEnd;
335337
}
336338
}
339+
else
340+
{
341+
richTextBox_ass.AppendText(text);
342+
}
337343
}
338344
}
339345
}
@@ -509,4 +515,4 @@ private void Form1_SizeChanged(object sender, EventArgs e)
509515

510516
}
511517
}
512-
}
518+
}

YouTubeTimeLineGenerator/Form1.resx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,9 @@
119119
</resheader>
120120
<data name="richTextBox_ass.Text" xml:space="preserve">
121121
<value>Download VTT Auto-subtitles using youtube-dl. Find more: https://rg3.github.io/youtube-dl/
122-
VTT Usage: youtube-dl --skip-download --write-auto-sub --sub-format vtt http://youtube.com/xxxx
123-
XML Usage: Openup a YouTube video, then Press F12, type timedtext, then download the file.
124-
125-
After the VTT file is loaded, click on the words to set the end of the sentence. The separator will be placed at the end of the word you clicked on.
126-
122+
- VTT Usage: youtube-dl --skip-download --write-auto-sub --sub-format vtt http://youtube.com/xxxx
123+
- XML Usage: Openup a YouTube video, then Press F12, type timedtext, then download the file.
124+
- After the VTT file is loaded, click on the words to set the end of the sentence. The separator will be placed at the end of the word you clicked on.
127125
If you find this useful, please consider supporting me. Alipay: xbox2xbox@gmail.com
128126
My website is http://sofronio.cn , and the latest version will be there. Have a good day.</value>
129127
</data>

YouTubeTimeLineGenerator/YouTubeTimeLineGenerator.csproj

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
15-
<PublishUrl>publish\</PublishUrl>
15+
<IsWebBootstrapper>false</IsWebBootstrapper>
16+
<PublishUrl>C:\Users\chen_\Desktop\</PublishUrl>
1617
<Install>true</Install>
1718
<InstallFrom>Disk</InstallFrom>
1819
<UpdateEnabled>false</UpdateEnabled>
@@ -22,10 +23,10 @@
2223
<UpdatePeriodically>false</UpdatePeriodically>
2324
<UpdateRequired>false</UpdateRequired>
2425
<MapFileExtensions>true</MapFileExtensions>
25-
<ApplicationRevision>0</ApplicationRevision>
26+
<ApplicationRevision>1</ApplicationRevision>
2627
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
27-
<IsWebBootstrapper>false</IsWebBootstrapper>
2828
<UseApplicationTrust>false</UseApplicationTrust>
29+
<PublishWizardCompleted>true</PublishWizardCompleted>
2930
<BootstrapperEnabled>true</BootstrapperEnabled>
3031
</PropertyGroup>
3132
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -50,6 +51,18 @@
5051
<PropertyGroup>
5152
<ApplicationIcon>soso.ico</ApplicationIcon>
5253
</PropertyGroup>
54+
<PropertyGroup>
55+
<ManifestCertificateThumbprint>9E1E7DFA5E2CE6A9F5C9FC21AFAE6971BB79D489</ManifestCertificateThumbprint>
56+
</PropertyGroup>
57+
<PropertyGroup>
58+
<ManifestKeyFile>YouTubeTimeLineGenerator_TemporaryKey.pfx</ManifestKeyFile>
59+
</PropertyGroup>
60+
<PropertyGroup>
61+
<GenerateManifests>true</GenerateManifests>
62+
</PropertyGroup>
63+
<PropertyGroup>
64+
<SignManifests>true</SignManifests>
65+
</PropertyGroup>
5366
<ItemGroup>
5467
<Reference Include="System" />
5568
<Reference Include="System.Core" />
@@ -93,6 +106,7 @@
93106
<DependentUpon>Settings.settings</DependentUpon>
94107
<DesignTimeSharedInput>True</DesignTimeSharedInput>
95108
</Compile>
109+
<None Include="YouTubeTimeLineGenerator_TemporaryKey.pfx" />
96110
</ItemGroup>
97111
<ItemGroup>
98112
<None Include="App.config" />
@@ -103,7 +117,7 @@
103117
<ItemGroup>
104118
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
105119
<Visible>False</Visible>
106-
<ProductName>Microsoft .NET Framework 4.5.2 %28x86 and x64%29</ProductName>
120+
<ProductName>Microsoft .NET Framework 4.5.2 %28x86 x64%29</ProductName>
107121
<Install>true</Install>
108122
</BootstrapperPackage>
109123
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">

0 commit comments

Comments
 (0)