Fix remaining MediaBrowser.Providers warnings

This commit is contained in:
Rich Lander 2021-07-22 20:16:38 -07:00
parent fb92eab69b
commit 927b003143
15 changed files with 82 additions and 37 deletions

View file

@ -59,9 +59,9 @@ namespace MediaBrowser.Providers.BoxSets
}
/// <inheritdoc />
protected override ItemUpdateType BeforeSaveInternal(BoxSet item, bool isFullRefresh, ItemUpdateType currentUpdateType)
protected override ItemUpdateType BeforeSaveInternal(BoxSet item, bool isFullRefresh, ItemUpdateType updateType)
{
var updateType = base.BeforeSaveInternal(item, isFullRefresh, currentUpdateType);
var updatedType = base.BeforeSaveInternal(item, isFullRefresh, updateType);
var libraryFolderIds = item.GetLibraryFolderIds();
@ -69,10 +69,10 @@ namespace MediaBrowser.Providers.BoxSets
if (itemLibraryFolderIds == null || !libraryFolderIds.SequenceEqual(itemLibraryFolderIds))
{
item.LibraryFolderIds = libraryFolderIds;
updateType |= ItemUpdateType.MetadataImport;
updatedType |= ItemUpdateType.MetadataImport;
}
return updateType;
return updatedType;
}
}
}

View file

@ -1,7 +1,8 @@
#pragma warning disable CS1591
#pragma warning disable CA1002, CS1591
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Net;

View file

@ -1,4 +1,4 @@
#pragma warning disable CS1591
#pragma warning disable CA1002, CS1591
using System;
using System.Collections.Generic;

View file

@ -1,4 +1,4 @@
#pragma warning disable CS1591
#pragma warning disable CA1068, CS1591
using System;
using System.Collections.Generic;

View file

@ -1,7 +1,8 @@
#pragma warning disable CS1591
#pragma warning disable CA1002, CS1591
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

View file

@ -1,7 +1,8 @@
#pragma warning disable CS1591
#pragma warning disable CA1002, CS1591
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Providers;

View file

@ -1,4 +1,4 @@
#pragma warning disable CS1591, SA1300
#pragma warning disable CA1002, CS1591, SA1300
using System;
using System.Collections.Generic;
@ -30,9 +30,9 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
private readonly IHttpClientFactory _httpClientFactory;
private readonly JsonSerializerOptions _jsonOptions = JsonDefaults.Options;
#pragma warning disable SA1401
#pragma warning disable SA1401, CA2211
public static AudioDbAlbumProvider Current;
#pragma warning restore SA1401
#pragma warning restore SA1401, CA2211
public AudioDbAlbumProvider(IServerConfigurationManager config, IFileSystem fileSystem, IHttpClientFactory httpClientFactory)
{
@ -204,6 +204,7 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
throw new NotImplementedException();
}
#pragma warning disable CA1034, CA2227
public class Album
{
public string idAlbum { get; set; }

View file

@ -1,4 +1,4 @@
#pragma warning disable CS1591, SA1300
#pragma warning disable CA1034, CS1591, CA1002, SA1028, SA1300
using System;
using System.Collections.Generic;
@ -274,6 +274,7 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
public string strLocked { get; set; }
}
#pragma warning disable CA2227
public class RootObject
{
public List<Artist> artists { get; set; }

View file

@ -23,7 +23,7 @@ using Microsoft.Extensions.Logging;
namespace MediaBrowser.Providers.Music
{
public class MusicBrainzAlbumProvider : IRemoteMetadataProvider<MusicAlbum, AlbumInfo>, IHasOrder
public class MusicBrainzAlbumProvider : IRemoteMetadataProvider<MusicAlbum, AlbumInfo>, IHasOrder, IDisposable
{
/// <summary>
/// For each single MB lookup/search, this is the maximum number of
@ -592,6 +592,21 @@ namespace MediaBrowser.Providers.Music
throw new NotImplementedException();
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
_apiRequestLock?.Dispose();
}
}
/// <summary>IDisposable implementation.</summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
private class ReleaseResult
{
public string ReleaseId;

View file

@ -577,6 +577,7 @@ namespace MediaBrowser.Providers.Plugins.Omdb
}
}
#pragma warning disable CA1034
/// <summary>Describes OMDB rating.</summary>
public class OmdbRating
{

View file

@ -77,14 +77,14 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.People
return remoteSearchResults;
}
public async Task<MetadataResult<Person>> GetMetadata(PersonLookupInfo id, CancellationToken cancellationToken)
public async Task<MetadataResult<Person>> GetMetadata(PersonLookupInfo info, CancellationToken cancellationToken)
{
var personTmdbId = Convert.ToInt32(id.GetProviderId(MetadataProvider.Tmdb), CultureInfo.InvariantCulture);
var personTmdbId = Convert.ToInt32(info.GetProviderId(MetadataProvider.Tmdb), CultureInfo.InvariantCulture);
// We don't already have an Id, need to fetch it
if (personTmdbId <= 0)
{
var personSearchResults = await _tmdbClientManager.SearchPersonAsync(id.Name, cancellationToken).ConfigureAwait(false);
var personSearchResults = await _tmdbClientManager.SearchPersonAsync(info.Name, cancellationToken).ConfigureAwait(false);
if (personSearchResults.Count > 0)
{
personTmdbId = personSearchResults[0].Id;
@ -95,7 +95,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.People
if (personTmdbId > 0)
{
var person = await _tmdbClientManager.GetPersonAsync(personTmdbId, id.MetadataLanguage, cancellationToken).ConfigureAwait(false);
var person = await _tmdbClientManager.GetPersonAsync(personTmdbId, info.MetadataLanguage, cancellationToken).ConfigureAwait(false);
result.HasMetadata = true;
@ -103,7 +103,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.People
{
// Take name from incoming info, don't rename the person
// TODO: This should go in PersonMetadataService, not each person provider
Name = id.Name,
Name = info.Name,
HomePageUrl = person.Homepage,
Overview = person.Biography,
PremiereDate = person.Birthday?.ToUniversalTime(),

View file

@ -18,7 +18,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
/// <summary>
/// Manager class for abstracting the TMDb API client library.
/// </summary>
public class TmdbClientManager
public class TmdbClientManager : IDisposable
{
private const int CacheDurationInHours = 1;
@ -532,5 +532,23 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
{
return !_tmDbClient.HasConfig ? _tmDbClient.GetConfigAsync() : Task.CompletedTask;
}
/// <summary>Dispose method.</summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>IDispose implementation.</summary>
/// <param name="disposing">Specify true to dispose.</param>
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
_memoryCache?.Dispose();
_tmDbClient?.Dispose();
}
}
}
}

View file

@ -252,8 +252,14 @@ namespace MediaBrowser.Providers.Subtitles
}
catch (Exception ex)
{
(exs ??= new List<Exception>()).Add(ex);
}
#pragma warning disable CA1508
exs ??= new List<Exception>()
{
ex
};
#pragma warning restore CA1508
}
finally
{
_monitor.ReportFileSystemChangeComplete(savePath, false);

View file

@ -25,46 +25,46 @@ namespace MediaBrowser.Providers.TV
}
/// <inheritdoc />
protected override ItemUpdateType BeforeSaveInternal(Episode item, bool isFullRefresh, ItemUpdateType currentUpdateType)
protected override ItemUpdateType BeforeSaveInternal(Episode item, bool isFullRefresh, ItemUpdateType updateType)
{
var updateType = base.BeforeSaveInternal(item, isFullRefresh, currentUpdateType);
var updatedType = base.BeforeSaveInternal(item, isFullRefresh, updateType);
var seriesName = item.FindSeriesName();
if (!string.Equals(item.SeriesName, seriesName, StringComparison.Ordinal))
{
item.SeriesName = seriesName;
updateType |= ItemUpdateType.MetadataImport;
updatedType |= ItemUpdateType.MetadataImport;
}
var seasonName = item.FindSeasonName();
if (!string.Equals(item.SeasonName, seasonName, StringComparison.Ordinal))
{
item.SeasonName = seasonName;
updateType |= ItemUpdateType.MetadataImport;
updatedType |= ItemUpdateType.MetadataImport;
}
var seriesId = item.FindSeriesId();
if (!item.SeriesId.Equals(seriesId))
{
item.SeriesId = seriesId;
updateType |= ItemUpdateType.MetadataImport;
updatedType |= ItemUpdateType.MetadataImport;
}
var seasonId = item.FindSeasonId();
if (!item.SeasonId.Equals(seasonId))
{
item.SeasonId = seasonId;
updateType |= ItemUpdateType.MetadataImport;
updatedType |= ItemUpdateType.MetadataImport;
}
var seriesPresentationUniqueKey = item.FindSeriesPresentationUniqueKey();
if (!string.Equals(item.SeriesPresentationUniqueKey, seriesPresentationUniqueKey, StringComparison.Ordinal))
{
item.SeriesPresentationUniqueKey = seriesPresentationUniqueKey;
updateType |= ItemUpdateType.MetadataImport;
updatedType |= ItemUpdateType.MetadataImport;
}
return updateType;
return updatedType;
}
/// <inheritdoc />

View file

@ -31,9 +31,9 @@ namespace MediaBrowser.Providers.TV
protected override bool EnableUpdatingPremiereDateFromChildren => true;
/// <inheritdoc />
protected override ItemUpdateType BeforeSaveInternal(Season item, bool isFullRefresh, ItemUpdateType currentUpdateType)
protected override ItemUpdateType BeforeSaveInternal(Season item, bool isFullRefresh, ItemUpdateType updateType)
{
var updateType = base.BeforeSaveInternal(item, isFullRefresh, currentUpdateType);
var updatedType = base.BeforeSaveInternal(item, isFullRefresh, updateType);
if (item.IndexNumber.HasValue && item.IndexNumber.Value == 0)
{
@ -42,7 +42,7 @@ namespace MediaBrowser.Providers.TV
if (!string.Equals(item.Name, seasonZeroDisplayName, StringComparison.OrdinalIgnoreCase))
{
item.Name = seasonZeroDisplayName;
updateType = updateType | ItemUpdateType.MetadataEdit;
updatedType = updatedType | ItemUpdateType.MetadataEdit;
}
}
@ -50,24 +50,24 @@ namespace MediaBrowser.Providers.TV
if (!string.Equals(item.SeriesName, seriesName, StringComparison.Ordinal))
{
item.SeriesName = seriesName;
updateType |= ItemUpdateType.MetadataImport;
updatedType |= ItemUpdateType.MetadataImport;
}
var seriesPresentationUniqueKey = item.FindSeriesPresentationUniqueKey();
if (!string.Equals(item.SeriesPresentationUniqueKey, seriesPresentationUniqueKey, StringComparison.Ordinal))
{
item.SeriesPresentationUniqueKey = seriesPresentationUniqueKey;
updateType |= ItemUpdateType.MetadataImport;
updatedType |= ItemUpdateType.MetadataImport;
}
var seriesId = item.FindSeriesId();
if (!item.SeriesId.Equals(seriesId))
{
item.SeriesId = seriesId;
updateType |= ItemUpdateType.MetadataImport;
updatedType |= ItemUpdateType.MetadataImport;
}
return updateType;
return updatedType;
}
/// <inheritdoc />