mirror of https://github.com/jellyfin/jellyfin.git
update subtitle methods
This commit is contained in:
parent
3bb65c6f99
commit
3178896004
|
@ -689,7 +689,7 @@ namespace MediaBrowser.Api.Playback
|
||||||
|
|
||||||
// TODO: Perhaps also use original_size=1920x800 ??
|
// TODO: Perhaps also use original_size=1920x800 ??
|
||||||
return string.Format("subtitles=filename='{0}'{1},setpts=PTS -{2}/TB",
|
return string.Format("subtitles=filename='{0}'{1},setpts=PTS -{2}/TB",
|
||||||
subtitlePath.Replace('\\', '/').Replace("'", "\\'").Replace(":/", "\\:/"),
|
subtitlePath.Replace('\\', '/').Replace(":/", "\\:/"),
|
||||||
charsetParam,
|
charsetParam,
|
||||||
seconds.ToString(UsCulture));
|
seconds.ToString(UsCulture));
|
||||||
}
|
}
|
||||||
|
@ -697,7 +697,7 @@ namespace MediaBrowser.Api.Playback
|
||||||
var mediaPath = state.MediaPath ?? string.Empty;
|
var mediaPath = state.MediaPath ?? string.Empty;
|
||||||
|
|
||||||
return string.Format("subtitles='{0}:si={1}',setpts=PTS -{2}/TB",
|
return string.Format("subtitles='{0}:si={1}',setpts=PTS -{2}/TB",
|
||||||
mediaPath.Replace('\\', '/').Replace("'", "\\'").Replace(":/", "\\:/"),
|
mediaPath.Replace('\\', '/').Replace(":/", "\\:/"),
|
||||||
state.InternalSubtitleStreamOffset.ToString(UsCulture),
|
state.InternalSubtitleStreamOffset.ToString(UsCulture),
|
||||||
seconds.ToString(UsCulture));
|
seconds.ToString(UsCulture));
|
||||||
}
|
}
|
||||||
|
|
|
@ -902,13 +902,13 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
|
|
||||||
// TODO: Perhaps also use original_size=1920x800 ??
|
// TODO: Perhaps also use original_size=1920x800 ??
|
||||||
return string.Format("subtitles=filename='{0}'{1},setpts=PTS -{2}/TB",
|
return string.Format("subtitles=filename='{0}'{1},setpts=PTS -{2}/TB",
|
||||||
subtitlePath.Replace('\\', '/').Replace("'", "\\'").Replace(":/", "\\:/"),
|
subtitlePath.Replace('\\', '/').Replace(":/", "\\:/"),
|
||||||
charsetParam,
|
charsetParam,
|
||||||
seconds.ToString(UsCulture));
|
seconds.ToString(UsCulture));
|
||||||
}
|
}
|
||||||
|
|
||||||
return string.Format("subtitles='{0}:si={1}',setpts=PTS -{2}/TB",
|
return string.Format("subtitles='{0}:si={1}',setpts=PTS -{2}/TB",
|
||||||
state.MediaPath.Replace('\\', '/').Replace("'", "\\'").Replace(":/", "\\:/"),
|
state.MediaPath.Replace('\\', '/').Replace(":/", "\\:/"),
|
||||||
state.InternalSubtitleStreamOffset.ToString(UsCulture),
|
state.InternalSubtitleStreamOffset.ToString(UsCulture),
|
||||||
seconds.ToString(UsCulture));
|
seconds.ToString(UsCulture));
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,6 @@
|
||||||
<Compile Include="Subtitles\AssParser.cs" />
|
<Compile Include="Subtitles\AssParser.cs" />
|
||||||
<Compile Include="Subtitles\SsaParser.cs" />
|
<Compile Include="Subtitles\SsaParser.cs" />
|
||||||
<Compile Include="Subtitles\SubtitleEncoder.cs" />
|
<Compile Include="Subtitles\SubtitleEncoder.cs" />
|
||||||
<Compile Include="Subtitles\SubtitleTrackInfo.cs" />
|
|
||||||
<Compile Include="Subtitles\TtmlWriter.cs" />
|
<Compile Include="Subtitles\TtmlWriter.cs" />
|
||||||
<Compile Include="Subtitles\VttWriter.cs" />
|
<Compile Include="Subtitles\VttWriter.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using MediaBrowser.Model.MediaInfo;
|
||||||
|
|
||||||
namespace MediaBrowser.MediaEncoding.Subtitles
|
namespace MediaBrowser.MediaEncoding.Subtitles
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using MediaBrowser.Model.MediaInfo;
|
||||||
|
|
||||||
namespace MediaBrowser.MediaEncoding.Subtitles
|
namespace MediaBrowser.MediaEncoding.Subtitles
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using MediaBrowser.Model.MediaInfo;
|
||||||
|
|
||||||
namespace MediaBrowser.MediaEncoding.Subtitles
|
namespace MediaBrowser.MediaEncoding.Subtitles
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
|
using MediaBrowser.Model.Serialization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using MediaBrowser.Model.MediaInfo;
|
||||||
|
|
||||||
namespace MediaBrowser.MediaEncoding.Subtitles
|
namespace MediaBrowser.MediaEncoding.Subtitles
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using MediaBrowser.Model.MediaInfo;
|
||||||
|
|
||||||
namespace MediaBrowser.MediaEncoding.Subtitles
|
namespace MediaBrowser.MediaEncoding.Subtitles
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using MediaBrowser.Model.MediaInfo;
|
||||||
|
|
||||||
namespace MediaBrowser.MediaEncoding.Subtitles
|
namespace MediaBrowser.MediaEncoding.Subtitles
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace MediaBrowser.MediaEncoding.Subtitles
|
|
||||||
{
|
|
||||||
public class SubtitleTrackInfo
|
|
||||||
{
|
|
||||||
public List<SubtitleTrackEvent> TrackEvents { get; set; }
|
|
||||||
|
|
||||||
public SubtitleTrackInfo()
|
|
||||||
{
|
|
||||||
TrackEvents = new List<SubtitleTrackEvent>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class SubtitleTrackEvent
|
|
||||||
{
|
|
||||||
public string Id { get; set; }
|
|
||||||
public string Text { get; set; }
|
|
||||||
public long StartPositionTicks { get; set; }
|
|
||||||
public long EndPositionTicks { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,6 +3,7 @@ using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using MediaBrowser.Model.MediaInfo;
|
||||||
|
|
||||||
namespace MediaBrowser.MediaEncoding.Subtitles
|
namespace MediaBrowser.MediaEncoding.Subtitles
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using MediaBrowser.Model.MediaInfo;
|
||||||
|
|
||||||
namespace MediaBrowser.MediaEncoding.Subtitles
|
namespace MediaBrowser.MediaEncoding.Subtitles
|
||||||
{
|
{
|
||||||
|
|
|
@ -821,6 +821,12 @@
|
||||||
<Compile Include="..\MediaBrowser.Model\MediaInfo\SubtitleFormat.cs">
|
<Compile Include="..\MediaBrowser.Model\MediaInfo\SubtitleFormat.cs">
|
||||||
<Link>MediaInfo\SubtitleFormat.cs</Link>
|
<Link>MediaInfo\SubtitleFormat.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="..\MediaBrowser.Model\MediaInfo\SubtitleTrackEvent.cs">
|
||||||
|
<Link>MediaInfo\SubtitleTrackEvent.cs</Link>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="..\MediaBrowser.Model\MediaInfo\SubtitleTrackInfo.cs">
|
||||||
|
<Link>MediaInfo\SubtitleTrackInfo.cs</Link>
|
||||||
|
</Compile>
|
||||||
<Compile Include="..\MediaBrowser.Model\MediaInfo\TransportStreamTimestamp.cs">
|
<Compile Include="..\MediaBrowser.Model\MediaInfo\TransportStreamTimestamp.cs">
|
||||||
<Link>MediaInfo\TransportStreamTimestamp.cs</Link>
|
<Link>MediaInfo\TransportStreamTimestamp.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
|
@ -777,6 +777,12 @@
|
||||||
<Compile Include="..\MediaBrowser.Model\MediaInfo\SubtitleFormat.cs">
|
<Compile Include="..\MediaBrowser.Model\MediaInfo\SubtitleFormat.cs">
|
||||||
<Link>MediaInfo\SubtitleFormat.cs</Link>
|
<Link>MediaInfo\SubtitleFormat.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="..\MediaBrowser.Model\MediaInfo\SubtitleTrackEvent.cs">
|
||||||
|
<Link>MediaInfo\SubtitleTrackEvent.cs</Link>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="..\MediaBrowser.Model\MediaInfo\SubtitleTrackInfo.cs">
|
||||||
|
<Link>MediaInfo\SubtitleTrackInfo.cs</Link>
|
||||||
|
</Compile>
|
||||||
<Compile Include="..\MediaBrowser.Model\MediaInfo\TransportStreamTimestamp.cs">
|
<Compile Include="..\MediaBrowser.Model\MediaInfo\TransportStreamTimestamp.cs">
|
||||||
<Link>MediaInfo\TransportStreamTimestamp.cs</Link>
|
<Link>MediaInfo\TransportStreamTimestamp.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
|
@ -169,6 +169,8 @@
|
||||||
<Compile Include="Configuration\MetadataPluginType.cs" />
|
<Compile Include="Configuration\MetadataPluginType.cs" />
|
||||||
<Compile Include="Dlna\SubtitleProfile.cs" />
|
<Compile Include="Dlna\SubtitleProfile.cs" />
|
||||||
<Compile Include="MediaInfo\MediaProtocol.cs" />
|
<Compile Include="MediaInfo\MediaProtocol.cs" />
|
||||||
|
<Compile Include="MediaInfo\SubtitleTrackEvent.cs" />
|
||||||
|
<Compile Include="MediaInfo\SubtitleTrackInfo.cs" />
|
||||||
<Compile Include="Net\HttpResponse.cs" />
|
<Compile Include="Net\HttpResponse.cs" />
|
||||||
<Compile Include="Net\MimeTypes.cs" />
|
<Compile Include="Net\MimeTypes.cs" />
|
||||||
<Compile Include="Notifications\NotificationOption.cs" />
|
<Compile Include="Notifications\NotificationOption.cs" />
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
namespace MediaBrowser.Model.MediaInfo
|
||||||
|
{
|
||||||
|
public class SubtitleTrackEvent
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public string Text { get; set; }
|
||||||
|
public long StartPositionTicks { get; set; }
|
||||||
|
public long EndPositionTicks { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Model.MediaInfo
|
||||||
|
{
|
||||||
|
public class SubtitleTrackInfo
|
||||||
|
{
|
||||||
|
public List<SubtitleTrackEvent> TrackEvents { get; set; }
|
||||||
|
|
||||||
|
public SubtitleTrackInfo()
|
||||||
|
{
|
||||||
|
TrackEvents = new List<SubtitleTrackEvent>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -122,7 +122,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
}).Items;
|
}).Items;
|
||||||
|
|
||||||
// Add search hints based on item name
|
// Add search hints based on item name
|
||||||
hints.AddRange(mediaItems.Where(i => (user == null || i.IsVisibleStandalone(user)) && !(i is CollectionFolder)).Select(item =>
|
hints.AddRange(mediaItems.Where(i => IncludeInSearch(i) && (user == null || i.IsVisibleStandalone(user)) && !(i is CollectionFolder)).Select(item =>
|
||||||
{
|
{
|
||||||
var index = GetIndex(item.Name, searchTerm, terms);
|
var index = GetIndex(item.Name, searchTerm, terms);
|
||||||
|
|
||||||
|
|
|
@ -1001,6 +1001,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
}
|
}
|
||||||
|
|
||||||
dict["Recording"] = new[] { typeof(LiveTvAudioRecording).FullName, typeof(LiveTvVideoRecording).FullName };
|
dict["Recording"] = new[] { typeof(LiveTvAudioRecording).FullName, typeof(LiveTvVideoRecording).FullName };
|
||||||
|
dict["Program"] = new[] { typeof(LiveTvProgram).FullName };
|
||||||
|
dict["TvChannel"] = new[] { typeof(LiveTvChannel).FullName };
|
||||||
|
|
||||||
return dict;
|
return dict;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using MediaBrowser.MediaEncoding.Subtitles;
|
using MediaBrowser.MediaEncoding.Subtitles;
|
||||||
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using MediaBrowser.MediaEncoding.Subtitles;
|
using MediaBrowser.MediaEncoding.Subtitles;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
|
||||||
namespace MediaBrowser.Tests.MediaEncoding.Subtitles
|
namespace MediaBrowser.Tests.MediaEncoding.Subtitles
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using MediaBrowser.MediaEncoding.Subtitles;
|
using MediaBrowser.MediaEncoding.Subtitles;
|
||||||
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
|
||||||
namespace MediaBrowser.Tests.MediaEncoding.Subtitles {
|
namespace MediaBrowser.Tests.MediaEncoding.Subtitles {
|
||||||
|
|
|
@ -304,11 +304,11 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var version = GetType().Assembly.GetName().Version;
|
var versionString = !string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase) ? "?v=" + appVersion : string.Empty;
|
||||||
|
|
||||||
var imports = new[]
|
var imports = new[]
|
||||||
{
|
{
|
||||||
"vulcanize-out.html?v=" + appVersion
|
"vulcanize-out.html" + versionString
|
||||||
};
|
};
|
||||||
var importsHtml = string.Join("", imports.Select(i => "<link rel=\"import\" href=\"" + i + "\">").ToArray());
|
var importsHtml = string.Join("", imports.Select(i => "<link rel=\"import\" href=\"" + i + "\">").ToArray());
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
// In chrome it is causing the body to be hidden while loading, which leads to width-check methods to return 0 for everything
|
// In chrome it is causing the body to be hidden while loading, which leads to width-check methods to return 0 for everything
|
||||||
//imports = "";
|
//imports = "";
|
||||||
|
|
||||||
html = html.Replace("<head>", "<head>" + GetMetaTags(mode) + GetCommonCss(mode, version) + GetInitialJavascript(mode, version) + importsHtml + GetCommonJavascript(mode, version));
|
html = html.Replace("<head>", "<head>" + GetMetaTags(mode) + GetCommonCss(mode, appVersion) + GetInitialJavascript(mode, appVersion) + importsHtml + GetCommonJavascript(mode, appVersion));
|
||||||
|
|
||||||
var bytes = Encoding.UTF8.GetBytes(html);
|
var bytes = Encoding.UTF8.GetBytes(html);
|
||||||
|
|
||||||
|
@ -412,7 +412,7 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
/// <param name="mode">The mode.</param>
|
/// <param name="mode">The mode.</param>
|
||||||
/// <param name="version">The version.</param>
|
/// <param name="version">The version.</param>
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
private string GetCommonCss(string mode, Version version)
|
private string GetCommonCss(string mode, string version)
|
||||||
{
|
{
|
||||||
var versionString = !string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase) ? "?v=" + version : string.Empty;
|
var versionString = !string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase) ? "?v=" + version : string.Empty;
|
||||||
|
|
||||||
|
@ -433,7 +433,7 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
/// <param name="mode">The mode.</param>
|
/// <param name="mode">The mode.</param>
|
||||||
/// <param name="version">The version.</param>
|
/// <param name="version">The version.</param>
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
private string GetInitialJavascript(string mode, Version version)
|
private string GetInitialJavascript(string mode, string version)
|
||||||
{
|
{
|
||||||
var builder = new StringBuilder();
|
var builder = new StringBuilder();
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
/// <param name="mode">The mode.</param>
|
/// <param name="mode">The mode.</param>
|
||||||
/// <param name="version">The version.</param>
|
/// <param name="version">The version.</param>
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
private string GetCommonJavascript(string mode, Version version)
|
private string GetCommonJavascript(string mode, string version)
|
||||||
{
|
{
|
||||||
var builder = new StringBuilder();
|
var builder = new StringBuilder();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue