Skip to content

Commit

Permalink
Merge pull request jellyfin#6042 from crobibero/mbc-warn-2
Browse files Browse the repository at this point in the history
  • Loading branch information
Bond-009 authored May 18, 2021
2 parents 19e9bef + b6dda30 commit 8d2e5ef
Show file tree
Hide file tree
Showing 53 changed files with 417 additions and 435 deletions.
2 changes: 1 addition & 1 deletion MediaBrowser.Controller/Channels/Channel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected override bool IsAllowTagFilterEnforced()

internal static bool IsChannelVisible(BaseItem channelItem, User user)
{
var channel = ChannelManager.GetChannel(channelItem.ChannelId.ToString(""));
var channel = ChannelManager.GetChannel(channelItem.ChannelId.ToString(string.Empty));

return channel.IsVisible(user);
}
Expand Down
28 changes: 24 additions & 4 deletions MediaBrowser.Controller/Channels/IChannelManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,42 +51,62 @@ public interface IChannelManager
/// Gets the channels internal.
/// </summary>
/// <param name="query">The query.</param>
/// <returns>The channels.</returns>
QueryResult<Channel> GetChannelsInternal(ChannelQuery query);

/// <summary>
/// Gets the channels.
/// </summary>
/// <param name="query">The query.</param>
/// <returns>The channels.</returns>
QueryResult<BaseItemDto> GetChannels(ChannelQuery query);

/// <summary>
/// Gets the latest media.
/// Gets the latest channel items.
/// </summary>
/// <param name="query">The item query.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The latest channels.</returns>
Task<QueryResult<BaseItemDto>> GetLatestChannelItems(InternalItemsQuery query, CancellationToken cancellationToken);

/// <summary>
/// Gets the latest media.
/// Gets the latest channel items.
/// </summary>
/// <param name="query">The item query.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The latest channels.</returns>
Task<QueryResult<BaseItem>> GetLatestChannelItemsInternal(InternalItemsQuery query, CancellationToken cancellationToken);

/// <summary>
/// Gets the channel items.
/// </summary>
/// <param name="query">The query.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The channel items.</returns>
Task<QueryResult<BaseItemDto>> GetChannelItems(InternalItemsQuery query, CancellationToken cancellationToken);

/// <summary>
/// Gets the channel items internal.
/// Gets the channel items.
/// </summary>
/// <param name="query">The query.</param>
/// <param name="progress">The progress to report to.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The channel items.</returns>
Task<QueryResult<BaseItem>> GetChannelItemsInternal(InternalItemsQuery query, IProgress<double> progress, CancellationToken cancellationToken);

/// <summary>
/// Gets the channel item media sources.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{IEnumerable{MediaSourceInfo}}.</returns>
/// <returns>The item media sources.</returns>
IEnumerable<MediaSourceInfo> GetStaticMediaSources(BaseItem item, CancellationToken cancellationToken);

/// <summary>
/// Whether the item supports media probe.
/// </summary>
/// <param name="item">The item.</param>
/// <returns>Whether media probe should be enabled.</returns>
bool EnableMediaProbe(BaseItem item);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma warning disable CS1591

namespace MediaBrowser.Controller.Channels
{
public interface IDisableMediaSourceDisplay
{
}
}
9 changes: 9 additions & 0 deletions MediaBrowser.Controller/Channels/IHasFolderAttributes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma warning disable CS1591

namespace MediaBrowser.Controller.Channels
{
public interface IHasFolderAttributes
{
string[] Attributes { get; }
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
#pragma warning disable CS1591

using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Dto;

namespace MediaBrowser.Controller.Channels
{
/// <summary>
/// The channel requires a media info callback.
/// </summary>
public interface IRequiresMediaInfoCallback
{
/// <summary>
/// Gets the channel item media information.
/// </summary>
/// <param name="id">The channel item id.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The enumerable of media source info.</returns>
Task<IEnumerable<MediaSourceInfo>> GetChannelItemMediaInfo(string id, CancellationToken cancellationToken);
}
}
32 changes: 0 additions & 32 deletions MediaBrowser.Controller/Channels/ISearchableChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Entities;

namespace MediaBrowser.Controller.Channels
{
Expand All @@ -19,35 +18,4 @@ public interface ISearchableChannel
/// <returns>Task{IEnumerable{ChannelItemInfo}}.</returns>
Task<IEnumerable<ChannelItemInfo>> Search(ChannelSearchInfo searchInfo, CancellationToken cancellationToken);
}

public interface ISupportsLatestMedia
{
/// <summary>
/// Gets the latest media.
/// </summary>
/// <param name="request">The request.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{IEnumerable{ChannelItemInfo}}.</returns>
Task<IEnumerable<ChannelItemInfo>> GetLatestMedia(ChannelLatestMediaSearch request, CancellationToken cancellationToken);
}

public interface ISupportsDelete
{
bool CanDelete(BaseItem item);

Task DeleteItem(string id, CancellationToken cancellationToken);
}

public interface IDisableMediaSourceDisplay
{
}

public interface ISupportsMediaProbe
{
}

public interface IHasFolderAttributes
{
string[] Attributes { get; }
}
}
15 changes: 15 additions & 0 deletions MediaBrowser.Controller/Channels/ISupportsDelete.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma warning disable CS1591

using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Entities;

namespace MediaBrowser.Controller.Channels
{
public interface ISupportsDelete
{
bool CanDelete(BaseItem item);

Task DeleteItem(string id, CancellationToken cancellationToken);
}
}
21 changes: 21 additions & 0 deletions MediaBrowser.Controller/Channels/ISupportsLatestMedia.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#nullable disable

#pragma warning disable CS1591

using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace MediaBrowser.Controller.Channels
{
public interface ISupportsLatestMedia
{
/// <summary>
/// Gets the latest media.
/// </summary>
/// <param name="request">The request.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The latest media.</returns>
Task<IEnumerable<ChannelItemInfo>> GetLatestMedia(ChannelLatestMediaSearch request, CancellationToken cancellationToken);
}
}
8 changes: 8 additions & 0 deletions MediaBrowser.Controller/Channels/ISupportsMediaProbe.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma warning disable CS1591

namespace MediaBrowser.Controller.Channels
{
public interface ISupportsMediaProbe
{
}
}
4 changes: 2 additions & 2 deletions MediaBrowser.Controller/Channels/InternalChannelFeatures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public InternalChannelFeatures()
public List<ChannelMediaContentType> ContentTypes { get; set; }

/// <summary>
/// Represents the maximum number of records the channel allows retrieving at a time.
/// Gets or sets the maximum number of records the channel allows retrieving at a time.
/// </summary>
public int? MaxPageSize { get; set; }

Expand All @@ -41,7 +41,7 @@ public InternalChannelFeatures()
public List<ChannelItemSortField> DefaultSortFields { get; set; }

/// <summary>
/// Indicates if a sort ascending/descending toggle is supported or not.
/// Gets or sets a value indicating whether a sort ascending/descending toggle is supported or not.
/// </summary>
public bool SupportsSortOrderToggle { get; set; }

Expand Down
4 changes: 3 additions & 1 deletion MediaBrowser.Controller/Devices/IDeviceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public interface IDeviceManager
/// </summary>
/// <param name="reportedId">The reported identifier.</param>
/// <param name="capabilities">The capabilities.</param>
/// <returns>Task.</returns>
void SaveCapabilities(string reportedId, ClientCapabilities capabilities);

/// <summary>
Expand All @@ -47,6 +46,9 @@ public interface IDeviceManager
/// <summary>
/// Determines whether this instance [can access device] the specified user identifier.
/// </summary>
/// <param name="user">The user to test.</param>
/// <param name="deviceId">The device id to test.</param>
/// <returns>Whether the user can access the device.</returns>
bool CanAccessDevice(User user, string deviceId);

void UpdateDeviceOptions(string deviceId, DeviceOptions options);
Expand Down
6 changes: 6 additions & 0 deletions MediaBrowser.Controller/Dto/IDtoService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,17 @@ public interface IDtoService
/// <param name="options">The options.</param>
/// <param name="user">The user.</param>
/// <param name="owner">The owner.</param>
/// <returns>The <see cref="IReadOnlyList{T}"/> of <see cref="BaseItemDto"/>.</returns>
IReadOnlyList<BaseItemDto> GetBaseItemDtos(IReadOnlyList<BaseItem> items, DtoOptions options, User user = null, BaseItem owner = null);

/// <summary>
/// Gets the item by name dto.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="options">The dto options.</param>
/// <param name="taggedItems">The list of tagged items.</param>
/// <param name="user">The user.</param>
/// <returns>The item dto.</returns>
BaseItemDto GetItemByNameDto(BaseItem item, DtoOptions options, List<BaseItem> taggedItems, User user = null);
}
}
8 changes: 4 additions & 4 deletions MediaBrowser.Controller/Entities/AggregateFolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
public class AggregateFolder : Folder
{
private bool _requiresRefresh;

public AggregateFolder()
{
PhysicalLocationsList = Array.Empty<string>();
Expand Down Expand Up @@ -85,8 +87,6 @@ private void ClearCache()
}
}

private bool _requiresRefresh;

public override bool RequiresRefresh()
{
var changed = base.RequiresRefresh() || _requiresRefresh;
Expand All @@ -106,11 +106,11 @@ public override bool RequiresRefresh()
return changed;
}

public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{
ClearCache();

var changed = base.BeforeMetadataRefresh(replaceAllMetdata) || _requiresRefresh;
var changed = base.BeforeMetadataRefresh(replaceAllMetadata) || _requiresRefresh;
_requiresRefresh = false;
return changed;
}
Expand Down
4 changes: 2 additions & 2 deletions MediaBrowser.Controller/Entities/Audio/MusicArtist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ public override bool RequiresRefresh()
/// <summary>
/// This is called before any metadata refresh and returns true or false indicating if changes were made.
/// </summary>
public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{
var hasChanges = base.BeforeMetadataRefresh(replaceAllMetdata);
var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);

if (IsAccessedByName)
{
Expand Down
6 changes: 3 additions & 3 deletions MediaBrowser.Controller/Entities/Audio/MusicGenre.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public override string CreatePresentationUniqueKey()
public override bool IsDisplayedAsFolder => true;

/// <summary>
/// Returns the folder containing the item.
/// Gets the folder containing the item.
/// If the item is a folder, it returns the folder itself.
/// </summary>
/// <value>The containing folder path.</value>
Expand Down Expand Up @@ -106,9 +106,9 @@ public override bool RequiresRefresh()
/// <summary>
/// This is called before any metadata refresh and returns true or false indicating if changes were made.
/// </summary>
public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{
var hasChanges = base.BeforeMetadataRefresh(replaceAllMetdata);
var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);

var newPath = GetRebasedPath();
if (!string.Equals(Path, newPath, StringComparison.Ordinal))
Expand Down
Loading

0 comments on commit 8d2e5ef

Please sign in to comment.