Merge pull request #4877 from jellyfin/ass
commit
45c6d79dc9
@ -0,0 +1,38 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
|
using MediaBrowser.MediaEncoding.Subtitles;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Jellyfin.MediaEncoding.Subtitles.Tests
|
||||||
|
{
|
||||||
|
public class AssParserTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Parse_Valid_Success()
|
||||||
|
{
|
||||||
|
using (var stream = File.OpenRead("Test Data/example.ass"))
|
||||||
|
{
|
||||||
|
var parsed = new AssParser().Parse(stream, CancellationToken.None);
|
||||||
|
Assert.Single(parsed.TrackEvents);
|
||||||
|
var trackEvent = parsed.TrackEvents[0];
|
||||||
|
|
||||||
|
Assert.Equal("1", trackEvent.Id);
|
||||||
|
Assert.Equal(TimeSpan.Parse("00:00:01.18", CultureInfo.InvariantCulture).Ticks, trackEvent.StartPositionTicks);
|
||||||
|
Assert.Equal(TimeSpan.Parse("00:00:06.85", CultureInfo.InvariantCulture).Ticks, trackEvent.EndPositionTicks);
|
||||||
|
Assert.Equal("Like an Angel with pity on nobody\r\nThe second line in subtitle", trackEvent.Text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ParseFieldHeaders_Valid_Success()
|
||||||
|
{
|
||||||
|
const string Line = "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text";
|
||||||
|
var headers = AssParser.ParseFieldHeaders(Line);
|
||||||
|
Assert.Equal(1, headers["Start"]);
|
||||||
|
Assert.Equal(2, headers["End"]);
|
||||||
|
Assert.Equal(9, headers["Text"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
[Script Info]
|
||||||
|
; Script generated by Aegisub
|
||||||
|
; http://www.aegisub.org
|
||||||
|
Title: Neon Genesis Evangelion - Episode 26 (neutral Spanish)
|
||||||
|
Original Script: RoRo
|
||||||
|
Script Updated By: version 2.8.01
|
||||||
|
ScriptType: v4.00+
|
||||||
|
Collisions: Normal
|
||||||
|
PlayResY: 600
|
||||||
|
PlayDepth: 0
|
||||||
|
Timer: 100,0000
|
||||||
|
Video Aspect Ratio: 0
|
||||||
|
Video Zoom: 6
|
||||||
|
Video Position: 0
|
||||||
|
|
||||||
|
[V4+ Styles]
|
||||||
|
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
|
||||||
|
Style: DefaultVCD, Arial,28,&H00B4FCFC,&H00B4FCFC,&H00000008,&H80000008,-1,0,0,0,100,100,0.00,0.00,1,1.00,2.00,2,30,30,30,0
|
||||||
|
|
||||||
|
[Events]
|
||||||
|
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
|
||||||
|
Dialogue: 0,0:00:01.18,0:00:06.85,DefaultVCD, NTP,0000,0000,0000,,{\pos(400,570)}Like an Angel with pity on nobody\NThe second line in subtitle
|
Loading…
Reference in new issue