subtitle fixes

This commit is contained in:
Luke Pulverenti 2013-09-19 22:03:37 -04:00
parent 6cab9dc227
commit 21e9a7950e
6 changed files with 49 additions and 29 deletions

View File

@ -256,7 +256,10 @@ namespace MediaBrowser.Api.Playback
if (state.SubtitleStream != null)
{
if (state.SubtitleStream.Codec.IndexOf("srt", StringComparison.OrdinalIgnoreCase) != -1 || state.SubtitleStream.Codec.IndexOf("subrip", StringComparison.OrdinalIgnoreCase) != -1)
if (state.SubtitleStream.Codec.IndexOf("srt", StringComparison.OrdinalIgnoreCase) != -1 ||
state.SubtitleStream.Codec.IndexOf("subrip", StringComparison.OrdinalIgnoreCase) != -1 ||
string.Equals(state.SubtitleStream.Codec, "ass", StringComparison.OrdinalIgnoreCase) ||
string.Equals(state.SubtitleStream.Codec, "ssa", StringComparison.OrdinalIgnoreCase))
{
assSubtitleParam = GetTextSubtitleParam((Video)state.Item, state.SubtitleStream, request.StartTimeTicks, performTextSubtitleConversion);
}

View File

@ -951,15 +951,39 @@ namespace MediaBrowser.Controller.Entities
return result;
}
var children = Children;
return GetChildrenList(user, includeLinkedChildren);
}
/// <summary>
/// Gets the children list.
/// </summary>
/// <param name="user">The user.</param>
/// <param name="includeLinkedChildren">if set to <c>true</c> [include linked children].</param>
/// <returns>List{BaseItem}.</returns>
private List<BaseItem> GetChildrenList(User user, bool includeLinkedChildren)
{
var list = new List<BaseItem>();
foreach (var child in Children)
{
if (child.IsVisible(user))
{
list.Add(child);
}
}
if (includeLinkedChildren)
{
children = children.Concat(GetLinkedChildren());
foreach (var child in GetLinkedChildren())
{
if (child.IsVisible(user))
{
list.Add(child);
}
}
}
// If indexed is false or the indexing function is null
return children.AsParallel().Where(c => c.IsVisible(user)).AsEnumerable();
return list;
}
/// <summary>
@ -976,42 +1000,35 @@ namespace MediaBrowser.Controller.Entities
throw new ArgumentNullException();
}
var children = GetRecursiveChildrenInternal(user, includeLinkedChildren);
var list = new List<BaseItem>(10000);
AddRecursiveChildrenInternal(user, includeLinkedChildren, list);
if (includeLinkedChildren)
{
children = children.Distinct();
list = list.Distinct().ToList();
}
return children;
return list;
}
/// <summary>
/// Gets allowed recursive children of an item
/// Adds the recursive children internal.
/// </summary>
/// <param name="user">The user.</param>
/// <param name="includeLinkedChildren">if set to <c>true</c> [include linked children].</param>
/// <returns>IEnumerable{BaseItem}.</returns>
/// <exception cref="System.ArgumentNullException"></exception>
private IEnumerable<BaseItem> GetRecursiveChildrenInternal(User user, bool includeLinkedChildren)
/// <param name="list">The list.</param>
private void AddRecursiveChildrenInternal(User user, bool includeLinkedChildren, List<BaseItem> list)
{
if (user == null)
foreach (var item in GetChildrenList(user, includeLinkedChildren))
{
throw new ArgumentNullException();
}
foreach (var item in GetChildren(user, includeLinkedChildren))
{
yield return item;
list.Add(item);
var subFolder = item as Folder;
if (subFolder != null)
{
foreach (var subitem in subFolder.GetRecursiveChildrenInternal(user, includeLinkedChildren))
{
yield return subitem;
}
subFolder.AddRecursiveChildrenInternal(user, includeLinkedChildren, list);
}
}
}

View File

@ -482,7 +482,7 @@ namespace MediaBrowser.Providers.MediaInfo
Type = MediaStreamType.Subtitle,
IsExternal = true,
Path = fullName,
Codec = "srt",
Codec = Path.GetExtension(fullName).ToLower().TrimStart('.'),
Language = language
});
}

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common.Internal</id>
<version>3.0.203</version>
<version>3.0.204</version>
<title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
<copyright>Copyright © Media Browser 2013</copyright>
<dependencies>
<dependency id="MediaBrowser.Common" version="3.0.203" />
<dependency id="MediaBrowser.Common" version="3.0.204" />
<dependency id="NLog" version="2.0.1.2" />
<dependency id="ServiceStack.Text" version="3.9.58" />
<dependency id="SimpleInjector" version="2.3.2" />

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common</id>
<version>3.0.203</version>
<version>3.0.204</version>
<title>MediaBrowser.Common</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MediaBrowser.Server.Core</id>
<version>3.0.203</version>
<version>3.0.204</version>
<title>Media Browser.Server.Core</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Media Browser Server.</description>
<copyright>Copyright © Media Browser 2013</copyright>
<dependencies>
<dependency id="MediaBrowser.Common" version="3.0.203" />
<dependency id="MediaBrowser.Common" version="3.0.204" />
</dependencies>
</metadata>
<files>