Merge pull request #2066 from MediaBrowser/dev

Dev
pull/702/head
Luke 8 years ago committed by GitHub
commit bd47c8bd17

@ -170,10 +170,13 @@ namespace MediaBrowser.Controller.Entities.TV
Func<BaseItem, bool> filter = i => UserViewBuilder.Filter(i, user, query, UserDataManager, LibraryManager); Func<BaseItem, bool> filter = i => UserViewBuilder.Filter(i, user, query, UserDataManager, LibraryManager);
Logger.Debug("Season.GetItemsInternal entering GetEpisodes");
var items = GetEpisodes(user).Where(filter); var items = GetEpisodes(user).Where(filter);
Logger.Debug("Season.GetItemsInternal entering PostFilterAndSort");
var result = PostFilterAndSort(items, query); var result = PostFilterAndSort(items, query);
Logger.Debug("Season.GetItemsInternal complete");
return Task.FromResult(result); return Task.FromResult(result);
} }

@ -379,13 +379,19 @@ namespace MediaBrowser.Controller.Entities.TV
private IEnumerable<Episode> GetAllEpisodes(User user) private IEnumerable<Episode> GetAllEpisodes(User user)
{ {
return LibraryManager.GetItemList(new InternalItemsQuery(user) Logger.Debug("Series.GetAllEpisodes entering GetItemList");
var result = LibraryManager.GetItemList(new InternalItemsQuery(user)
{ {
AncestorWithPresentationUniqueKey = GetUniqueSeriesKey(this), AncestorWithPresentationUniqueKey = GetUniqueSeriesKey(this),
IncludeItemTypes = new[] { typeof(Episode).Name }, IncludeItemTypes = new[] { typeof(Episode).Name },
SortBy = new[] { ItemSortBy.SortName } SortBy = new[] { ItemSortBy.SortName }
}).Cast<Episode>(); }).Cast<Episode>().ToList();
Logger.Debug("Series.GetAllEpisodes returning {0} episodes", result.Count);
return result;
} }
public IEnumerable<Episode> GetSeasonEpisodes(User user, Season parentSeason, bool includeMissingEpisodes, bool includeVirtualUnairedEpisodes) public IEnumerable<Episode> GetSeasonEpisodes(User user, Season parentSeason, bool includeMissingEpisodes, bool includeVirtualUnairedEpisodes)

@ -81,46 +81,24 @@ namespace MediaBrowser.Providers.Music
private IEnumerable<RemoteSearchResult> GetResultsFromResponse(XmlDocument doc) private IEnumerable<RemoteSearchResult> GetResultsFromResponse(XmlDocument doc)
{ {
var ns = new XmlNamespaceManager(doc.NameTable); return ReleaseResult.Parse(doc).Select(i =>
ns.AddNamespace("mb", MusicBrainzBaseUrl + "/ns/mmd-2.0#");
var list = new List<RemoteSearchResult>();
var nodes = doc.SelectNodes("//mb:release-list/mb:release", ns);
if (nodes != null)
{ {
foreach (var node in nodes.Cast<XmlNode>()) var result = new RemoteSearchResult
{ {
if (node.Attributes != null) Name = i.Title
{ };
string name = null;
string mbzId = node.Attributes["id"].Value;
var nameNode = node.SelectSingleNode("//mb:title", ns);
if (nameNode != null)
{
name = nameNode.InnerText;
}
if (!string.IsNullOrWhiteSpace(mbzId) && !string.IsNullOrWhiteSpace(name))
{
var result = new RemoteSearchResult
{
Name = name
};
result.SetProviderId(MetadataProviders.MusicBrainzAlbum, mbzId);
list.Add(result); if (!string.IsNullOrWhiteSpace(i.ReleaseId))
} {
} result.SetProviderId(MetadataProviders.MusicBrainzAlbum, i.ReleaseId);
}
if (!string.IsNullOrWhiteSpace(i.ReleaseGroupId))
{
result.SetProviderId(MetadataProviders.MusicBrainzAlbum, i.ReleaseGroupId);
} }
}
return list; return result;
});
} }
public async Task<MetadataResult<MusicAlbum>> GetMetadata(AlbumInfo id, CancellationToken cancellationToken) public async Task<MetadataResult<MusicAlbum>> GetMetadata(AlbumInfo id, CancellationToken cancellationToken)
@ -208,7 +186,7 @@ namespace MediaBrowser.Providers.Music
var doc = await GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false); var doc = await GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false);
return ReleaseResult.Parse(doc); return ReleaseResult.Parse(doc, 1).FirstOrDefault();
} }
private async Task<ReleaseResult> GetReleaseResultByArtistName(string albumName, string artistName, CancellationToken cancellationToken) private async Task<ReleaseResult> GetReleaseResultByArtistName(string albumName, string artistName, CancellationToken cancellationToken)
@ -219,32 +197,32 @@ namespace MediaBrowser.Providers.Music
var doc = await GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false); var doc = await GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false);
return ReleaseResult.Parse(doc); return ReleaseResult.Parse(doc, 1).FirstOrDefault();
} }
private class ReleaseResult private class ReleaseResult
{ {
public string ReleaseId; public string ReleaseId;
public string ReleaseGroupId; public string ReleaseGroupId;
public string Title;
public static ReleaseResult Parse(XmlDocument doc) public static List<ReleaseResult> Parse(XmlDocument doc, int? limit = null)
{ {
var docElem = doc.DocumentElement; var docElem = doc.DocumentElement;
var list = new List<ReleaseResult>();
if (docElem == null) if (docElem == null)
{ {
return new ReleaseResult(); return list;
} }
var releaseList = docElem.FirstChild; var releaseList = docElem.FirstChild;
if (releaseList == null) if (releaseList == null)
{ {
return new ReleaseResult(); return list;
} }
var nodes = releaseList.ChildNodes; var nodes = releaseList.ChildNodes;
string releaseId = null;
string releaseGroupId = null;
if (nodes != null) if (nodes != null)
{ {
@ -252,18 +230,42 @@ namespace MediaBrowser.Providers.Music
{ {
if (string.Equals(node.Name, "release", StringComparison.OrdinalIgnoreCase)) if (string.Equals(node.Name, "release", StringComparison.OrdinalIgnoreCase))
{ {
releaseId = node.Attributes["id"].Value; var releaseId = node.Attributes["id"].Value;
releaseGroupId = GetReleaseGroupIdFromReleaseNode(node); var releaseGroupId = GetReleaseGroupIdFromReleaseNode(node);
break;
list.Add(new ReleaseResult
{
ReleaseId = releaseId,
ReleaseGroupId = releaseGroupId,
Title = GetTitleFromReleaseNode(node)
});
if (limit.HasValue && list.Count >= limit.Value)
{
break;
}
} }
} }
} }
return new ReleaseResult return list;
}
private static string GetTitleFromReleaseNode(XmlNode node)
{
var subNodes = node.ChildNodes;
if (subNodes != null)
{ {
ReleaseId = releaseId, foreach (var subNode in subNodes.Cast<XmlNode>())
ReleaseGroupId = releaseGroupId {
}; if (string.Equals(subNode.Name, "title", StringComparison.OrdinalIgnoreCase))
{
return subNode.InnerText;
}
}
}
return null;
} }
private static string GetReleaseGroupIdFromReleaseNode(XmlNode node) private static string GetReleaseGroupIdFromReleaseNode(XmlNode node)

@ -52,7 +52,8 @@ namespace MediaBrowser.Server.Implementations.IO
".db", ".db",
// bts sync files // bts sync files
".bts" ".bts",
".sync"
}; };
/// <summary> /// <summary>

@ -136,7 +136,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts
RequiresOpening = false, RequiresOpening = false,
RequiresClosing = false, RequiresClosing = false,
ReadAtNativeFramerate = true ReadAtNativeFramerate = false
}; };
return new List<MediaSourceInfo> { mediaSource }; return new List<MediaSourceInfo> { mediaSource };

@ -173,6 +173,9 @@
<Content Include="dashboard-ui\components\remotecontrolautoplay.js"> <Content Include="dashboard-ui\components\remotecontrolautoplay.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\components\syncjoblist\syncjoblist.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\components\tvproviders\xmltv.js"> <Content Include="dashboard-ui\components\tvproviders\xmltv.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>

Loading…
Cancel
Save