add 'remove CC Style' option

add 'remove CC Style' option #769
This commit is contained in:
hama3254 2023-06-24 23:50:39 +02:00
parent ce0d3801ef
commit 33be0da197
9 changed files with 147 additions and 56 deletions

Binary file not shown.

View File

@ -168,6 +168,9 @@
<setting name="SubtitleMod1" serializeAs="String">
<value>False</value>
</setting>
<setting name="vttStyleRemove" serializeAs="String">
<value>False</value>
</setting>
</Crunchyroll_Downloader.My.MySettings>
</userSettings>
</configuration>

View File

@ -1175,12 +1175,25 @@ Public Class CRD_List_Item
InputData = AddScaledBorderAndShadow(InputData)
End If
If My.Settings.vttStyleRemove = True Then
If CBool(InStr(InputData, "WEBVTT")) And CBool(InStr(InputData, "STYLE")) Then
Dim VTT As String() = InputData.Split(New String() {"STYLE"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim VTT0 As String() = VTT(1).Split(New String() {"}"}, System.StringSplitOptions.RemoveEmptyEntries)
InputData = VTT(0) + VTT(1).Replace("}", "").Replace(VTT0(0), "")
End If
If CBool(InStr(InputData, "WEBVTT")) Then
InputData = InputData.Replace("<Default>", "").Replace("</Default>", "")
End If
End If
Using sink As New StreamWriter(SubsFile, False, utf8WithoutBom2)
sink.WriteLine(InputData)
End Using
'replace url with local file
DL_URL = DL_URL.Replace(InputURL(0), SubsFile)
End If
sink.WriteLine(InputData)
End Using
'replace url with local file
DL_URL = DL_URL.Replace(InputURL(0), SubsFile)
End If
Catch ex As Exception
Debug.WriteLine(ex.ToString)
DL_URL = DL_URL_old

View File

@ -2092,28 +2092,34 @@ Public Class Main
Next
Catch ex As Exception
End Try
If KeepCache = False Then
Try
If KeepCache = False Then
Dim folderPath As String = Pfad
Dim files() As String = Directory.GetFiles(folderPath, "*", SearchOption.AllDirectories)
Dim folderPath As String = Pfad
Dim files() As String = Directory.GetFiles(folderPath, "*", SearchOption.AllDirectories)
For Each file As String In files
If CBool(InStr(file, "CRD-Temp-File-")) Then
'MsgBox(file)
System.IO.File.Delete(file)
End If
Next
Try
Dim di As New System.IO.DirectoryInfo(Pfad)
For Each fi As System.IO.DirectoryInfo In di.EnumerateDirectories("*.*", System.IO.SearchOption.TopDirectoryOnly)
If CBool(InStr(fi.Name, "CRD-Temp-File-")) Then
System.IO.Directory.Delete(fi.FullName, True)
For Each file As String In files
If CBool(InStr(file, "CRD-Temp-File-")) Then
'MsgBox(file)
System.IO.File.Delete(file)
End If
Next
Catch ex As Exception
End Try
End If
Try
Dim di As New System.IO.DirectoryInfo(Pfad)
For Each fi As System.IO.DirectoryInfo In di.EnumerateDirectories("*.*", System.IO.SearchOption.TopDirectoryOnly)
If CBool(InStr(fi.Name, "CRD-Temp-File-")) Then
System.IO.Directory.Delete(fi.FullName, True)
End If
Next
Catch ex As Exception
End Try
End If
Catch ex As Exception
End Try
End Sub
Private Sub RetryWithCachedFiles()
@ -4687,6 +4693,10 @@ Public Class Main
End Sub
Private Sub Main_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
End Sub
#End Region
End Class

View File

@ -642,6 +642,18 @@ Namespace My
Me("SubtitleMod1") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("False")> _
Public Property vttStyleRemove() As Boolean
Get
Return CType(Me("vttStyleRemove"),Boolean)
End Get
Set
Me("vttStyleRemove") = value
End Set
End Property
End Class
End Namespace

View File

@ -149,5 +149,8 @@
<Setting Name="SubtitleMod1" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="vttStyleRemove" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -24,6 +24,7 @@ Partial Class Einstellungen
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
Me.CB_Mod1 = New MetroFramework.Controls.MetroCheckBox()
Me.pictureBox1 = New System.Windows.Forms.PictureBox()
Me.ToolTip2 = New System.Windows.Forms.ToolTip(Me.components)
Me.GroupBox14 = New System.Windows.Forms.GroupBox()
@ -34,6 +35,7 @@ Partial Class Einstellungen
Me.CB_CR_Harsubs = New MetroFramework.Controls.MetroComboBox()
Me.DubMode = New MetroFramework.Controls.MetroCheckBox()
Me.TabPage2 = New MetroFramework.Controls.MetroTabPage()
Me.GroupBox23 = New System.Windows.Forms.GroupBox()
Me.GroupBox18 = New System.Windows.Forms.GroupBox()
Me.ListViewAdd_True = New MetroFramework.Controls.MetroCheckBox()
Me.GroupBox16 = New System.Windows.Forms.GroupBox()
@ -157,13 +159,13 @@ Partial Class Einstellungen
Me.Label5 = New MetroFramework.Controls.MetroLabel()
Me.BackgroundWorker1 = New System.ComponentModel.BackgroundWorker()
Me.Btn_Save = New System.Windows.Forms.Button()
Me.GroupBox23 = New System.Windows.Forms.GroupBox()
Me.CB_Mod1 = New MetroFramework.Controls.MetroCheckBox()
Me.CB_vttStyle = New MetroFramework.Controls.MetroCheckBox()
CType(Me.pictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.GroupBox14.SuspendLayout()
Me.SoftSubs.SuspendLayout()
Me.GB_SubLanguage.SuspendLayout()
Me.TabPage2.SuspendLayout()
Me.GroupBox23.SuspendLayout()
Me.GroupBox18.SuspendLayout()
Me.GroupBox16.SuspendLayout()
Me.GroupBox4.SuspendLayout()
@ -199,7 +201,6 @@ Partial Class Einstellungen
Me.GroupBox8.SuspendLayout()
Me.TabPage7.SuspendLayout()
CType(Me.PictureBox7, System.ComponentModel.ISupportInitialize).BeginInit()
Me.GroupBox23.SuspendLayout()
Me.SuspendLayout()
'
'ToolTip1
@ -209,6 +210,20 @@ Partial Class Einstellungen
Me.ToolTip1.IsBalloon = True
Me.ToolTip1.ReshowDelay = 100
'
'CB_Mod1
'
Me.CB_Mod1.AutoSize = True
Me.CB_Mod1.FontSize = MetroFramework.MetroCheckBoxSize.Medium
Me.CB_Mod1.ForeColor = System.Drawing.Color.Black
Me.CB_Mod1.Location = New System.Drawing.Point(25, 21)
Me.CB_Mod1.Name = "CB_Mod1"
Me.CB_Mod1.Size = New System.Drawing.Size(305, 19)
Me.CB_Mod1.TabIndex = 5
Me.CB_Mod1.Text = "add 'ScaledBorderAndShadow:yes' to subtitles"
Me.ToolTip1.SetToolTip(Me.CB_Mod1, "adds the 'ScaledBorderAndShadow:yes' to the subtitles see more on https://github." &
"com/hama3254/Crunchyroll-Downloader-v3.0/issues/764")
Me.CB_Mod1.UseSelectable = True
'
'pictureBox1
'
Me.pictureBox1.BackColor = System.Drawing.Color.Transparent
@ -339,6 +354,20 @@ Partial Class Einstellungen
Me.TabPage2.VerticalScrollbarSize = 10
Me.TabPage2.Visible = False
'
'GroupBox23
'
Me.GroupBox23.BackColor = System.Drawing.Color.Transparent
Me.GroupBox23.Controls.Add(Me.CB_vttStyle)
Me.GroupBox23.Controls.Add(Me.CB_Mod1)
Me.GroupBox23.Font = New System.Drawing.Font("Arial", 9.75!)
Me.GroupBox23.ForeColor = System.Drawing.Color.Black
Me.GroupBox23.Location = New System.Drawing.Point(5, 350)
Me.GroupBox23.Name = "GroupBox23"
Me.GroupBox23.Size = New System.Drawing.Size(490, 60)
Me.GroupBox23.TabIndex = 51
Me.GroupBox23.TabStop = False
Me.GroupBox23.Text = "Subtitle Mods"
'
'GroupBox18
'
Me.GroupBox18.BackColor = System.Drawing.Color.Transparent
@ -1374,9 +1403,9 @@ Partial Class Einstellungen
Me.MetroTabPage1.HorizontalScrollbarBarColor = True
Me.MetroTabPage1.HorizontalScrollbarHighlightOnWheel = False
Me.MetroTabPage1.HorizontalScrollbarSize = 10
Me.MetroTabPage1.Location = New System.Drawing.Point(4, 44)
Me.MetroTabPage1.Location = New System.Drawing.Point(4, 35)
Me.MetroTabPage1.Name = "MetroTabPage1"
Me.MetroTabPage1.Size = New System.Drawing.Size(501, 519)
Me.MetroTabPage1.Size = New System.Drawing.Size(501, 528)
Me.MetroTabPage1.TabIndex = 7
Me.MetroTabPage1.Text = "Crunchyroll"
Me.MetroTabPage1.VerticalScrollbarBarColor = True
@ -1852,32 +1881,19 @@ Partial Class Einstellungen
Me.Btn_Save.TabIndex = 9
Me.Btn_Save.UseVisualStyleBackColor = False
'
'GroupBox23
'CB_vttStyle
'
Me.GroupBox23.BackColor = System.Drawing.Color.Transparent
Me.GroupBox23.Controls.Add(Me.CB_Mod1)
Me.GroupBox23.Font = New System.Drawing.Font("Arial", 9.75!)
Me.GroupBox23.ForeColor = System.Drawing.Color.Black
Me.GroupBox23.Location = New System.Drawing.Point(5, 350)
Me.GroupBox23.Name = "GroupBox23"
Me.GroupBox23.Size = New System.Drawing.Size(490, 60)
Me.GroupBox23.TabIndex = 51
Me.GroupBox23.TabStop = False
Me.GroupBox23.Text = "Subtitle Mods"
'
'CB_Mod1
'
Me.CB_Mod1.AutoSize = True
Me.CB_Mod1.FontSize = MetroFramework.MetroCheckBoxSize.Medium
Me.CB_Mod1.ForeColor = System.Drawing.Color.Black
Me.CB_Mod1.Location = New System.Drawing.Point(87, 25)
Me.CB_Mod1.Name = "CB_Mod1"
Me.CB_Mod1.Size = New System.Drawing.Size(305, 19)
Me.CB_Mod1.TabIndex = 5
Me.CB_Mod1.Text = "add 'ScaledBorderAndShadow:yes' to subtitles"
Me.ToolTip1.SetToolTip(Me.CB_Mod1, "adds the 'ScaledBorderAndShadow:yes' to the subtitles see more on https://github." &
"com/hama3254/Crunchyroll-Downloader-v3.0/issues/764")
Me.CB_Mod1.UseSelectable = True
Me.CB_vttStyle.AutoSize = True
Me.CB_vttStyle.FontSize = MetroFramework.MetroCheckBoxSize.Medium
Me.CB_vttStyle.ForeColor = System.Drawing.Color.Black
Me.CB_vttStyle.Location = New System.Drawing.Point(349, 21)
Me.CB_vttStyle.Name = "CB_vttStyle"
Me.CB_vttStyle.Size = New System.Drawing.Size(126, 19)
Me.CB_vttStyle.TabIndex = 6
Me.CB_vttStyle.Text = "remove CC Style"
Me.ToolTip1.SetToolTip(Me.CB_vttStyle, "fixing CRs mess of cc's https://github.com/hama3254/Crunchyroll-Downloader-v3.0/" &
"issues/769")
Me.CB_vttStyle.UseSelectable = True
'
'Einstellungen
'
@ -1902,6 +1918,8 @@ Partial Class Einstellungen
Me.SoftSubs.ResumeLayout(False)
Me.GB_SubLanguage.ResumeLayout(False)
Me.TabPage2.ResumeLayout(False)
Me.GroupBox23.ResumeLayout(False)
Me.GroupBox23.PerformLayout()
Me.GroupBox18.ResumeLayout(False)
Me.GroupBox18.PerformLayout()
Me.GroupBox16.ResumeLayout(False)
@ -1948,8 +1966,6 @@ Partial Class Einstellungen
Me.GroupBox8.PerformLayout()
Me.TabPage7.ResumeLayout(False)
CType(Me.PictureBox7, System.ComponentModel.ISupportInitialize).EndInit()
Me.GroupBox23.ResumeLayout(False)
Me.GroupBox23.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
@ -2091,4 +2107,5 @@ Partial Class Einstellungen
Friend WithEvents CB_Cap As MetroFramework.Controls.MetroCheckBox
Friend WithEvents GroupBox23 As GroupBox
Friend WithEvents CB_Mod1 As MetroFramework.Controls.MetroCheckBox
Friend WithEvents CB_vttStyle As MetroFramework.Controls.MetroCheckBox
End Class

View File

@ -126,6 +126,9 @@
<metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>118, 20</value>
</metadata>
<metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>118, 20</value>
</metadata>
<metadata name="BackgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>332, 20</value>
</metadata>

View File

@ -18,6 +18,7 @@ Public Class Einstellungen
Public CR_SoftSubsTemp As New List(Of String)
Dim TempCheckSubMod1 As Boolean = False
Dim TempVTTStyle As Boolean = False
Private Sub Einstellungen_Load(sender As Object, e As EventArgs) Handles MyBase.Load
@ -38,6 +39,8 @@ Public Class Einstellungen
CB_Mod1.Checked = My.Settings.SubtitleMod1
CB_vtt.Checked = My.Settings.vttStyleRemove
TempTB.Text = Main.TempFolder
LeadingZeroDD.SelectedIndex = Main.LeadingZero
@ -391,6 +394,7 @@ Public Class Einstellungen
My.Settings.IgnoreSeason = CB_Ignore.SelectedIndex
My.Settings.SubtitleMod1 = CB_Mod1.Checked
My.Settings.vttStyleRemove = CB_vttStyle.Checked
If DubMode.Checked = True Then
Main.DubMode = True
@ -1116,9 +1120,18 @@ Public Class Einstellungen
If (CB_Merge.Text = "[merge disabled]") = False And DD_DLMode.Text = "Default - ffmpeg" Then
CB_Mod1.Enabled = False
CB_Mod1.Checked = False
Else
CB_vttStyle.Enabled = False
CB_vttStyle.Checked = False
ElseIf (CB_Merge.Text = "[merge disabled]") = True And DD_DLMode.Text = "Default - ffmpeg" Then
CB_Mod1.Enabled = True
CB_Mod1.Checked = TempCheckSubMod1
CB_vttStyle.Enabled = False
CB_vttStyle.Checked = False
ElseIf (DD_DLMode.Text = "Default - ffmpeg") = False Then
CB_Mod1.Enabled = True
CB_Mod1.Checked = TempCheckSubMod1
CB_vttStyle.Enabled = True
CB_vttStyle.Checked = TempVTTStyle
End If
End Sub
@ -1209,11 +1222,22 @@ Public Class Einstellungen
If (CB_Merge.Text = "[merge disabled]") = False And DD_DLMode.Text = "Default - ffmpeg" Then
CB_Mod1.Enabled = False
CB_Mod1.Checked = False
Else
CB_vttStyle.Enabled = False
CB_vttStyle.Checked = False
ElseIf (CB_Merge.Text = "[merge disabled]") = True And DD_DLMode.Text = "Default - ffmpeg" Then
CB_Mod1.Enabled = True
CB_Mod1.Checked = TempCheckSubMod1
CB_vttStyle.Enabled = False
CB_vttStyle.Checked = False
ElseIf (DD_DLMode.Text = "Default - ffmpeg") = False Then
CB_Mod1.Enabled = True
CB_Mod1.Checked = TempCheckSubMod1
CB_vttStyle.Enabled = True
CB_vttStyle.Checked = TempVTTStyle
End If
End Sub
Private Sub CB_Mod1_CheckedChanged(sender As Object, e As EventArgs) Handles CB_Mod1.CheckedChanged
@ -1223,6 +1247,12 @@ Public Class Einstellungen
End Sub
Private Sub CB_vttStyle_CheckedChanged(sender As Object, e As EventArgs) Handles CB_vttStyle.CheckedChanged
If CB_vttStyle.Enabled = True Then
TempVTTStyle = CB_vttStyle.Checked
End If
End Sub
'Private Sub CB_CR_Audio_Click(sender As Object, e As EventArgs) Handles CB_CR_Audio.Click