mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-16 14:03:03 +03:00
Replace == null with is null
This commit is contained in:
@@ -96,7 +96,7 @@ namespace Jellyfin.Api.Controllers
|
||||
var configurationType = _configurationManager.GetConfigurationType(key);
|
||||
var deserializedConfiguration = configuration.Deserialize(configurationType, _serializerOptions);
|
||||
|
||||
if (deserializedConfiguration == null)
|
||||
if (deserializedConfiguration is null)
|
||||
{
|
||||
throw new ArgumentException("Body doesn't contain a valid configuration");
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public ActionResult GetDashboardConfigurationPage([FromQuery] string? name)
|
||||
{
|
||||
var altPage = GetPluginPages().FirstOrDefault(p => string.Equals(p.Item1.Name, name, StringComparison.OrdinalIgnoreCase));
|
||||
if (altPage == null)
|
||||
if (altPage is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -84,7 +84,7 @@ namespace Jellyfin.Api.Controllers
|
||||
IPlugin plugin = altPage.Item2;
|
||||
string resourcePath = altPage.Item1.EmbeddedResourcePath;
|
||||
Stream? stream = plugin.GetType().Assembly.GetManifestResourceStream(resourcePath);
|
||||
if (stream == null)
|
||||
if (stream is null)
|
||||
{
|
||||
_logger.LogError("Failed to get resource {Resource} from plugin {Plugin}", resourcePath, plugin.Name);
|
||||
return NotFound();
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public async Task<ActionResult<DeviceInfo>> GetDeviceInfo([FromQuery, Required] string id)
|
||||
{
|
||||
var deviceInfo = await _deviceManager.GetDevice(id).ConfigureAwait(false);
|
||||
if (deviceInfo == null)
|
||||
if (deviceInfo is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -85,7 +85,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public async Task<ActionResult<DeviceOptions>> GetDeviceOptions([FromQuery, Required] string id)
|
||||
{
|
||||
var deviceInfo = await _deviceManager.GetDeviceOptions(id).ConfigureAwait(false);
|
||||
if (deviceInfo == null)
|
||||
if (deviceInfo is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -123,7 +123,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public async Task<ActionResult> DeleteDevice([FromQuery, Required] string id)
|
||||
{
|
||||
var existingDevice = await _deviceManager.GetDevice(id).ConfigureAwait(false);
|
||||
if (existingDevice == null)
|
||||
if (existingDevice is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public ActionResult<DeviceProfile> GetProfile([FromRoute, Required] string profileId)
|
||||
{
|
||||
var profile = _dlnaManager.GetProfile(profileId);
|
||||
if (profile == null)
|
||||
if (profile is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -84,7 +84,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public ActionResult DeleteProfile([FromRoute, Required] string profileId)
|
||||
{
|
||||
var existingDeviceProfile = _dlnaManager.GetProfile(profileId);
|
||||
if (existingDeviceProfile == null)
|
||||
if (existingDeviceProfile is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -121,7 +121,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public ActionResult UpdateProfile([FromRoute, Required] string profileId, [FromBody] DeviceProfile deviceProfile)
|
||||
{
|
||||
var existingDeviceProfile = _dlnaManager.GetProfile(profileId);
|
||||
if (existingDeviceProfile == null)
|
||||
if (existingDeviceProfile is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ namespace Jellyfin.Api.Controllers
|
||||
private ActionResult GetIconInternal(string fileName)
|
||||
{
|
||||
var icon = _dlnaManager.GetIcon(fileName);
|
||||
if (icon == null)
|
||||
if (icon is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -1482,7 +1482,7 @@ namespace Jellyfin.Api.Controllers
|
||||
startTranscoding = true;
|
||||
segmentId = 0;
|
||||
}
|
||||
else if (currentTranscodingIndex == null)
|
||||
else if (currentTranscodingIndex is null)
|
||||
{
|
||||
_logger.LogDebug("Starting transcoding because currentTranscodingIndex=null");
|
||||
startTranscoding = true;
|
||||
@@ -1665,7 +1665,7 @@ namespace Jellyfin.Api.Controllers
|
||||
/// <returns>The command line arguments for audio transcoding.</returns>
|
||||
private string GetAudioArguments(StreamState state)
|
||||
{
|
||||
if (state.AudioStream == null)
|
||||
if (state.AudioStream is null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
@@ -1762,7 +1762,7 @@ namespace Jellyfin.Api.Controllers
|
||||
/// <returns>The command line arguments for video transcoding.</returns>
|
||||
private string GetVideoArguments(StreamState state, int startNumber, bool isEventPlaylist)
|
||||
{
|
||||
if (state.VideoStream == null)
|
||||
if (state.VideoStream is null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
@@ -1969,14 +1969,14 @@ namespace Jellyfin.Api.Controllers
|
||||
{
|
||||
var job = _transcodingJobHelper.GetTranscodingJob(playlist, TranscodingJobType);
|
||||
|
||||
if (job == null || job.HasExited)
|
||||
if (job is null || job.HasExited)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var file = GetLastTranscodingFile(playlist, segmentExtension, _fileSystem);
|
||||
|
||||
if (file == null)
|
||||
if (file is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Jellyfin.Api.Controllers
|
||||
|
||||
if (validatePathDto.ValidateWritable)
|
||||
{
|
||||
if (validatePathDto.Path == null)
|
||||
if (validatePathDto.Path is null)
|
||||
{
|
||||
throw new ResourceNotFoundException(nameof(validatePathDto.Path));
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ namespace Jellyfin.Api.Controllers
|
||||
|
||||
if ((recursive ?? true) || parentItem is UserView || parentItem is ICollectionFolder)
|
||||
{
|
||||
genreQuery.AncestorIds = parentItem == null ? Array.Empty<Guid>() : new[] { parentItem.Id };
|
||||
genreQuery.AncestorIds = parentItem is null ? Array.Empty<Guid>() : new[] { parentItem.Id };
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace Jellyfin.Api.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return playlistPath == null
|
||||
return playlistPath is null
|
||||
? NotFound("Hls segment not found.")
|
||||
: GetFileResult(file, playlistPath);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Jellyfin.Api.Controllers
|
||||
.Select(i => Path.GetFullPath(Path.Combine(_applicationPaths.GeneralPath, name, filename + i)))
|
||||
.FirstOrDefault(System.IO.File.Exists);
|
||||
|
||||
if (path == null)
|
||||
if (path is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace Jellyfin.Api.Controllers
|
||||
}
|
||||
|
||||
var user = _userManager.GetUserById(userId);
|
||||
if (user?.ProfileImage == null)
|
||||
if (user?.ProfileImage is null)
|
||||
{
|
||||
return NoContent();
|
||||
}
|
||||
@@ -242,7 +242,7 @@ namespace Jellyfin.Api.Controllers
|
||||
}
|
||||
|
||||
var user = _userManager.GetUserById(userId);
|
||||
if (user?.ProfileImage == null)
|
||||
if (user?.ProfileImage is null)
|
||||
{
|
||||
return NoContent();
|
||||
}
|
||||
@@ -279,7 +279,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery] int? imageIndex)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -307,7 +307,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromRoute] int imageIndex)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -335,7 +335,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromRoute, Required] ImageType imageType)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -371,7 +371,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromRoute] int imageIndex)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -407,7 +407,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery, Required] int newIndex)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -430,7 +430,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public async Task<ActionResult<IEnumerable<ImageInfo>>> GetItemImageInfos([FromRoute, Required] Guid itemId)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -537,7 +537,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery] int? imageIndex)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -620,7 +620,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery] string? foregroundLayer)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -703,7 +703,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromRoute, Required] int imageIndex)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -786,7 +786,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromRoute, Required] int imageIndex)
|
||||
{
|
||||
var item = _libraryManager.GetArtist(name);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -869,7 +869,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery] int? imageIndex)
|
||||
{
|
||||
var item = _libraryManager.GetGenre(name);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -952,7 +952,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery] string? foregroundLayer)
|
||||
{
|
||||
var item = _libraryManager.GetGenre(name);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -1035,7 +1035,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery] int? imageIndex)
|
||||
{
|
||||
var item = _libraryManager.GetMusicGenre(name);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -1118,7 +1118,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery] string? foregroundLayer)
|
||||
{
|
||||
var item = _libraryManager.GetMusicGenre(name);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -1201,7 +1201,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery] int? imageIndex)
|
||||
{
|
||||
var item = _libraryManager.GetPerson(name);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -1284,7 +1284,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery] string? foregroundLayer)
|
||||
{
|
||||
var item = _libraryManager.GetPerson(name);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -1367,7 +1367,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery] int? imageIndex)
|
||||
{
|
||||
var item = _libraryManager.GetStudio(name);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -1450,7 +1450,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery] string? foregroundLayer)
|
||||
{
|
||||
var item = _libraryManager.GetStudio(name);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -1533,7 +1533,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery] int? imageIndex)
|
||||
{
|
||||
var user = _userManager.GetUserById(userId);
|
||||
if (user?.ProfileImage == null)
|
||||
if (user?.ProfileImage is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -1634,7 +1634,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery] string? foregroundLayer)
|
||||
{
|
||||
var user = _userManager.GetUserById(userId);
|
||||
if (user?.ProfileImage == null)
|
||||
if (user?.ProfileImage is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -1944,10 +1944,10 @@ namespace Jellyfin.Api.Controllers
|
||||
unplayedCount = null;
|
||||
}
|
||||
|
||||
if (imageInfo == null)
|
||||
if (imageInfo is null)
|
||||
{
|
||||
imageInfo = item?.GetImageInfo(imageType, imageIndex ?? 0);
|
||||
if (imageInfo == null)
|
||||
if (imageInfo is null)
|
||||
{
|
||||
return NotFound(string.Format(NumberFormatInfo.InvariantInfo, "{0} does not have an image of type {1}", item?.Name, imageType));
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public ActionResult<IEnumerable<ExternalIdInfo>> GetExternalIdInfos([FromRoute, Required] Guid itemId)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery] bool replaceAllImages = false)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public async Task<ActionResult> UpdateItem([FromRoute, Required] Guid itemId, [FromBody, Required] BaseItemDto request)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -198,7 +198,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public ActionResult UpdateItemContentType([FromRoute, Required] Guid itemId, [FromQuery] string? contentType)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public ActionResult GetFile([FromRoute, Required] Guid itemId)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -154,7 +154,7 @@ namespace Jellyfin.Api.Controllers
|
||||
: _libraryManager.GetUserRootFolder())
|
||||
: _libraryManager.GetItemById(itemId);
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound("Item not found.");
|
||||
}
|
||||
@@ -171,7 +171,7 @@ namespace Jellyfin.Api.Controllers
|
||||
}
|
||||
|
||||
var parent = item.GetParent();
|
||||
if (parent == null)
|
||||
if (parent is null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -220,7 +220,7 @@ namespace Jellyfin.Api.Controllers
|
||||
: _libraryManager.GetUserRootFolder())
|
||||
: _libraryManager.GetItemById(itemId);
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound("Item not found.");
|
||||
}
|
||||
@@ -237,7 +237,7 @@ namespace Jellyfin.Api.Controllers
|
||||
}
|
||||
|
||||
var parent = item.GetParent();
|
||||
if (parent == null)
|
||||
if (parent is null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -435,7 +435,7 @@ namespace Jellyfin.Api.Controllers
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound("Item not found");
|
||||
}
|
||||
@@ -610,7 +610,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public async Task<ActionResult> GetDownload([FromRoute, Required] Guid itemId)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -763,7 +763,7 @@ namespace Jellyfin.Api.Controllers
|
||||
await AssertUserCanManageLiveTv().ConfigureAwait(false);
|
||||
|
||||
var item = _libraryManager.GetItemById(recordingId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -840,7 +840,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public async Task<ActionResult<SeriesTimerInfoDto>> GetSeriesTimer([FromRoute, Required] string timerId)
|
||||
{
|
||||
var timer = await _liveTvManager.GetSeriesTimer(timerId, CancellationToken.None).ConfigureAwait(false);
|
||||
if (timer == null)
|
||||
if (timer is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -1201,7 +1201,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public ActionResult GetLiveStreamFile([FromRoute, Required] string streamId, [FromRoute, Required] string container)
|
||||
{
|
||||
var liveStreamInfo = _mediaSourceManager.GetLiveStreamInfoByUniqueId(streamId);
|
||||
if (liveStreamInfo == null)
|
||||
if (liveStreamInfo is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace Jellyfin.Api.Controllers
|
||||
var profile = playbackInfoDto?.DeviceProfile;
|
||||
_logger.LogDebug("GetPostedPlaybackInfo profile: {@Profile}", profile);
|
||||
|
||||
if (profile == null)
|
||||
if (profile is null)
|
||||
{
|
||||
var caps = _deviceManager.GetCapabilities(User.GetDeviceId());
|
||||
if (caps != null)
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Jellyfin.Api.Controllers
|
||||
assemblyGuid ?? default)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (result == null)
|
||||
if (result is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -110,7 +110,7 @@ namespace Jellyfin.Api.Controllers
|
||||
specificVersion: string.IsNullOrEmpty(version) ? null : Version.Parse(version))
|
||||
.FirstOrDefault();
|
||||
|
||||
if (package == null)
|
||||
if (package is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace Jellyfin.Api.Controllers
|
||||
.AddClientFields(User);
|
||||
|
||||
var item = _libraryManager.GetPerson(name);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] enableImageTypes)
|
||||
{
|
||||
var playlist = (Playlist)_libraryManager.GetItemById(playlistId);
|
||||
if (playlist == null)
|
||||
if (playlist is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ namespace Jellyfin.Api.Controllers
|
||||
if (method == PlayMethod.Transcode)
|
||||
{
|
||||
var job = string.IsNullOrWhiteSpace(playSessionId) ? null : _transcodingJobHelper.GetTranscodingJob(playSessionId);
|
||||
if (job == null)
|
||||
if (job is null)
|
||||
{
|
||||
return PlayMethod.DirectPlay;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public ActionResult EnablePlugin([FromRoute, Required] Guid pluginId, [FromRoute, Required] Version version)
|
||||
{
|
||||
var plugin = _pluginManager.GetPlugin(pluginId, version);
|
||||
if (plugin == null)
|
||||
if (plugin is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -95,7 +95,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public ActionResult DisablePlugin([FromRoute, Required] Guid pluginId, [FromRoute, Required] Version version)
|
||||
{
|
||||
var plugin = _pluginManager.GetPlugin(pluginId, version);
|
||||
if (plugin == null)
|
||||
if (plugin is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -119,7 +119,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public ActionResult UninstallPluginByVersion([FromRoute, Required] Guid pluginId, [FromRoute, Required] Version version)
|
||||
{
|
||||
var plugin = _pluginManager.GetPlugin(pluginId, version);
|
||||
if (plugin == null)
|
||||
if (plugin is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -146,7 +146,7 @@ namespace Jellyfin.Api.Controllers
|
||||
var plugins = _pluginManager.Plugins.Where(p => p.Id.Equals(pluginId));
|
||||
|
||||
// Select the un-instanced one first.
|
||||
var plugin = plugins.FirstOrDefault(p => p.Instance == null) ?? plugins.OrderBy(p => p.Manifest.Status).FirstOrDefault();
|
||||
var plugin = plugins.FirstOrDefault(p => p.Instance is null) ?? plugins.OrderBy(p => p.Manifest.Status).FirstOrDefault();
|
||||
|
||||
if (plugin != null)
|
||||
{
|
||||
@@ -225,13 +225,13 @@ namespace Jellyfin.Api.Controllers
|
||||
public ActionResult GetPluginImage([FromRoute, Required] Guid pluginId, [FromRoute, Required] Version version)
|
||||
{
|
||||
var plugin = _pluginManager.GetPlugin(pluginId, version);
|
||||
if (plugin == null)
|
||||
if (plugin is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var imagePath = Path.Combine(plugin.Path, plugin.Manifest.ImagePath ?? string.Empty);
|
||||
if (plugin.Manifest.ImagePath == null || !System.IO.File.Exists(imagePath))
|
||||
if (plugin.Manifest.ImagePath is null || !System.IO.File.Exists(imagePath))
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery] bool includeAllLanguages = false)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -127,7 +127,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public ActionResult<IEnumerable<ImageProviderInfo>> GetRemoteImageProviders([FromRoute, Required] Guid itemId)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -154,7 +154,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery] string? imageUrl)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Jellyfin.Api.Controllers
|
||||
var task = _taskManager.ScheduledTasks.FirstOrDefault(i =>
|
||||
string.Equals(i.Id, taskId, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (task == null)
|
||||
if (task is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -99,7 +99,7 @@ namespace Jellyfin.Api.Controllers
|
||||
var task = _taskManager.ScheduledTasks.FirstOrDefault(o =>
|
||||
o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (task == null)
|
||||
if (task is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -123,7 +123,7 @@ namespace Jellyfin.Api.Controllers
|
||||
var task = _taskManager.ScheduledTasks.FirstOrDefault(o =>
|
||||
o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (task == null)
|
||||
if (task is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -149,7 +149,7 @@ namespace Jellyfin.Api.Controllers
|
||||
{
|
||||
var task = _taskManager.ScheduledTasks.FirstOrDefault(o =>
|
||||
o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase));
|
||||
if (task == null)
|
||||
if (task is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ namespace Jellyfin.Api.Controllers
|
||||
{
|
||||
var itemWithImage = item.HasImage(ImageType.Thumb) ? item : null;
|
||||
|
||||
if (itemWithImage == null && item is Episode)
|
||||
if (itemWithImage is null && item is Episode)
|
||||
{
|
||||
itemWithImage = GetParentWithImage<Series>(item, ImageType.Thumb);
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ namespace Jellyfin.Api.Controllers
|
||||
{
|
||||
var currentSession = await RequestHelpers.GetSession(_sessionManager, _userManager, HttpContext).ConfigureAwait(false);
|
||||
|
||||
if (command == null)
|
||||
if (command is null)
|
||||
{
|
||||
throw new ArgumentException("Request body may not be null");
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace Jellyfin.Api.Controllers
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ namespace Jellyfin.Api.Controllers
|
||||
.GetSeasons(user, dtoOptions)
|
||||
.FirstOrDefault(i => i.IndexNumber == season.Value);
|
||||
|
||||
episodes = seasonItem == null ?
|
||||
episodes = seasonItem is null ?
|
||||
new List<BaseItem>()
|
||||
: ((Season)seasonItem).GetEpisodes(user, dtoOptions);
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace Jellyfin.Api.Controllers
|
||||
{
|
||||
var user = _userManager.GetUserById(userId);
|
||||
|
||||
if (user == null)
|
||||
if (user is null)
|
||||
{
|
||||
return NotFound("User not found");
|
||||
}
|
||||
@@ -173,7 +173,7 @@ namespace Jellyfin.Api.Controllers
|
||||
{
|
||||
var user = _userManager.GetUserById(userId);
|
||||
|
||||
if (user == null)
|
||||
if (user is null)
|
||||
{
|
||||
return NotFound("User not found");
|
||||
}
|
||||
@@ -272,7 +272,7 @@ namespace Jellyfin.Api.Controllers
|
||||
|
||||
var user = _userManager.GetUserById(userId);
|
||||
|
||||
if (user == null)
|
||||
if (user is null)
|
||||
{
|
||||
return NotFound("User not found");
|
||||
}
|
||||
@@ -292,7 +292,7 @@ namespace Jellyfin.Api.Controllers
|
||||
HttpContext.GetNormalizedRemoteIp().ToString(),
|
||||
false).ConfigureAwait(false);
|
||||
|
||||
if (success == null)
|
||||
if (success is null)
|
||||
{
|
||||
return StatusCode(StatusCodes.Status403Forbidden, "Invalid user or password entered.");
|
||||
}
|
||||
@@ -333,7 +333,7 @@ namespace Jellyfin.Api.Controllers
|
||||
|
||||
var user = _userManager.GetUserById(userId);
|
||||
|
||||
if (user == null)
|
||||
if (user is null)
|
||||
{
|
||||
return NotFound("User not found");
|
||||
}
|
||||
@@ -544,7 +544,7 @@ namespace Jellyfin.Api.Controllers
|
||||
}
|
||||
|
||||
var user = _userManager.GetUserById(userId);
|
||||
if (user == null)
|
||||
if (user is null)
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ namespace Jellyfin.Api.Controllers
|
||||
{
|
||||
var user = _userManager.GetUserById(userId);
|
||||
|
||||
if (user == null)
|
||||
if (user is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -411,7 +411,7 @@ namespace Jellyfin.Api.Controllers
|
||||
? _libraryManager.GetUserRootFolder()
|
||||
: _libraryManager.GetItemById(itemId);
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public ActionResult<IEnumerable<SpecialViewOptionDto>> GetGroupingOptions([FromRoute, Required] Guid userId)
|
||||
{
|
||||
var user = _userManager.GetUserById(userId);
|
||||
if (user == null)
|
||||
if (user is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Jellyfin.Api.Controllers
|
||||
try
|
||||
{
|
||||
var item = _libraryManager.GetItemById(videoId);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace Jellyfin.Api.Controllers
|
||||
{
|
||||
var video = (Video)_libraryManager.GetItemById(itemId);
|
||||
|
||||
if (video == null)
|
||||
if (video is null)
|
||||
{
|
||||
return NotFound("The video either does not exist or the id does not belong to a video.");
|
||||
}
|
||||
@@ -199,7 +199,7 @@ namespace Jellyfin.Api.Controllers
|
||||
}
|
||||
|
||||
var primaryVersion = items.FirstOrDefault(i => i.MediaSourceCount > 1 && string.IsNullOrEmpty(i.PrimaryVersionId));
|
||||
if (primaryVersion == null)
|
||||
if (primaryVersion is null)
|
||||
{
|
||||
primaryVersion = items
|
||||
.OrderBy(i =>
|
||||
@@ -444,7 +444,7 @@ namespace Jellyfin.Api.Controllers
|
||||
StreamingHelpers.AddDlnaHeaders(state, Response.Headers, true, state.Request.StartTimeTicks, Request, _dlnaManager);
|
||||
|
||||
var liveStreamInfo = _mediaSourceManager.GetLiveStreamInfo(streamingRequest.LiveStreamId);
|
||||
if (liveStreamInfo == null)
|
||||
if (liveStreamInfo is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ namespace Jellyfin.Api.Controllers
|
||||
public ActionResult<BaseItemDto> GetYear([FromRoute, Required] int year, [FromQuery] Guid? userId)
|
||||
{
|
||||
var item = _libraryManager.GetYear(year);
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user