mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
applied review comments
This commit is contained in:
parent
96e4d8ca78
commit
2f306358c0
@ -1,7 +1,8 @@
|
|||||||
|
#pragma warning disable RS0030 // Do not use banned APIs
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -17,7 +18,6 @@ using MediaBrowser.Model.Entities;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using AudioBook = MediaBrowser.Controller.Entities.AudioBook;
|
using AudioBook = MediaBrowser.Controller.Entities.AudioBook;
|
||||||
using Book = MediaBrowser.Controller.Entities.Book;
|
using Book = MediaBrowser.Controller.Entities.Book;
|
||||||
#pragma warning disable RS0030 // Do not use banned APIs
|
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Library
|
namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
@ -100,7 +100,7 @@ namespace Emby.Server.Implementations.Library
|
|||||||
ArgumentNullException.ThrowIfNull(item);
|
ArgumentNullException.ThrowIfNull(item);
|
||||||
ArgumentNullException.ThrowIfNull(userDataDto);
|
ArgumentNullException.ThrowIfNull(userDataDto);
|
||||||
|
|
||||||
var userData = GetUserData(user, item) ?? throw new InvalidOperationException("Did not expect UserData to be null.");
|
var userData = GetUserData(user, item) ?? throw new InvalidOperationException("UserData should not be null.");
|
||||||
|
|
||||||
if (userDataDto.PlaybackPositionTicks.HasValue)
|
if (userDataDto.PlaybackPositionTicks.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
|
#pragma warning disable CA1027 // Mark enums with FlagsAttribute
|
||||||
namespace Jellyfin.Data.Entities;
|
namespace Jellyfin.Data.Entities;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides the Value types for an <see cref="ItemValue"/>.
|
/// Provides the Value types for an <see cref="ItemValue"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
#pragma warning disable CA1027 // Mark enums with FlagsAttribute
|
|
||||||
public enum ItemValueType
|
public enum ItemValueType
|
||||||
#pragma warning restore CA1027 // Mark enums with FlagsAttribute
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Artists.
|
/// Artists.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#nullable disable
|
#pragma warning disable CA1826 // CA1826 Do not use Enumerable methods on Indexable collections.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -80,12 +80,11 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
|
|
||||||
if (!File.Exists(path))
|
if (!File.Exists(path))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
var directoryName = Path.GetDirectoryName(path) ?? throw new InvalidOperationException($"Invalid path '{path}'");
|
||||||
#pragma warning disable CA1826
|
Directory.CreateDirectory(directoryName);
|
||||||
var imageStream = imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).Contains("front", StringComparison.OrdinalIgnoreCase)) ??
|
var imageStream = imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).Contains("front", StringComparison.OrdinalIgnoreCase)) ??
|
||||||
imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).Contains("cover", StringComparison.OrdinalIgnoreCase)) ??
|
imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).Contains("cover", StringComparison.OrdinalIgnoreCase)) ??
|
||||||
imageStreams.FirstOrDefault();
|
imageStreams.FirstOrDefault();
|
||||||
#pragma warning restore CA1826
|
|
||||||
var imageStreamIndex = imageStream?.Index;
|
var imageStreamIndex = imageStream?.Index;
|
||||||
|
|
||||||
var tempFile = await _mediaEncoder.ExtractAudioImage(item.Path, imageStreamIndex, cancellationToken).ConfigureAwait(false);
|
var tempFile = await _mediaEncoder.ExtractAudioImage(item.Path, imageStreamIndex, cancellationToken).ConfigureAwait(false);
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#pragma warning disable CA1826 // CA1826 Do not use Enumerable methods on Indexable collections.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -88,7 +90,6 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
: TimeSpan.FromSeconds(10);
|
: TimeSpan.FromSeconds(10);
|
||||||
|
|
||||||
var query = new MediaStreamQuery { ItemId = item.Id, Index = item.DefaultVideoStreamIndex };
|
var query = new MediaStreamQuery { ItemId = item.Id, Index = item.DefaultVideoStreamIndex };
|
||||||
#pragma warning disable CA1826
|
|
||||||
var videoStream = _mediaSourceManager.GetMediaStreams(query).FirstOrDefault();
|
var videoStream = _mediaSourceManager.GetMediaStreams(query).FirstOrDefault();
|
||||||
if (videoStream is null)
|
if (videoStream is null)
|
||||||
{
|
{
|
||||||
@ -96,7 +97,6 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
query.Index = null;
|
query.Index = null;
|
||||||
videoStream = _mediaSourceManager.GetMediaStreams(query).FirstOrDefault();
|
videoStream = _mediaSourceManager.GetMediaStreams(query).FirstOrDefault();
|
||||||
}
|
}
|
||||||
#pragma warning restore CA1826
|
|
||||||
if (videoStream is null)
|
if (videoStream is null)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Skipping image extraction: no video stream found for {Path}.", item.Path ?? string.Empty);
|
_logger.LogInformation("Skipping image extraction: no video stream found for {Path}.", item.Path ?? string.Empty);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user