Remove more warnings
This commit is contained in:
parent
251b9a5235
commit
7bfc6b5679
|
@ -101,7 +101,7 @@ namespace Emby.Drawing
|
|||
public async Task ProcessImage(ImageProcessingOptions options, Stream toStream)
|
||||
{
|
||||
var file = await ProcessImage(options).ConfigureAwait(false);
|
||||
using (var fileStream = AsyncFile.OpenRead(file.path))
|
||||
using (var fileStream = AsyncFile.OpenRead(file.Path))
|
||||
{
|
||||
await fileStream.CopyToAsync(toStream).ConfigureAwait(false);
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ namespace Emby.Drawing
|
|||
=> _transparentImageTypes.Contains(Path.GetExtension(path));
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<(string path, string? mimeType, DateTime dateModified)> ProcessImage(ImageProcessingOptions options)
|
||||
public async Task<(string Path, string? MimeType, DateTime DateModified)> ProcessImage(ImageProcessingOptions options)
|
||||
{
|
||||
ItemImageInfo originalImage = options.Image;
|
||||
BaseItem item = options.Item;
|
||||
|
@ -135,14 +135,14 @@ namespace Emby.Drawing
|
|||
}
|
||||
|
||||
var supportedImageInfo = await GetSupportedImage(originalImagePath, dateModified).ConfigureAwait(false);
|
||||
originalImagePath = supportedImageInfo.path;
|
||||
originalImagePath = supportedImageInfo.Path;
|
||||
|
||||
if (!File.Exists(originalImagePath))
|
||||
{
|
||||
return (originalImagePath, MimeTypes.GetMimeType(originalImagePath), dateModified);
|
||||
}
|
||||
|
||||
dateModified = supportedImageInfo.dateModified;
|
||||
dateModified = supportedImageInfo.DateModified;
|
||||
bool requiresTransparency = _transparentImageTypes.Contains(Path.GetExtension(originalImagePath));
|
||||
|
||||
bool autoOrient = false;
|
||||
|
@ -436,7 +436,7 @@ namespace Emby.Drawing
|
|||
.ToString("N", CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
private async Task<(string path, DateTime dateModified)> GetSupportedImage(string originalImagePath, DateTime dateModified)
|
||||
private async Task<(string Path, DateTime DateModified)> GetSupportedImage(string originalImagePath, DateTime dateModified)
|
||||
{
|
||||
var inputFormat = Path.GetExtension(originalImagePath)
|
||||
.TrimStart('.')
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace Emby.Naming.TV
|
|||
/// <param name="supportSpecialAliases">if set to <c>true</c> [support special aliases].</param>
|
||||
/// <param name="supportNumericSeasonFolders">if set to <c>true</c> [support numeric season folders].</param>
|
||||
/// <returns>System.Nullable{System.Int32}.</returns>
|
||||
private static (int? seasonNumber, bool isSeasonFolder) GetSeasonNumberFromPath(
|
||||
private static (int? SeasonNumber, bool IsSeasonFolder) GetSeasonNumberFromPath(
|
||||
string path,
|
||||
bool supportSpecialAliases,
|
||||
bool supportNumericSeasonFolders)
|
||||
|
@ -99,7 +99,7 @@ namespace Emby.Naming.TV
|
|||
if (filename.Contains(name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var result = GetSeasonNumberFromPathSubstring(filename.Replace(name, " ", StringComparison.OrdinalIgnoreCase));
|
||||
if (result.seasonNumber.HasValue)
|
||||
if (result.SeasonNumber.HasValue)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ namespace Emby.Naming.TV
|
|||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns>System.Nullable{System.Int32}.</returns>
|
||||
private static (int? seasonNumber, bool isSeasonFolder) GetSeasonNumberFromPathSubstring(ReadOnlySpan<char> path)
|
||||
private static (int? SeasonNumber, bool IsSeasonFolder) GetSeasonNumberFromPathSubstring(ReadOnlySpan<char> path)
|
||||
{
|
||||
var numericStart = -1;
|
||||
var length = 0;
|
||||
|
|
|
@ -130,16 +130,14 @@ namespace Emby.Server.Implementations.Channels
|
|||
var internalChannel = _libraryManager.GetItemById(item.ChannelId);
|
||||
if (internalChannel == null)
|
||||
{
|
||||
throw new ArgumentException();
|
||||
throw new ArgumentException(nameof(item.ChannelId));
|
||||
}
|
||||
|
||||
var channel = Channels.FirstOrDefault(i => GetInternalChannelId(i.Name).Equals(internalChannel.Id));
|
||||
|
||||
var supportsDelete = channel as ISupportsDelete;
|
||||
|
||||
if (supportsDelete == null)
|
||||
if (channel is not ISupportsDelete supportsDelete)
|
||||
{
|
||||
throw new ArgumentException();
|
||||
throw new ArgumentException(nameof(channel));
|
||||
}
|
||||
|
||||
return supportsDelete.DeleteItem(item.ExternalId, CancellationToken.None);
|
||||
|
|
|
@ -140,7 +140,7 @@ namespace Emby.Server.Implementations.Collections
|
|||
|
||||
if (parentFolder == null)
|
||||
{
|
||||
throw new ArgumentException();
|
||||
throw new ArgumentException(nameof(parentFolder));
|
||||
}
|
||||
|
||||
var path = Path.Combine(parentFolder.Path, folderName);
|
||||
|
|
|
@ -248,40 +248,6 @@ namespace Emby.Server.Implementations.Data
|
|||
BaseItemKind.AudioBook
|
||||
};
|
||||
|
||||
private static readonly Type[] _knownTypes =
|
||||
{
|
||||
typeof(LiveTvProgram),
|
||||
typeof(LiveTvChannel),
|
||||
typeof(Series),
|
||||
typeof(Audio),
|
||||
typeof(MusicAlbum),
|
||||
typeof(MusicArtist),
|
||||
typeof(MusicGenre),
|
||||
typeof(MusicVideo),
|
||||
typeof(Movie),
|
||||
typeof(Playlist),
|
||||
typeof(AudioBook),
|
||||
typeof(Trailer),
|
||||
typeof(BoxSet),
|
||||
typeof(Episode),
|
||||
typeof(Season),
|
||||
typeof(Series),
|
||||
typeof(Book),
|
||||
typeof(CollectionFolder),
|
||||
typeof(Folder),
|
||||
typeof(Genre),
|
||||
typeof(Person),
|
||||
typeof(Photo),
|
||||
typeof(PhotoAlbum),
|
||||
typeof(Studio),
|
||||
typeof(UserRootFolder),
|
||||
typeof(UserView),
|
||||
typeof(Video),
|
||||
typeof(Year),
|
||||
typeof(Channel),
|
||||
typeof(AggregateFolder)
|
||||
};
|
||||
|
||||
private static readonly Dictionary<BaseItemKind, string> _baseItemKindNames = new()
|
||||
{
|
||||
{ BaseItemKind.AggregateFolder, typeof(AggregateFolder).FullName },
|
||||
|
@ -688,13 +654,13 @@ namespace Emby.Server.Implementations.Data
|
|||
connection.RunInTransaction(
|
||||
db =>
|
||||
{
|
||||
SaveItemsInTranscation(db, tuples);
|
||||
SaveItemsInTransaction(db, tuples);
|
||||
},
|
||||
TransactionMode);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveItemsInTranscation(IDatabaseConnection db, IEnumerable<(BaseItem, List<Guid>, BaseItem, string, List<string>)> tuples)
|
||||
private void SaveItemsInTransaction(IDatabaseConnection db, IEnumerable<(BaseItem Item, List<Guid> AncestorIds, BaseItem TopParent, string UserDataKey, List<string> InheritedTags)> tuples)
|
||||
{
|
||||
var statements = PrepareAll(db, new string[]
|
||||
{
|
||||
|
@ -713,17 +679,17 @@ namespace Emby.Server.Implementations.Data
|
|||
saveItemStatement.Reset();
|
||||
}
|
||||
|
||||
var item = tuple.Item1;
|
||||
var topParent = tuple.Item3;
|
||||
var userDataKey = tuple.Item4;
|
||||
var item = tuple.Item;
|
||||
var topParent = tuple.TopParent;
|
||||
var userDataKey = tuple.UserDataKey;
|
||||
|
||||
SaveItem(item, topParent, userDataKey, saveItemStatement);
|
||||
|
||||
var inheritedTags = tuple.Item5;
|
||||
var inheritedTags = tuple.InheritedTags;
|
||||
|
||||
if (item.SupportsAncestors)
|
||||
{
|
||||
UpdateAncestors(item.Id, tuple.Item2, db, deleteAncestorsStatement);
|
||||
UpdateAncestors(item.Id, tuple.AncestorIds, db, deleteAncestorsStatement);
|
||||
}
|
||||
|
||||
UpdateItemValues(item.Id, GetItemValuesToSave(item, inheritedTags), db);
|
||||
|
@ -2201,7 +2167,7 @@ namespace Emby.Server.Implementations.Data
|
|||
return false;
|
||||
}
|
||||
|
||||
var sortingFields = new HashSet<string>(query.OrderBy.Select(i => i.Item1), StringComparer.OrdinalIgnoreCase);
|
||||
var sortingFields = new HashSet<string>(query.OrderBy.Select(i => i.OrderBy), StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
return sortingFields.Contains(ItemSortBy.IsFavoriteOrLiked)
|
||||
|| sortingFields.Contains(ItemSortBy.IsPlayed)
|
||||
|
@ -3049,88 +3015,86 @@ namespace Emby.Server.Implementations.Data
|
|||
|
||||
return " ORDER BY " + string.Join(',', orderBy.Select(i =>
|
||||
{
|
||||
var columnMap = MapOrderByField(i.Item1, query);
|
||||
var columnMap = MapOrderByField(i.OrderBy, query);
|
||||
|
||||
var sortOrder = i.Item2 == SortOrder.Ascending ? "ASC" : "DESC";
|
||||
|
||||
return columnMap.Item1 + " " + sortOrder;
|
||||
return columnMap.SortBy + " " + columnMap.SortOrder;
|
||||
}));
|
||||
}
|
||||
|
||||
private (string, bool) MapOrderByField(string name, InternalItemsQuery query)
|
||||
private (string SortBy, SortOrder SortOrder) MapOrderByField(string name, InternalItemsQuery query)
|
||||
{
|
||||
if (string.Equals(name, ItemSortBy.AirTime, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// TODO
|
||||
return ("SortName", false);
|
||||
return ("SortName", SortOrder.Descending);
|
||||
}
|
||||
else if (string.Equals(name, ItemSortBy.Runtime, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ("RuntimeTicks", false);
|
||||
return ("RuntimeTicks", SortOrder.Descending);
|
||||
}
|
||||
else if (string.Equals(name, ItemSortBy.Random, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ("RANDOM()", false);
|
||||
return ("RANDOM()", SortOrder.Descending);
|
||||
}
|
||||
else if (string.Equals(name, ItemSortBy.DatePlayed, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (query.GroupBySeriesPresentationUniqueKey)
|
||||
{
|
||||
return ("MAX(LastPlayedDate)", false);
|
||||
return ("MAX(LastPlayedDate)", SortOrder.Descending);
|
||||
}
|
||||
|
||||
return ("LastPlayedDate", false);
|
||||
return ("LastPlayedDate", SortOrder.Descending);
|
||||
}
|
||||
else if (string.Equals(name, ItemSortBy.PlayCount, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ("PlayCount", false);
|
||||
return ("PlayCount", SortOrder.Descending);
|
||||
}
|
||||
else if (string.Equals(name, ItemSortBy.IsFavoriteOrLiked, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ("(Select Case When IsFavorite is null Then 0 Else IsFavorite End )", true);
|
||||
return ("(Select Case When IsFavorite is null Then 0 Else IsFavorite End )", SortOrder.Ascending);
|
||||
}
|
||||
else if (string.Equals(name, ItemSortBy.IsFolder, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ("IsFolder", true);
|
||||
return ("IsFolder", SortOrder.Ascending);
|
||||
}
|
||||
else if (string.Equals(name, ItemSortBy.IsPlayed, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ("played", true);
|
||||
return ("played", SortOrder.Ascending);
|
||||
}
|
||||
else if (string.Equals(name, ItemSortBy.IsUnplayed, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ("played", false);
|
||||
return ("played", SortOrder.Descending);
|
||||
}
|
||||
else if (string.Equals(name, ItemSortBy.DateLastContentAdded, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ("DateLastMediaAdded", false);
|
||||
return ("DateLastMediaAdded", SortOrder.Descending);
|
||||
}
|
||||
else if (string.Equals(name, ItemSortBy.Artist, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ("(select CleanValue from itemvalues where ItemId=Guid and Type=0 LIMIT 1)", false);
|
||||
return ("(select CleanValue from itemvalues where ItemId=Guid and Type=0 LIMIT 1)", SortOrder.Descending);
|
||||
}
|
||||
else if (string.Equals(name, ItemSortBy.AlbumArtist, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ("(select CleanValue from itemvalues where ItemId=Guid and Type=1 LIMIT 1)", false);
|
||||
return ("(select CleanValue from itemvalues where ItemId=Guid and Type=1 LIMIT 1)", SortOrder.Descending);
|
||||
}
|
||||
else if (string.Equals(name, ItemSortBy.OfficialRating, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ("InheritedParentalRatingValue", false);
|
||||
return ("InheritedParentalRatingValue", SortOrder.Descending);
|
||||
}
|
||||
else if (string.Equals(name, ItemSortBy.Studio, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ("(select CleanValue from itemvalues where ItemId=Guid and Type=3 LIMIT 1)", false);
|
||||
return ("(select CleanValue from itemvalues where ItemId=Guid and Type=3 LIMIT 1)", SortOrder.Descending);
|
||||
}
|
||||
else if (string.Equals(name, ItemSortBy.SeriesDatePlayed, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ("(Select MAX(LastPlayedDate) from TypedBaseItems B" + GetJoinUserDataText(query) + " where Played=1 and B.SeriesPresentationUniqueKey=A.PresentationUniqueKey)", false);
|
||||
return ("(Select MAX(LastPlayedDate) from TypedBaseItems B" + GetJoinUserDataText(query) + " where Played=1 and B.SeriesPresentationUniqueKey=A.PresentationUniqueKey)", SortOrder.Descending);
|
||||
}
|
||||
else if (string.Equals(name, ItemSortBy.SeriesSortName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ("SeriesName", false);
|
||||
return ("SeriesName", SortOrder.Descending);
|
||||
}
|
||||
|
||||
return (name, false);
|
||||
return (name, SortOrder.Descending);
|
||||
}
|
||||
|
||||
public List<Guid> GetItemIdsList(InternalItemsQuery query)
|
||||
|
@ -5230,32 +5194,32 @@ AND Type = @InternalPersonType)");
|
|||
}
|
||||
}
|
||||
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetAllArtists(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetAllArtists(InternalItemsQuery query)
|
||||
{
|
||||
return GetItemValues(query, new[] { 0, 1 }, typeof(MusicArtist).FullName);
|
||||
}
|
||||
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetArtists(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetArtists(InternalItemsQuery query)
|
||||
{
|
||||
return GetItemValues(query, new[] { 0 }, typeof(MusicArtist).FullName);
|
||||
}
|
||||
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetAlbumArtists(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetAlbumArtists(InternalItemsQuery query)
|
||||
{
|
||||
return GetItemValues(query, new[] { 1 }, typeof(MusicArtist).FullName);
|
||||
}
|
||||
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetStudios(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetStudios(InternalItemsQuery query)
|
||||
{
|
||||
return GetItemValues(query, new[] { 3 }, typeof(Studio).FullName);
|
||||
}
|
||||
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetGenres(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetGenres(InternalItemsQuery query)
|
||||
{
|
||||
return GetItemValues(query, new[] { 2 }, typeof(Genre).FullName);
|
||||
}
|
||||
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetMusicGenres(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetMusicGenres(InternalItemsQuery query)
|
||||
{
|
||||
return GetItemValues(query, new[] { 2 }, typeof(MusicGenre).FullName);
|
||||
}
|
||||
|
@ -5351,7 +5315,7 @@ AND Type = @InternalPersonType)");
|
|||
return list;
|
||||
}
|
||||
|
||||
private QueryResult<(BaseItem, ItemCounts)> GetItemValues(InternalItemsQuery query, int[] itemValueTypes, string returnType)
|
||||
private QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetItemValues(InternalItemsQuery query, int[] itemValueTypes, string returnType)
|
||||
{
|
||||
if (query == null)
|
||||
{
|
||||
|
@ -5676,7 +5640,7 @@ AND Type = @InternalPersonType)");
|
|||
return counts;
|
||||
}
|
||||
|
||||
private List<(int, string)> GetItemValuesToSave(BaseItem item, List<string> inheritedTags)
|
||||
private List<(int MagicNumber, string Value)> GetItemValuesToSave(BaseItem item, List<string> inheritedTags)
|
||||
{
|
||||
var list = new List<(int, string)>();
|
||||
|
||||
|
@ -5701,7 +5665,7 @@ AND Type = @InternalPersonType)");
|
|||
return list;
|
||||
}
|
||||
|
||||
private void UpdateItemValues(Guid itemId, List<(int, string)> values, IDatabaseConnection db)
|
||||
private void UpdateItemValues(Guid itemId, List<(int MagicNumber, string Value)> values, IDatabaseConnection db)
|
||||
{
|
||||
if (itemId.Equals(Guid.Empty))
|
||||
{
|
||||
|
@ -5723,7 +5687,7 @@ AND Type = @InternalPersonType)");
|
|||
InsertItemValues(guidBlob, values, db);
|
||||
}
|
||||
|
||||
private void InsertItemValues(byte[] idBlob, List<(int, string)> values, IDatabaseConnection db)
|
||||
private void InsertItemValues(byte[] idBlob, List<(int MagicNumber, string Value)> values, IDatabaseConnection db)
|
||||
{
|
||||
const int Limit = 100;
|
||||
var startIndex = 0;
|
||||
|
@ -5755,7 +5719,7 @@ AND Type = @InternalPersonType)");
|
|||
|
||||
var currentValueInfo = values[i];
|
||||
|
||||
var itemValue = currentValueInfo.Item2;
|
||||
var itemValue = currentValueInfo.Value;
|
||||
|
||||
// Don't save if invalid
|
||||
if (string.IsNullOrWhiteSpace(itemValue))
|
||||
|
@ -5763,7 +5727,7 @@ AND Type = @InternalPersonType)");
|
|||
continue;
|
||||
}
|
||||
|
||||
statement.TryBind("@Type" + index, currentValueInfo.Item1);
|
||||
statement.TryBind("@Type" + index, currentValueInfo.MagicNumber);
|
||||
statement.TryBind("@Value" + index, itemValue);
|
||||
statement.TryBind("@CleanValue" + index, GetCleanValue(itemValue));
|
||||
}
|
||||
|
|
|
@ -464,6 +464,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
|||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -17,11 +17,11 @@ namespace Emby.Server.Implementations.IO
|
|||
try
|
||||
{
|
||||
int read;
|
||||
while ((read = await source.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false)) != 0)
|
||||
while ((read = await source.ReadAsync(buffer, cancellationToken).ConfigureAwait(false)) != 0)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
await destination.WriteAsync(buffer, 0, read, cancellationToken).ConfigureAwait(false);
|
||||
await destination.WriteAsync(buffer.AsMemory(0, read), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (onStarted != null)
|
||||
{
|
||||
|
@ -44,11 +44,11 @@ namespace Emby.Server.Implementations.IO
|
|||
if (emptyReadLimit <= 0)
|
||||
{
|
||||
int read;
|
||||
while ((read = await source.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false)) != 0)
|
||||
while ((read = await source.ReadAsync(buffer, cancellationToken).ConfigureAwait(false)) != 0)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
await destination.WriteAsync(buffer, 0, read, cancellationToken).ConfigureAwait(false);
|
||||
await destination.WriteAsync(buffer.AsMemory(0, read), cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -60,7 +60,7 @@ namespace Emby.Server.Implementations.IO
|
|||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var bytesRead = await source.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false);
|
||||
var bytesRead = await source.ReadAsync(buffer, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (bytesRead == 0)
|
||||
{
|
||||
|
@ -71,7 +71,7 @@ namespace Emby.Server.Implementations.IO
|
|||
{
|
||||
eofCount = 0;
|
||||
|
||||
await destination.WriteAsync(buffer, 0, bytesRead, cancellationToken).ConfigureAwait(false);
|
||||
await destination.WriteAsync(buffer.AsMemory(0, bytesRead), cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,13 +88,13 @@ namespace Emby.Server.Implementations.IO
|
|||
{
|
||||
int bytesRead;
|
||||
|
||||
while ((bytesRead = await source.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false)) != 0)
|
||||
while ((bytesRead = await source.ReadAsync(buffer, cancellationToken).ConfigureAwait(false)) != 0)
|
||||
{
|
||||
var bytesToWrite = Math.Min(bytesRead, copyLength);
|
||||
|
||||
if (bytesToWrite > 0)
|
||||
{
|
||||
await destination.WriteAsync(buffer, 0, Convert.ToInt32(bytesToWrite), cancellationToken).ConfigureAwait(false);
|
||||
await destination.WriteAsync(buffer.AsMemory(0, Convert.ToInt32(bytesToWrite)), cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
copyLength -= bytesToWrite;
|
||||
|
@ -137,9 +137,9 @@ namespace Emby.Server.Implementations.IO
|
|||
int bytesRead;
|
||||
int totalBytesRead = 0;
|
||||
|
||||
while ((bytesRead = await source.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false)) != 0)
|
||||
while ((bytesRead = await source.ReadAsync(buffer, cancellationToken).ConfigureAwait(false)) != 0)
|
||||
{
|
||||
await destination.WriteAsync(buffer, 0, bytesRead, cancellationToken).ConfigureAwait(false);
|
||||
await destination.WriteAsync(buffer.AsMemory(0, bytesRead), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
totalBytesRead += bytesRead;
|
||||
}
|
||||
|
|
|
@ -68,9 +68,9 @@ namespace Emby.Server.Implementations.Images
|
|||
DtoOptions = new DtoOptions(false),
|
||||
ImageTypes = new ImageType[] { ImageType.Primary },
|
||||
Limit = 8,
|
||||
OrderBy = new ValueTuple<string, SortOrder>[]
|
||||
OrderBy = new[]
|
||||
{
|
||||
new ValueTuple<string, SortOrder>(ItemSortBy.Random, SortOrder.Ascending)
|
||||
(ItemSortBy.Random, SortOrder.Ascending)
|
||||
},
|
||||
IncludeItemTypes = includeItemTypes
|
||||
});
|
||||
|
|
|
@ -1373,7 +1373,7 @@ namespace Emby.Server.Implementations.Library
|
|||
return _itemRepository.GetItemIdsList(query);
|
||||
}
|
||||
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetStudios(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetStudios(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
{
|
||||
|
@ -1384,7 +1384,7 @@ namespace Emby.Server.Implementations.Library
|
|||
return _itemRepository.GetStudios(query);
|
||||
}
|
||||
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetGenres(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetGenres(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
{
|
||||
|
@ -1395,7 +1395,7 @@ namespace Emby.Server.Implementations.Library
|
|||
return _itemRepository.GetGenres(query);
|
||||
}
|
||||
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetMusicGenres(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetMusicGenres(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
{
|
||||
|
@ -1406,7 +1406,7 @@ namespace Emby.Server.Implementations.Library
|
|||
return _itemRepository.GetMusicGenres(query);
|
||||
}
|
||||
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetAllArtists(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetAllArtists(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
{
|
||||
|
@ -1417,7 +1417,7 @@ namespace Emby.Server.Implementations.Library
|
|||
return _itemRepository.GetAllArtists(query);
|
||||
}
|
||||
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetArtists(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetArtists(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
{
|
||||
|
@ -1458,7 +1458,7 @@ namespace Emby.Server.Implementations.Library
|
|||
}
|
||||
}
|
||||
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetAlbumArtists(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetAlbumArtists(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
{
|
||||
|
@ -1757,7 +1757,7 @@ namespace Emby.Server.Implementations.Library
|
|||
return orderedItems ?? items;
|
||||
}
|
||||
|
||||
public IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<ValueTuple<string, SortOrder>> orderBy)
|
||||
public IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<(string OrderBy, SortOrder SortOrder)> orderBy)
|
||||
{
|
||||
var isFirst = true;
|
||||
|
||||
|
|
|
@ -464,12 +464,11 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
try
|
||||
{
|
||||
var tuple = GetProvider(request.OpenToken);
|
||||
var provider = tuple.Item1;
|
||||
var (provider, keyId) = GetProvider(request.OpenToken);
|
||||
|
||||
var currentLiveStreams = _openStreams.Values.ToList();
|
||||
|
||||
liveStream = await provider.OpenMediaSource(tuple.Item2, currentLiveStreams, cancellationToken).ConfigureAwait(false);
|
||||
liveStream = await provider.OpenMediaSource(keyId, currentLiveStreams, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
mediaSource = liveStream.MediaSource;
|
||||
|
||||
|
@ -829,7 +828,7 @@ namespace Emby.Server.Implementations.Library
|
|||
}
|
||||
}
|
||||
|
||||
private (IMediaSourceProvider, string) GetProvider(string key)
|
||||
private (IMediaSourceProvider MediaSourceProvider, string KeyId) GetProvider(string key)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
|
|
|
@ -190,7 +190,7 @@ namespace Emby.Server.Implementations.Library
|
|||
searchQuery.ParentId = Guid.Empty;
|
||||
searchQuery.IncludeItemsByName = true;
|
||||
searchQuery.IncludeItemTypes = Array.Empty<BaseItemKind>();
|
||||
mediaItems = _libraryManager.GetAllArtists(searchQuery).Items.Select(i => i.Item1).ToList();
|
||||
mediaItems = _libraryManager.GetAllArtists(searchQuery).Items.Select(i => i.Item).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -643,7 +643,9 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
CancellationToken cancellationToken)
|
||||
{
|
||||
using var options = new HttpRequestMessage(HttpMethod.Post, ApiUrl + "/token");
|
||||
#pragma warning disable CA5350 // SchedulesDirect is always SHA1.
|
||||
var hashedPasswordBytes = SHA1.HashData(Encoding.ASCII.GetBytes(password));
|
||||
#pragma warning restore CA5350
|
||||
// TODO: remove ToLower when Convert.ToHexString supports lowercase
|
||||
// Schedules Direct requires the hex to be lowercase
|
||||
string hashedPassword = Convert.ToHexString(hashedPasswordBytes).ToLowerInvariant();
|
||||
|
|
|
@ -207,7 +207,7 @@ namespace Emby.Server.Implementations.LiveTv
|
|||
orderBy.Insert(0, (ItemSortBy.IsFavoriteOrLiked, SortOrder.Descending));
|
||||
}
|
||||
|
||||
if (!internalQuery.OrderBy.Any(i => string.Equals(i.Item1, ItemSortBy.SortName, StringComparison.OrdinalIgnoreCase)))
|
||||
if (!internalQuery.OrderBy.Any(i => string.Equals(i.OrderBy, ItemSortBy.SortName, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
orderBy.Add((ItemSortBy.SortName, SortOrder.Ascending));
|
||||
}
|
||||
|
@ -520,7 +520,7 @@ namespace Emby.Server.Implementations.LiveTv
|
|||
return item;
|
||||
}
|
||||
|
||||
private (LiveTvProgram item, bool isNew, bool isUpdated) GetProgram(ProgramInfo info, Dictionary<Guid, LiveTvProgram> allExistingPrograms, LiveTvChannel channel)
|
||||
private (LiveTvProgram Item, bool IsNew, bool IsUpdated) GetProgram(ProgramInfo info, Dictionary<Guid, LiveTvProgram> allExistingPrograms, LiveTvChannel channel)
|
||||
{
|
||||
var id = _tvDtoService.GetInternalProgramId(info.Id);
|
||||
|
||||
|
@ -779,9 +779,9 @@ namespace Emby.Server.Implementations.LiveTv
|
|||
|
||||
var dto = _dtoService.GetBaseItemDto(program, new DtoOptions(), user);
|
||||
|
||||
var list = new List<Tuple<BaseItemDto, string, string>>
|
||||
var list = new List<(BaseItemDto ItemDto, string ExternalId, string ExternalSeriesId)>
|
||||
{
|
||||
new Tuple<BaseItemDto, string, string>(dto, program.ExternalId, program.ExternalSeriesId)
|
||||
(dto, program.ExternalId, program.ExternalSeriesId)
|
||||
};
|
||||
|
||||
await AddRecordingInfo(list, cancellationToken).ConfigureAwait(false);
|
||||
|
@ -976,16 +976,16 @@ namespace Emby.Server.Implementations.LiveTv
|
|||
return score;
|
||||
}
|
||||
|
||||
private async Task AddRecordingInfo(IEnumerable<Tuple<BaseItemDto, string, string>> programs, CancellationToken cancellationToken)
|
||||
private async Task AddRecordingInfo(IEnumerable<(BaseItemDto ItemDto, string ExternalId, string ExternalSeriesId)> programs, CancellationToken cancellationToken)
|
||||
{
|
||||
IReadOnlyList<TimerInfo> timerList = null;
|
||||
IReadOnlyList<SeriesTimerInfo> seriesTimerList = null;
|
||||
|
||||
foreach (var programTuple in programs)
|
||||
{
|
||||
var program = programTuple.Item1;
|
||||
var externalProgramId = programTuple.Item2;
|
||||
string externalSeriesId = programTuple.Item3;
|
||||
var program = programTuple.ItemDto;
|
||||
var externalProgramId = programTuple.ExternalId;
|
||||
string externalSeriesId = programTuple.ExternalSeriesId;
|
||||
|
||||
timerList ??= (await GetTimersInternal(new TimerQuery(), cancellationToken).ConfigureAwait(false)).Items;
|
||||
|
||||
|
@ -1186,13 +1186,13 @@ namespace Emby.Server.Implementations.LiveTv
|
|||
foreach (var program in channelPrograms)
|
||||
{
|
||||
var programTuple = GetProgram(program, existingPrograms, currentChannel);
|
||||
var programItem = programTuple.item;
|
||||
var programItem = programTuple.Item;
|
||||
|
||||
if (programTuple.isNew)
|
||||
if (programTuple.IsNew)
|
||||
{
|
||||
newPrograms.Add(programItem);
|
||||
}
|
||||
else if (programTuple.isUpdated)
|
||||
else if (programTuple.IsUpdated)
|
||||
{
|
||||
updatedPrograms.Add(programItem);
|
||||
}
|
||||
|
@ -1423,9 +1423,9 @@ namespace Emby.Server.Implementations.LiveTv
|
|||
return result;
|
||||
}
|
||||
|
||||
public Task AddInfoToProgramDto(IReadOnlyCollection<(BaseItem, BaseItemDto)> programs, IReadOnlyList<ItemFields> fields, User user = null)
|
||||
public Task AddInfoToProgramDto(IReadOnlyCollection<(BaseItem Item, BaseItemDto ItemDto)> programs, IReadOnlyList<ItemFields> fields, User user = null)
|
||||
{
|
||||
var programTuples = new List<Tuple<BaseItemDto, string, string>>();
|
||||
var programTuples = new List<(BaseItemDto Dto, string ExternalId, string ExternalSeriesId)>();
|
||||
var hasChannelImage = fields.Contains(ItemFields.ChannelImage);
|
||||
var hasChannelInfo = fields.Contains(ItemFields.ChannelInfo);
|
||||
|
||||
|
@ -1461,7 +1461,7 @@ namespace Emby.Server.Implementations.LiveTv
|
|||
}
|
||||
}
|
||||
|
||||
programTuples.Add(new Tuple<BaseItemDto, string, string>(dto, program.ExternalId, program.ExternalSeriesId));
|
||||
programTuples.Add((dto, program.ExternalId, program.ExternalSeriesId));
|
||||
}
|
||||
|
||||
return AddRecordingInfo(programTuples, CancellationToken.None);
|
||||
|
@ -1868,11 +1868,11 @@ namespace Emby.Server.Implementations.LiveTv
|
|||
return _libraryManager.GetItemById(internalChannelId);
|
||||
}
|
||||
|
||||
public void AddChannelInfo(IReadOnlyCollection<(BaseItemDto, LiveTvChannel)> items, DtoOptions options, User user)
|
||||
public void AddChannelInfo(IReadOnlyCollection<(BaseItemDto ItemDto, LiveTvChannel Channel)> items, DtoOptions options, User user)
|
||||
{
|
||||
var now = DateTime.UtcNow;
|
||||
|
||||
var channelIds = items.Select(i => i.Item2.Id).Distinct().ToArray();
|
||||
var channelIds = items.Select(i => i.Channel.Id).Distinct().ToArray();
|
||||
|
||||
var programs = options.AddCurrentProgram ? _libraryManager.GetItemList(new InternalItemsQuery(user)
|
||||
{
|
||||
|
@ -1893,11 +1893,8 @@ namespace Emby.Server.Implementations.LiveTv
|
|||
|
||||
var addCurrentProgram = options.AddCurrentProgram;
|
||||
|
||||
foreach (var tuple in items)
|
||||
foreach (var (dto, channel) in items)
|
||||
{
|
||||
var dto = tuple.Item1;
|
||||
var channel = tuple.Item2;
|
||||
|
||||
dto.Number = channel.Number;
|
||||
dto.ChannelNumber = channel.Number;
|
||||
dto.ChannelType = channel.ChannelType;
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
_profile = profile;
|
||||
}
|
||||
|
||||
public IEnumerable<(string, string)> GetCommands()
|
||||
public IEnumerable<(string CommandName, string CommandValue)> GetCommands()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_channel))
|
||||
{
|
||||
|
|
|
@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
|
||||
foreach (var command in commands.GetCommands())
|
||||
{
|
||||
var channelMsgLen = WriteSetMessage(buffer, i, command.Item1, command.Item2, lockKeyValue);
|
||||
var channelMsgLen = WriteSetMessage(buffer, i, command.CommandName, command.CommandValue, lockKeyValue);
|
||||
await stream.WriteAsync(buffer.AsMemory(0, channelMsgLen), cancellationToken).ConfigureAwait(false);
|
||||
receivedBytes = await stream.ReadAsync(buffer, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
|
@ -167,7 +167,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
{
|
||||
foreach (var command in commandList)
|
||||
{
|
||||
var channelMsgLen = WriteSetMessage(buffer, _activeTuner, command.Item1, command.Item2, _lockkey);
|
||||
var channelMsgLen = WriteSetMessage(buffer, _activeTuner, command.CommandName, command.CommandValue, _lockkey);
|
||||
await stream.WriteAsync(buffer.AsMemory(0, channelMsgLen), cancellationToken).ConfigureAwait(false);
|
||||
int receivedBytes = await stream.ReadAsync(buffer, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
|
||||
if (read > 0)
|
||||
{
|
||||
fileStream.Write(buffer, RtpHeaderBytes, read);
|
||||
await fileStream.WriteAsync(buffer.AsMemory(RtpHeaderBytes, read), linkedSource.Token).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (!resolved)
|
||||
|
|
|
@ -6,6 +6,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
{
|
||||
public interface IHdHomerunChannelCommands
|
||||
{
|
||||
IEnumerable<(string, string)> GetCommands();
|
||||
IEnumerable<(string CommandName, string CommandValue)> GetCommands();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
}
|
||||
}
|
||||
|
||||
public IEnumerable<(string, string)> GetCommands()
|
||||
public IEnumerable<(string CommandName, string CommandValue)> GetCommands()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_channel))
|
||||
{
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace Emby.Server.Implementations.Playlists
|
|||
var parentFolder = GetPlaylistsFolder(Guid.Empty);
|
||||
if (parentFolder == null)
|
||||
{
|
||||
throw new ArgumentException();
|
||||
throw new ArgumentException(nameof(parentFolder));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(options.MediaType))
|
||||
|
|
|
@ -117,7 +117,7 @@ namespace Emby.Server.Implementations.TV
|
|||
new InternalItemsQuery(user)
|
||||
{
|
||||
IncludeItemTypes = new[] { BaseItemKind.Episode },
|
||||
OrderBy = new[] { new ValueTuple<string, SortOrder>(ItemSortBy.DatePlayed, SortOrder.Descending) },
|
||||
OrderBy = new[] { (ItemSortBy.DatePlayed, SortOrder.Descending) },
|
||||
SeriesPresentationUniqueKey = presentationUniqueKey,
|
||||
Limit = limit,
|
||||
DtoOptions = new DtoOptions { Fields = new[] { ItemFields.SeriesPresentationUniqueKey }, EnableImages = false },
|
||||
|
@ -193,7 +193,7 @@ namespace Emby.Server.Implementations.TV
|
|||
AncestorWithPresentationUniqueKey = null,
|
||||
SeriesPresentationUniqueKey = seriesKey,
|
||||
IncludeItemTypes = new[] { BaseItemKind.Episode },
|
||||
OrderBy = new[] { new ValueTuple<string, SortOrder>(ItemSortBy.SortName, SortOrder.Descending) },
|
||||
OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Descending) },
|
||||
IsPlayed = true,
|
||||
Limit = 1,
|
||||
ParentIndexNumberNotEquals = 0,
|
||||
|
@ -211,7 +211,7 @@ namespace Emby.Server.Implementations.TV
|
|||
AncestorWithPresentationUniqueKey = null,
|
||||
SeriesPresentationUniqueKey = seriesKey,
|
||||
IncludeItemTypes = new[] { BaseItemKind.Episode },
|
||||
OrderBy = new[] { new ValueTuple<string, SortOrder>(ItemSortBy.SortName, SortOrder.Ascending) },
|
||||
OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) },
|
||||
Limit = 1,
|
||||
IsPlayed = false,
|
||||
IsVirtualItem = false,
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace Emby.Server.Implementations.Updates
|
|||
/// <summary>
|
||||
/// The current installations.
|
||||
/// </summary>
|
||||
private readonly List<(InstallationInfo info, CancellationTokenSource token)> _currentInstallations;
|
||||
private readonly List<(InstallationInfo Info, CancellationTokenSource Token)> _currentInstallations;
|
||||
|
||||
/// <summary>
|
||||
/// The completed installations.
|
||||
|
@ -399,13 +399,13 @@ namespace Emby.Server.Implementations.Updates
|
|||
{
|
||||
lock (_currentInstallationsLock)
|
||||
{
|
||||
var install = _currentInstallations.Find(x => x.info.Id == id);
|
||||
var install = _currentInstallations.Find(x => x.Info.Id == id);
|
||||
if (install == default((InstallationInfo, CancellationTokenSource)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
install.token.Cancel();
|
||||
install.Token.Cancel();
|
||||
_currentInstallations.Remove(install);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -197,16 +197,16 @@ namespace Jellyfin.Api.Controllers
|
|||
{
|
||||
filters.Genres = _libraryManager.GetMusicGenres(genreQuery).Items.Select(i => new NameGuidPair
|
||||
{
|
||||
Name = i.Item1.Name,
|
||||
Id = i.Item1.Id
|
||||
Name = i.Item.Name,
|
||||
Id = i.Item.Id
|
||||
}).ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
filters.Genres = _libraryManager.GetGenres(genreQuery).Items.Select(i => new NameGuidPair
|
||||
{
|
||||
Name = i.Item1.Name,
|
||||
Id = i.Item1.Id
|
||||
Name = i.Item.Name,
|
||||
Id = i.Item.Id
|
||||
}).ToArray();
|
||||
}
|
||||
|
||||
|
|
|
@ -484,7 +484,7 @@ namespace Jellyfin.Api.Controllers
|
|||
// Albums by artist
|
||||
if (query.ArtistIds.Length > 0 && query.IncludeItemTypes.Length == 1 && query.IncludeItemTypes[0] == BaseItemKind.MusicAlbum)
|
||||
{
|
||||
query.OrderBy = new[] { new ValueTuple<string, SortOrder>(ItemSortBy.ProductionYear, SortOrder.Descending), new ValueTuple<string, SortOrder>(ItemSortBy.SortName, SortOrder.Ascending) };
|
||||
query.OrderBy = new[] { (ItemSortBy.ProductionYear, SortOrder.Descending), (ItemSortBy.SortName, SortOrder.Ascending) };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace Jellyfin.Api.Helpers
|
|||
{
|
||||
if (sortBy.Count == 0)
|
||||
{
|
||||
return Array.Empty<ValueTuple<string, SortOrder>>();
|
||||
return Array.Empty<(string, SortOrder)>();
|
||||
}
|
||||
|
||||
var result = new (string, SortOrder)[sortBy.Count];
|
||||
|
|
|
@ -394,12 +394,12 @@ namespace Jellyfin.Server.Implementations.Users
|
|||
var user = Users.FirstOrDefault(i => string.Equals(username, i.Username, StringComparison.OrdinalIgnoreCase));
|
||||
var authResult = await AuthenticateLocalUser(username, password, user, remoteEndPoint)
|
||||
.ConfigureAwait(false);
|
||||
var authenticationProvider = authResult.authenticationProvider;
|
||||
var success = authResult.success;
|
||||
var authenticationProvider = authResult.AuthenticationProvider;
|
||||
var success = authResult.Success;
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
string updatedUsername = authResult.username;
|
||||
string updatedUsername = authResult.Username;
|
||||
|
||||
if (success
|
||||
&& authenticationProvider != null
|
||||
|
@ -785,7 +785,7 @@ namespace Jellyfin.Server.Implementations.Users
|
|||
return providers;
|
||||
}
|
||||
|
||||
private async Task<(IAuthenticationProvider? authenticationProvider, string username, bool success)> AuthenticateLocalUser(
|
||||
private async Task<(IAuthenticationProvider? AuthenticationProvider, string Username, bool Success)> AuthenticateLocalUser(
|
||||
string username,
|
||||
string password,
|
||||
User? user,
|
||||
|
@ -798,8 +798,8 @@ namespace Jellyfin.Server.Implementations.Users
|
|||
{
|
||||
var providerAuthResult =
|
||||
await AuthenticateWithProvider(provider, username, password, user).ConfigureAwait(false);
|
||||
var updatedUsername = providerAuthResult.username;
|
||||
success = providerAuthResult.success;
|
||||
var updatedUsername = providerAuthResult.Username;
|
||||
success = providerAuthResult.Success;
|
||||
|
||||
if (success)
|
||||
{
|
||||
|
@ -822,7 +822,7 @@ namespace Jellyfin.Server.Implementations.Users
|
|||
return (authenticationProvider, username, success);
|
||||
}
|
||||
|
||||
private async Task<(string username, bool success)> AuthenticateWithProvider(
|
||||
private async Task<(string Username, bool Success)> AuthenticateWithProvider(
|
||||
IAuthenticationProvider provider,
|
||||
string username,
|
||||
string password,
|
||||
|
|
|
@ -53,7 +53,7 @@ public class CreateNetworkConfiguration : IMigrationRoutine
|
|||
networkConfigSerializer.Serialize(xmlWriter, networkSettings);
|
||||
}
|
||||
|
||||
#pragma warning disable CS1591
|
||||
#pragma warning disable
|
||||
public sealed class OldNetworkConfiguration
|
||||
{
|
||||
public const int DefaultHttpPort = 8096;
|
||||
|
@ -134,5 +134,5 @@ public class CreateNetworkConfiguration : IMigrationRoutine
|
|||
|
||||
public string[] KnownProxies { get; set; } = Array.Empty<string>();
|
||||
}
|
||||
#pragma warning restore CS1591
|
||||
#pragma warning restore
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ namespace MediaBrowser.Common.Net
|
|||
return NetworkAddress.PrefixLength <= netaddrObj.PrefixLength;
|
||||
}
|
||||
|
||||
var altAddress = NetworkAddressOf(netaddrObj.Address, PrefixLength).address;
|
||||
var altAddress = NetworkAddressOf(netaddrObj.Address, PrefixLength).Address;
|
||||
return NetworkAddress.Address.Equals(altAddress);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace MediaBrowser.Common.Net
|
|||
/// <param name="address">IP Address to convert.</param>
|
||||
/// <param name="prefixLength">Subnet prefix.</param>
|
||||
/// <returns>IPAddress.</returns>
|
||||
public static (IPAddress address, byte prefixLength) NetworkAddressOf(IPAddress address, byte prefixLength)
|
||||
public static (IPAddress Address, byte PrefixLength) NetworkAddressOf(IPAddress address, byte prefixLength)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace MediaBrowser.Controller.Drawing
|
|||
/// </summary>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task<(string path, string? mimeType, DateTime dateModified)> ProcessImage(ImageProcessingOptions options);
|
||||
Task<(string Path, string? MimeType, DateTime DateModified)> ProcessImage(ImageProcessingOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the supported image output formats.
|
||||
|
|
|
@ -135,7 +135,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||
return info;
|
||||
}
|
||||
|
||||
protected override IEnumerable<(BaseItem, MediaSourceType)> GetAllItemsForMediaSources()
|
||||
protected override IEnumerable<(BaseItem Item, MediaSourceType MediaSourceType)> GetAllItemsForMediaSources()
|
||||
=> new[] { ((BaseItem)this, MediaSourceType.Default) };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1069,7 +1069,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
|
||||
var list = GetAllItemsForMediaSources();
|
||||
var result = list.Select(i => GetVersionInfo(enablePathSubstitution, i.Item1, i.Item2)).ToList();
|
||||
var result = list.Select(i => GetVersionInfo(enablePathSubstitution, i.Item, i.MediaSourceType)).ToList();
|
||||
|
||||
if (IsActiveRecording())
|
||||
{
|
||||
|
@ -1097,7 +1097,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
.ToList();
|
||||
}
|
||||
|
||||
protected virtual IEnumerable<(BaseItem, MediaSourceType)> GetAllItemsForMediaSources()
|
||||
protected virtual IEnumerable<(BaseItem Item, MediaSourceType MediaSourceType)> GetAllItemsForMediaSources()
|
||||
{
|
||||
return Enumerable.Empty<(BaseItem, MediaSourceType)>();
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
MediaTypes = Array.Empty<string>();
|
||||
MinSimilarityScore = 20;
|
||||
OfficialRatings = Array.Empty<string>();
|
||||
OrderBy = Array.Empty<ValueTuple<string, SortOrder>>();
|
||||
OrderBy = Array.Empty<(string, SortOrder)>();
|
||||
PersonIds = Array.Empty<Guid>();
|
||||
PersonTypes = Array.Empty<string>();
|
||||
PresetViews = Array.Empty<string>();
|
||||
|
@ -271,7 +271,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
public bool? HasChapterImages { get; set; }
|
||||
|
||||
public IReadOnlyList<(string, SortOrder)> OrderBy { get; set; }
|
||||
public IReadOnlyList<(string OrderBy, SortOrder SortOrder)> OrderBy { get; set; }
|
||||
|
||||
public DateTime? MinDateCreated { get; set; }
|
||||
|
||||
|
|
|
@ -517,7 +517,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
}).FirstOrDefault();
|
||||
}
|
||||
|
||||
protected override IEnumerable<(BaseItem, MediaSourceType)> GetAllItemsForMediaSources()
|
||||
protected override IEnumerable<(BaseItem Item, MediaSourceType MediaSourceType)> GetAllItemsForMediaSources()
|
||||
{
|
||||
var list = new List<(BaseItem, MediaSourceType)>
|
||||
{
|
||||
|
|
|
@ -212,7 +212,7 @@ namespace MediaBrowser.Controller.Library
|
|||
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||
IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<string> sortBy, SortOrder sortOrder);
|
||||
|
||||
IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<ValueTuple<string, SortOrder>> orderBy);
|
||||
IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<(string OrderBy, SortOrder SortOrder)> orderBy);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user root folder.
|
||||
|
@ -573,17 +573,17 @@ namespace MediaBrowser.Controller.Library
|
|||
|
||||
void RemoveMediaPath(string virtualFolderName, string mediaPath);
|
||||
|
||||
QueryResult<(BaseItem, ItemCounts)> GetGenres(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetGenres(InternalItemsQuery query);
|
||||
|
||||
QueryResult<(BaseItem, ItemCounts)> GetMusicGenres(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetMusicGenres(InternalItemsQuery query);
|
||||
|
||||
QueryResult<(BaseItem, ItemCounts)> GetStudios(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetStudios(InternalItemsQuery query);
|
||||
|
||||
QueryResult<(BaseItem, ItemCounts)> GetArtists(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetArtists(InternalItemsQuery query);
|
||||
|
||||
QueryResult<(BaseItem, ItemCounts)> GetAlbumArtists(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetAlbumArtists(InternalItemsQuery query);
|
||||
|
||||
QueryResult<(BaseItem, ItemCounts)> GetAllArtists(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetAllArtists(InternalItemsQuery query);
|
||||
|
||||
int GetCount(InternalItemsQuery query);
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
/// <param name="fields">The fields.</param>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task AddInfoToProgramDto(IReadOnlyCollection<(BaseItem, BaseItemDto)> programs, IReadOnlyList<ItemFields> fields, User user = null);
|
||||
Task AddInfoToProgramDto(IReadOnlyCollection<(BaseItem Item, BaseItemDto ItemDto)> programs, IReadOnlyList<ItemFields> fields, User user = null);
|
||||
|
||||
/// <summary>
|
||||
/// Saves the tuner host.
|
||||
|
@ -292,7 +292,7 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
/// <param name="items">The items.</param>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <param name="user">The user.</param>
|
||||
void AddChannelInfo(IReadOnlyCollection<(BaseItemDto, LiveTvChannel)> items, DtoOptions options, User user);
|
||||
void AddChannelInfo(IReadOnlyCollection<(BaseItemDto ItemDto, LiveTvChannel Channel)> items, DtoOptions options, User user);
|
||||
|
||||
Task<List<ChannelInfo>> GetChannelsForListingsProvider(string id, CancellationToken cancellationToken);
|
||||
|
||||
|
|
|
@ -21,6 +21,13 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
{
|
||||
public class EncodingHelper
|
||||
{
|
||||
private const string QsvAlias = "qs";
|
||||
private const string VaapiAlias = "va";
|
||||
private const string D3d11vaAlias = "dx11";
|
||||
private const string VideotoolboxAlias = "vt";
|
||||
private const string OpenclAlias = "ocl";
|
||||
private const string CudaAlias = "cu";
|
||||
|
||||
private readonly IMediaEncoder _mediaEncoder;
|
||||
private readonly ISubtitleEncoder _subtitleEncoder;
|
||||
|
||||
|
@ -42,13 +49,6 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
"Main10"
|
||||
};
|
||||
|
||||
private const string QsvAlias = "qs";
|
||||
private const string VaapiAlias = "va";
|
||||
private const string D3d11vaAlias = "dx11";
|
||||
private const string VideotoolboxAlias = "vt";
|
||||
private const string OpenclAlias = "ocl";
|
||||
private const string CudaAlias = "cu";
|
||||
|
||||
public EncodingHelper(
|
||||
IMediaEncoder mediaEncoder,
|
||||
ISubtitleEncoder subtitleEncoder)
|
||||
|
@ -2290,7 +2290,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
return returnFirstIfNoIndex ? streams.FirstOrDefault() : null;
|
||||
}
|
||||
|
||||
public static (int? width, int? height) GetFixedOutputSize(
|
||||
public static (int? Width, int? Height) GetFixedOutputSize(
|
||||
int? videoWidth,
|
||||
int? videoHeight,
|
||||
int? requestedWidth,
|
||||
|
@ -2671,7 +2671,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
/// <param name="options">Encoding options.</param>
|
||||
/// <param name="vidEncoder">Video encoder to use.</param>
|
||||
/// <returns>The tuple contains three lists: main, sub and overlay filters.</returns>
|
||||
public (List<string>, List<string>, List<string>) GetSwVidFilterChain(
|
||||
public (List<string> MainFilters, List<string> SubFilters, List<string> OverlayFilters) GetSwVidFilterChain(
|
||||
EncodingJobInfo state,
|
||||
EncodingOptions options,
|
||||
string vidEncoder)
|
||||
|
@ -2751,7 +2751,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
/// <param name="options">Encoding options.</param>
|
||||
/// <param name="vidEncoder">Video encoder to use.</param>
|
||||
/// <returns>The tuple contains three lists: main, sub and overlay filters.</returns>
|
||||
public (List<string>, List<string>, List<string>) GetNvidiaVidFilterChain(
|
||||
public (List<string> MainFilters, List<string> SubFilters, List<string> OverlayFilters) GetNvidiaVidFilterChain(
|
||||
EncodingJobInfo state,
|
||||
EncodingOptions options,
|
||||
string vidEncoder)
|
||||
|
@ -2778,7 +2778,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
return GetNvidiaVidFiltersPrefered(state, options, vidDecoder, vidEncoder);
|
||||
}
|
||||
|
||||
public (List<string>, List<string>, List<string>) GetNvidiaVidFiltersPrefered(
|
||||
public (List<string> MainFilters, List<string> SubFilters, List<string> OverlayFilters) GetNvidiaVidFiltersPrefered(
|
||||
EncodingJobInfo state,
|
||||
EncodingOptions options,
|
||||
string vidDecoder,
|
||||
|
@ -2838,6 +2838,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
mainFilters.Add("hwupload");
|
||||
}
|
||||
}
|
||||
|
||||
if (isNvdecDecoder)
|
||||
{
|
||||
// INPUT cuda surface(vram)
|
||||
|
@ -2938,7 +2939,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
/// <param name="options">Encoding options.</param>
|
||||
/// <param name="vidEncoder">Video encoder to use.</param>
|
||||
/// <returns>The tuple contains three lists: main, sub and overlay filters.</returns>
|
||||
public (List<string>, List<string>, List<string>) GetAmdVidFilterChain(
|
||||
public (List<string> MainFilters, List<string> SubFilters, List<string> OverlayFilters) GetAmdVidFilterChain(
|
||||
EncodingJobInfo state,
|
||||
EncodingOptions options,
|
||||
string vidEncoder)
|
||||
|
@ -2966,7 +2967,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
return GetAmdDx11VidFiltersPrefered(state, options, vidDecoder, vidEncoder);
|
||||
}
|
||||
|
||||
public (List<string>, List<string>, List<string>) GetAmdDx11VidFiltersPrefered(
|
||||
public (List<string> MainFilters, List<string> SubFilters, List<string> OverlayFilters) GetAmdDx11VidFiltersPrefered(
|
||||
EncodingJobInfo state,
|
||||
EncodingOptions options,
|
||||
string vidDecoder,
|
||||
|
@ -3136,7 +3137,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
/// <param name="options">Encoding options.</param>
|
||||
/// <param name="vidEncoder">Video encoder to use.</param>
|
||||
/// <returns>The tuple contains three lists: main, sub and overlay filters.</returns>
|
||||
public (List<string>, List<string>, List<string>) GetIntelVidFilterChain(
|
||||
public (List<string> MainFilters, List<string> SubFilters, List<string> OverlayFilters) GetIntelVidFilterChain(
|
||||
EncodingJobInfo state,
|
||||
EncodingOptions options,
|
||||
string vidEncoder)
|
||||
|
@ -3182,7 +3183,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
return (null, null, null);
|
||||
}
|
||||
|
||||
public (List<string>, List<string>, List<string>) GetIntelQsvDx11VidFiltersPrefered(
|
||||
public (List<string> MainFilters, List<string> SubFilters, List<string> OverlayFilters) GetIntelQsvDx11VidFiltersPrefered(
|
||||
EncodingJobInfo state,
|
||||
EncodingOptions options,
|
||||
string vidDecoder,
|
||||
|
@ -3374,7 +3375,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
return (mainFilters, subFilters, overlayFilters);
|
||||
}
|
||||
|
||||
public (List<string>, List<string>, List<string>) GetIntelQsvVaapiVidFiltersPrefered(
|
||||
public (List<string> MainFilters, List<string> SubFilters, List<string> OverlayFilters) GetIntelQsvVaapiVidFiltersPrefered(
|
||||
EncodingJobInfo state,
|
||||
EncodingOptions options,
|
||||
string vidDecoder,
|
||||
|
@ -3589,7 +3590,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
/// <param name="options">Encoding options.</param>
|
||||
/// <param name="vidEncoder">Video encoder to use.</param>
|
||||
/// <returns>The tuple contains three lists: main, sub and overlay filters.</returns>
|
||||
public (List<string>, List<string>, List<string>) GetVaapiVidFilterChain(
|
||||
public (List<string> MainFilters, List<string> SubFilters, List<string> OverlayFilters) GetVaapiVidFilterChain(
|
||||
EncodingJobInfo state,
|
||||
EncodingOptions options,
|
||||
string vidEncoder)
|
||||
|
@ -3615,13 +3616,13 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
if (!isSwEncoder)
|
||||
{
|
||||
var newfilters = new List<string>();
|
||||
var noOverlay = swFilterChain.Item3.Count == 0;
|
||||
newfilters.AddRange(noOverlay ? swFilterChain.Item1 : swFilterChain.Item3);
|
||||
var noOverlay = swFilterChain.OverlayFilters.Count == 0;
|
||||
newfilters.AddRange(noOverlay ? swFilterChain.MainFilters : swFilterChain.OverlayFilters);
|
||||
newfilters.Add("hwupload");
|
||||
|
||||
var mainFilters = noOverlay ? newfilters : swFilterChain.Item1;
|
||||
var overlayFilters = noOverlay ? swFilterChain.Item3 : newfilters;
|
||||
return (mainFilters, swFilterChain.Item2, overlayFilters);
|
||||
var mainFilters = noOverlay ? newfilters : swFilterChain.MainFilters;
|
||||
var overlayFilters = noOverlay ? swFilterChain.OverlayFilters : newfilters;
|
||||
return (mainFilters, swFilterChain.SubFilters, overlayFilters);
|
||||
}
|
||||
|
||||
return swFilterChain;
|
||||
|
@ -3638,7 +3639,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
return GetVaapiLimitedVidFiltersPrefered(state, options, vidDecoder, vidEncoder);
|
||||
}
|
||||
|
||||
public (List<string>, List<string>, List<string>) GetVaapiFullVidFiltersPrefered(
|
||||
public (List<string> MainFilters, List<string> SubFilters, List<string> OverlayFilters) GetVaapiFullVidFiltersPrefered(
|
||||
EncodingJobInfo state,
|
||||
EncodingOptions options,
|
||||
string vidDecoder,
|
||||
|
@ -3834,7 +3835,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
return (mainFilters, subFilters, overlayFilters);
|
||||
}
|
||||
|
||||
public (List<string>, List<string>, List<string>) GetVaapiLimitedVidFiltersPrefered(
|
||||
public (List<string> MainFilters, List<string> SubFilters, List<string> OverlayFilters) GetVaapiLimitedVidFiltersPrefered(
|
||||
EncodingJobInfo state,
|
||||
EncodingOptions options,
|
||||
string vidDecoder,
|
||||
|
@ -4090,7 +4091,6 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
"{0}",
|
||||
string.Join(',', overlayFilters));
|
||||
|
||||
|
||||
var mapPrefix = Convert.ToInt32(state.SubtitleStream.IsExternal);
|
||||
var subtitleStreamIndex = state.SubtitleStream.IsExternal
|
||||
? 0
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
{
|
||||
public interface IAttachmentExtractor
|
||||
{
|
||||
Task<(MediaAttachment attachment, Stream stream)> GetAttachment(
|
||||
Task<(MediaAttachment Attachment, Stream Stream)> GetAttachment(
|
||||
BaseItem item,
|
||||
string mediaSourceId,
|
||||
int attachmentStreamIndex,
|
||||
|
|
|
@ -32,19 +32,19 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
Version EncoderVersion { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the configured Vaapi device is from AMD(radeonsi/r600 Mesa driver).
|
||||
/// Gets a value indicating whether the configured Vaapi device is from AMD(radeonsi/r600 Mesa driver).
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if the Vaapi device is an AMD(radeonsi/r600 Mesa driver) GPU, <c>false</c> otherwise.</value>
|
||||
bool IsVaapiDeviceAmd { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the configured Vaapi device is from Intel(iHD driver).
|
||||
/// Gets a value indicating whether the configured Vaapi device is from Intel(iHD driver).
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if the Vaapi device is an Intel(iHD driver) GPU, <c>false</c> otherwise.</value>
|
||||
bool IsVaapiDeviceInteliHD { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the configured Vaapi device is from Intel(legacy i965 driver).
|
||||
/// Gets a value indicating whether the configured Vaapi device is from Intel(legacy i965 driver).
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if the Vaapi device is an Intel(legacy i965 driver) GPU, <c>false</c> otherwise.</value>
|
||||
bool IsVaapiDeviceInteli965 { get; }
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
break;
|
||||
}
|
||||
|
||||
await target.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);
|
||||
await target.WriteAsync(bytes).ConfigureAwait(false);
|
||||
|
||||
// Check again, the stream could have been closed
|
||||
if (!target.CanWrite)
|
||||
|
|
|
@ -161,17 +161,17 @@ namespace MediaBrowser.Controller.Persistence
|
|||
|
||||
int GetCount(InternalItemsQuery query);
|
||||
|
||||
QueryResult<(BaseItem, ItemCounts)> GetGenres(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetGenres(InternalItemsQuery query);
|
||||
|
||||
QueryResult<(BaseItem, ItemCounts)> GetMusicGenres(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetMusicGenres(InternalItemsQuery query);
|
||||
|
||||
QueryResult<(BaseItem, ItemCounts)> GetStudios(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetStudios(InternalItemsQuery query);
|
||||
|
||||
QueryResult<(BaseItem, ItemCounts)> GetArtists(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetArtists(InternalItemsQuery query);
|
||||
|
||||
QueryResult<(BaseItem, ItemCounts)> GetAlbumArtists(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetAlbumArtists(InternalItemsQuery query);
|
||||
|
||||
QueryResult<(BaseItem, ItemCounts)> GetAllArtists(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetAllArtists(InternalItemsQuery query);
|
||||
|
||||
List<string> GetMusicGenreNames();
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.Providers
|
|||
{
|
||||
// Images aren't always used so the allocation is a waste a lot of the time
|
||||
private List<LocalImageInfo> _images;
|
||||
private List<(string url, ImageType type)> _remoteImages;
|
||||
private List<(string Url, ImageType Type)> _remoteImages;
|
||||
|
||||
public MetadataResult()
|
||||
{
|
||||
|
@ -27,9 +27,9 @@ namespace MediaBrowser.Controller.Providers
|
|||
set => _images = value;
|
||||
}
|
||||
|
||||
public List<(string url, ImageType type)> RemoteImages
|
||||
public List<(string Url, ImageType Type)> RemoteImages
|
||||
{
|
||||
get => _remoteImages ??= new List<(string url, ImageType type)>();
|
||||
get => _remoteImages ??= new List<(string Url, ImageType Type)>();
|
||||
set => _remoteImages = value;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace MediaBrowser.MediaEncoding.Attachments
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<(MediaAttachment attachment, Stream stream)> GetAttachment(BaseItem item, string mediaSourceId, int attachmentStreamIndex, CancellationToken cancellationToken)
|
||||
public async Task<(MediaAttachment Attachment, Stream Stream)> GetAttachment(BaseItem item, string mediaSourceId, int attachmentStreamIndex, CancellationToken cancellationToken)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
|
|
|
@ -91,9 +91,13 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||
|
||||
/// <inheritdoc />
|
||||
public string EncoderPath => _ffmpegPath;
|
||||
|
||||
public Version EncoderVersion => _ffmpegVersion;
|
||||
|
||||
public bool IsVaapiDeviceAmd => _isVaapiDeviceAmd;
|
||||
|
||||
public bool IsVaapiDeviceInteliHD => _isVaapiDeviceInteliHD;
|
||||
|
||||
public bool IsVaapiDeviceInteli965 => _isVaapiDeviceInteli965;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -139,28 +139,28 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
var subtitle = await GetSubtitleStream(mediaSource, subtitleStream, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
var inputFormat = subtitle.format;
|
||||
var inputFormat = subtitle.Format;
|
||||
|
||||
// Return the original if we don't have any way of converting it
|
||||
if (!TryGetWriter(outputFormat, out var writer))
|
||||
{
|
||||
return subtitle.stream;
|
||||
return subtitle.Stream;
|
||||
}
|
||||
|
||||
// Return the original if the same format is being requested
|
||||
// Character encoding was already handled in GetSubtitleStream
|
||||
if (string.Equals(inputFormat, outputFormat, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return subtitle.stream;
|
||||
return subtitle.Stream;
|
||||
}
|
||||
|
||||
using (var stream = subtitle.stream)
|
||||
using (var stream = subtitle.Stream)
|
||||
{
|
||||
return ConvertSubtitles(stream, inputFormat, outputFormat, startTimeTicks, endTimeTicks, preserveOriginalTimestamps, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<(Stream stream, string format)> GetSubtitleStream(
|
||||
private async Task<(Stream Stream, string Format)> GetSubtitleStream(
|
||||
MediaSourceInfo mediaSource,
|
||||
MediaStream subtitleStream,
|
||||
CancellationToken cancellationToken)
|
||||
|
|
|
@ -289,8 +289,8 @@ namespace MediaBrowser.Model.Dlna
|
|||
|
||||
var directPlayInfo = GetAudioDirectPlayMethods(item, audioStream, options);
|
||||
|
||||
var directPlayMethods = directPlayInfo.Item1;
|
||||
var transcodeReasons = directPlayInfo.Item2.ToList();
|
||||
var directPlayMethods = directPlayInfo.PlayMethods;
|
||||
var transcodeReasons = directPlayInfo.TranscodeReasons.ToList();
|
||||
|
||||
int? inputAudioChannels = audioStream?.Channels;
|
||||
int? inputAudioBitrate = audioStream?.BitDepth;
|
||||
|
@ -448,7 +448,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
return options.GetMaxBitrate(isAudio);
|
||||
}
|
||||
|
||||
private (IEnumerable<PlayMethod>, IEnumerable<TranscodeReason>) GetAudioDirectPlayMethods(MediaSourceInfo item, MediaStream audioStream, AudioOptions options)
|
||||
private (IEnumerable<PlayMethod> PlayMethods, IEnumerable<TranscodeReason> TranscodeReasons) GetAudioDirectPlayMethods(MediaSourceInfo item, MediaStream audioStream, AudioOptions options)
|
||||
{
|
||||
DirectPlayProfile directPlayProfile = options.Profile.DirectPlayProfiles
|
||||
.FirstOrDefault(x => x.Type == DlnaProfileType.Audio && IsAudioDirectPlaySupported(x, item, audioStream));
|
||||
|
@ -679,8 +679,8 @@ namespace MediaBrowser.Model.Dlna
|
|||
// TODO: This doesn't account for situations where the device is able to handle the media's bitrate, but the connection isn't fast enough
|
||||
var directPlayEligibilityResult = IsEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options, true) ?? 0, subtitleStream, audioStream, options, PlayMethod.DirectPlay);
|
||||
var directStreamEligibilityResult = IsEligibleForDirectPlay(item, options.GetMaxBitrate(false) ?? 0, subtitleStream, audioStream, options, PlayMethod.DirectStream);
|
||||
bool isEligibleForDirectPlay = options.EnableDirectPlay && (options.ForceDirectPlay || directPlayEligibilityResult.directPlay);
|
||||
bool isEligibleForDirectStream = options.EnableDirectStream && (options.ForceDirectStream || directStreamEligibilityResult.directPlay);
|
||||
bool isEligibleForDirectPlay = options.EnableDirectPlay && (options.ForceDirectPlay || directPlayEligibilityResult.DirectPlay);
|
||||
bool isEligibleForDirectStream = options.EnableDirectStream && (options.ForceDirectStream || directStreamEligibilityResult.DirectPlay);
|
||||
|
||||
_logger.LogDebug(
|
||||
"Profile: {0}, Path: {1}, isEligibleForDirectPlay: {2}, isEligibleForDirectStream: {3}",
|
||||
|
@ -695,7 +695,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
{
|
||||
// See if it can be direct played
|
||||
var directPlayInfo = GetVideoDirectPlayProfile(options, item, videoStream, audioStream, isEligibleForDirectStream);
|
||||
var directPlay = directPlayInfo.playMethod;
|
||||
var directPlay = directPlayInfo.PlayMethod;
|
||||
|
||||
if (directPlay != null)
|
||||
{
|
||||
|
@ -713,17 +713,17 @@ namespace MediaBrowser.Model.Dlna
|
|||
return playlistItem;
|
||||
}
|
||||
|
||||
transcodeReasons.AddRange(directPlayInfo.transcodeReasons);
|
||||
transcodeReasons.AddRange(directPlayInfo.TranscodeReasons);
|
||||
}
|
||||
|
||||
if (directPlayEligibilityResult.reason.HasValue)
|
||||
if (directPlayEligibilityResult.Reason.HasValue)
|
||||
{
|
||||
transcodeReasons.Add(directPlayEligibilityResult.reason.Value);
|
||||
transcodeReasons.Add(directPlayEligibilityResult.Reason.Value);
|
||||
}
|
||||
|
||||
if (directStreamEligibilityResult.reason.HasValue)
|
||||
if (directStreamEligibilityResult.Reason.HasValue)
|
||||
{
|
||||
transcodeReasons.Add(directStreamEligibilityResult.reason.Value);
|
||||
transcodeReasons.Add(directStreamEligibilityResult.Reason.Value);
|
||||
}
|
||||
|
||||
// Can't direct play, find the transcoding profile
|
||||
|
@ -1000,7 +1000,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
return 7168000;
|
||||
}
|
||||
|
||||
private (PlayMethod? playMethod, List<TranscodeReason> transcodeReasons) GetVideoDirectPlayProfile(
|
||||
private (PlayMethod? PlayMethod, List<TranscodeReason> TranscodeReasons) GetVideoDirectPlayProfile(
|
||||
VideoOptions options,
|
||||
MediaSourceInfo mediaSource,
|
||||
MediaStream videoStream,
|
||||
|
@ -1209,7 +1209,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
mediaSource.Path ?? "Unknown path");
|
||||
}
|
||||
|
||||
private (bool directPlay, TranscodeReason? reason) IsEligibleForDirectPlay(
|
||||
private (bool DirectPlay, TranscodeReason? Reason) IsEligibleForDirectPlay(
|
||||
MediaSourceInfo item,
|
||||
long maxBitrate,
|
||||
MediaStream subtitleStream,
|
||||
|
|
|
@ -39,7 +39,6 @@ namespace MediaBrowser.Model.Session
|
|||
SetRepeatMode = 29,
|
||||
ChannelUp = 30,
|
||||
ChannelDown = 31,
|
||||
SetMaxStreamingBitrate = 31,
|
||||
Guide = 32,
|
||||
ToggleStats = 33,
|
||||
PlayMediaSource = 34,
|
||||
|
@ -48,6 +47,7 @@ namespace MediaBrowser.Model.Session
|
|||
PlayState = 37,
|
||||
PlayNext = 38,
|
||||
ToggleOsdMenu = 39,
|
||||
Play = 40
|
||||
Play = 40,
|
||||
SetMaxStreamingBitrate = 41
|
||||
}
|
||||
}
|
||||
|
|
|
@ -682,12 +682,12 @@ namespace MediaBrowser.Providers.Manager
|
|||
{
|
||||
try
|
||||
{
|
||||
await ProviderManager.SaveImage(item, remoteImage.url, remoteImage.type, null, cancellationToken).ConfigureAwait(false);
|
||||
await ProviderManager.SaveImage(item, remoteImage.Url, remoteImage.Type, null, cancellationToken).ConfigureAwait(false);
|
||||
refreshResult.UpdateType |= ItemUpdateType.ImageUpdate;
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
Logger.LogError(ex, "Could not save {ImageType} image: {Url}", Enum.GetName(remoteImage.type), remoteImage.url);
|
||||
Logger.LogError(ex, "Could not save {ImageType} image: {Url}", Enum.GetName(remoteImage.Type), remoteImage.Url);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -303,7 +303,7 @@ namespace MediaBrowser.Providers.Music
|
|||
return ReleaseResult.Parse(reader).FirstOrDefault();
|
||||
}
|
||||
|
||||
private static (string, string) ParseArtistCredit(XmlReader reader)
|
||||
private static (string Name, string ArtistId) ParseArtistCredit(XmlReader reader)
|
||||
{
|
||||
reader.MoveToContent();
|
||||
reader.Read();
|
||||
|
@ -345,7 +345,7 @@ namespace MediaBrowser.Providers.Music
|
|||
return default;
|
||||
}
|
||||
|
||||
private static (string, string) ParseArtistNameCredit(XmlReader reader)
|
||||
private static (string Name, string ArtistId) ParseArtistNameCredit(XmlReader reader)
|
||||
{
|
||||
reader.MoveToContent();
|
||||
reader.Read();
|
||||
|
@ -388,7 +388,7 @@ namespace MediaBrowser.Providers.Music
|
|||
return (null, null);
|
||||
}
|
||||
|
||||
private static (string name, string id) ParseArtistArtistCredit(XmlReader reader, string artistId)
|
||||
private static (string Name, string ArtistId) ParseArtistArtistCredit(XmlReader reader, string artistId)
|
||||
{
|
||||
reader.MoveToContent();
|
||||
reader.Read();
|
||||
|
@ -628,7 +628,7 @@ namespace MediaBrowser.Providers.Music
|
|||
public string Overview;
|
||||
public int? Year;
|
||||
|
||||
public List<ValueTuple<string, string>> Artists = new List<ValueTuple<string, string>>();
|
||||
public List<(string, string)> Artists = new();
|
||||
|
||||
public static IEnumerable<ReleaseResult> Parse(XmlReader reader)
|
||||
{
|
||||
|
@ -776,7 +776,7 @@ namespace MediaBrowser.Providers.Music
|
|||
using var subReader = reader.ReadSubtree();
|
||||
var artist = ParseArtistCredit(subReader);
|
||||
|
||||
if (!string.IsNullOrEmpty(artist.Item1))
|
||||
if (!string.IsNullOrEmpty(artist.Name))
|
||||
{
|
||||
result.Artists.Add(artist);
|
||||
}
|
||||
|
|
|
@ -872,7 +872,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||
else
|
||||
{
|
||||
// only allow one item of each type
|
||||
if (itemResult.RemoteImages.Any(x => x.type == imageType))
|
||||
if (itemResult.RemoteImages.Any(x => x.Type == imageType))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Jellyfin.Data.Entities;
|
||||
|
@ -157,33 +158,33 @@ namespace Jellyfin.XbmcMetadata.Tests.Parsers
|
|||
// Images
|
||||
Assert.Equal(7, result.RemoteImages.Count);
|
||||
|
||||
var posters = result.RemoteImages.Where(x => x.type == ImageType.Primary).ToList();
|
||||
var posters = result.RemoteImages.Where(x => x.Type == ImageType.Primary).ToList();
|
||||
Assert.Single(posters);
|
||||
Assert.Equal("http://image.tmdb.org/t/p/original/9rtrRGeRnL0JKtu9IMBWsmlmmZz.jpg", posters[0].url);
|
||||
Assert.Equal("http://image.tmdb.org/t/p/original/9rtrRGeRnL0JKtu9IMBWsmlmmZz.jpg", posters[0].Url);
|
||||
|
||||
var logos = result.RemoteImages.Where(x => x.type == ImageType.Logo).ToList();
|
||||
var logos = result.RemoteImages.Where(x => x.Type == ImageType.Logo).ToList();
|
||||
Assert.Single(logos);
|
||||
Assert.Equal("https://assets.fanart.tv/fanart/movies/141052/hdmovielogo/justice-league-5865bf95cbadb.png", logos[0].url);
|
||||
Assert.Equal("https://assets.fanart.tv/fanart/movies/141052/hdmovielogo/justice-league-5865bf95cbadb.png", logos[0].Url);
|
||||
|
||||
var banners = result.RemoteImages.Where(x => x.type == ImageType.Banner).ToList();
|
||||
var banners = result.RemoteImages.Where(x => x.Type == ImageType.Banner).ToList();
|
||||
Assert.Single(banners);
|
||||
Assert.Equal("https://assets.fanart.tv/fanart/movies/141052/moviebanner/justice-league-586017e95adbd.jpg", banners[0].url);
|
||||
Assert.Equal("https://assets.fanart.tv/fanart/movies/141052/moviebanner/justice-league-586017e95adbd.jpg", banners[0].Url);
|
||||
|
||||
var thumbs = result.RemoteImages.Where(x => x.type == ImageType.Thumb).ToList();
|
||||
var thumbs = result.RemoteImages.Where(x => x.Type == ImageType.Thumb).ToList();
|
||||
Assert.Single(thumbs);
|
||||
Assert.Equal("https://assets.fanart.tv/fanart/movies/141052/moviethumb/justice-league-585fb155c3743.jpg", thumbs[0].url);
|
||||
Assert.Equal("https://assets.fanart.tv/fanart/movies/141052/moviethumb/justice-league-585fb155c3743.jpg", thumbs[0].Url);
|
||||
|
||||
var art = result.RemoteImages.Where(x => x.type == ImageType.Art).ToList();
|
||||
var art = result.RemoteImages.Where(x => x.Type == ImageType.Art).ToList();
|
||||
Assert.Single(art);
|
||||
Assert.Equal("https://assets.fanart.tv/fanart/movies/141052/hdmovieclearart/justice-league-5865c23193041.png", art[0].url);
|
||||
Assert.Equal("https://assets.fanart.tv/fanart/movies/141052/hdmovieclearart/justice-league-5865c23193041.png", art[0].Url);
|
||||
|
||||
var discArt = result.RemoteImages.Where(x => x.type == ImageType.Disc).ToList();
|
||||
var discArt = result.RemoteImages.Where(x => x.Type == ImageType.Disc).ToList();
|
||||
Assert.Single(discArt);
|
||||
Assert.Equal("https://assets.fanart.tv/fanart/movies/141052/moviedisc/justice-league-5a3af26360617.png", discArt[0].url);
|
||||
Assert.Equal("https://assets.fanart.tv/fanart/movies/141052/moviedisc/justice-league-5a3af26360617.png", discArt[0].Url);
|
||||
|
||||
var backdrop = result.RemoteImages.Where(x => x.type == ImageType.Backdrop).ToList();
|
||||
var backdrop = result.RemoteImages.Where(x => x.Type == ImageType.Backdrop).ToList();
|
||||
Assert.Single(backdrop);
|
||||
Assert.Equal("https://assets.fanart.tv/fanart/movies/141052/moviebackground/justice-league-5793f518c6d6e.jpg", backdrop[0].url);
|
||||
Assert.Equal("https://assets.fanart.tv/fanart/movies/141052/moviebackground/justice-league-5793f518c6d6e.jpg", backdrop[0].Url);
|
||||
|
||||
// Local Image - contains only one item depending on operating system
|
||||
Assert.Single(result.Images);
|
||||
|
@ -216,8 +217,8 @@ namespace Jellyfin.XbmcMetadata.Tests.Parsers
|
|||
|
||||
_parser.Fetch(result, "Test Data/Fanart.nfo", CancellationToken.None);
|
||||
|
||||
Assert.Single(result.RemoteImages.Where(x => x.type == ImageType.Backdrop));
|
||||
Assert.Equal("https://assets.fanart.tv/fanart/movies/141052/moviebackground/justice-league-5a5332c7b5e77.jpg", result.RemoteImages.First(x => x.type == ImageType.Backdrop).url);
|
||||
Assert.Single(result.RemoteImages.Where(x => x.Type == ImageType.Backdrop));
|
||||
Assert.Equal("https://assets.fanart.tv/fanart/movies/141052/moviebackground/justice-league-5a5332c7b5e77.jpg", result.RemoteImages.First(x => x.Type == ImageType.Backdrop).Url);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
Loading…
Reference in New Issue
Block a user