fix playlists empty with dlna

This commit is contained in:
Luke Pulverenti 2016-05-15 15:25:54 -04:00
parent 9ad551c77c
commit abf9809a1d
2 changed files with 24 additions and 14 deletions

View File

@ -181,6 +181,11 @@ namespace MediaBrowser.Controller.Entities
public InternalItemsQuery(User user) public InternalItemsQuery(User user)
: this() : this()
{
SetUser(user);
}
public void SetUser(User user)
{ {
if (user != null) if (user != null)
{ {

View File

@ -125,13 +125,13 @@ namespace MediaBrowser.Controller.Entities
case CollectionType.HomeVideos: case CollectionType.HomeVideos:
case CollectionType.Games: case CollectionType.Games:
case CollectionType.MusicVideos: case CollectionType.MusicVideos:
{
if (query.Recursive)
{ {
return GetResult(queryParent.GetRecursiveChildren(user, true), queryParent, query); if (query.Recursive)
{
return GetResult(queryParent.GetRecursiveChildren(user, true), queryParent, query);
}
return GetResult(queryParent.GetChildren(user, true), queryParent, query);
} }
return GetResult(queryParent.GetChildren(user, true), queryParent, query);
}
case CollectionType.Folders: case CollectionType.Folders:
return GetResult(user.RootFolder.GetChildren(user, true), queryParent, query); return GetResult(user.RootFolder.GetChildren(user, true), queryParent, query);
@ -140,7 +140,7 @@ namespace MediaBrowser.Controller.Entities
return await GetPlaylistsView(queryParent, user, query).ConfigureAwait(false); return await GetPlaylistsView(queryParent, user, query).ConfigureAwait(false);
case CollectionType.BoxSets: case CollectionType.BoxSets:
return await GetBoxsetView(queryParent, user, query).ConfigureAwait(false); return GetBoxsetView(queryParent, user, query);
case CollectionType.TvShows: case CollectionType.TvShows:
return await GetTvView(queryParent, user, query).ConfigureAwait(false); return await GetTvView(queryParent, user, query).ConfigureAwait(false);
@ -206,7 +206,7 @@ namespace MediaBrowser.Controller.Entities
return GetMusicLatest(queryParent, user, query); return GetMusicLatest(queryParent, user, query);
case SpecialFolder.MusicPlaylists: case SpecialFolder.MusicPlaylists:
return await GetMusicPlaylists(queryParent, user, query).ConfigureAwait(false); return GetMusicPlaylists(queryParent, user, query);
case SpecialFolder.MusicAlbums: case SpecialFolder.MusicAlbums:
return GetMusicAlbums(queryParent, user, query); return GetMusicAlbums(queryParent, user, query);
@ -353,12 +353,14 @@ namespace MediaBrowser.Controller.Entities
return GetResult(artists, parent, query); return GetResult(artists, parent, query);
} }
private Task<QueryResult<BaseItem>> GetMusicPlaylists(Folder parent, User user, InternalItemsQuery query) private QueryResult<BaseItem> GetMusicPlaylists(Folder parent, User user, InternalItemsQuery query)
{ {
query.IncludeItemTypes = new[] { "Playlist" }; query.ParentId = null;
query.IncludeItemTypes = new[] { typeof(Playlist).Name };
query.SetUser(user);
query.Recursive = true; query.Recursive = true;
return parent.GetItems(query); return _libraryManager.GetItemsResult(query);
} }
private QueryResult<BaseItem> GetMusicAlbums(Folder parent, User user, InternalItemsQuery query) private QueryResult<BaseItem> GetMusicAlbums(Folder parent, User user, InternalItemsQuery query)
@ -559,11 +561,14 @@ namespace MediaBrowser.Controller.Entities
return GetResult(_playlistManager.GetPlaylists(user.Id.ToString("N")), parent, query); return GetResult(_playlistManager.GetPlaylists(user.Id.ToString("N")), parent, query);
} }
private async Task<QueryResult<BaseItem>> GetBoxsetView(Folder parent, User user, InternalItemsQuery query) private QueryResult<BaseItem> GetBoxsetView(Folder parent, User user, InternalItemsQuery query)
{ {
var collections = _collectionManager.GetCollections(user); query.ParentId = null;
query.IncludeItemTypes = new[] { typeof(BoxSet).Name };
query.SetUser(user);
query.Recursive = true;
return GetResult(collections, parent, query); return _libraryManager.GetItemsResult(query);
} }
private async Task<QueryResult<BaseItem>> GetTvView(Folder parent, User user, InternalItemsQuery query) private async Task<QueryResult<BaseItem>> GetTvView(Folder parent, User user, InternalItemsQuery query)
@ -1735,7 +1740,7 @@ namespace MediaBrowser.Controller.Entities
if (query.SeriesStatuses.Length > 0) if (query.SeriesStatuses.Length > 0)
{ {
var ok = new[] { item }.OfType<Series>().Any(p => p.Status.HasValue && query.SeriesStatuses.Contains(p.Status.Value)); var ok = new[] { item }.OfType<Series>().Any(p => p.Status.HasValue && query.SeriesStatuses.Contains(p.Status.Value));
if (!ok) if (!ok)
{ {
return false; return false;