fix invalid metadata

fix issues with invalid data from CR #542
This commit is contained in:
hama3254 2022-10-11 17:05:20 +02:00
parent 7e3eecb3ca
commit b6e8ff53b2
6 changed files with 61 additions and 12 deletions

Binary file not shown.

View File

@ -2020,20 +2020,36 @@ Public Class Main
Dim EndTime_ms As String = EndTime3(0) + EndTime4
Dim AfterTime_ms As String = EndTime3(0) + AfterTime
Dim Metadata As String = Nothing
Dim Metadata As String = My.Resources.ffmpeg_metadata.Replace("[Titel]", CR_FilenName).Replace("[Start]", StartTime_ms).Replace("[END]", EndTime_ms).Replace("[after]", AfterTime_ms).Replace("[duration_ms]", CR_episode_duration_ms.ToString)
If CInt(CR_episode_duration_ms) < CInt(StartTime_ms) Then
'Totaly invalid...
ElseIf CInt(CR_episode_duration_ms) < CInt(EndTime_ms) Then
'it's not an Intro it's an outro
Dim DeCh As Integer = CInt(StartTime_ms) - 1
Metadata = My.Resources.ffmpeg_metadata_out.Replace("[Titel]", CR_FilenName).Replace("[Start-1]", DeCh.ToString).Replace("[Start]", StartTime_ms).Replace("[duration_ms]", CR_episode_duration_ms)
Else
Metadata = My.Resources.ffmpeg_metadata.Replace("[Titel]", CR_FilenName).Replace("[Start]", StartTime_ms).Replace("[END]", EndTime_ms).Replace("[after]", AfterTime_ms).Replace("[duration_ms]", CR_episode_duration_ms)
End If
If Metadata = Nothing Then
Else
Dim utf8WithoutBom2 As New System.Text.UTF8Encoding(False)
Using sink As New StreamWriter(Mdata_File, False, utf8WithoutBom2)
sink.WriteLine(Metadata)
CR_MetadataUsage = True
End Using
End If
Dim utf8WithoutBom2 As New System.Text.UTF8Encoding(False)
Using sink As New StreamWriter(Mdata_File, False, utf8WithoutBom2)
sink.WriteLine(Metadata)
CR_MetadataUsage = True
End Using
End If
#End Region
#Region "VideoJson"
Dim VideoJson As String = Nothing
Dim VideoJson As String = Nothing
Try
Using client As New WebClient()
client.Encoding = System.Text.Encoding.UTF8

View File

@ -357,6 +357,27 @@ Namespace My.Resources
End Get
End Property
'''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die ;FFMETADATA1
'''title=[Titel]
'''
'''[CHAPTER]
'''TIMEBASE=1/1000
'''START=1
'''END=[Start-1]
'''
'''[CHAPTER]
'''TIMEBASE=1/1000
'''START=[Start]
'''END=[duration_ms]
'''title=Ending ähnelt.
'''</summary>
Friend ReadOnly Property ffmpeg_metadata_out() As String
Get
Return ResourceManager.GetString("ffmpeg_metadata_out", resourceCulture)
End Get
End Property
'''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die &quot;User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0&quot; ähnelt.
'''</summary>

View File

@ -547,4 +547,19 @@ TIMEBASE=1/1000
START=[after]
END=[duration_ms]</value>
</data>
<data name="ffmpeg_metadata_out" xml:space="preserve">
<value>;FFMETADATA1
title=[Titel]
[CHAPTER]
TIMEBASE=1/1000
START=1
END=[Start-1]
[CHAPTER]
TIMEBASE=1/1000
START=[Start]
END=[duration_ms]
title=Ending</value>
</data>
</root>

View File

@ -534,7 +534,7 @@ Partial Class Einstellungen
Me.CB_Merge.IntegralHeight = False
Me.CB_Merge.ItemHeight = 23
Me.CB_Merge.Items.AddRange(New Object() {"[Merge Disabeld]"})
Me.CB_Merge.Location = New System.Drawing.Point(249, 31)
Me.CB_Merge.Location = New System.Drawing.Point(265, 25)
Me.CB_Merge.Name = "CB_Merge"
Me.CB_Merge.Size = New System.Drawing.Size(175, 29)
Me.CB_Merge.TabIndex = 19
@ -548,7 +548,7 @@ Partial Class Einstellungen
Me.CB_Format.IntegralHeight = False
Me.CB_Format.ItemHeight = 23
Me.CB_Format.Items.AddRange(New Object() {"MP4", "MKV", "AAC (Audio only)"})
Me.CB_Format.Location = New System.Drawing.Point(25, 31)
Me.CB_Format.Location = New System.Drawing.Point(50, 25)
Me.CB_Format.Name = "CB_Format"
Me.CB_Format.Size = New System.Drawing.Size(175, 29)
Me.CB_Format.TabIndex = 17

View File

@ -126,9 +126,6 @@
<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>