Enable nullable for MediaBrowser.Providers

This commit is contained in:
Bond_009 2021-10-26 15:49:01 +02:00
parent dc72d90703
commit f5ca9cbc3b
72 changed files with 115 additions and 61 deletions

View File

@ -1,5 +1,3 @@
#nullable disable
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Providers;
@ -35,7 +33,7 @@ namespace MediaBrowser.Controller.Providers
/// <summary>
/// Gets the URL format string for this id.
/// </summary>
string UrlFormatString { get; }
string? UrlFormatString { get; }
/// <summary>
/// Determines whether this id supports a given item type.

View File

@ -12,7 +12,7 @@ namespace MediaBrowser.Model.Providers
/// <param name="key">Key for this id. This key should be unique across all providers.</param>
/// <param name="type">Specific media type for this id.</param>
/// <param name="urlFormatString">URL format string.</param>
public ExternalIdInfo(string name, string key, ExternalIdMediaType? type, string urlFormatString)
public ExternalIdInfo(string name, string key, ExternalIdMediaType? type, string? urlFormatString)
{
Name = name;
Key = key;
@ -46,6 +46,6 @@ namespace MediaBrowser.Model.Providers
/// <summary>
/// Gets or sets the URL format string.
/// </summary>
public string UrlFormatString { get; set; }
public string? UrlFormatString { get; set; }
}
}

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CA1002, CS1591
using System;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -1,3 +1,5 @@
#nullable disable
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -8,7 +8,7 @@ namespace MediaBrowser.Providers.Manager
{
public ItemUpdateType UpdateType { get; set; }
public string ErrorMessage { get; set; }
public string? ErrorMessage { get; set; }
public int Failures { get; set; }
}

View File

@ -30,7 +30,6 @@
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
<Nullable>disable</Nullable>
</PropertyGroup>
<!-- Code Analyzers-->

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CA1002, CS1591
using System;

View File

@ -1,3 +1,5 @@
#nullable disable
using System;
using System.Collections.Generic;
using System.IO;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CA1068, CS1591
using System;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CA1002, CS1591
using System;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CA1002, CS1591
using System;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -22,7 +22,7 @@ namespace MediaBrowser.Providers.Movies
public ExternalIdMediaType? Type => null;
/// <inheritdoc />
public string UrlFormatString => "https://www.imdb.com/title/{0}";
public string? UrlFormatString => "https://www.imdb.com/title/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item)

View File

@ -19,7 +19,7 @@ namespace MediaBrowser.Providers.Movies
public ExternalIdMediaType? Type => ExternalIdMediaType.Person;
/// <inheritdoc />
public string UrlFormatString => "https://www.imdb.com/name/{0}";
public string? UrlFormatString => "https://www.imdb.com/name/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item) => item is Person;

View File

@ -8,7 +8,7 @@ namespace MediaBrowser.Providers.Music
{
public static class AlbumInfoExtensions
{
public static string GetAlbumArtist(this AlbumInfo info)
public static string? GetAlbumArtist(this AlbumInfo info)
{
var id = info.SongInfos.SelectMany(i => i.AlbumArtists)
.FirstOrDefault(i => !string.IsNullOrEmpty(i));
@ -21,7 +21,7 @@ namespace MediaBrowser.Providers.Music
return info.AlbumArtists.Count > 0 ? info.AlbumArtists[0] : default;
}
public static string GetReleaseGroupId(this AlbumInfo info)
public static string? GetReleaseGroupId(this AlbumInfo info)
{
var id = info.GetProviderId(MetadataProvider.MusicBrainzReleaseGroup);
@ -34,7 +34,7 @@ namespace MediaBrowser.Providers.Music
return id;
}
public static string GetReleaseId(this AlbumInfo info)
public static string? GetReleaseId(this AlbumInfo info)
{
var id = info.GetProviderId(MetadataProvider.MusicBrainzAlbum);
@ -47,9 +47,9 @@ namespace MediaBrowser.Providers.Music
return id;
}
public static string GetMusicBrainzArtistId(this AlbumInfo info)
public static string? GetMusicBrainzArtistId(this AlbumInfo info)
{
info.ProviderIds.TryGetValue(MetadataProvider.MusicBrainzAlbumArtist.ToString(), out string id);
info.ProviderIds.TryGetValue(MetadataProvider.MusicBrainzAlbumArtist.ToString(), out string? id);
if (string.IsNullOrEmpty(id))
{
@ -65,7 +65,7 @@ namespace MediaBrowser.Providers.Music
return id;
}
public static string GetMusicBrainzArtistId(this ArtistInfo info)
public static string? GetMusicBrainzArtistId(this ArtistInfo info)
{
info.ProviderIds.TryGetValue(MetadataProvider.MusicBrainzArtist.ToString(), out var id);

View File

@ -81,7 +81,7 @@ namespace MediaBrowser.Providers.Music
if (!item.AlbumArtists.SequenceEqual(artists, StringComparer.OrdinalIgnoreCase))
{
item.AlbumArtists = artists;
updateType = updateType | ItemUpdateType.MetadataEdit;
updateType |= ItemUpdateType.MetadataEdit;
}
return updateType;
@ -100,7 +100,7 @@ namespace MediaBrowser.Providers.Music
if (!item.Artists.SequenceEqual(artists, StringComparer.OrdinalIgnoreCase))
{
item.Artists = artists;
updateType = updateType | ItemUpdateType.MetadataEdit;
updateType |= ItemUpdateType.MetadataEdit;
}
return updateType;

View File

@ -19,7 +19,7 @@ namespace MediaBrowser.Providers.Music
public ExternalIdMediaType? Type => null;
/// <inheritdoc />
public string UrlFormatString => null;
public string? UrlFormatString => null;
/// <inheritdoc />
public bool Supports(IHasProviderIds item)

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -19,7 +19,7 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
public ExternalIdMediaType? Type => null;
/// <inheritdoc />
public string UrlFormatString => "https://www.theaudiodb.com/album/{0}";
public string? UrlFormatString => "https://www.theaudiodb.com/album/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item) => item is MusicAlbum;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System.Collections.Generic;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CA1002, CS1591, SA1300
using System;

View File

@ -19,7 +19,7 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
public ExternalIdMediaType? Type => ExternalIdMediaType.Artist;
/// <inheritdoc />
public string UrlFormatString => "https://www.theaudiodb.com/artist/{0}";
public string? UrlFormatString => "https://www.theaudiodb.com/artist/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item) => item is MusicArtist;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System.Collections.Generic;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CA1034, CS1591, CA1002, SA1028, SA1300
using System;

View File

@ -19,7 +19,7 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
public ExternalIdMediaType? Type => ExternalIdMediaType.Album;
/// <inheritdoc />
public string UrlFormatString => "https://www.theaudiodb.com/album/{0}";
public string? UrlFormatString => "https://www.theaudiodb.com/album/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item) => item is Audio;

View File

@ -19,7 +19,7 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
public ExternalIdMediaType? Type => ExternalIdMediaType.OtherArtist;
/// <inheritdoc />
public string UrlFormatString => "https://www.theaudiodb.com/artist/{0}";
public string? UrlFormatString => "https://www.theaudiodb.com/artist/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item) => item is Audio || item is MusicAlbum;

View File

@ -1,4 +1,4 @@
#pragma warning disable CS1591
#pragma warning disable CS1591
using MediaBrowser.Model.Plugins;

View File

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -1,4 +1,4 @@
#pragma warning disable CS1591
#pragma warning disable CS1591
using MediaBrowser.Model.Plugins;
@ -12,24 +12,13 @@ namespace MediaBrowser.Providers.Plugins.MusicBrainz
public string Server
{
get
{
return _server;
}
set
{
_server = value.TrimEnd('/');
}
get => _server;
set => _server = value.TrimEnd('/');
}
public long RateLimit
{
get
{
return _rateLimit;
}
get => _rateLimit;
set
{
if (value < Plugin.DefaultRateLimit && _server == Plugin.DefaultServer)

View File

@ -20,7 +20,7 @@ namespace MediaBrowser.Providers.Music
public ExternalIdMediaType? Type => ExternalIdMediaType.AlbumArtist;
/// <inheritdoc />
public string UrlFormatString => Plugin.Instance.Configuration.Server + "/artist/{0}";
public string? UrlFormatString => Plugin.Instance.Configuration.Server + "/artist/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item) => item is Audio;

View File

@ -20,7 +20,7 @@ namespace MediaBrowser.Providers.Music
public ExternalIdMediaType? Type => ExternalIdMediaType.Album;
/// <inheritdoc />
public string UrlFormatString => Plugin.Instance.Configuration.Server + "/release/{0}";
public string? UrlFormatString => Plugin.Instance.Configuration.Server + "/release/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item) => item is Audio || item is MusicAlbum;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591, SA1401
using System;

View File

@ -20,7 +20,7 @@ namespace MediaBrowser.Providers.Music
public ExternalIdMediaType? Type => ExternalIdMediaType.Artist;
/// <inheritdoc />
public string UrlFormatString => Plugin.Instance.Configuration.Server + "/artist/{0}";
public string? UrlFormatString => Plugin.Instance.Configuration.Server + "/artist/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item) => item is MusicArtist;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -20,7 +20,7 @@ namespace MediaBrowser.Providers.Music
public ExternalIdMediaType? Type => ExternalIdMediaType.OtherArtist;
/// <inheritdoc />
public string UrlFormatString => Plugin.Instance.Configuration.Server + "/artist/{0}";
public string? UrlFormatString => Plugin.Instance.Configuration.Server + "/artist/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item) => item is Audio || item is MusicAlbum;

View File

@ -20,7 +20,7 @@ namespace MediaBrowser.Providers.Music
public ExternalIdMediaType? Type => ExternalIdMediaType.ReleaseGroup;
/// <inheritdoc />
public string UrlFormatString => Plugin.Instance.Configuration.Server + "/release-group/{0}";
public string? UrlFormatString => Plugin.Instance.Configuration.Server + "/release-group/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item) => item is Audio || item is MusicAlbum;

View File

@ -20,7 +20,7 @@ namespace MediaBrowser.Providers.Music
public ExternalIdMediaType? Type => ExternalIdMediaType.Track;
/// <inheritdoc />
public string UrlFormatString => Plugin.Instance.Configuration.Server + "/track/{0}";
public string? UrlFormatString => Plugin.Instance.Configuration.Server + "/track/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item) => item is Audio;

View File

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -1,4 +1,4 @@
#pragma warning disable CS1591
#pragma warning disable CS1591
using MediaBrowser.Model.Plugins;

View File

@ -1,5 +1,3 @@
#nullable enable
using System;
using System.ComponentModel;
using System.Text.Json;

View File

@ -1,5 +1,3 @@
#nullable enable
using System;
using System.Text.Json;
using System.Text.Json.Serialization;

View File

@ -61,7 +61,7 @@ namespace MediaBrowser.Providers.Plugins.Omdb
return result;
}
if (info.SeriesProviderIds.TryGetValue(MetadataProvider.Imdb.ToString(), out string seriesImdbId) && !string.IsNullOrEmpty(seriesImdbId))
if (info.SeriesProviderIds.TryGetValue(MetadataProvider.Imdb.ToString(), out string? seriesImdbId) && !string.IsNullOrEmpty(seriesImdbId))
{
if (info.IndexNumber.HasValue && info.ParentIndexNumber.HasValue)
{

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System.Collections.Generic;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591, SA1300
using System;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS159, SA1300
using System;

View File

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -21,7 +21,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
public ExternalIdMediaType? Type => ExternalIdMediaType.BoxSet;
/// <inheritdoc />
public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "collection/{0}";
public string? UrlFormatString => TmdbUtils.BaseTmdbUrl + "collection/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item)

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -21,7 +21,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
public ExternalIdMediaType? Type => ExternalIdMediaType.Movie;
/// <inheritdoc />
public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "movie/{0}";
public string? UrlFormatString => TmdbUtils.BaseTmdbUrl + "movie/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item)

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -20,7 +20,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.People
public ExternalIdMediaType? Type => ExternalIdMediaType.Person;
/// <inheritdoc />
public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "person/{0}";
public string? UrlFormatString => TmdbUtils.BaseTmdbUrl + "person/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item)

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -1,3 +1,5 @@
#nullable disable
using System;
using System.Collections.Generic;
using MediaBrowser.Common.Configuration;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -33,7 +33,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
{
var result = new MetadataResult<Season>();
info.SeriesProviderIds.TryGetValue(MetadataProvider.Tmdb.ToString(), out string seriesTmdbId);
info.SeriesProviderIds.TryGetValue(MetadataProvider.Tmdb.ToString(), out string? seriesTmdbId);
var seasonNumber = info.IndexNumber;

View File

@ -20,7 +20,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
public ExternalIdMediaType? Type => ExternalIdMediaType.Series;
/// <inheritdoc />
public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "tv/{0}";
public string? UrlFormatString => TmdbUtils.BaseTmdbUrl + "tv/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item)

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -1,4 +1,6 @@
using System;
#nullable disable
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;

View File

@ -1,5 +1,3 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System;
@ -21,7 +23,6 @@ using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Providers;
using Microsoft.Extensions.Logging;
using static MediaBrowser.Model.IO.IODefaults;
namespace MediaBrowser.Providers.Subtitles
{

View File

@ -42,7 +42,7 @@ namespace MediaBrowser.Providers.TV
if (!string.Equals(item.Name, seasonZeroDisplayName, StringComparison.OrdinalIgnoreCase))
{
item.Name = seasonZeroDisplayName;
updatedType = updatedType | ItemUpdateType.MetadataEdit;
updatedType |= ItemUpdateType.MetadataEdit;
}
}

View File

@ -1,3 +1,5 @@
#nullable disable
#pragma warning disable CS1591
using System.Collections.Generic;

View File

@ -19,7 +19,7 @@ namespace MediaBrowser.Providers.TV
public ExternalIdMediaType? Type => null;
/// <inheritdoc />
public string UrlFormatString => "http://tvlistings.zap2it.com/overview.html?programSeriesId={0}";
public string? UrlFormatString => "http://tvlistings.zap2it.com/overview.html?programSeriesId={0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item) => item is Series;