Remove warninigs from MediaBrowser.Controller (Part 3) (#6078)

Co-authored-by: Bond-009 <bond.009@outlook.com>
This commit is contained in:
Cody Robibero 2021-06-06 09:16:41 -06:00 committed by GitHub
parent 9154f20b34
commit d461e3912a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 183 additions and 136 deletions

View File

@ -1065,17 +1065,17 @@ namespace Emby.Server.Implementations.Library
// Start by just validating the children of the root, but go no further // Start by just validating the children of the root, but go no further
await RootFolder.ValidateChildren( await RootFolder.ValidateChildren(
new SimpleProgress<double>(), new SimpleProgress<double>(),
cancellationToken,
new MetadataRefreshOptions(new DirectoryService(_fileSystem)), new MetadataRefreshOptions(new DirectoryService(_fileSystem)),
recursive: false).ConfigureAwait(false); recursive: false,
cancellationToken).ConfigureAwait(false);
await GetUserRootFolder().RefreshMetadata(cancellationToken).ConfigureAwait(false); await GetUserRootFolder().RefreshMetadata(cancellationToken).ConfigureAwait(false);
await GetUserRootFolder().ValidateChildren( await GetUserRootFolder().ValidateChildren(
new SimpleProgress<double>(), new SimpleProgress<double>(),
cancellationToken,
new MetadataRefreshOptions(new DirectoryService(_fileSystem)), new MetadataRefreshOptions(new DirectoryService(_fileSystem)),
recursive: false).ConfigureAwait(false); recursive: false,
cancellationToken).ConfigureAwait(false);
// Quickly scan CollectionFolders for changes // Quickly scan CollectionFolders for changes
foreach (var folder in GetUserRootFolder().Children.OfType<Folder>()) foreach (var folder in GetUserRootFolder().Children.OfType<Folder>())
@ -1095,7 +1095,7 @@ namespace Emby.Server.Implementations.Library
innerProgress.RegisterAction(pct => progress.Report(pct * 0.96)); innerProgress.RegisterAction(pct => progress.Report(pct * 0.96));
// Validate the entire media library // Validate the entire media library
await RootFolder.ValidateChildren(innerProgress, cancellationToken, new MetadataRefreshOptions(new DirectoryService(_fileSystem)), recursive: true).ConfigureAwait(false); await RootFolder.ValidateChildren(innerProgress, new MetadataRefreshOptions(new DirectoryService(_fileSystem)), recursive: true, cancellationToken).ConfigureAwait(false);
progress.Report(96); progress.Report(96);

View File

@ -1,7 +1,13 @@
#pragma warning disable CS1591 #pragma warning disable CA1040 // Avoid empty interfaces
namespace MediaBrowser.Controller.Channels namespace MediaBrowser.Controller.Channels
{ {
/// <summary>
/// Disable media source display.
/// </summary>
/// <remarks>
/// <see cref="Channel"/> can inherit this interface to disable being displayed.
/// </remarks>
public interface IDisableMediaSourceDisplay public interface IDisableMediaSourceDisplay
{ {
} }

View File

@ -1,7 +1,10 @@
#pragma warning disable CS1591 #pragma warning disable CA1040 // Avoid empty interfaces
namespace MediaBrowser.Controller.Channels namespace MediaBrowser.Controller.Channels
{ {
/// <summary>
/// Channel supports media probe.
/// </summary>
public interface ISupportsMediaProbe public interface ISupportsMediaProbe
{ {
} }

View File

@ -155,11 +155,11 @@ namespace MediaBrowser.Controller.Entities
return base.GetNonCachedChildren(directoryService).Concat(_virtualChildren); return base.GetNonCachedChildren(directoryService).Concat(_virtualChildren);
} }
protected override async Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService) protected override async Task ValidateChildrenInternal(IProgress<double> progress, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
{ {
ClearCache(); ClearCache();
await base.ValidateChildrenInternal(progress, cancellationToken, recursive, refreshChildMetadata, refreshOptions, directoryService) await base.ValidateChildrenInternal(progress, recursive, refreshChildMetadata, refreshOptions, directoryService, cancellationToken)
.ConfigureAwait(false); .ConfigureAwait(false);
ClearCache(); ClearCache();
@ -185,7 +185,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary> /// </summary>
/// <param name="id">The id.</param> /// <param name="id">The id.</param>
/// <returns>BaseItem.</returns> /// <returns>BaseItem.</returns>
/// <exception cref="ArgumentNullException">id</exception> /// <exception cref="ArgumentNullException">The id is empty.</exception>
public BaseItem FindVirtualChild(Guid id) public BaseItem FindVirtualChild(Guid id)
{ {
if (id.Equals(Guid.Empty)) if (id.Equals(Guid.Empty))

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using Jellyfin.Data.Enums; using Jellyfin.Data.Enums;
@ -82,19 +83,19 @@ namespace MediaBrowser.Controller.Entities.Audio
/// <returns>System.String.</returns> /// <returns>System.String.</returns>
protected override string CreateSortName() protected override string CreateSortName()
{ {
return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ") : "") return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ", CultureInfo.InvariantCulture) : string.Empty)
+ (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name; + (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ", CultureInfo.InvariantCulture) : string.Empty) + Name;
} }
public override List<string> GetUserDataKeys() public override List<string> GetUserDataKeys()
{ {
var list = base.GetUserDataKeys(); var list = base.GetUserDataKeys();
var songKey = IndexNumber.HasValue ? IndexNumber.Value.ToString("0000") : string.Empty; var songKey = IndexNumber.HasValue ? IndexNumber.Value.ToString("0000", CultureInfo.InvariantCulture) : string.Empty;
if (ParentIndexNumber.HasValue) if (ParentIndexNumber.HasValue)
{ {
songKey = ParentIndexNumber.Value.ToString("0000") + "-" + songKey; songKey = ParentIndexNumber.Value.ToString("0000", CultureInfo.InvariantCulture) + "-" + songKey;
} }
songKey += Name; songKey += Name;

View File

@ -94,7 +94,7 @@ namespace MediaBrowser.Controller.Entities.Audio
return base.IsSaveLocalMetadataEnabled(); return base.IsSaveLocalMetadataEnabled();
} }
protected override Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService) protected override Task ValidateChildrenInternal(IProgress<double> progress, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
{ {
if (IsAccessedByName) if (IsAccessedByName)
{ {
@ -102,7 +102,7 @@ namespace MediaBrowser.Controller.Entities.Audio
return Task.CompletedTask; return Task.CompletedTask;
} }
return base.ValidateChildrenInternal(progress, cancellationToken, recursive, refreshChildMetadata, refreshOptions, directoryService); return base.ValidateChildrenInternal(progress, recursive, refreshChildMetadata, refreshOptions, directoryService, cancellationToken);
} }
public override List<string> GetUserDataKeys() public override List<string> GetUserDataKeys()

View File

@ -620,7 +620,11 @@ namespace MediaBrowser.Controller.Entities
public string ForcedSortName public string ForcedSortName
{ {
get => _forcedSortName; get => _forcedSortName;
set { _forcedSortName = value; _sortName = null; } set
{
_forcedSortName = value;
_sortName = null;
}
} }
private string _sortName; private string _sortName;
@ -1337,7 +1341,7 @@ namespace MediaBrowser.Controller.Entities
} }
// Use some hackery to get the extra type based on foldername // Use some hackery to get the extra type based on foldername
item.ExtraType = Enum.TryParse(extraFolderName.Replace(" ", string.Empty), true, out ExtraType extraType) item.ExtraType = Enum.TryParse(extraFolderName.Replace(" ", string.Empty, StringComparison.Ordinal), true, out ExtraType extraType)
? extraType ? extraType
: Model.Entities.ExtraType.Unknown; : Model.Entities.ExtraType.Unknown;
@ -1427,10 +1431,10 @@ namespace MediaBrowser.Controller.Entities
/// Refreshes owned items such as trailers, theme videos, special features, etc. /// Refreshes owned items such as trailers, theme videos, special features, etc.
/// Returns true or false indicating if changes were found. /// Returns true or false indicating if changes were found.
/// </summary> /// </summary>
/// <param name="options"></param> /// <param name="options">The metadata refresh options.</param>
/// <param name="fileSystemChildren"></param> /// <param name="fileSystemChildren">The list of filesystem children.</param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns> /// <returns><c>true</c> if any items have changed, else <c>false</c>.</returns>
protected virtual async Task<bool> RefreshedOwnedItems(MetadataRefreshOptions options, List<FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken) protected virtual async Task<bool> RefreshedOwnedItems(MetadataRefreshOptions options, List<FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken)
{ {
var themeSongsChanged = false; var themeSongsChanged = false;
@ -1772,7 +1776,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary> /// </summary>
/// <param name="user">The user.</param> /// <param name="user">The user.</param>
/// <returns><c>true</c> if [is parental allowed] [the specified user]; otherwise, <c>false</c>.</returns> /// <returns><c>true</c> if [is parental allowed] [the specified user]; otherwise, <c>false</c>.</returns>
/// <exception cref="ArgumentNullException">user</exception> /// <exception cref="ArgumentNullException">If user is null.</exception>
public bool IsParentalAllowed(User user) public bool IsParentalAllowed(User user)
{ {
if (user == null) if (user == null)
@ -1917,7 +1921,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary> /// </summary>
/// <param name="user">The user.</param> /// <param name="user">The user.</param>
/// <returns><c>true</c> if the specified user is visible; otherwise, <c>false</c>.</returns> /// <returns><c>true</c> if the specified user is visible; otherwise, <c>false</c>.</returns>
/// <exception cref="ArgumentNullException">user</exception> /// <exception cref="ArgumentNullException"><paramref name="user" /> is <c>null</c>.</exception>
public virtual bool IsVisible(User user) public virtual bool IsVisible(User user)
{ {
if (user == null) if (user == null)
@ -2215,7 +2219,7 @@ namespace MediaBrowser.Controller.Entities
/// <param name="type">The type.</param> /// <param name="type">The type.</param>
/// <param name="imageIndex">Index of the image.</param> /// <param name="imageIndex">Index of the image.</param>
/// <returns><c>true</c> if the specified type has image; otherwise, <c>false</c>.</returns> /// <returns><c>true</c> if the specified type has image; otherwise, <c>false</c>.</returns>
/// <exception cref="ArgumentException">Backdrops should be accessed using Item.Backdrops</exception> /// <exception cref="ArgumentException">Backdrops should be accessed using Item.Backdrops.</exception>
public bool HasImage(ImageType type, int imageIndex) public bool HasImage(ImageType type, int imageIndex)
{ {
return GetImageInfo(type, imageIndex) != null; return GetImageInfo(type, imageIndex) != null;
@ -2344,9 +2348,8 @@ namespace MediaBrowser.Controller.Entities
/// <param name="imageType">Type of the image.</param> /// <param name="imageType">Type of the image.</param>
/// <param name="imageIndex">Index of the image.</param> /// <param name="imageIndex">Index of the image.</param>
/// <returns>System.String.</returns> /// <returns>System.String.</returns>
/// <exception cref="InvalidOperationException"> /// <exception cref="InvalidOperationException"> </exception>
/// </exception> /// <exception cref="ArgumentNullException">Item is null.</exception>
/// <exception cref="ArgumentNullException">item</exception>
public string GetImagePath(ImageType imageType, int imageIndex) public string GetImagePath(ImageType imageType, int imageIndex)
=> GetImageInfo(imageType, imageIndex)?.Path; => GetImageInfo(imageType, imageIndex)?.Path;
@ -2442,7 +2445,7 @@ namespace MediaBrowser.Controller.Entities
/// <param name="imageType">Type of the image.</param> /// <param name="imageType">Type of the image.</param>
/// <param name="images">The images.</param> /// <param name="images">The images.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
/// <exception cref="ArgumentException">Cannot call AddImages with chapter images</exception> /// <exception cref="ArgumentException">Cannot call AddImages with chapter images.</exception>
public bool AddImages(ImageType imageType, List<FileSystemMetadata> images) public bool AddImages(ImageType imageType, List<FileSystemMetadata> images)
{ {
if (imageType == ImageType.Chapter) if (imageType == ImageType.Chapter)
@ -2526,10 +2529,11 @@ namespace MediaBrowser.Controller.Entities
/// <summary> /// <summary>
/// Gets the file system path to delete when the item is to be deleted. /// Gets the file system path to delete when the item is to be deleted.
/// </summary> /// </summary>
/// <returns></returns> /// <returns>The metadata for the deleted paths.</returns>
public virtual IEnumerable<FileSystemMetadata> GetDeletePaths() public virtual IEnumerable<FileSystemMetadata> GetDeletePaths()
{ {
return new[] { return new[]
{
new FileSystemMetadata new FileSystemMetadata
{ {
FullName = Path, FullName = Path,
@ -2889,7 +2893,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary> /// <summary>
/// Updates the official rating based on content and returns true or false indicating if it changed. /// Updates the official rating based on content and returns true or false indicating if it changed.
/// </summary> /// </summary>
/// <returns></returns> /// <returns><c>true</c> if the rating was updated; otherwise <c>false</c>.</returns>
public bool UpdateRatingToItems(IList<BaseItem> children) public bool UpdateRatingToItems(IList<BaseItem> children)
{ {
var currentOfficialRating = OfficialRating; var currentOfficialRating = OfficialRating;
@ -2905,7 +2909,9 @@ namespace MediaBrowser.Controller.Entities
OfficialRating = ratings.FirstOrDefault() ?? currentOfficialRating; OfficialRating = ratings.FirstOrDefault() ?? currentOfficialRating;
return !string.Equals(currentOfficialRating ?? string.Empty, OfficialRating ?? string.Empty, return !string.Equals(
currentOfficialRating ?? string.Empty,
OfficialRating ?? string.Empty,
StringComparison.OrdinalIgnoreCase); StringComparison.OrdinalIgnoreCase);
} }
@ -3002,7 +3008,7 @@ namespace MediaBrowser.Controller.Entities
} }
/// <inheritdoc /> /// <inheritdoc />
public bool Equals(BaseItem item) => Object.Equals(Id, item?.Id); public bool Equals(BaseItem other) => object.Equals(Id, other?.Id);
/// <inheritdoc /> /// <inheritdoc />
public override int GetHashCode() => HashCode.Combine(Id); public override int GetHashCode() => HashCode.Combine(Id);

View File

@ -315,16 +315,16 @@ namespace MediaBrowser.Controller.Entities
/// <summary> /// <summary>
/// Compare our current children (presumably just read from the repo) with the current state of the file system and adjust for any changes /// Compare our current children (presumably just read from the repo) with the current state of the file system and adjust for any changes
/// ***Currently does not contain logic to maintain items that are unavailable in the file system*** /// ***Currently does not contain logic to maintain items that are unavailable in the file system***.
/// </summary> /// </summary>
/// <param name="progress">The progress.</param> /// <param name="progress">The progress.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <param name="recursive">if set to <c>true</c> [recursive].</param> /// <param name="recursive">if set to <c>true</c> [recursive].</param>
/// <param name="refreshChildMetadata">if set to <c>true</c> [refresh child metadata].</param> /// <param name="refreshChildMetadata">if set to <c>true</c> [refresh child metadata].</param>
/// <param name="refreshOptions">The refresh options.</param> /// <param name="refreshOptions">The refresh options.</param>
/// <param name="directoryService">The directory service.</param> /// <param name="directoryService">The directory service.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns> /// <returns>Task.</returns>
protected override Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService) protected override Task ValidateChildrenInternal(IProgress<double> progress, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
{ {
return Task.CompletedTask; return Task.CompletedTask;
} }

View File

@ -207,8 +207,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary> /// </summary>
/// <param name="item">The item.</param> /// <param name="item">The item.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns> /// <exception cref="InvalidOperationException">Unable to add + item.Name.</exception>
/// <exception cref="InvalidOperationException">Unable to add + item.Name</exception>
public void AddChild(BaseItem item, CancellationToken cancellationToken) public void AddChild(BaseItem item, CancellationToken cancellationToken)
{ {
item.SetParent(this); item.SetParent(this);
@ -274,20 +273,20 @@ namespace MediaBrowser.Controller.Entities
public Task ValidateChildren(IProgress<double> progress, CancellationToken cancellationToken) public Task ValidateChildren(IProgress<double> progress, CancellationToken cancellationToken)
{ {
return ValidateChildren(progress, cancellationToken, new MetadataRefreshOptions(new DirectoryService(FileSystem))); return ValidateChildren(progress, new MetadataRefreshOptions(new DirectoryService(FileSystem)), cancellationToken: cancellationToken);
} }
/// <summary> /// <summary>
/// Validates that the children of the folder still exist. /// Validates that the children of the folder still exist.
/// </summary> /// </summary>
/// <param name="progress">The progress.</param> /// <param name="progress">The progress.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <param name="metadataRefreshOptions">The metadata refresh options.</param> /// <param name="metadataRefreshOptions">The metadata refresh options.</param>
/// <param name="recursive">if set to <c>true</c> [recursive].</param> /// <param name="recursive">if set to <c>true</c> [recursive].</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns> /// <returns>Task.</returns>
public Task ValidateChildren(IProgress<double> progress, CancellationToken cancellationToken, MetadataRefreshOptions metadataRefreshOptions, bool recursive = true) public Task ValidateChildren(IProgress<double> progress, MetadataRefreshOptions metadataRefreshOptions, bool recursive = true, CancellationToken cancellationToken = default)
{ {
return ValidateChildrenInternal(progress, cancellationToken, recursive, true, metadataRefreshOptions, metadataRefreshOptions.DirectoryService); return ValidateChildrenInternal(progress, recursive, true, metadataRefreshOptions, metadataRefreshOptions.DirectoryService, cancellationToken);
} }
private Dictionary<Guid, BaseItem> GetActualChildrenDictionary() private Dictionary<Guid, BaseItem> GetActualChildrenDictionary()
@ -327,13 +326,13 @@ namespace MediaBrowser.Controller.Entities
/// Validates the children internal. /// Validates the children internal.
/// </summary> /// </summary>
/// <param name="progress">The progress.</param> /// <param name="progress">The progress.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <param name="recursive">if set to <c>true</c> [recursive].</param> /// <param name="recursive">if set to <c>true</c> [recursive].</param>
/// <param name="refreshChildMetadata">if set to <c>true</c> [refresh child metadata].</param> /// <param name="refreshChildMetadata">if set to <c>true</c> [refresh child metadata].</param>
/// <param name="refreshOptions">The refresh options.</param> /// <param name="refreshOptions">The refresh options.</param>
/// <param name="directoryService">The directory service.</param> /// <param name="directoryService">The directory service.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns> /// <returns>Task.</returns>
protected virtual async Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService) protected virtual async Task ValidateChildrenInternal(IProgress<double> progress, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
{ {
if (recursive) if (recursive)
{ {
@ -342,7 +341,7 @@ namespace MediaBrowser.Controller.Entities
try try
{ {
await ValidateChildrenInternal2(progress, cancellationToken, recursive, refreshChildMetadata, refreshOptions, directoryService).ConfigureAwait(false); await ValidateChildrenInternal2(progress, recursive, refreshChildMetadata, refreshOptions, directoryService, cancellationToken).ConfigureAwait(false);
} }
finally finally
{ {
@ -353,7 +352,7 @@ namespace MediaBrowser.Controller.Entities
} }
} }
private async Task ValidateChildrenInternal2(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService) private async Task ValidateChildrenInternal2(IProgress<double> progress, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
{ {
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
@ -575,7 +574,7 @@ namespace MediaBrowser.Controller.Entities
private Task ValidateSubFolders(IList<Folder> children, IDirectoryService directoryService, IProgress<double> progress, CancellationToken cancellationToken) private Task ValidateSubFolders(IList<Folder> children, IDirectoryService directoryService, IProgress<double> progress, CancellationToken cancellationToken)
{ {
return RunTasks( return RunTasks(
(folder, innerProgress) => folder.ValidateChildrenInternal(innerProgress, cancellationToken, true, false, null, directoryService), (folder, innerProgress) => folder.ValidateChildrenInternal(innerProgress, true, false, null, directoryService, cancellationToken),
children, children,
progress, progress,
cancellationToken); cancellationToken);
@ -1013,7 +1012,7 @@ namespace MediaBrowser.Controller.Entities
if (!string.IsNullOrEmpty(query.NameStartsWith)) if (!string.IsNullOrEmpty(query.NameStartsWith))
{ {
items = items.Where(i => i.SortName.StartsWith(query.NameStartsWith, StringComparison.OrdinalIgnoreCase)); items = items.Where(i => i.SortName.StartsWith(query.NameStartsWith, StringComparison.CurrentCultureIgnoreCase));
} }
if (!string.IsNullOrEmpty(query.NameLessThan)) if (!string.IsNullOrEmpty(query.NameLessThan))
@ -1324,7 +1323,6 @@ namespace MediaBrowser.Controller.Entities
/// <summary> /// <summary>
/// Adds the children to list. /// Adds the children to list.
/// </summary> /// </summary>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
private void AddChildren(User user, bool includeLinkedChildren, Dictionary<Guid, BaseItem> result, bool recursive, InternalItemsQuery query) private void AddChildren(User user, bool includeLinkedChildren, Dictionary<Guid, BaseItem> result, bool recursive, InternalItemsQuery query)
{ {
foreach (var child in GetEligibleChildrenForRecursiveChildren(user)) foreach (var child in GetEligibleChildrenForRecursiveChildren(user))
@ -1596,7 +1594,8 @@ namespace MediaBrowser.Controller.Entities
/// <summary> /// <summary>
/// Refreshes the linked children. /// Refreshes the linked children.
/// </summary> /// </summary>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns> /// <param name="fileSystemChildren">The enumerable of file system metadata.</param>
/// <returns><c>true</c> if the linked children were updated, <c>false</c> otherwise.</returns>
protected virtual bool RefreshLinkedChildren(IEnumerable<FileSystemMetadata> fileSystemChildren) protected virtual bool RefreshLinkedChildren(IEnumerable<FileSystemMetadata> fileSystemChildren)
{ {
if (SupportsShortcutChildren) if (SupportsShortcutChildren)

View File

@ -107,7 +107,11 @@ namespace MediaBrowser.Controller.Entities
return base.RequiresRefresh(); return base.RequiresRefresh();
} }
/// <inheridoc /> /// <summary>
/// This is called before any metadata refresh and returns true if changes were made.
/// </summary>
/// <param name="replaceAllMetadata">Whether to replace all metadata.</param>
/// <returns>true if the item has change, else false.</returns>
public override bool BeforeMetadataRefresh(bool replaceAllMetadata) public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{ {
var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata); var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);

View File

@ -1,7 +1,9 @@
#pragma warning disable CA1040 // Avoid empty interfaces
namespace MediaBrowser.Controller.Entities namespace MediaBrowser.Controller.Entities
{ {
/// <summary> /// <summary>
/// Interface IHasScreenshots. /// The item has screenshots.
/// </summary> /// </summary>
public interface IHasScreenshots public interface IHasScreenshots
{ {

View File

@ -1,3 +1,5 @@
#pragma warning disable CA1040 // Avoid empty interfaces
namespace MediaBrowser.Controller.Entities namespace MediaBrowser.Controller.Entities
{ {
/// <summary> /// <summary>

View File

@ -2,6 +2,7 @@
#pragma warning disable CS1591 #pragma warning disable CS1591
using System;
using System.Collections.Generic; using System.Collections.Generic;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
@ -28,7 +29,7 @@ namespace MediaBrowser.Controller.Entities
public int GetHashCode(LinkedChild obj) public int GetHashCode(LinkedChild obj)
{ {
return ((obj.Path ?? string.Empty) + (obj.LibraryItemId ?? string.Empty) + obj.Type).GetHashCode(); return ((obj.Path ?? string.Empty) + (obj.LibraryItemId ?? string.Empty) + obj.Type).GetHashCode(StringComparison.Ordinal);
} }
} }
} }

View File

@ -218,8 +218,8 @@ namespace MediaBrowser.Controller.Entities.TV
/// <returns>System.String.</returns> /// <returns>System.String.</returns>
protected override string CreateSortName() protected override string CreateSortName()
{ {
return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("000 - ") : "") return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("000 - ", CultureInfo.InvariantCulture) : string.Empty)
+ (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name; + (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ", CultureInfo.InvariantCulture) : string.Empty) + Name;
} }
/// <summary> /// <summary>
@ -287,7 +287,8 @@ namespace MediaBrowser.Controller.Entities.TV
public override IEnumerable<FileSystemMetadata> GetDeletePaths() public override IEnumerable<FileSystemMetadata> GetDeletePaths()
{ {
return new[] { return new[]
{
new FileSystemMetadata new FileSystemMetadata
{ {
FullName = Path, FullName = Path,

View File

@ -122,7 +122,7 @@ namespace MediaBrowser.Controller.Entities.TV
var series = Series; var series = Series;
if (series != null) if (series != null)
{ {
return series.PresentationUniqueKey + "-" + (IndexNumber ?? 0).ToString("000"); return series.PresentationUniqueKey + "-" + (IndexNumber ?? 0).ToString("000", CultureInfo.InvariantCulture);
} }
} }
@ -135,7 +135,7 @@ namespace MediaBrowser.Controller.Entities.TV
/// <returns>System.String.</returns> /// <returns>System.String.</returns>
protected override string CreateSortName() protected override string CreateSortName()
{ {
return IndexNumber != null ? IndexNumber.Value.ToString("0000") : Name; return IndexNumber != null ? IndexNumber.Value.ToString("0000", CultureInfo.InvariantCulture) : Name;
} }
protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query) protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query)

View File

@ -109,11 +109,11 @@ namespace MediaBrowser.Controller.Entities
return base.GetNonCachedChildren(directoryService); return base.GetNonCachedChildren(directoryService);
} }
protected override async Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService) protected override async Task ValidateChildrenInternal(IProgress<double> progress, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
{ {
ClearCache(); ClearCache();
await base.ValidateChildrenInternal(progress, cancellationToken, recursive, refreshChildMetadata, refreshOptions, directoryService) await base.ValidateChildrenInternal(progress, recursive, refreshChildMetadata, refreshOptions, directoryService, cancellationToken)
.ConfigureAwait(false); .ConfigureAwait(false);
ClearCache(); ClearCache();

View File

@ -172,7 +172,7 @@ namespace MediaBrowser.Controller.Entities
return OriginalFolderViewTypes.Contains(viewType ?? string.Empty, StringComparer.OrdinalIgnoreCase); return OriginalFolderViewTypes.Contains(viewType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
} }
protected override Task ValidateChildrenInternal(IProgress<double> progress, System.Threading.CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, Providers.MetadataRefreshOptions refreshOptions, Providers.IDirectoryService directoryService) protected override Task ValidateChildrenInternal(IProgress<double> progress, bool recursive, bool refreshChildMetadata, Providers.MetadataRefreshOptions refreshOptions, Providers.IDirectoryService directoryService, System.Threading.CancellationToken cancellationToken)
{ {
return Task.CompletedTask; return Task.CompletedTask;
} }

View File

@ -55,12 +55,12 @@ namespace MediaBrowser.Controller.Entities
// if (query.IncludeItemTypes != null && // if (query.IncludeItemTypes != null &&
// query.IncludeItemTypes.Length == 1 && // query.IncludeItemTypes.Length == 1 &&
// string.Equals(query.IncludeItemTypes[0], "Playlist", StringComparison.OrdinalIgnoreCase)) // string.Equals(query.IncludeItemTypes[0], "Playlist", StringComparison.OrdinalIgnoreCase))
//{ // {
// if (!string.Equals(viewType, CollectionType.Playlists, StringComparison.OrdinalIgnoreCase)) // if (!string.Equals(viewType, CollectionType.Playlists, StringComparison.OrdinalIgnoreCase))
// { // {
// return await FindPlaylists(queryParent, user, query).ConfigureAwait(false); // return await FindPlaylists(queryParent, user, query).ConfigureAwait(false);
// } // }
//} // }
switch (viewType) switch (viewType)
{ {
@ -344,12 +344,14 @@ namespace MediaBrowser.Controller.Entities
var parentFolders = GetMediaFolders(parent, query.User, new[] { CollectionType.TvShows, string.Empty }); var parentFolders = GetMediaFolders(parent, query.User, new[] { CollectionType.TvShows, string.Empty });
var result = _tvSeriesManager.GetNextUp( var result = _tvSeriesManager.GetNextUp(
new NextUpQuery new NextUpQuery
{ {
Limit = query.Limit, Limit = query.Limit,
StartIndex = query.StartIndex, StartIndex = query.StartIndex,
UserId = query.User.Id UserId = query.User.Id
}, parentFolders, query.DtoOptions); },
parentFolders,
query.DtoOptions);
return result; return result;
} }

View File

@ -482,7 +482,8 @@ namespace MediaBrowser.Controller.Entities
{ {
if (!IsInMixedFolder) if (!IsInMixedFolder)
{ {
return new[] { return new[]
{
new FileSystemMetadata new FileSystemMetadata
{ {
FullName = ContainingFolderPath, FullName = ContainingFolderPath,

View File

@ -24,7 +24,7 @@ namespace MediaBrowser.Controller.IO
/// <param name="flattenFolderDepth">The flatten folder depth.</param> /// <param name="flattenFolderDepth">The flatten folder depth.</param>
/// <param name="resolveShortcuts">if set to <c>true</c> [resolve shortcuts].</param> /// <param name="resolveShortcuts">if set to <c>true</c> [resolve shortcuts].</param>
/// <returns>Dictionary{System.StringFileSystemInfo}.</returns> /// <returns>Dictionary{System.StringFileSystemInfo}.</returns>
/// <exception cref="ArgumentNullException">path</exception> /// <exception cref="ArgumentNullException"><paramref name="path" /> is <c>null</c> or empty.</exception>
public static FileSystemMetadata[] GetFilteredFileSystemEntries( public static FileSystemMetadata[] GetFilteredFileSystemEntries(
IDirectoryService directoryService, IDirectoryService directoryService,
string path, string path,

View File

@ -352,6 +352,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="viewType">Type of the view.</param> /// <param name="viewType">Type of the view.</param>
/// <param name="sortName">Name of the sort.</param> /// <param name="sortName">Name of the sort.</param>
/// <param name="uniqueId">The unique identifier.</param> /// <param name="uniqueId">The unique identifier.</param>
/// <returns>The named view.</returns>
UserView GetNamedView( UserView GetNamedView(
string name, string name,
Guid parentId, Guid parentId,
@ -365,10 +366,11 @@ namespace MediaBrowser.Controller.Library
/// <param name="parent">The parent.</param> /// <param name="parent">The parent.</param>
/// <param name="viewType">Type of the view.</param> /// <param name="viewType">Type of the view.</param>
/// <param name="sortName">Name of the sort.</param> /// <param name="sortName">Name of the sort.</param>
/// <returns>The shadow view.</returns>
UserView GetShadowView( UserView GetShadowView(
BaseItem parent, BaseItem parent,
string viewType, string viewType,
string sortName); string sortName);
/// <summary> /// <summary>
/// Determines whether [is video file] [the specified path]. /// Determines whether [is video file] [the specified path].

View File

@ -49,17 +49,16 @@ namespace MediaBrowser.Controller.Library
/// <summary> /// <summary>
/// Get all user data for the given user. /// Get all user data for the given user.
/// </summary> /// </summary>
/// <param name="userId"></param> /// <param name="userId">The user id.</param>
/// <returns></returns> /// <returns>The user item data.</returns>
List<UserItemData> GetAllUserData(Guid userId); List<UserItemData> GetAllUserData(Guid userId);
/// <summary> /// <summary>
/// Save the all provided user data for the given user. /// Save the all provided user data for the given user.
/// </summary> /// </summary>
/// <param name="userId"></param> /// <param name="userId">The user id.</param>
/// <param name="userData"></param> /// <param name="userData">The array of user data.</param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
void SaveAllUserData(Guid userId, UserItemData[] userData, CancellationToken cancellationToken); void SaveAllUserData(Guid userId, UserItemData[] userData, CancellationToken cancellationToken);
/// <summary> /// <summary>

View File

@ -61,16 +61,16 @@ namespace MediaBrowser.Controller.Library
/// <param name="user">The user.</param> /// <param name="user">The user.</param>
/// <param name="newName">The new name.</param> /// <param name="newName">The new name.</param>
/// <returns>Task.</returns> /// <returns>Task.</returns>
/// <exception cref="ArgumentNullException">user</exception> /// <exception cref="ArgumentNullException">If user is <c>null</c>.</exception>
/// <exception cref="ArgumentException"></exception> /// <exception cref="ArgumentException">If the provided user doesn't exist.</exception>
Task RenameUser(User user, string newName); Task RenameUser(User user, string newName);
/// <summary> /// <summary>
/// Updates the user. /// Updates the user.
/// </summary> /// </summary>
/// <param name="user">The user.</param> /// <param name="user">The user.</param>
/// <exception cref="ArgumentNullException">user</exception> /// <exception cref="ArgumentNullException">If user is <c>null</c>.</exception>
/// <exception cref="ArgumentException"></exception> /// <exception cref="ArgumentException">If the provided user doesn't exist.</exception>
void UpdateUser(User user); void UpdateUser(User user);
/// <summary> /// <summary>
@ -87,8 +87,8 @@ namespace MediaBrowser.Controller.Library
/// </summary> /// </summary>
/// <param name="name">The name of the new user.</param> /// <param name="name">The name of the new user.</param>
/// <returns>The created user.</returns> /// <returns>The created user.</returns>
/// <exception cref="ArgumentNullException">name</exception> /// <exception cref="ArgumentNullException"><paramref name="name"/> is <c>null</c> or empty.</exception>
/// <exception cref="ArgumentException"></exception> /// <exception cref="ArgumentException"><paramref name="name"/> already exists.</exception>
Task<User> CreateUserAsync(string name); Task<User> CreateUserAsync(string name);
/// <summary> /// <summary>

View File

@ -39,7 +39,7 @@ namespace MediaBrowser.Controller.Library
public IDirectoryService DirectoryService { get; } public IDirectoryService DirectoryService { get; }
/// <summary> /// <summary>
/// Gets the file system children. /// Gets or sets the file system children.
/// </summary> /// </summary>
/// <value>The file system children.</value> /// <value>The file system children.</value>
public FileSystemMetadata[] FileSystemChildren { get; set; } public FileSystemMetadata[] FileSystemChildren { get; set; }
@ -242,14 +242,14 @@ namespace MediaBrowser.Controller.Library
/// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.</returns> /// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.</returns>
public override int GetHashCode() public override int GetHashCode()
{ {
return Path.GetHashCode(); return Path.GetHashCode(StringComparison.Ordinal);
} }
/// <summary> /// <summary>
/// Equals the specified args. /// Equals the specified args.
/// </summary> /// </summary>
/// <param name="args">The args.</param> /// <param name="args">The args.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns> /// <returns><c>true</c> if the arguments are the same, <c>false</c> otherwise.</returns>
protected bool Equals(ItemResolveArgs args) protected bool Equals(ItemResolveArgs args)
{ {
if (args != null) if (args != null)

View File

@ -53,6 +53,7 @@ namespace MediaBrowser.Controller.LiveTv
} }
private static string EmbyServiceName = "Emby"; private static string EmbyServiceName = "Emby";
public override double GetDefaultPrimaryImageAspectRatio() public override double GetDefaultPrimaryImageAspectRatio()
{ {
var serviceName = ServiceName; var serviceName = ServiceName;
@ -150,14 +151,14 @@ namespace MediaBrowser.Controller.LiveTv
[JsonIgnore] [JsonIgnore]
public override string ContainingFolderPath => Path; public override string ContainingFolderPath => Path;
//[JsonIgnore] // [JsonIgnore]
// public override string MediaType // public override string MediaType
//{ // {
// get // get
// { // {
// return ChannelType == ChannelType.TV ? Model.Entities.MediaType.Video : Model.Entities.MediaType.Audio; // return ChannelType == ChannelType.TV ? Model.Entities.MediaType.Video : Model.Entities.MediaType.Audio;
// } // }
//} // }
[JsonIgnore] [JsonIgnore]
public bool IsAiring public bool IsAiring

View File

@ -1,4 +1,4 @@
#nullable disable #nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
@ -8,7 +8,6 @@ using MediaBrowser.Model.Dlna;
namespace MediaBrowser.Controller.MediaEncoding namespace MediaBrowser.Controller.MediaEncoding
{ {
// For now until api and media encoding layers are unified
public class BaseEncodingJobOptions public class BaseEncodingJobOptions
{ {
/// <summary> /// <summary>
@ -202,4 +201,4 @@ namespace MediaBrowser.Controller.MediaEncoding
StreamOptions = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); StreamOptions = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
} }
} }
} }

View File

@ -1166,7 +1166,9 @@ namespace MediaBrowser.Controller.MediaEncoding
profileScore = Math.Min(profileScore, 2); profileScore = Math.Min(profileScore, 2);
// http://www.webmproject.org/docs/encoder-parameters/ // http://www.webmproject.org/docs/encoder-parameters/
param += string.Format(CultureInfo.InvariantCulture, " -speed 16 -quality good -profile:v {0} -slices 8 -crf {1} -qmin {2} -qmax {3}", param += string.Format(
CultureInfo.InvariantCulture,
" -speed 16 -quality good -profile:v {0} -slices 8 -crf {1} -qmin {2} -qmax {3}",
profileScore.ToString(_usCulture), profileScore.ToString(_usCulture),
crf, crf,
qmin, qmin,
@ -1296,7 +1298,7 @@ namespace MediaBrowser.Controller.MediaEncoding
// hevc_qsv use -level 51 instead of -level 153. // hevc_qsv use -level 51 instead of -level 153.
if (double.TryParse(level, NumberStyles.Any, _usCulture, out double hevcLevel)) if (double.TryParse(level, NumberStyles.Any, _usCulture, out double hevcLevel))
{ {
param += " -level " + hevcLevel / 3; param += " -level " + (hevcLevel / 3);
} }
} }
else if (string.Equals(videoEncoder, "h264_amf", StringComparison.OrdinalIgnoreCase) else if (string.Equals(videoEncoder, "h264_amf", StringComparison.OrdinalIgnoreCase)
@ -1392,7 +1394,7 @@ namespace MediaBrowser.Controller.MediaEncoding
var requestedProfile = requestedProfiles[0]; var requestedProfile = requestedProfiles[0];
// strip spaces because they may be stripped out on the query string as well // strip spaces because they may be stripped out on the query string as well
if (!string.IsNullOrEmpty(videoStream.Profile) if (!string.IsNullOrEmpty(videoStream.Profile)
&& !requestedProfiles.Contains(videoStream.Profile.Replace(" ", "", StringComparison.Ordinal), StringComparer.OrdinalIgnoreCase)) && !requestedProfiles.Contains(videoStream.Profile.Replace(" ", string.Empty, StringComparison.Ordinal), StringComparer.OrdinalIgnoreCase))
{ {
var currentScore = GetVideoProfileScore(videoStream.Profile); var currentScore = GetVideoProfileScore(videoStream.Profile);
var requestedScore = GetVideoProfileScore(requestedProfile); var requestedScore = GetVideoProfileScore(requestedProfile);
@ -1801,7 +1803,7 @@ namespace MediaBrowser.Controller.MediaEncoding
if (isTranscodingAudio if (isTranscodingAudio
&& state.TranscodingType != TranscodingJobType.Progressive && state.TranscodingType != TranscodingJobType.Progressive
&& resultChannels.HasValue && resultChannels.HasValue
&& (resultChannels.Value > 2 && resultChannels.Value < 6 || resultChannels.Value == 7)) && ((resultChannels.Value > 2 && resultChannels.Value < 6) || resultChannels.Value == 7))
{ {
resultChannels = 2; resultChannels = 2;
} }
@ -2129,8 +2131,8 @@ namespace MediaBrowser.Controller.MediaEncoding
return (null, null); return (null, null);
} }
decimal inputWidth = Convert.ToDecimal(videoWidth ?? requestedWidth); decimal inputWidth = Convert.ToDecimal(videoWidth ?? requestedWidth, CultureInfo.InvariantCulture);
decimal inputHeight = Convert.ToDecimal(videoHeight ?? requestedHeight); decimal inputHeight = Convert.ToDecimal(videoHeight ?? requestedHeight, CultureInfo.InvariantCulture);
decimal outputWidth = requestedWidth.HasValue ? Convert.ToDecimal(requestedWidth.Value) : inputWidth; decimal outputWidth = requestedWidth.HasValue ? Convert.ToDecimal(requestedWidth.Value) : inputWidth;
decimal outputHeight = requestedHeight.HasValue ? Convert.ToDecimal(requestedHeight.Value) : inputHeight; decimal outputHeight = requestedHeight.HasValue ? Convert.ToDecimal(requestedHeight.Value) : inputHeight;
decimal maximumWidth = requestedMaxWidth.HasValue ? Convert.ToDecimal(requestedMaxWidth.Value) : outputWidth; decimal maximumWidth = requestedMaxWidth.HasValue ? Convert.ToDecimal(requestedMaxWidth.Value) : outputWidth;
@ -2197,12 +2199,11 @@ namespace MediaBrowser.Controller.MediaEncoding
var isQsvHevcEncoder = videoEncoder.Contains("hevc_qsv", StringComparison.OrdinalIgnoreCase); var isQsvHevcEncoder = videoEncoder.Contains("hevc_qsv", StringComparison.OrdinalIgnoreCase);
var isTonemappingSupported = IsTonemappingSupported(state, options); var isTonemappingSupported = IsTonemappingSupported(state, options);
var isVppTonemappingSupported = IsVppTonemappingSupported(state, options); var isVppTonemappingSupported = IsVppTonemappingSupported(state, options);
var isTonemappingSupportedOnVaapi = string.Equals(options.HardwareAccelerationType, "vaapi", StringComparison.OrdinalIgnoreCase)&& isVaapiDecoder && (isVaapiH264Encoder || isVaapiHevcEncoder); var isTonemappingSupportedOnVaapi = string.Equals(options.HardwareAccelerationType, "vaapi", StringComparison.OrdinalIgnoreCase) && isVaapiDecoder && (isVaapiH264Encoder || isVaapiHevcEncoder);
var isTonemappingSupportedOnQsv = string.Equals(options.HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase) && isVaapiDecoder && (isQsvH264Encoder || isQsvHevcEncoder); var isTonemappingSupportedOnQsv = string.Equals(options.HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase) && isVaapiDecoder && (isQsvH264Encoder || isQsvHevcEncoder);
var isP010PixFmtRequired = (isTonemappingSupportedOnVaapi && (isTonemappingSupported || isVppTonemappingSupported)) var isP010PixFmtRequired = (isTonemappingSupportedOnVaapi && (isTonemappingSupported || isVppTonemappingSupported))
|| (isTonemappingSupportedOnQsv && isVppTonemappingSupported); || (isTonemappingSupportedOnQsv && isVppTonemappingSupported);
var outputPixFmt = "format=nv12"; var outputPixFmt = "format=nv12";
if (isP010PixFmtRequired) if (isP010PixFmtRequired)
{ {
@ -3175,8 +3176,8 @@ namespace MediaBrowser.Controller.MediaEncoding
state.ReadInputAtNativeFramerate = mediaSource.ReadAtNativeFramerate; state.ReadInputAtNativeFramerate = mediaSource.ReadAtNativeFramerate;
if (state.ReadInputAtNativeFramerate if (state.ReadInputAtNativeFramerate
|| mediaSource.Protocol == MediaProtocol.File || (mediaSource.Protocol == MediaProtocol.File
&& string.Equals(mediaSource.Container, "wtv", StringComparison.OrdinalIgnoreCase)) && string.Equals(mediaSource.Container, "wtv", StringComparison.OrdinalIgnoreCase)))
{ {
state.InputVideoSync = "-1"; state.InputVideoSync = "-1";
state.InputAudioSync = "1"; state.InputAudioSync = "1";
@ -3549,7 +3550,7 @@ namespace MediaBrowser.Controller.MediaEncoding
} }
/// <summary> /// <summary>
/// Gets a hw decoder name /// Gets a hw decoder name.
/// </summary> /// </summary>
public string GetHwDecoderName(EncodingOptions options, string decoder, string videoCodec, bool isColorDepth10) public string GetHwDecoderName(EncodingOptions options, string decoder, string videoCodec, bool isColorDepth10)
{ {
@ -3567,7 +3568,7 @@ namespace MediaBrowser.Controller.MediaEncoding
} }
/// <summary> /// <summary>
/// Gets a hwaccel type to use as a hardware decoder(dxva/vaapi) depending on the system /// Gets a hwaccel type to use as a hardware decoder(dxva/vaapi) depending on the system.
/// </summary> /// </summary>
public string GetHwaccelType(EncodingJobInfo state, EncodingOptions options, string videoCodec, bool isColorDepth10) public string GetHwaccelType(EncodingJobInfo state, EncodingOptions options, string videoCodec, bool isColorDepth10)
{ {
@ -3693,7 +3694,7 @@ namespace MediaBrowser.Controller.MediaEncoding
if (flags.Count > 0) if (flags.Count > 0)
{ {
return " -fflags " + string.Join("", flags); return " -fflags " + string.Join(string.Empty, flags);
} }
return string.Empty; return string.Empty;

View File

@ -69,6 +69,7 @@ namespace MediaBrowser.Controller.MediaEncoding
} }
private TranscodeReason[] _transcodeReasons = null; private TranscodeReason[] _transcodeReasons = null;
public TranscodeReason[] TranscodeReasons public TranscodeReason[] TranscodeReasons
{ {
get get

View File

@ -6,6 +6,7 @@ using System;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;

View File

@ -270,13 +270,4 @@ namespace MediaBrowser.Controller.Net
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
} }
public class WebSocketListenerState
{
public DateTime DateLastSendUtc { get; set; }
public long InitialDelayMs { get; set; }
public long IntervalMs { get; set; }
}
} }

View File

@ -60,11 +60,11 @@ namespace MediaBrowser.Controller.Net
/// <summary> /// <summary>
/// Sends a message asynchronously. /// Sends a message asynchronously.
/// </summary> /// </summary>
/// <typeparam name="T"></typeparam> /// <typeparam name="T">The type of websocket message data.</typeparam>
/// <param name="message">The message.</param> /// <param name="message">The message.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns> /// <returns>Task.</returns>
/// <exception cref="ArgumentNullException">message</exception> /// <exception cref="ArgumentNullException">The message is null.</exception>
Task SendAsync<T>(WebSocketMessage<T> message, CancellationToken cancellationToken); Task SendAsync<T>(WebSocketMessage<T> message, CancellationToken cancellationToken);
Task ProcessAsync(CancellationToken cancellationToken = default); Task ProcessAsync(CancellationToken cancellationToken = default);

View File

@ -0,0 +1,17 @@
#nullable disable
#pragma warning disable CS1591
using System;
namespace MediaBrowser.Controller.Net
{
public class WebSocketListenerState
{
public DateTime DateLastSendUtc { get; set; }
public long InitialDelayMs { get; set; }
public long IntervalMs { get; set; }
}
}

View File

@ -49,21 +49,23 @@ namespace MediaBrowser.Controller.Persistence
/// <summary> /// <summary>
/// Gets chapters for an item. /// Gets chapters for an item.
/// </summary> /// </summary>
/// <param name="id"></param> /// <param name="id">The item.</param>
/// <returns></returns> /// <returns>The list of chapter info.</returns>
List<ChapterInfo> GetChapters(BaseItem id); List<ChapterInfo> GetChapters(BaseItem id);
/// <summary> /// <summary>
/// Gets a single chapter for an item. /// Gets a single chapter for an item.
/// </summary> /// </summary>
/// <param name="id"></param> /// <param name="id">The item.</param>
/// <param name="index"></param> /// <param name="index">The chapter index.</param>
/// <returns></returns> /// <returns>The chapter info at the specified index.</returns>
ChapterInfo GetChapter(BaseItem id, int index); ChapterInfo GetChapter(BaseItem id, int index);
/// <summary> /// <summary>
/// Saves the chapters. /// Saves the chapters.
/// </summary> /// </summary>
/// <param name="id">The item id.</param>
/// <param name="chapters">The list of chapters to save.</param>
void SaveChapters(Guid id, IReadOnlyList<ChapterInfo> chapters); void SaveChapters(Guid id, IReadOnlyList<ChapterInfo> chapters);
/// <summary> /// <summary>

View File

@ -40,17 +40,16 @@ namespace MediaBrowser.Controller.Persistence
/// <summary> /// <summary>
/// Return all user data associated with the given user. /// Return all user data associated with the given user.
/// </summary> /// </summary>
/// <param name="userId"></param> /// <param name="userId">The user id.</param>
/// <returns></returns> /// <returns>The list of user item data.</returns>
List<UserItemData> GetAllUserData(long userId); List<UserItemData> GetAllUserData(long userId);
/// <summary> /// <summary>
/// Save all user data associated with the given user. /// Save all user data associated with the given user.
/// </summary> /// </summary>
/// <param name="userId"></param> /// <param name="userId">The user id.</param>
/// <param name="userData"></param> /// <param name="userData">The user item data.</param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
void SaveAllUserData(long userId, UserItemData[] userData, CancellationToken cancellationToken); void SaveAllUserData(long userId, UserItemData[] userData, CancellationToken cancellationToken);
} }
} }

View File

@ -101,7 +101,7 @@ namespace MediaBrowser.Controller.Playlists
return new List<BaseItem>(); return new List<BaseItem>();
} }
protected override Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService) protected override Task ValidateChildrenInternal(IProgress<double> progress, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
{ {
return Task.CompletedTask; return Task.CompletedTask;
} }

View File

@ -1,4 +1,6 @@
namespace MediaBrowser.Controller.Plugins #pragma warning disable CA1040 // Avoid empty interfaces
namespace MediaBrowser.Controller.Plugins
{ {
/// <summary> /// <summary>
/// Indicates that a <see cref="IServerEntryPoint"/> should be invoked as a pre-startup task. /// Indicates that a <see cref="IServerEntryPoint"/> should be invoked as a pre-startup task.

View File

@ -1,3 +1,5 @@
#pragma warning disable CA1040 // Avoid empty interfaces
namespace MediaBrowser.Controller.Providers namespace MediaBrowser.Controller.Providers
{ {
/// <summary> /// <summary>

View File

@ -8,7 +8,7 @@ namespace MediaBrowser.Controller.Resolvers
/// <summary> /// <summary>
/// Class ItemResolver. /// Class ItemResolver.
/// </summary> /// </summary>
/// <typeparam name="T"></typeparam> /// <typeparam name="T">The type of BaseItem.</typeparam>
public abstract class ItemResolver<T> : IItemResolver public abstract class ItemResolver<T> : IItemResolver
where T : BaseItem, new() where T : BaseItem, new()
{ {

View File

@ -121,7 +121,9 @@ namespace MediaBrowser.Controller.Sorting
return result; return result;
} }
} }
#pragma warning disable SA1500 // TODO remove with StyleCop.Analyzers v1.2.0 https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3196
} while (pos1 < len1 && pos2 < len2); } while (pos1 < len1 && pos2 < len2);
#pragma warning restore SA1500
return len1 - len2; return len1 - len2;
} }

View File

@ -1111,7 +1111,7 @@ namespace MediaBrowser.Providers.Manager
await RefreshCollectionFolderChildren(options, collectionFolder, cancellationToken).ConfigureAwait(false); await RefreshCollectionFolderChildren(options, collectionFolder, cancellationToken).ConfigureAwait(false);
break; break;
case Folder folder: case Folder folder:
await folder.ValidateChildren(new SimpleProgress<double>(), cancellationToken, options).ConfigureAwait(false); await folder.ValidateChildren(new SimpleProgress<double>(), options, cancellationToken: cancellationToken).ConfigureAwait(false);
break; break;
} }
} }
@ -1122,7 +1122,7 @@ namespace MediaBrowser.Providers.Manager
{ {
await child.RefreshMetadata(options, cancellationToken).ConfigureAwait(false); await child.RefreshMetadata(options, cancellationToken).ConfigureAwait(false);
await child.ValidateChildren(new SimpleProgress<double>(), cancellationToken, options).ConfigureAwait(false); await child.ValidateChildren(new SimpleProgress<double>(), options, cancellationToken: cancellationToken).ConfigureAwait(false);
} }
} }
@ -1144,7 +1144,7 @@ namespace MediaBrowser.Providers.Manager
.Select(i => i.MusicArtist) .Select(i => i.MusicArtist)
.Where(i => i != null); .Where(i => i != null);
var musicArtistRefreshTasks = musicArtists.Select(i => i.ValidateChildren(new SimpleProgress<double>(), cancellationToken, options, true)); var musicArtistRefreshTasks = musicArtists.Select(i => i.ValidateChildren(new SimpleProgress<double>(), options, true, cancellationToken));
await Task.WhenAll(musicArtistRefreshTasks).ConfigureAwait(false); await Task.WhenAll(musicArtistRefreshTasks).ConfigureAwait(false);