Merge remote-tracking branch 'upstream/master' into authenticationdb-efcore

This commit is contained in:
Cody Robibero
2021-09-03 11:01:55 -06:00
220 changed files with 4473 additions and 2339 deletions

View File

@@ -154,11 +154,11 @@ namespace Jellyfin.Api.Controllers
};
if (!item.IsVirtualItem
&& !(item is ICollectionFolder)
&& !(item is UserView)
&& !(item is AggregateFolder)
&& !(item is LiveTvChannel)
&& !(item is IItemByName)
&& item is not ICollectionFolder
&& item is not UserView
&& item is not AggregateFolder
&& item is not LiveTvChannel
&& item is not IItemByName
&& item.SourceType == SourceType.Library)
{
var inheritedContentType = _libraryManager.GetInheritedContentType(item);

View File

@@ -241,7 +241,7 @@ namespace Jellyfin.Api.Controllers
var item = _libraryManager.GetParentItem(parentId, userId);
QueryResult<BaseItem> result;
if (!(item is Folder folder))
if (item is not Folder folder)
{
folder = _libraryManager.GetUserRootFolder();
}
@@ -285,7 +285,7 @@ namespace Jellyfin.Api.Controllers
return Unauthorized($"{user.Username} is not permitted to access Library {item.Name}.");
}
if ((recursive.HasValue && recursive.Value) || ids.Length != 0 || !(item is UserRootFolder))
if ((recursive.HasValue && recursive.Value) || ids.Length != 0 || item is not UserRootFolder)
{
var query = new InternalItemsQuery(user!)
{

View File

@@ -700,7 +700,7 @@ namespace Jellyfin.Api.Controllers
: _libraryManager.RootFolder)
: _libraryManager.GetItemById(itemId);
if (item is Episode || (item is IItemByName && !(item is MusicArtist)))
if (item is Episode || (item is IItemByName && item is not MusicArtist))
{
return new QueryResult<BaseItemDto>();
}

View File

@@ -84,7 +84,7 @@ namespace Jellyfin.Api.Controllers
if (paths != null && paths.Length > 0)
{
libraryOptions.PathInfos = paths.Select(i => new MediaPathInfo { Path = i }).ToArray();
libraryOptions.PathInfos = paths.Select(i => new MediaPathInfo(i)).ToArray();
}
await _libraryManager.AddVirtualFolder(name, collectionType, libraryOptions, refreshLibrary).ConfigureAwait(false);
@@ -212,7 +212,7 @@ namespace Jellyfin.Api.Controllers
try
{
var mediaPath = mediaPathDto.PathInfo ?? new MediaPathInfo { Path = mediaPathDto.Path };
var mediaPath = mediaPathDto.PathInfo ?? new MediaPathInfo(mediaPathDto.Path ?? throw new ArgumentException("PathInfo and Path can't both be null."));
_libraryManager.AddMediaPath(mediaPathDto.Name, mediaPath);
}

View File

@@ -1172,7 +1172,7 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesVideoFile]
public async Task<ActionResult> GetLiveRecordingFile([FromRoute, Required] string recordingId)
public ActionResult GetLiveRecordingFile([FromRoute, Required] string recordingId)
{
var path = _liveTvManager.GetEmbyTvActiveRecordingPath(recordingId);
@@ -1181,11 +1181,8 @@ namespace Jellyfin.Api.Controllers
return NotFound();
}
await using var memoryStream = new MemoryStream();
await new ProgressiveFileCopier(path, null, _transcodingJobHelper, CancellationToken.None)
.WriteToAsync(memoryStream, CancellationToken.None)
.ConfigureAwait(false);
return File(memoryStream, MimeTypes.GetMimeType(path));
var stream = new ProgressiveFileStream(path, null, _transcodingJobHelper);
return new FileStreamResult(stream, MimeTypes.GetMimeType(path));
}
/// <summary>

View File

@@ -228,7 +228,7 @@ namespace Jellyfin.Api.Controllers
if (seasonId.HasValue) // Season id was supplied. Get episodes by season id.
{
var item = _libraryManager.GetItemById(seasonId.Value);
if (!(item is Season seasonItem))
if (item is not Season seasonItem)
{
return NotFound("No season exists with Id " + seasonId);
}
@@ -237,7 +237,7 @@ namespace Jellyfin.Api.Controllers
}
else if (season.HasValue) // Season number was supplied. Get episodes by season number
{
if (!(_libraryManager.GetItemById(seriesId) is Series series))
if (_libraryManager.GetItemById(seriesId) is not Series series)
{
return NotFound("Series not found");
}
@@ -252,7 +252,7 @@ namespace Jellyfin.Api.Controllers
}
else // No season number or season id was supplied. Returning all episodes.
{
if (!(_libraryManager.GetItemById(seriesId) is Series series))
if (_libraryManager.GetItemById(seriesId) is not Series series)
{
return NotFound("Series not found");
}
@@ -336,7 +336,7 @@ namespace Jellyfin.Api.Controllers
? _userManager.GetUserById(userId.Value)
: null;
if (!(_libraryManager.GetItemById(seriesId) is Series series))
if (_libraryManager.GetItemById(seriesId) is not Series series)
{
return NotFound("Series not found");
}