update music dlna
This commit is contained in:
parent
17e5c92549
commit
3768de3a32
|
@ -201,7 +201,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return await GetMusicFolders(queryParent, user, query).ConfigureAwait(false);
|
return await GetMusicFolders(queryParent, user, query).ConfigureAwait(false);
|
||||||
|
|
||||||
case SpecialFolder.MusicGenres:
|
case SpecialFolder.MusicGenres:
|
||||||
return await GetMusicGenres(queryParent, user, query).ConfigureAwait(false);
|
return GetMusicGenres(queryParent, user, query);
|
||||||
|
|
||||||
case SpecialFolder.MusicGenre:
|
case SpecialFolder.MusicGenre:
|
||||||
return await GetMusicGenreItems(queryParent, displayParent, user, query).ConfigureAwait(false);
|
return await GetMusicGenreItems(queryParent, displayParent, user, query).ConfigureAwait(false);
|
||||||
|
@ -290,32 +290,20 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return GetResult(list, parent, query);
|
return GetResult(list, parent, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<QueryResult<BaseItem>> GetMusicGenres(Folder parent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetMusicGenres(Folder parent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
var tasks = GetRecursiveChildren(parent, user, new[] { CollectionType.Music, CollectionType.MusicVideos })
|
var result = _libraryManager.GetMusicGenres(new InternalItemsQuery(user)
|
||||||
.Where(i => !i.IsFolder)
|
|
||||||
.SelectMany(i => i.Genres)
|
|
||||||
.DistinctNames()
|
|
||||||
.Select(i =>
|
|
||||||
{
|
{
|
||||||
try
|
AncestorIds = new[] { parent.Id.ToString("N") },
|
||||||
{
|
StartIndex = query.StartIndex,
|
||||||
return _libraryManager.GetMusicGenre(i);
|
Limit = query.Limit
|
||||||
}
|
});
|
||||||
catch
|
|
||||||
{
|
|
||||||
// Full exception logged at lower levels
|
|
||||||
_logger.Error("Error getting genre");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
return new QueryResult<BaseItem>
|
||||||
.Where(i => i != null)
|
{
|
||||||
.Select(i => GetUserView(i.Name, SpecialFolder.MusicGenre, i.SortName, parent));
|
TotalRecordCount = result.TotalRecordCount,
|
||||||
|
Items = result.Items.Select(i => i.Item1).ToArray()
|
||||||
var genres = await Task.WhenAll(tasks).ConfigureAwait(false);
|
};
|
||||||
|
|
||||||
return GetResult(genres, parent, query);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<QueryResult<BaseItem>> GetMusicGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query)
|
private async Task<QueryResult<BaseItem>> GetMusicGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query)
|
||||||
|
@ -332,50 +320,51 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
private QueryResult<BaseItem> GetMusicAlbumArtists(Folder parent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetMusicAlbumArtists(Folder parent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
var items = parent.QueryRecursive(new InternalItemsQuery(user)
|
var artists = _libraryManager.GetAlbumArtists(new InternalItemsQuery(user)
|
||||||
{
|
{
|
||||||
Recursive = true,
|
AncestorIds = new[] { parent.Id.ToString("N") },
|
||||||
ParentId = parent.Id,
|
StartIndex = query.StartIndex,
|
||||||
IncludeItemTypes = new[] { typeof(Audio.Audio).Name },
|
Limit = query.Limit
|
||||||
EnableTotalRecordCount = false
|
});
|
||||||
|
|
||||||
}).Items.Cast<IHasAlbumArtist>();
|
return new QueryResult<BaseItem>
|
||||||
|
{
|
||||||
var artists = _libraryManager.GetAlbumArtists(items);
|
TotalRecordCount = artists.TotalRecordCount,
|
||||||
|
Items = artists.Items.Select(i => i.Item1).ToArray()
|
||||||
return GetResult(artists, parent, query);
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private QueryResult<BaseItem> GetMusicArtists(Folder parent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetMusicArtists(Folder parent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
var items = parent.QueryRecursive(new InternalItemsQuery(user)
|
var artists = _libraryManager.GetArtists(new InternalItemsQuery(user)
|
||||||
{
|
{
|
||||||
Recursive = true,
|
AncestorIds = new[] { parent.Id.ToString("N") },
|
||||||
ParentId = parent.Id,
|
StartIndex = query.StartIndex,
|
||||||
IncludeItemTypes = new[] { typeof(Audio.Audio).Name, typeof(MusicVideo).Name },
|
Limit = query.Limit
|
||||||
EnableTotalRecordCount = false
|
});
|
||||||
|
|
||||||
}).Items.Cast<IHasArtist>();
|
return new QueryResult<BaseItem>
|
||||||
|
{
|
||||||
var artists = _libraryManager.GetArtists(items);
|
TotalRecordCount = artists.TotalRecordCount,
|
||||||
|
Items = artists.Items.Select(i => i.Item1).ToArray()
|
||||||
return GetResult(artists, parent, query);
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private QueryResult<BaseItem> GetFavoriteArtists(Folder parent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetFavoriteArtists(Folder parent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
var items = parent.QueryRecursive(new InternalItemsQuery(user)
|
var artists = _libraryManager.GetArtists(new InternalItemsQuery(user)
|
||||||
{
|
{
|
||||||
Recursive = true,
|
AncestorIds = new[] { parent.Id.ToString("N") },
|
||||||
ParentId = parent.Id,
|
StartIndex = query.StartIndex,
|
||||||
IncludeItemTypes = new[] { typeof(Audio.Audio).Name },
|
Limit = query.Limit,
|
||||||
EnableTotalRecordCount = false
|
IsFavorite = true
|
||||||
|
});
|
||||||
|
|
||||||
}).Items.Cast<IHasAlbumArtist>();
|
return new QueryResult<BaseItem>
|
||||||
|
{
|
||||||
var artists = _libraryManager.GetAlbumArtists(items).Where(i => _userDataManager.GetUserData(user, i).IsFavorite);
|
TotalRecordCount = artists.TotalRecordCount,
|
||||||
|
Items = artists.Items.Select(i => i.Item1).ToArray()
|
||||||
return GetResult(artists, parent, query);
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private QueryResult<BaseItem> GetMusicPlaylists(Folder parent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetMusicPlaylists(Folder parent, User user, InternalItemsQuery query)
|
||||||
|
@ -577,35 +566,18 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
private async Task<QueryResult<BaseItem>> GetMovieGenres(Folder parent, User user, InternalItemsQuery query)
|
private async Task<QueryResult<BaseItem>> GetMovieGenres(Folder parent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
var tasks = parent.QueryRecursive(new InternalItemsQuery(user)
|
var result = _libraryManager.GetGenres(new InternalItemsQuery(user)
|
||||||
{
|
{
|
||||||
IncludeItemTypes = new[] { typeof(Movie).Name },
|
AncestorIds = new[] { parent.Id.ToString("N") },
|
||||||
Recursive = true,
|
StartIndex = query.StartIndex,
|
||||||
EnableTotalRecordCount = false
|
Limit = query.Limit
|
||||||
|
});
|
||||||
|
|
||||||
}).Items
|
return new QueryResult<BaseItem>
|
||||||
.SelectMany(i => i.Genres)
|
|
||||||
.DistinctNames()
|
|
||||||
.Select(i =>
|
|
||||||
{
|
{
|
||||||
try
|
TotalRecordCount = result.TotalRecordCount,
|
||||||
{
|
Items = result.Items.Select(i => i.Item1).ToArray()
|
||||||
return _libraryManager.GetGenre(i);
|
};
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// Full exception logged at lower levels
|
|
||||||
_logger.Error("Error getting genre");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
.Where(i => i != null)
|
|
||||||
.Select(i => GetUserView(i.Name, SpecialFolder.MovieGenre, i.SortName, parent));
|
|
||||||
|
|
||||||
var genres = await Task.WhenAll(tasks).ConfigureAwait(false);
|
|
||||||
|
|
||||||
return GetResult(genres, parent, query);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<QueryResult<BaseItem>> GetMovieGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query)
|
private async Task<QueryResult<BaseItem>> GetMovieGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query)
|
||||||
|
@ -720,35 +692,18 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
private async Task<QueryResult<BaseItem>> GetTvGenres(Folder parent, User user, InternalItemsQuery query)
|
private async Task<QueryResult<BaseItem>> GetTvGenres(Folder parent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
var tasks = parent.QueryRecursive(new InternalItemsQuery(user)
|
var result = _libraryManager.GetGenres(new InternalItemsQuery(user)
|
||||||
{
|
{
|
||||||
IncludeItemTypes = new[] { typeof(Series).Name },
|
AncestorIds = new[] { parent.Id.ToString("N") },
|
||||||
Recursive = true,
|
StartIndex = query.StartIndex,
|
||||||
EnableTotalRecordCount = false
|
Limit = query.Limit
|
||||||
|
});
|
||||||
|
|
||||||
}).Items
|
return new QueryResult<BaseItem>
|
||||||
.SelectMany(i => i.Genres)
|
|
||||||
.DistinctNames()
|
|
||||||
.Select(i =>
|
|
||||||
{
|
{
|
||||||
try
|
TotalRecordCount = result.TotalRecordCount,
|
||||||
{
|
Items = result.Items.Select(i => i.Item1).ToArray()
|
||||||
return _libraryManager.GetGenre(i);
|
};
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// Full exception logged at lower levels
|
|
||||||
_logger.Error("Error getting genre");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
.Where(i => i != null)
|
|
||||||
.Select(i => GetUserView(i.Name, SpecialFolder.TvGenre, i.SortName, parent));
|
|
||||||
|
|
||||||
var genres = await Task.WhenAll(tasks).ConfigureAwait(false);
|
|
||||||
|
|
||||||
return GetResult(genres, parent, query);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private QueryResult<BaseItem> GetTvGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetTvGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user