Apply code review suggestions

This commit is contained in:
Patrick Barron 2020-04-19 13:39:12 -04:00
parent c4e6329e58
commit f26f44acaf
3 changed files with 24 additions and 48 deletions

View File

@ -5,7 +5,7 @@ using MediaBrowser.Model.Branding;
namespace Emby.Server.Implementations.Branding namespace Emby.Server.Implementations.Branding
{ {
/// <summary> /// <summary>
/// Branding configuration factory. /// A configuration factory for <see cref="BrandingOptions"/>.
/// </summary> /// </summary>
public class BrandingConfigurationFactory : IConfigurationFactory public class BrandingConfigurationFactory : IConfigurationFactory
{ {

View File

@ -141,9 +141,9 @@ namespace Emby.Server.Implementations.Channels
} }
/// <summary> /// <summary>
/// Returns an <see cref="IEnumerable{T}"/> containing installed channel ID's. /// Get the installed channel IDs.
/// </summary> /// </summary>
/// <returns>An <see cref="IEnumerable{T}"/> containing installed channel ID's.</returns> /// <returns>An <see cref="IEnumerable{T}"/> containing installed channel IDs.</returns>
public IEnumerable<Guid> GetInstalledChannelIds() public IEnumerable<Guid> GetInstalledChannelIds()
{ {
return GetAllChannels().Select(i => GetInternalChannelId(i.Name)); return GetAllChannels().Select(i => GetInternalChannelId(i.Name));
@ -296,7 +296,7 @@ namespace Emby.Server.Implementations.Channels
/// Refreshes the associated channels. /// Refreshes the associated channels.
/// </summary> /// </summary>
/// <param name="progress">The progress.</param> /// <param name="progress">The progress.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>The completed task.</returns> /// <returns>The completed task.</returns>
public async Task RefreshChannels(IProgress<double> progress, CancellationToken cancellationToken) public async Task RefreshChannels(IProgress<double> progress, CancellationToken cancellationToken)
{ {
@ -384,8 +384,8 @@ namespace Emby.Server.Implementations.Channels
/// Gets the dynamic media sources based on the provided item. /// Gets the dynamic media sources based on the provided item.
/// </summary> /// </summary>
/// <param name="item">The item.</param> /// <param name="item">The item.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>The completed task.</returns> /// <returns>The task representing the operation to get the media sources.</returns>
public async Task<IEnumerable<MediaSourceInfo>> GetDynamicMediaSources(BaseItem item, CancellationToken cancellationToken) public async Task<IEnumerable<MediaSourceInfo>> GetDynamicMediaSources(BaseItem item, CancellationToken cancellationToken)
{ {
var channel = GetChannel(item.ChannelId); var channel = GetChannel(item.ChannelId);
@ -578,7 +578,8 @@ namespace Emby.Server.Implementations.Channels
/// <param name="provider">The provider.</param> /// <param name="provider">The provider.</param>
/// <param name="features">The features.</param> /// <param name="features">The features.</param>
/// <returns>The supported features.</returns> /// <returns>The supported features.</returns>
public ChannelFeatures GetChannelFeaturesDto(Channel channel, public ChannelFeatures GetChannelFeaturesDto(
Channel channel,
IChannel provider, IChannel provider,
InternalChannelFeatures features) InternalChannelFeatures features)
{ {
@ -961,27 +962,15 @@ namespace Emby.Server.Implementations.Channels
if (info.Type == ChannelItemType.Folder) if (info.Type == ChannelItemType.Folder)
{ {
switch (info.FolderType) item = info.FolderType switch
{ {
case ChannelFolderType.MusicAlbum: ChannelFolderType.MusicAlbum => GetItemById<MusicAlbum>(info.Id, channelProvider.Name, out isNew),
item = GetItemById<MusicAlbum>(info.Id, channelProvider.Name, out isNew); ChannelFolderType.MusicArtist => GetItemById<MusicArtist>(info.Id, channelProvider.Name, out isNew),
break; ChannelFolderType.PhotoAlbum => GetItemById<PhotoAlbum>(info.Id, channelProvider.Name, out isNew),
case ChannelFolderType.MusicArtist: ChannelFolderType.Series => GetItemById<Series>(info.Id, channelProvider.Name, out isNew),
item = GetItemById<MusicArtist>(info.Id, channelProvider.Name, out isNew); ChannelFolderType.Season => GetItemById<Season>(info.Id, channelProvider.Name, out isNew),
break; _ => GetItemById<Folder>(info.Id, channelProvider.Name, out isNew)
case ChannelFolderType.PhotoAlbum: };
item = GetItemById<PhotoAlbum>(info.Id, channelProvider.Name, out isNew);
break;
case ChannelFolderType.Series:
item = GetItemById<Series>(info.Id, channelProvider.Name, out isNew);
break;
case ChannelFolderType.Season:
item = GetItemById<Season>(info.Id, channelProvider.Name, out isNew);
break;
default:
item = GetItemById<Folder>(info.Id, channelProvider.Name, out isNew);
break;
}
} }
else if (info.MediaType == ChannelMediaType.Audio) else if (info.MediaType == ChannelMediaType.Audio)
{ {
@ -991,26 +980,14 @@ namespace Emby.Server.Implementations.Channels
} }
else else
{ {
switch (info.ContentType) item = info.ContentType switch
{ {
case ChannelMediaContentType.Episode: ChannelMediaContentType.Episode => GetItemById<Episode>(info.Id, channelProvider.Name, out isNew),
item = GetItemById<Episode>(info.Id, channelProvider.Name, out isNew); ChannelMediaContentType.Movie => GetItemById<Movie>(info.Id, channelProvider.Name, out isNew),
break; var x when x == ChannelMediaContentType.Trailer || info.ExtraType == ExtraType.Trailer
case ChannelMediaContentType.Movie: => GetItemById<Trailer>(info.Id, channelProvider.Name, out isNew),
item = GetItemById<Movie>(info.Id, channelProvider.Name, out isNew); _ => GetItemById<Video>(info.Id, channelProvider.Name, out isNew)
break; };
default:
if (info.ContentType == ChannelMediaContentType.Trailer || info.ExtraType == ExtraType.Trailer)
{
item = GetItemById<Trailer>(info.Id, channelProvider.Name, out isNew);
}
else
{
item = GetItemById<Video>(info.Id, channelProvider.Name, out isNew);
}
break;
}
} }
var enableMediaProbe = channelProvider is ISupportsMediaProbe; var enableMediaProbe = channelProvider is ISupportsMediaProbe;

View File

@ -10,8 +10,7 @@ using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Channels namespace Emby.Server.Implementations.Channels
{ {
/// <summary> /// <summary>
/// Channel post scan task. /// A task to remove all non-installed channels from the database.
/// This task removes all non-installed channels from the database.
/// </summary> /// </summary>
public class ChannelPostScanTask public class ChannelPostScanTask
{ {