mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-04 06:48:35 +01:00
Merge branch 'master' into userdb-efcore
# Conflicts: # Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs # Emby.Server.Implementations/Library/UserManager.cs # Emby.Server.Implementations/Sorting/IsFavoriteOrLikeComparer.cs # Emby.Server.Implementations/Sorting/IsPlayedComparer.cs # Emby.Server.Implementations/Sorting/IsUnplayedComparer.cs # Emby.Server.Implementations/TV/TVSeriesManager.cs # Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
using MediaBrowser.Model.Devices;
|
||||
|
||||
namespace MediaBrowser.Controller.Devices
|
||||
{
|
||||
public class CameraImageUploadInfo
|
||||
{
|
||||
public LocalFileInfo FileInfo { get; set; }
|
||||
public DeviceInfo Device { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,15 @@ namespace MediaBrowser.Controller.Drawing
|
||||
/// <returns>The image dimensions.</returns>
|
||||
ImageDimensions GetImageSize(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the blurhash of an image.
|
||||
/// </summary>
|
||||
/// <param name="xComp">Amount of X components of DCT to take.</param>
|
||||
/// <param name="yComp">Amount of Y components of DCT to take.</param>
|
||||
/// <param name="path">The filepath of the image.</param>
|
||||
/// <returns>The blurhash.</returns>
|
||||
string GetImageBlurHash(int xComp, int yComp, string path);
|
||||
|
||||
/// <summary>
|
||||
/// Encode an image.
|
||||
/// </summary>
|
||||
|
||||
@@ -41,6 +41,13 @@ namespace MediaBrowser.Controller.Drawing
|
||||
/// <returns>ImageDimensions</returns>
|
||||
ImageDimensions GetImageDimensions(BaseItem item, ItemImageInfo info);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the blurhash of the image.
|
||||
/// </summary>
|
||||
/// <param name="path">Path to the image file.</param>
|
||||
/// <returns>BlurHash</returns>
|
||||
string GetImageBlurHash(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the image cache tag.
|
||||
/// </summary>
|
||||
|
||||
@@ -1375,6 +1375,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
new List<FileSystemMetadata>();
|
||||
|
||||
var ownedItemsChanged = await RefreshedOwnedItems(options, files, cancellationToken).ConfigureAwait(false);
|
||||
LibraryManager.UpdateImages(this); // ensure all image properties in DB are fresh
|
||||
|
||||
if (ownedItemsChanged)
|
||||
{
|
||||
@@ -2219,6 +2220,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
existingImage.DateModified = image.DateModified;
|
||||
existingImage.Width = image.Width;
|
||||
existingImage.Height = image.Height;
|
||||
existingImage.BlurHash = image.BlurHash;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2370,6 +2372,46 @@ namespace MediaBrowser.Controller.Entities
|
||||
.ElementAtOrDefault(imageIndex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computes image index for given image or raises if no matching image found.
|
||||
/// </summary>
|
||||
/// <param name="image">Image to compute index for.</param>
|
||||
/// <exception cref="ArgumentException">Image index cannot be computed as no matching image found.
|
||||
/// </exception>
|
||||
/// <returns>Image index.</returns>
|
||||
public int GetImageIndex(ItemImageInfo image)
|
||||
{
|
||||
if (image == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(image));
|
||||
}
|
||||
|
||||
if (image.Type == ImageType.Chapter)
|
||||
{
|
||||
var chapters = ItemRepository.GetChapters(this);
|
||||
for (var i = 0; i < chapters.Count; i++)
|
||||
{
|
||||
if (chapters[i].ImagePath == image.Path)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
throw new ArgumentException("No chapter index found for image path", image.Path);
|
||||
}
|
||||
|
||||
var images = GetImages(image.Type).ToArray();
|
||||
for (var i = 0; i < images.Length; i++)
|
||||
{
|
||||
if (images[i].Path == image.Path)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
throw new ArgumentException("No image index found for image path", image.Path);
|
||||
}
|
||||
|
||||
public IEnumerable<ItemImageInfo> GetImages(ImageType imageType)
|
||||
{
|
||||
if (imageType == ImageType.Chapter)
|
||||
|
||||
@@ -348,6 +348,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
currentChild.UpdateToRepository(ItemUpdateType.MetadataImport, cancellationToken);
|
||||
}
|
||||
else
|
||||
{
|
||||
// metadata is up-to-date; make sure DB has correct images dimensions and hash
|
||||
LibraryManager.UpdateImages(currentChild);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,12 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public int Height { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the blurhash.
|
||||
/// </summary>
|
||||
/// <value>The blurhash.</value>
|
||||
public string BlurHash { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public bool IsLocalFile => Path == null || !Path.StartsWith("http", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace MediaBrowser.Controller.Library
|
||||
/// </summary>
|
||||
void QueueLibraryScan();
|
||||
|
||||
void UpdateImages(BaseItem item);
|
||||
void UpdateImages(BaseItem item, bool forceUpdate = false);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default view.
|
||||
@@ -197,6 +197,7 @@ namespace MediaBrowser.Controller.Library
|
||||
/// Updates the item.
|
||||
/// </summary>
|
||||
void UpdateItems(IEnumerable<BaseItem> items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken);
|
||||
|
||||
void UpdateItem(BaseItem item, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Controller.LiveTv
|
||||
{
|
||||
public class TimerEventInfo
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public Guid ProgramId { get; set; }
|
||||
public TimerEventInfo(string id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public string Id { get; }
|
||||
|
||||
public Guid? ProgramId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1339,7 +1339,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
transcoderChannelLimit = 6;
|
||||
}
|
||||
|
||||
var isTranscodingAudio = !string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase);
|
||||
var isTranscodingAudio = !EncodingHelper.IsCopyCodec(codec);
|
||||
|
||||
int? resultChannels = state.GetRequestedAudioChannels(codec);
|
||||
if (isTranscodingAudio)
|
||||
@@ -1735,7 +1735,8 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
var hasTextSubs = state.SubtitleStream != null && state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
|
||||
if (string.Equals(videoEncoder, "h264_vaapi", StringComparison.OrdinalIgnoreCase) || (string.Equals(videoEncoder, "h264_qsv", StringComparison.OrdinalIgnoreCase) && !hasTextSubs)
|
||||
if ((string.Equals(videoEncoder, "h264_vaapi", StringComparison.OrdinalIgnoreCase)
|
||||
|| (string.Equals(videoEncoder, "h264_qsv", StringComparison.OrdinalIgnoreCase) && !hasTextSubs))
|
||||
&& width.HasValue
|
||||
&& height.HasValue)
|
||||
{
|
||||
@@ -2249,7 +2250,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
flags.Add("+ignidx");
|
||||
}
|
||||
|
||||
if (state.GenPtsInput || string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
if (state.GenPtsInput || EncodingHelper.IsCopyCodec(state.OutputVideoCodec))
|
||||
{
|
||||
flags.Add("+genpts");
|
||||
}
|
||||
@@ -2512,7 +2513,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
/// </summary>
|
||||
protected string GetHardwareAcceleratedVideoDecoder(EncodingJobInfo state, EncodingOptions encodingOptions)
|
||||
{
|
||||
if (string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
if (EncodingHelper.IsCopyCodec(state.OutputVideoCodec))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -2800,7 +2801,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
args += " -mpegts_m2ts_mode 1";
|
||||
}
|
||||
|
||||
if (string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
if (EncodingHelper.IsCopyCodec(videoCodec))
|
||||
{
|
||||
if (state.VideoStream != null
|
||||
&& string.Equals(state.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase)
|
||||
@@ -2902,7 +2903,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
var args = "-codec:a:0 " + codec;
|
||||
|
||||
if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
if (EncodingHelper.IsCopyCodec(codec))
|
||||
{
|
||||
return args;
|
||||
}
|
||||
@@ -2974,5 +2975,10 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
string.Empty,
|
||||
string.Empty).Trim();
|
||||
}
|
||||
|
||||
public static bool IsCopyCodec(string codec)
|
||||
{
|
||||
return string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
return false;
|
||||
}
|
||||
|
||||
return BaseRequest.BreakOnNonKeyFrames && string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase);
|
||||
return BaseRequest.BreakOnNonKeyFrames && EncodingHelper.IsCopyCodec(videoCodec);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -382,7 +382,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
get
|
||||
{
|
||||
if (BaseRequest.Static
|
||||
|| string.Equals(OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
|| EncodingHelper.IsCopyCodec(OutputAudioCodec))
|
||||
{
|
||||
if (AudioStream != null)
|
||||
{
|
||||
@@ -405,7 +405,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
get
|
||||
{
|
||||
if (BaseRequest.Static
|
||||
|| string.Equals(OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
|| EncodingHelper.IsCopyCodec(OutputAudioCodec))
|
||||
{
|
||||
if (AudioStream != null)
|
||||
{
|
||||
@@ -424,7 +424,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
get
|
||||
{
|
||||
if (BaseRequest.Static || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
if (BaseRequest.Static || EncodingHelper.IsCopyCodec(OutputVideoCodec))
|
||||
{
|
||||
return VideoStream?.Level;
|
||||
}
|
||||
@@ -448,7 +448,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
get
|
||||
{
|
||||
if (BaseRequest.Static
|
||||
|| string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
|| EncodingHelper.IsCopyCodec(OutputVideoCodec))
|
||||
{
|
||||
return VideoStream?.BitDepth;
|
||||
}
|
||||
@@ -466,7 +466,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
get
|
||||
{
|
||||
if (BaseRequest.Static
|
||||
|| string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
|| EncodingHelper.IsCopyCodec(OutputVideoCodec))
|
||||
{
|
||||
return VideoStream?.RefFrames;
|
||||
}
|
||||
@@ -483,7 +483,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
get
|
||||
{
|
||||
if (BaseRequest.Static
|
||||
|| string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
|| EncodingHelper.IsCopyCodec(OutputVideoCodec))
|
||||
{
|
||||
return VideoStream == null ? null : (VideoStream.AverageFrameRate ?? VideoStream.RealFrameRate);
|
||||
}
|
||||
@@ -514,7 +514,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
get
|
||||
{
|
||||
if (BaseRequest.Static || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
if (BaseRequest.Static || EncodingHelper.IsCopyCodec(OutputVideoCodec))
|
||||
{
|
||||
return VideoStream?.PacketLength;
|
||||
}
|
||||
@@ -530,7 +530,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
get
|
||||
{
|
||||
if (BaseRequest.Static || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
if (BaseRequest.Static || EncodingHelper.IsCopyCodec(OutputVideoCodec))
|
||||
{
|
||||
return VideoStream?.Profile;
|
||||
}
|
||||
@@ -550,7 +550,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
get
|
||||
{
|
||||
if (BaseRequest.Static
|
||||
|| string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
|| EncodingHelper.IsCopyCodec(OutputVideoCodec))
|
||||
{
|
||||
return VideoStream?.CodecTag;
|
||||
}
|
||||
@@ -564,7 +564,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
get
|
||||
{
|
||||
if (BaseRequest.Static
|
||||
|| string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
|| EncodingHelper.IsCopyCodec(OutputVideoCodec))
|
||||
{
|
||||
return VideoStream?.IsAnamorphic;
|
||||
}
|
||||
@@ -577,7 +577,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
if (EncodingHelper.IsCopyCodec(OutputVideoCodec))
|
||||
{
|
||||
return VideoStream?.Codec;
|
||||
}
|
||||
@@ -590,7 +590,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.Equals(OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
if (EncodingHelper.IsCopyCodec(OutputAudioCodec))
|
||||
{
|
||||
return AudioStream?.Codec;
|
||||
}
|
||||
@@ -604,7 +604,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
get
|
||||
{
|
||||
if (BaseRequest.Static
|
||||
|| string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
|| EncodingHelper.IsCopyCodec(OutputVideoCodec))
|
||||
{
|
||||
return VideoStream?.IsInterlaced;
|
||||
}
|
||||
@@ -622,7 +622,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
get
|
||||
{
|
||||
if (BaseRequest.Static || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
if (BaseRequest.Static || EncodingHelper.IsCopyCodec(OutputVideoCodec))
|
||||
{
|
||||
return VideoStream?.IsAVC;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace MediaBrowser.Controller.Net
|
||||
}
|
||||
}
|
||||
|
||||
protected void SendData(bool force)
|
||||
protected async Task SendData(bool force)
|
||||
{
|
||||
Tuple<IWebSocketConnection, CancellationTokenSource, TStateType>[] tuples;
|
||||
|
||||
@@ -128,13 +128,18 @@ namespace MediaBrowser.Controller.Net
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
foreach (var tuple in tuples)
|
||||
IEnumerable<Task> GetTasks()
|
||||
{
|
||||
SendData(tuple);
|
||||
foreach (var tuple in tuples)
|
||||
{
|
||||
yield return SendData(tuple);
|
||||
}
|
||||
}
|
||||
|
||||
await Task.WhenAll(GetTasks()).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void SendData(Tuple<IWebSocketConnection, CancellationTokenSource, TStateType> tuple)
|
||||
private async Task SendData(Tuple<IWebSocketConnection, CancellationTokenSource, TStateType> tuple)
|
||||
{
|
||||
var connection = tuple.Item1;
|
||||
|
||||
@@ -148,11 +153,13 @@ namespace MediaBrowser.Controller.Net
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
await connection.SendAsync(new WebSocketMessage<TReturnDataType>
|
||||
{
|
||||
MessageType = Name,
|
||||
Data = data
|
||||
}, cancellationToken).ConfigureAwait(false);
|
||||
await connection.SendAsync(
|
||||
new WebSocketMessage<TReturnDataType>
|
||||
{
|
||||
MessageType = Name,
|
||||
Data = data
|
||||
},
|
||||
cancellationToken).ConfigureAwait(false);
|
||||
|
||||
state.DateLastSendUtc = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user