Merge pull request #2066 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-08-17 01:48:55 -04:00 committed by GitHub
commit bd47c8bd17
6 changed files with 68 additions and 53 deletions

View File

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

View File

@ -379,13 +379,19 @@ namespace MediaBrowser.Controller.Entities.TV
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),
IncludeItemTypes = new[] { typeof(Episode).Name },
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)

View File

@ -81,46 +81,24 @@ namespace MediaBrowser.Providers.Music
private IEnumerable<RemoteSearchResult> GetResultsFromResponse(XmlDocument doc)
{
var ns = new XmlNamespaceManager(doc.NameTable);
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)
return ReleaseResult.Parse(doc).Select(i =>
{
foreach (var node in nodes.Cast<XmlNode>())
var result = new RemoteSearchResult
{
if (node.Attributes != null)
{
string name = null;
Name = i.Title
};
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)
@ -208,7 +186,7 @@ namespace MediaBrowser.Providers.Music
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)
@ -219,32 +197,32 @@ namespace MediaBrowser.Providers.Music
var doc = await GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false);
return ReleaseResult.Parse(doc);
return ReleaseResult.Parse(doc, 1).FirstOrDefault();
}
private class ReleaseResult
{
public string ReleaseId;
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 list = new List<ReleaseResult>();
if (docElem == null)
{
return new ReleaseResult();
return list;
}
var releaseList = docElem.FirstChild;
if (releaseList == null)
{
return new ReleaseResult();
return list;
}
var nodes = releaseList.ChildNodes;
string releaseId = null;
string releaseGroupId = null;
if (nodes != null)
{
@ -252,18 +230,42 @@ namespace MediaBrowser.Providers.Music
{
if (string.Equals(node.Name, "release", StringComparison.OrdinalIgnoreCase))
{
releaseId = node.Attributes["id"].Value;
releaseGroupId = GetReleaseGroupIdFromReleaseNode(node);
break;
var releaseId = node.Attributes["id"].Value;
var releaseGroupId = GetReleaseGroupIdFromReleaseNode(node);
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,
ReleaseGroupId = releaseGroupId
};
foreach (var subNode in subNodes.Cast<XmlNode>())
{
if (string.Equals(subNode.Name, "title", StringComparison.OrdinalIgnoreCase))
{
return subNode.InnerText;
}
}
}
return null;
}
private static string GetReleaseGroupIdFromReleaseNode(XmlNode node)

View File

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

View File

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

View File

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