mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-20 10:08:04 +00:00
Compare commits
45 Commits
openapi-ca
...
v10.9.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76854b5eff | ||
|
|
5200633574 | ||
|
|
832e27a8fb | ||
|
|
2da06bc0b1 | ||
|
|
46c748d888 | ||
|
|
430d450828 | ||
|
|
02937873b1 | ||
|
|
d303ca56e3 | ||
|
|
c647143e53 | ||
|
|
dd0ab8ed56 | ||
|
|
18e6c1ef7d | ||
|
|
dec2032e13 | ||
|
|
287e06d6dc | ||
|
|
dc93cc13b5 | ||
|
|
26714e2c62 | ||
|
|
c6c48a2b47 | ||
|
|
f8b67ec44c | ||
|
|
ddd5c302b4 | ||
|
|
9b98638b2b | ||
|
|
2ca8ce6f60 | ||
|
|
56a158e5c9 | ||
|
|
9b65d243a8 | ||
|
|
c45dd5d6fb | ||
|
|
af4b732080 | ||
|
|
1cdf0f5cc4 | ||
|
|
20a1da1855 | ||
|
|
8aee50020b | ||
|
|
c1615419b9 | ||
|
|
15489eeae3 | ||
|
|
80c9589885 | ||
|
|
a5d60c4521 | ||
|
|
2cb052a119 | ||
|
|
0756174b13 | ||
|
|
3f760e6685 | ||
|
|
d5dc4435d9 | ||
|
|
48228430c0 | ||
|
|
f396a95f05 | ||
|
|
717afcdc82 | ||
|
|
25c50bcc5d | ||
|
|
f77a5d0c5c | ||
|
|
6689d837d6 | ||
|
|
c1907354e8 | ||
|
|
efba619acb | ||
|
|
7d271547c6 | ||
|
|
327f92bb2e |
@@ -255,3 +255,4 @@
|
|||||||
- [JPUC1143](https://github.com/Jpuc1143/)
|
- [JPUC1143](https://github.com/Jpuc1143/)
|
||||||
- [0x25CBFC4F](https://github.com/0x25CBFC4F)
|
- [0x25CBFC4F](https://github.com/0x25CBFC4F)
|
||||||
- [Robert Lützner](https://github.com/rluetzner)
|
- [Robert Lützner](https://github.com/rluetzner)
|
||||||
|
- [Nathan McCrina](https://github.com/nfmccrina)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors>Jellyfin Contributors</Authors>
|
<Authors>Jellyfin Contributors</Authors>
|
||||||
<PackageId>Jellyfin.Naming</PackageId>
|
<PackageId>Jellyfin.Naming</PackageId>
|
||||||
<VersionPrefix>10.9.0</VersionPrefix>
|
<VersionPrefix>10.9.2</VersionPrefix>
|
||||||
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
||||||
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
44
Emby.Naming/TV/TvParserHelpers.cs
Normal file
44
Emby.Naming/TV/TvParserHelpers.cs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
|
||||||
|
namespace Emby.Naming.TV;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper class for TV metadata parsing.
|
||||||
|
/// </summary>
|
||||||
|
public static class TvParserHelpers
|
||||||
|
{
|
||||||
|
private static readonly string[] _continuingState = ["Pilot", "Returning Series", "Returning"];
|
||||||
|
private static readonly string[] _endedState = ["Cancelled"];
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tries to parse a string into <see cref="SeriesStatus"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="status">The status string.</param>
|
||||||
|
/// <param name="enumValue">The <see cref="SeriesStatus"/>.</param>
|
||||||
|
/// <returns>Returns true if parsing was successful.</returns>
|
||||||
|
public static bool TryParseSeriesStatus(string status, out SeriesStatus? enumValue)
|
||||||
|
{
|
||||||
|
if (Enum.TryParse(status, true, out SeriesStatus seriesStatus))
|
||||||
|
{
|
||||||
|
enumValue = seriesStatus;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_continuingState.Contains(status, StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
enumValue = SeriesStatus.Continuing;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_endedState.Contains(status, StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
enumValue = SeriesStatus.Ended;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
enumValue = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -422,7 +422,7 @@ namespace Emby.Server.Implementations
|
|||||||
// Initialize runtime stat collection
|
// Initialize runtime stat collection
|
||||||
if (ConfigurationManager.Configuration.EnableMetrics)
|
if (ConfigurationManager.Configuration.EnableMetrics)
|
||||||
{
|
{
|
||||||
DotNetRuntimeStatsBuilder.Default().StartCollecting();
|
_disposableParts.Add(DotNetRuntimeStatsBuilder.Default().StartCollecting());
|
||||||
}
|
}
|
||||||
|
|
||||||
var networkConfiguration = ConfigurationManager.GetNetworkConfiguration();
|
var networkConfiguration = ConfigurationManager.GetNetworkConfiguration();
|
||||||
|
|||||||
@@ -2323,7 +2323,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
|
|
||||||
columns.Add(builder.ToString());
|
columns.Add(builder.ToString());
|
||||||
|
|
||||||
query.ExcludeItemIds = [..query.ExcludeItemIds, item.Id, ..item.ExtraIds];
|
query.ExcludeItemIds = [.. query.ExcludeItemIds, item.Id, .. item.ExtraIds];
|
||||||
query.ExcludeProviderIds = item.ProviderIds;
|
query.ExcludeProviderIds = item.ProviderIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2831,7 +2831,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
prepend.Add((ItemSortBy.Random, SortOrder.Ascending));
|
prepend.Add((ItemSortBy.Random, SortOrder.Ascending));
|
||||||
}
|
}
|
||||||
|
|
||||||
orderBy = query.OrderBy = [..prepend, ..orderBy];
|
orderBy = query.OrderBy = [.. prepend, .. orderBy];
|
||||||
}
|
}
|
||||||
else if (orderBy.Count == 0)
|
else if (orderBy.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -5144,7 +5144,7 @@ AND Type = @InternalPersonType)");
|
|||||||
list.AddRange(inheritedTags.Select(i => (6, i)));
|
list.AddRange(inheritedTags.Select(i => (6, i)));
|
||||||
|
|
||||||
// Remove all invalid values.
|
// Remove all invalid values.
|
||||||
list.RemoveAll(i => string.IsNullOrEmpty(i.Item2));
|
list.RemoveAll(i => string.IsNullOrWhiteSpace(i.Item2));
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@@ -5202,12 +5202,6 @@ AND Type = @InternalPersonType)");
|
|||||||
|
|
||||||
var itemValue = currentValueInfo.Value;
|
var itemValue = currentValueInfo.Value;
|
||||||
|
|
||||||
// Don't save if invalid
|
|
||||||
if (string.IsNullOrWhiteSpace(itemValue))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
statement.TryBind("@Type" + index, currentValueInfo.MagicNumber);
|
statement.TryBind("@Type" + index, currentValueInfo.MagicNumber);
|
||||||
statement.TryBind("@Value" + index, itemValue);
|
statement.TryBind("@Value" + index, itemValue);
|
||||||
statement.TryBind("@CleanValue" + index, GetCleanValue(itemValue));
|
statement.TryBind("@CleanValue" + index, GetCleanValue(itemValue));
|
||||||
|
|||||||
@@ -80,12 +80,14 @@ namespace Emby.Server.Implementations.IO
|
|||||||
public virtual string MakeAbsolutePath(string folderPath, string filePath)
|
public virtual string MakeAbsolutePath(string folderPath, string filePath)
|
||||||
{
|
{
|
||||||
// path is actually a stream
|
// path is actually a stream
|
||||||
if (string.IsNullOrWhiteSpace(filePath) || filePath.Contains("://", StringComparison.Ordinal))
|
if (string.IsNullOrWhiteSpace(filePath))
|
||||||
{
|
{
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filePath.Length > 3 && filePath[1] == ':' && filePath[2] == '/')
|
var isAbsolutePath = Path.IsPathRooted(filePath) && (!OperatingSystem.IsWindows() || filePath[0] != '\\');
|
||||||
|
|
||||||
|
if (isAbsolutePath)
|
||||||
{
|
{
|
||||||
// absolute local path
|
// absolute local path
|
||||||
return filePath;
|
return filePath;
|
||||||
@@ -97,17 +99,10 @@ namespace Emby.Server.Implementations.IO
|
|||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
var firstChar = filePath[0];
|
|
||||||
if (firstChar == '/')
|
|
||||||
{
|
|
||||||
// for this we don't really know
|
|
||||||
return filePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
var filePathSpan = filePath.AsSpan();
|
var filePathSpan = filePath.AsSpan();
|
||||||
|
|
||||||
// relative path
|
// relative path on windows
|
||||||
if (firstChar == '\\')
|
if (filePath[0] == '\\')
|
||||||
{
|
{
|
||||||
filePathSpan = filePathSpan.Slice(1);
|
filePathSpan = filePathSpan.Slice(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ using MediaBrowser.Controller.Library;
|
|||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Querying;
|
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Images
|
namespace Emby.Server.Implementations.Images
|
||||||
{
|
{
|
||||||
@@ -33,12 +32,12 @@ namespace Emby.Server.Implementations.Images
|
|||||||
Parent = item,
|
Parent = item,
|
||||||
Recursive = true,
|
Recursive = true,
|
||||||
DtoOptions = new DtoOptions(true),
|
DtoOptions = new DtoOptions(true),
|
||||||
ImageTypes = new ImageType[] { ImageType.Primary },
|
ImageTypes = [ImageType.Primary],
|
||||||
OrderBy = new (ItemSortBy, SortOrder)[]
|
OrderBy =
|
||||||
{
|
[
|
||||||
(ItemSortBy.IsFolder, SortOrder.Ascending),
|
(ItemSortBy.IsFolder, SortOrder.Ascending),
|
||||||
(ItemSortBy.SortName, SortOrder.Ascending)
|
(ItemSortBy.SortName, SortOrder.Ascending)
|
||||||
},
|
],
|
||||||
Limit = 1
|
Limit = 1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Controller.Drawing;
|
using MediaBrowser.Controller.Drawing;
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
@@ -15,5 +18,13 @@ namespace Emby.Server.Implementations.Images
|
|||||||
: base(fileSystem, providerManager, applicationPaths, imageProcessor, libraryManager)
|
: base(fileSystem, providerManager, applicationPaths, imageProcessor, libraryManager)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override IReadOnlyList<BaseItem> GetItemsWithImages(BaseItem item)
|
||||||
|
{
|
||||||
|
var items = base.GetItemsWithImages(item);
|
||||||
|
|
||||||
|
// Ignore any folders because they can have generated collages
|
||||||
|
return items.Where(i => i is not Folder).ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
|||||||
var seasonNumber = season.IndexNumber.Value;
|
var seasonNumber = season.IndexNumber.Value;
|
||||||
if (string.IsNullOrEmpty(season.Name))
|
if (string.IsNullOrEmpty(season.Name))
|
||||||
{
|
{
|
||||||
var seasonNames = series.SeasonNames;
|
var seasonNames = series.GetSeasonNames();
|
||||||
if (seasonNames.TryGetValue(seasonNumber, out var seasonName))
|
if (seasonNames.TryGetValue(seasonNumber, out var seasonName))
|
||||||
{
|
{
|
||||||
season.Name = seasonName;
|
season.Name = seasonName;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
"DeviceOfflineWithName": "{0} has disconnected",
|
"DeviceOfflineWithName": "{0} has disconnected",
|
||||||
"DeviceOnlineWithName": "{0} is connected",
|
"DeviceOnlineWithName": "{0} is connected",
|
||||||
"External": "External",
|
"External": "External",
|
||||||
"FailedLoginAttemptWithUserName": "Failed login try from {0}",
|
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
|
||||||
"Favorites": "Favorites",
|
"Favorites": "Favorites",
|
||||||
"Folders": "Folders",
|
"Folders": "Folders",
|
||||||
"Forced": "Forced",
|
"Forced": "Forced",
|
||||||
|
|||||||
@@ -321,7 +321,11 @@ namespace Emby.Server.Implementations.Localization
|
|||||||
// Try splitting by : to handle "Germany: FSK-18"
|
// Try splitting by : to handle "Germany: FSK-18"
|
||||||
if (rating.Contains(':', StringComparison.OrdinalIgnoreCase))
|
if (rating.Contains(':', StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return GetRatingLevel(rating.AsSpan().RightPart(':').ToString());
|
var ratingLevelRightPart = rating.AsSpan().RightPart(':');
|
||||||
|
if (ratingLevelRightPart.Length != 0)
|
||||||
|
{
|
||||||
|
return GetRatingLevel(ratingLevelRightPart.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle prefix country code to handle "DE-18"
|
// Handle prefix country code to handle "DE-18"
|
||||||
@@ -332,8 +336,12 @@ namespace Emby.Server.Implementations.Localization
|
|||||||
// Extract culture from country prefix
|
// Extract culture from country prefix
|
||||||
var culture = FindLanguageInfo(ratingSpan.LeftPart('-').ToString());
|
var culture = FindLanguageInfo(ratingSpan.LeftPart('-').ToString());
|
||||||
|
|
||||||
// Check rating system of culture
|
var ratingLevelRightPart = ratingSpan.RightPart('-');
|
||||||
return GetRatingLevel(ratingSpan.RightPart('-').ToString(), culture?.TwoLetterISOLanguageName);
|
if (ratingLevelRightPart.Length != 0)
|
||||||
|
{
|
||||||
|
// Check rating system of culture
|
||||||
|
return GetRatingLevel(ratingLevelRightPart.ToString(), culture?.TwoLetterISOLanguageName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -32,6 +32,10 @@ namespace Jellyfin.Api.Auth.FirstTimeSetupPolicy
|
|||||||
{
|
{
|
||||||
context.Fail();
|
context.Fail();
|
||||||
}
|
}
|
||||||
|
else if (!requirement.RequireAdmin && context.User.IsInRole(UserRoles.Guest))
|
||||||
|
{
|
||||||
|
context.Fail();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Any user-specific checks are handled in the DefaultAuthorizationHandler.
|
// Any user-specific checks are handled in the DefaultAuthorizationHandler.
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors>Jellyfin Contributors</Authors>
|
<Authors>Jellyfin Contributors</Authors>
|
||||||
<PackageId>Jellyfin.Data</PackageId>
|
<PackageId>Jellyfin.Data</PackageId>
|
||||||
<VersionPrefix>10.9.0</VersionPrefix>
|
<VersionPrefix>10.9.2</VersionPrefix>
|
||||||
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
||||||
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ namespace Jellyfin.Server.Implementations.Devices
|
|||||||
.SelectMany(d => dbContext.DeviceOptions.Where(o => o.DeviceId == d.DeviceId).DefaultIfEmpty(), (d, o) => new { Device = d, Options = o })
|
.SelectMany(d => dbContext.DeviceOptions.Where(o => o.DeviceId == d.DeviceId).DefaultIfEmpty(), (d, o) => new { Device = d, Options = o })
|
||||||
.AsAsyncEnumerable();
|
.AsAsyncEnumerable();
|
||||||
|
|
||||||
if (userId.HasValue)
|
if (!userId.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(userId.Value);
|
var user = _userManager.GetUserById(userId.Value);
|
||||||
if (user is null)
|
if (user is null)
|
||||||
|
|||||||
@@ -121,6 +121,13 @@ public class TrickplayManager : ITrickplayManager
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var mediaPath = mediaSource.Path;
|
||||||
|
if (!File.Exists(mediaPath))
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Media source {MediaSourceId} not found at {Path} for item {ItemID}", mediaSource.Id, mediaPath, video.Id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// The width has to be even, otherwise a lot of filters will not be able to sample it
|
// The width has to be even, otherwise a lot of filters will not be able to sample it
|
||||||
var actualWidth = 2 * (width / 2);
|
var actualWidth = 2 * (width / 2);
|
||||||
|
|
||||||
@@ -139,7 +146,6 @@ public class TrickplayManager : ITrickplayManager
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var mediaPath = mediaSource.Path;
|
|
||||||
var mediaStream = mediaSource.VideoStream;
|
var mediaStream = mediaSource.VideoStream;
|
||||||
var container = mediaSource.Container;
|
var container = mediaSource.Container;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma warning disable CA1307
|
#pragma warning disable CA1307
|
||||||
#pragma warning disable CA1309 // Use ordinal string comparison - EF can't translate this
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -47,6 +47,8 @@ namespace Jellyfin.Server.Implementations.Users
|
|||||||
private readonly DefaultPasswordResetProvider _defaultPasswordResetProvider;
|
private readonly DefaultPasswordResetProvider _defaultPasswordResetProvider;
|
||||||
private readonly IServerConfigurationManager _serverConfigurationManager;
|
private readonly IServerConfigurationManager _serverConfigurationManager;
|
||||||
|
|
||||||
|
private readonly IDictionary<Guid, User> _users;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="UserManager"/> class.
|
/// Initializes a new instance of the <see cref="UserManager"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -84,30 +86,29 @@ namespace Jellyfin.Server.Implementations.Users
|
|||||||
_invalidAuthProvider = _authenticationProviders.OfType<InvalidAuthProvider>().First();
|
_invalidAuthProvider = _authenticationProviders.OfType<InvalidAuthProvider>().First();
|
||||||
_defaultAuthenticationProvider = _authenticationProviders.OfType<DefaultAuthenticationProvider>().First();
|
_defaultAuthenticationProvider = _authenticationProviders.OfType<DefaultAuthenticationProvider>().First();
|
||||||
_defaultPasswordResetProvider = _passwordResetProviders.OfType<DefaultPasswordResetProvider>().First();
|
_defaultPasswordResetProvider = _passwordResetProviders.OfType<DefaultPasswordResetProvider>().First();
|
||||||
|
|
||||||
|
_users = new ConcurrentDictionary<Guid, User>();
|
||||||
|
using var dbContext = _dbProvider.CreateDbContext();
|
||||||
|
foreach (var user in dbContext.Users
|
||||||
|
.AsSplitQuery()
|
||||||
|
.Include(user => user.Permissions)
|
||||||
|
.Include(user => user.Preferences)
|
||||||
|
.Include(user => user.AccessSchedules)
|
||||||
|
.Include(user => user.ProfileImage)
|
||||||
|
.AsEnumerable())
|
||||||
|
{
|
||||||
|
_users.Add(user.Id, user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public event EventHandler<GenericEventArgs<User>>? OnUserUpdated;
|
public event EventHandler<GenericEventArgs<User>>? OnUserUpdated;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IEnumerable<User> Users
|
public IEnumerable<User> Users => _users.Values;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
using var dbContext = _dbProvider.CreateDbContext();
|
|
||||||
return GetUsersInternal(dbContext).ToList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IEnumerable<Guid> UsersIds
|
public IEnumerable<Guid> UsersIds => _users.Keys;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
using var dbContext = _dbProvider.CreateDbContext();
|
|
||||||
return dbContext.Users.Select(u => u.Id).ToList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is some regex that matches only on unicode "word" characters, as well as -, _ and @
|
// This is some regex that matches only on unicode "word" characters, as well as -, _ and @
|
||||||
// In theory this will cut out most if not all 'control' characters which should help minimize any weirdness
|
// In theory this will cut out most if not all 'control' characters which should help minimize any weirdness
|
||||||
@@ -123,8 +124,8 @@ namespace Jellyfin.Server.Implementations.Users
|
|||||||
throw new ArgumentException("Guid can't be empty", nameof(id));
|
throw new ArgumentException("Guid can't be empty", nameof(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
using var dbContext = _dbProvider.CreateDbContext();
|
_users.TryGetValue(id, out var user);
|
||||||
return GetUsersInternal(dbContext).FirstOrDefault(u => u.Id.Equals(id));
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@@ -135,9 +136,7 @@ namespace Jellyfin.Server.Implementations.Users
|
|||||||
throw new ArgumentException("Invalid username", nameof(name));
|
throw new ArgumentException("Invalid username", nameof(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
using var dbContext = _dbProvider.CreateDbContext();
|
return _users.Values.FirstOrDefault(u => string.Equals(u.Username, name, StringComparison.OrdinalIgnoreCase));
|
||||||
return GetUsersInternal(dbContext)
|
|
||||||
.FirstOrDefault(u => string.Equals(u.Username, name));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@@ -202,6 +201,8 @@ namespace Jellyfin.Server.Implementations.Users
|
|||||||
user.AddDefaultPermissions();
|
user.AddDefaultPermissions();
|
||||||
user.AddDefaultPreferences();
|
user.AddDefaultPreferences();
|
||||||
|
|
||||||
|
_users.Add(user.Id, user);
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,46 +237,40 @@ namespace Jellyfin.Server.Implementations.Users
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public async Task DeleteUserAsync(Guid userId)
|
public async Task DeleteUserAsync(Guid userId)
|
||||||
{
|
{
|
||||||
var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false);
|
if (!_users.TryGetValue(userId, out var user))
|
||||||
|
{
|
||||||
|
throw new ResourceNotFoundException(nameof(userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_users.Count == 1)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException(string.Format(
|
||||||
|
CultureInfo.InvariantCulture,
|
||||||
|
"The user '{0}' cannot be deleted because there must be at least one user in the system.",
|
||||||
|
user.Username));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (user.HasPermission(PermissionKind.IsAdministrator)
|
||||||
|
&& Users.Count(i => i.HasPermission(PermissionKind.IsAdministrator)) == 1)
|
||||||
|
{
|
||||||
|
throw new ArgumentException(
|
||||||
|
string.Format(
|
||||||
|
CultureInfo.InvariantCulture,
|
||||||
|
"The user '{0}' cannot be deleted because there must be at least one admin user in the system.",
|
||||||
|
user.Username),
|
||||||
|
nameof(userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false);
|
||||||
await using (dbContext.ConfigureAwait(false))
|
await using (dbContext.ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
var user = await dbContext.Users
|
|
||||||
.AsSingleQuery()
|
|
||||||
.Include(u => u.Permissions)
|
|
||||||
.FirstOrDefaultAsync(u => u.Id.Equals(userId))
|
|
||||||
.ConfigureAwait(false);
|
|
||||||
if (user is null)
|
|
||||||
{
|
|
||||||
throw new ResourceNotFoundException(nameof(userId));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (await dbContext.Users.CountAsync().ConfigureAwait(false) == 1)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException(string.Format(
|
|
||||||
CultureInfo.InvariantCulture,
|
|
||||||
"The user '{0}' cannot be deleted because there must be at least one user in the system.",
|
|
||||||
user.Username));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user.HasPermission(PermissionKind.IsAdministrator)
|
|
||||||
&& await dbContext.Users
|
|
||||||
.CountAsync(u => u.Permissions.Any(p => p.Kind == PermissionKind.IsAdministrator && p.Value))
|
|
||||||
.ConfigureAwait(false) == 1)
|
|
||||||
{
|
|
||||||
throw new ArgumentException(
|
|
||||||
string.Format(
|
|
||||||
CultureInfo.InvariantCulture,
|
|
||||||
"The user '{0}' cannot be deleted because there must be at least one admin user in the system.",
|
|
||||||
user.Username),
|
|
||||||
nameof(userId));
|
|
||||||
}
|
|
||||||
|
|
||||||
dbContext.Users.Remove(user);
|
dbContext.Users.Remove(user);
|
||||||
await dbContext.SaveChangesAsync().ConfigureAwait(false);
|
await dbContext.SaveChangesAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
await _eventManager.PublishAsync(new UserDeletedEventArgs(user)).ConfigureAwait(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_users.Remove(userId);
|
||||||
|
|
||||||
|
await _eventManager.PublishAsync(new UserDeletedEventArgs(user)).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@@ -542,23 +537,23 @@ namespace Jellyfin.Server.Implementations.Users
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public async Task InitializeAsync()
|
public async Task InitializeAsync()
|
||||||
{
|
{
|
||||||
|
// TODO: Refactor the startup wizard so that it doesn't require a user to already exist.
|
||||||
|
if (_users.Any())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var defaultName = Environment.UserName;
|
||||||
|
if (string.IsNullOrWhiteSpace(defaultName) || !ValidUsernameRegex().IsMatch(defaultName))
|
||||||
|
{
|
||||||
|
defaultName = "MyJellyfinUser";
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogWarning("No users, creating one with username {UserName}", defaultName);
|
||||||
|
|
||||||
var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false);
|
var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false);
|
||||||
await using (dbContext.ConfigureAwait(false))
|
await using (dbContext.ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
// TODO: Refactor the startup wizard so that it doesn't require a user to already exist.
|
|
||||||
if (await dbContext.Users.AnyAsync().ConfigureAwait(false))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var defaultName = Environment.UserName;
|
|
||||||
if (string.IsNullOrWhiteSpace(defaultName) || !ValidUsernameRegex().IsMatch(defaultName))
|
|
||||||
{
|
|
||||||
defaultName = "MyJellyfinUser";
|
|
||||||
}
|
|
||||||
|
|
||||||
_logger.LogWarning("No users, creating one with username {UserName}", defaultName);
|
|
||||||
|
|
||||||
var newUser = await CreateUserInternalAsync(defaultName, dbContext).ConfigureAwait(false);
|
var newUser = await CreateUserInternalAsync(defaultName, dbContext).ConfigureAwait(false);
|
||||||
newUser.SetPermission(PermissionKind.IsAdministrator, true);
|
newUser.SetPermission(PermissionKind.IsAdministrator, true);
|
||||||
newUser.SetPermission(PermissionKind.EnableContentDeletion, true);
|
newUser.SetPermission(PermissionKind.EnableContentDeletion, true);
|
||||||
@@ -605,9 +600,12 @@ namespace Jellyfin.Server.Implementations.Users
|
|||||||
var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false);
|
var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false);
|
||||||
await using (dbContext.ConfigureAwait(false))
|
await using (dbContext.ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
var user = await GetUsersInternal(dbContext)
|
var user = dbContext.Users
|
||||||
.FirstOrDefaultAsync(u => u.Id.Equals(userId))
|
.Include(u => u.Permissions)
|
||||||
.ConfigureAwait(false)
|
.Include(u => u.Preferences)
|
||||||
|
.Include(u => u.AccessSchedules)
|
||||||
|
.Include(u => u.ProfileImage)
|
||||||
|
.FirstOrDefault(u => u.Id.Equals(userId))
|
||||||
?? throw new ArgumentException("No user exists with given Id!");
|
?? throw new ArgumentException("No user exists with given Id!");
|
||||||
|
|
||||||
user.SubtitleMode = config.SubtitleMode;
|
user.SubtitleMode = config.SubtitleMode;
|
||||||
@@ -635,6 +633,7 @@ namespace Jellyfin.Server.Implementations.Users
|
|||||||
user.SetPreference(PreferenceKind.LatestItemExcludes, config.LatestItemsExcludes);
|
user.SetPreference(PreferenceKind.LatestItemExcludes, config.LatestItemsExcludes);
|
||||||
|
|
||||||
dbContext.Update(user);
|
dbContext.Update(user);
|
||||||
|
_users[user.Id] = user;
|
||||||
await dbContext.SaveChangesAsync().ConfigureAwait(false);
|
await dbContext.SaveChangesAsync().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -645,9 +644,12 @@ namespace Jellyfin.Server.Implementations.Users
|
|||||||
var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false);
|
var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false);
|
||||||
await using (dbContext.ConfigureAwait(false))
|
await using (dbContext.ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
var user = await GetUsersInternal(dbContext)
|
var user = dbContext.Users
|
||||||
.FirstOrDefaultAsync(u => u.Id.Equals(userId))
|
.Include(u => u.Permissions)
|
||||||
.ConfigureAwait(false)
|
.Include(u => u.Preferences)
|
||||||
|
.Include(u => u.AccessSchedules)
|
||||||
|
.Include(u => u.ProfileImage)
|
||||||
|
.FirstOrDefault(u => u.Id.Equals(userId))
|
||||||
?? throw new ArgumentException("No user exists with given Id!");
|
?? throw new ArgumentException("No user exists with given Id!");
|
||||||
|
|
||||||
// The default number of login attempts is 3, but for some god forsaken reason it's sent to the server as "0"
|
// The default number of login attempts is 3, but for some god forsaken reason it's sent to the server as "0"
|
||||||
@@ -708,6 +710,7 @@ namespace Jellyfin.Server.Implementations.Users
|
|||||||
user.SetPreference(PreferenceKind.EnableContentDeletionFromFolders, policy.EnableContentDeletionFromFolders);
|
user.SetPreference(PreferenceKind.EnableContentDeletionFromFolders, policy.EnableContentDeletionFromFolders);
|
||||||
|
|
||||||
dbContext.Update(user);
|
dbContext.Update(user);
|
||||||
|
_users[user.Id] = user;
|
||||||
await dbContext.SaveChangesAsync().ConfigureAwait(false);
|
await dbContext.SaveChangesAsync().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -728,6 +731,7 @@ namespace Jellyfin.Server.Implementations.Users
|
|||||||
}
|
}
|
||||||
|
|
||||||
user.ProfileImage = null;
|
user.ProfileImage = null;
|
||||||
|
_users[user.Id] = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void ThrowIfInvalidUsername(string name)
|
internal static void ThrowIfInvalidUsername(string name)
|
||||||
@@ -874,15 +878,8 @@ namespace Jellyfin.Server.Implementations.Users
|
|||||||
private async Task UpdateUserInternalAsync(JellyfinDbContext dbContext, User user)
|
private async Task UpdateUserInternalAsync(JellyfinDbContext dbContext, User user)
|
||||||
{
|
{
|
||||||
dbContext.Users.Update(user);
|
dbContext.Users.Update(user);
|
||||||
|
_users[user.Id] = user;
|
||||||
await dbContext.SaveChangesAsync().ConfigureAwait(false);
|
await dbContext.SaveChangesAsync().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IQueryable<User> GetUsersInternal(JellyfinDbContext dbContext)
|
|
||||||
=> dbContext.Users
|
|
||||||
.AsSplitQuery()
|
|
||||||
.Include(user => user.Permissions)
|
|
||||||
.Include(user => user.Preferences)
|
|
||||||
.Include(user => user.AccessSchedules)
|
|
||||||
.Include(user => user.ProfileImage);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,17 +35,18 @@ public static class WebHostBuilderExtensions
|
|||||||
return builder
|
return builder
|
||||||
.UseKestrel((builderContext, options) =>
|
.UseKestrel((builderContext, options) =>
|
||||||
{
|
{
|
||||||
var addresses = appHost.NetManager.GetAllBindInterfaces(true);
|
var addresses = appHost.NetManager.GetAllBindInterfaces(false);
|
||||||
|
|
||||||
bool flagged = false;
|
bool flagged = false;
|
||||||
foreach (var netAdd in addresses)
|
foreach (var netAdd in addresses)
|
||||||
{
|
{
|
||||||
logger.LogInformation("Kestrel is listening on {Address}", IPAddress.IPv6Any.Equals(netAdd.Address) ? "All IPv6 addresses" : netAdd.Address);
|
var address = netAdd.Address;
|
||||||
|
logger.LogInformation("Kestrel is listening on {Address}", address.Equals(IPAddress.IPv6Any) ? "all interfaces" : address);
|
||||||
options.Listen(netAdd.Address, appHost.HttpPort);
|
options.Listen(netAdd.Address, appHost.HttpPort);
|
||||||
if (appHost.ListenWithHttps)
|
if (appHost.ListenWithHttps)
|
||||||
{
|
{
|
||||||
options.Listen(
|
options.Listen(
|
||||||
netAdd.Address,
|
address,
|
||||||
appHost.HttpsPort,
|
appHost.HttpsPort,
|
||||||
listenOptions => listenOptions.UseHttps(appHost.Certificate));
|
listenOptions => listenOptions.UseHttps(appHost.Certificate));
|
||||||
}
|
}
|
||||||
@@ -54,7 +55,7 @@ public static class WebHostBuilderExtensions
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
options.Listen(
|
options.Listen(
|
||||||
netAdd.Address,
|
address,
|
||||||
appHost.HttpsPort,
|
appHost.HttpsPort,
|
||||||
listenOptions => listenOptions.UseHttps());
|
listenOptions => listenOptions.UseHttps());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace Jellyfin.Server.Migrations.Routines
|
|||||||
using (var connection = new SqliteConnection($"Filename={Path.Combine(dataPath, DbFilename)}"))
|
using (var connection = new SqliteConnection($"Filename={Path.Combine(dataPath, DbFilename)}"))
|
||||||
{
|
{
|
||||||
connection.Open();
|
connection.Open();
|
||||||
var dbContext = _provider.CreateDbContext();
|
using var dbContext = _provider.CreateDbContext();
|
||||||
|
|
||||||
var queryResult = connection.Query("SELECT * FROM LocalUsersv2");
|
var queryResult = connection.Query("SELECT * FROM LocalUsersv2");
|
||||||
|
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ namespace Jellyfin.Server
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
_restartOnShutdown = false;
|
||||||
_logger.LogCritical(ex, "Error while starting server");
|
_logger.LogCritical(ex, "Error while starting server");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors>Jellyfin Contributors</Authors>
|
<Authors>Jellyfin Contributors</Authors>
|
||||||
<PackageId>Jellyfin.Common</PackageId>
|
<PackageId>Jellyfin.Common</PackageId>
|
||||||
<VersionPrefix>10.9.0</VersionPrefix>
|
<VersionPrefix>10.9.2</VersionPrefix>
|
||||||
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
||||||
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -169,8 +169,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||||||
|
|
||||||
var childUpdateType = ItemUpdateType.None;
|
var childUpdateType = ItemUpdateType.None;
|
||||||
|
|
||||||
// Refresh songs only and not m3u files in album folder
|
foreach (var item in items)
|
||||||
foreach (var item in items.OfType<Audio>())
|
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
|||||||
@@ -594,7 +594,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fanoutConcurrency = ConfigurationManager.Configuration.LibraryScanFanoutConcurrency;
|
var fanoutConcurrency = ConfigurationManager.Configuration.LibraryScanFanoutConcurrency;
|
||||||
var parallelism = fanoutConcurrency > 0 ? fanoutConcurrency : 2 * Environment.ProcessorCount;
|
var parallelism = fanoutConcurrency > 0 ? fanoutConcurrency : Environment.ProcessorCount;
|
||||||
|
|
||||||
var actionBlock = new ActionBlock<int>(
|
var actionBlock = new ActionBlock<int>(
|
||||||
async i =>
|
async i =>
|
||||||
|
|||||||
@@ -25,19 +25,18 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class Series : Folder, IHasTrailers, IHasDisplayOrder, IHasLookupInfo<SeriesInfo>, IMetadataContainer
|
public class Series : Folder, IHasTrailers, IHasDisplayOrder, IHasLookupInfo<SeriesInfo>, IMetadataContainer
|
||||||
{
|
{
|
||||||
|
private readonly Dictionary<int, string> _seasonNames;
|
||||||
|
|
||||||
public Series()
|
public Series()
|
||||||
{
|
{
|
||||||
AirDays = Array.Empty<DayOfWeek>();
|
AirDays = Array.Empty<DayOfWeek>();
|
||||||
SeasonNames = new Dictionary<int, string>();
|
_seasonNames = new Dictionary<int, string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DayOfWeek[] AirDays { get; set; }
|
public DayOfWeek[] AirDays { get; set; }
|
||||||
|
|
||||||
public string AirTime { get; set; }
|
public string AirTime { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public Dictionary<int, string> SeasonNames { get; set; }
|
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public override bool SupportsAddingToPlaylist => true;
|
public override bool SupportsAddingToPlaylist => true;
|
||||||
|
|
||||||
@@ -213,6 +212,26 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||||||
return LibraryManager.GetItemList(query);
|
return LibraryManager.GetItemList(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Dictionary<int, string> GetSeasonNames()
|
||||||
|
{
|
||||||
|
var newSeasons = Children.OfType<Season>()
|
||||||
|
.Where(s => s.IndexNumber.HasValue)
|
||||||
|
.Where(s => !_seasonNames.ContainsKey(s.IndexNumber.Value))
|
||||||
|
.DistinctBy(s => s.IndexNumber);
|
||||||
|
|
||||||
|
foreach (var season in newSeasons)
|
||||||
|
{
|
||||||
|
SetSeasonName(season.IndexNumber.Value, season.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return _seasonNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetSeasonName(int index, string name)
|
||||||
|
{
|
||||||
|
_seasonNames[index] = name;
|
||||||
|
}
|
||||||
|
|
||||||
private void SetSeasonQueryOptions(InternalItemsQuery query, User user)
|
private void SetSeasonQueryOptions(InternalItemsQuery query, User user)
|
||||||
{
|
{
|
||||||
var seriesKey = GetUniqueSeriesKey(this);
|
var seriesKey = GetUniqueSeriesKey(this);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors>Jellyfin Contributors</Authors>
|
<Authors>Jellyfin Contributors</Authors>
|
||||||
<PackageId>Jellyfin.Controller</PackageId>
|
<PackageId>Jellyfin.Controller</PackageId>
|
||||||
<VersionPrefix>10.9.0</VersionPrefix>
|
<VersionPrefix>10.9.2</VersionPrefix>
|
||||||
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
||||||
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -2771,7 +2771,13 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
|
|
||||||
if (time > 0)
|
if (time > 0)
|
||||||
{
|
{
|
||||||
seekParam += string.Format(CultureInfo.InvariantCulture, "-ss {0}", _mediaEncoder.GetTimeParameter(time));
|
// For direct streaming/remuxing, we seek at the exact position of the keyframe
|
||||||
|
// However, ffmpeg will seek to previous keyframe when the exact time is the input
|
||||||
|
// Workaround this by adding 0.5s offset to the seeking time to get the exact keyframe on most videos.
|
||||||
|
// This will help subtitle syncing.
|
||||||
|
var isHlsRemuxing = state.IsVideoRequest && state.TranscodingType is TranscodingJobType.Hls && IsCopyCodec(state.OutputVideoCodec);
|
||||||
|
var seekTick = isHlsRemuxing ? time + 5000000L : time;
|
||||||
|
seekParam += string.Format(CultureInfo.InvariantCulture, "-ss {0}", _mediaEncoder.GetTimeParameter(seekTick));
|
||||||
|
|
||||||
if (state.IsVideoRequest)
|
if (state.IsVideoRequest)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -871,6 +871,15 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
throw new InvalidOperationException("Empty or invalid input argument.");
|
throw new InvalidOperationException("Empty or invalid input argument.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float? encoderQuality = qualityScale;
|
||||||
|
if (vidEncoder.Contains("vaapi", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
// vaapi's mjpeg encoder uses jpeg quality divided by QP2LAMBDA (118) as input, instead of ffmpeg defined qscale
|
||||||
|
// ffmpeg qscale is a value from 1-31, with 1 being best quality and 31 being worst
|
||||||
|
// jpeg quality is a value from 0-100, with 0 being worst quality and 100 being best
|
||||||
|
encoderQuality = (100 - ((qualityScale - 1) * (100 / 30))) / 118;
|
||||||
|
}
|
||||||
|
|
||||||
// Output arguments
|
// Output arguments
|
||||||
var targetDirectory = Path.Combine(_configurationManager.ApplicationPaths.TempDirectory, Guid.NewGuid().ToString("N"));
|
var targetDirectory = Path.Combine(_configurationManager.ApplicationPaths.TempDirectory, Guid.NewGuid().ToString("N"));
|
||||||
Directory.CreateDirectory(targetDirectory);
|
Directory.CreateDirectory(targetDirectory);
|
||||||
@@ -884,7 +893,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
filterParam,
|
filterParam,
|
||||||
outputThreads.GetValueOrDefault(_threads),
|
outputThreads.GetValueOrDefault(_threads),
|
||||||
vidEncoder,
|
vidEncoder,
|
||||||
qualityScale.HasValue ? "-qscale:v " + qualityScale.Value.ToString(CultureInfo.InvariantCulture) + " " : string.Empty,
|
qualityScale.HasValue ? "-qscale:v " + encoderQuality.Value.ToString(CultureInfo.InvariantCulture) + " " : string.Empty,
|
||||||
"image2",
|
"image2",
|
||||||
outputPath);
|
outputPath);
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors>Jellyfin Contributors</Authors>
|
<Authors>Jellyfin Contributors</Authors>
|
||||||
<PackageId>Jellyfin.Model</PackageId>
|
<PackageId>Jellyfin.Model</PackageId>
|
||||||
<VersionPrefix>10.9.0</VersionPrefix>
|
<VersionPrefix>10.9.2</VersionPrefix>
|
||||||
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
||||||
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ using System.Linq;
|
|||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Jellyfin.Data.Enums;
|
|
||||||
using Jellyfin.Extensions;
|
using Jellyfin.Extensions;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using MediaBrowser.Model.Dlna;
|
|||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using TagLib;
|
using TagLib;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.MediaInfo
|
namespace MediaBrowser.Providers.MediaInfo
|
||||||
@@ -27,6 +28,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
private readonly IMediaEncoder _mediaEncoder;
|
private readonly IMediaEncoder _mediaEncoder;
|
||||||
private readonly IItemRepository _itemRepo;
|
private readonly IItemRepository _itemRepo;
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
private readonly ILogger<AudioFileProber> _logger;
|
||||||
private readonly IMediaSourceManager _mediaSourceManager;
|
private readonly IMediaSourceManager _mediaSourceManager;
|
||||||
private readonly LyricResolver _lyricResolver;
|
private readonly LyricResolver _lyricResolver;
|
||||||
private readonly ILyricManager _lyricManager;
|
private readonly ILyricManager _lyricManager;
|
||||||
@@ -34,6 +36,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="AudioFileProber"/> class.
|
/// Initializes a new instance of the <see cref="AudioFileProber"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="logger">Instance of the <see cref="ILogger"/> interface.</param>
|
||||||
/// <param name="mediaSourceManager">Instance of the <see cref="IMediaSourceManager"/> interface.</param>
|
/// <param name="mediaSourceManager">Instance of the <see cref="IMediaSourceManager"/> interface.</param>
|
||||||
/// <param name="mediaEncoder">Instance of the <see cref="IMediaEncoder"/> interface.</param>
|
/// <param name="mediaEncoder">Instance of the <see cref="IMediaEncoder"/> interface.</param>
|
||||||
/// <param name="itemRepo">Instance of the <see cref="IItemRepository"/> interface.</param>
|
/// <param name="itemRepo">Instance of the <see cref="IItemRepository"/> interface.</param>
|
||||||
@@ -41,6 +44,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
/// <param name="lyricResolver">Instance of the <see cref="LyricResolver"/> interface.</param>
|
/// <param name="lyricResolver">Instance of the <see cref="LyricResolver"/> interface.</param>
|
||||||
/// <param name="lyricManager">Instance of the <see cref="ILyricManager"/> interface.</param>
|
/// <param name="lyricManager">Instance of the <see cref="ILyricManager"/> interface.</param>
|
||||||
public AudioFileProber(
|
public AudioFileProber(
|
||||||
|
ILogger<AudioFileProber> logger,
|
||||||
IMediaSourceManager mediaSourceManager,
|
IMediaSourceManager mediaSourceManager,
|
||||||
IMediaEncoder mediaEncoder,
|
IMediaEncoder mediaEncoder,
|
||||||
IItemRepository itemRepo,
|
IItemRepository itemRepo,
|
||||||
@@ -51,6 +55,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
_mediaEncoder = mediaEncoder;
|
_mediaEncoder = mediaEncoder;
|
||||||
_itemRepo = itemRepo;
|
_itemRepo = itemRepo;
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
|
_logger = logger;
|
||||||
_mediaSourceManager = mediaSourceManager;
|
_mediaSourceManager = mediaSourceManager;
|
||||||
_lyricResolver = lyricResolver;
|
_lyricResolver = lyricResolver;
|
||||||
_lyricManager = lyricManager;
|
_lyricManager = lyricManager;
|
||||||
@@ -276,7 +281,14 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
|
|
||||||
if (!audio.PremiereDate.HasValue)
|
if (!audio.PremiereDate.HasValue)
|
||||||
{
|
{
|
||||||
audio.PremiereDate = new DateTime(year, 01, 01);
|
try
|
||||||
|
{
|
||||||
|
audio.PremiereDate = new DateTime(year, 01, 01);
|
||||||
|
}
|
||||||
|
catch (ArgumentOutOfRangeException ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Error parsing YEAR tag in {File}. '{TagValue}' is an invalid year.", audio.Path, tags.Year);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
_subtitleResolver);
|
_subtitleResolver);
|
||||||
|
|
||||||
_audioProber = new AudioFileProber(
|
_audioProber = new AudioFileProber(
|
||||||
|
loggerFactory.CreateLogger<AudioFileProber>(),
|
||||||
mediaSourceManager,
|
mediaSourceManager,
|
||||||
mediaEncoder,
|
mediaEncoder,
|
||||||
itemRepo,
|
itemRepo,
|
||||||
|
|||||||
@@ -8,11 +8,13 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using Jellyfin.Extensions;
|
using Jellyfin.Extensions;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Playlists;
|
using MediaBrowser.Controller.Playlists;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using PlaylistsNET.Content;
|
using PlaylistsNET.Content;
|
||||||
|
|
||||||
@@ -24,11 +26,16 @@ namespace MediaBrowser.Providers.Playlists
|
|||||||
IPreRefreshProvider,
|
IPreRefreshProvider,
|
||||||
IHasItemChangeMonitor
|
IHasItemChangeMonitor
|
||||||
{
|
{
|
||||||
|
private readonly IFileSystem _fileSystem;
|
||||||
|
private readonly ILibraryManager _libraryManager;
|
||||||
private readonly ILogger<PlaylistItemsProvider> _logger;
|
private readonly ILogger<PlaylistItemsProvider> _logger;
|
||||||
|
private readonly CollectionType[] _ignoredCollections = [CollectionType.livetv, CollectionType.boxsets, CollectionType.playlists];
|
||||||
|
|
||||||
public PlaylistItemsProvider(ILogger<PlaylistItemsProvider> logger)
|
public PlaylistItemsProvider(ILogger<PlaylistItemsProvider> logger, ILibraryManager libraryManager, IFileSystem fileSystem)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
_libraryManager = libraryManager;
|
||||||
|
_fileSystem = fileSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name => "Playlist Reader";
|
public string Name => "Playlist Reader";
|
||||||
@@ -54,114 +61,122 @@ namespace MediaBrowser.Providers.Playlists
|
|||||||
|
|
||||||
item.LinkedChildren = items;
|
item.LinkedChildren = items;
|
||||||
|
|
||||||
return Task.FromResult(ItemUpdateType.None);
|
return Task.FromResult(ItemUpdateType.MetadataImport);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<LinkedChild> GetItems(string path, string extension)
|
private IEnumerable<LinkedChild> GetItems(string path, string extension)
|
||||||
{
|
{
|
||||||
|
var libraryRoots = _libraryManager.GetUserRootFolder().Children
|
||||||
|
.OfType<CollectionFolder>()
|
||||||
|
.Where(f => f.CollectionType.HasValue && !_ignoredCollections.Contains(f.CollectionType.Value))
|
||||||
|
.SelectMany(f => f.PhysicalLocations)
|
||||||
|
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
using (var stream = File.OpenRead(path))
|
using (var stream = File.OpenRead(path))
|
||||||
{
|
{
|
||||||
if (string.Equals(".wpl", extension, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(".wpl", extension, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return GetWplItems(stream, path);
|
return GetWplItems(stream, path, libraryRoots);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.Equals(".zpl", extension, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(".zpl", extension, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return GetZplItems(stream, path);
|
return GetZplItems(stream, path, libraryRoots);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.Equals(".m3u", extension, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(".m3u", extension, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return GetM3uItems(stream, path);
|
return GetM3uItems(stream, path, libraryRoots);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.Equals(".m3u8", extension, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(".m3u8", extension, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return GetM3u8Items(stream, path);
|
return GetM3uItems(stream, path, libraryRoots);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.Equals(".pls", extension, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(".pls", extension, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return GetPlsItems(stream, path);
|
return GetPlsItems(stream, path, libraryRoots);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enumerable.Empty<LinkedChild>();
|
return Enumerable.Empty<LinkedChild>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<LinkedChild> GetPlsItems(Stream stream, string path)
|
private IEnumerable<LinkedChild> GetPlsItems(Stream stream, string playlistPath, List<string> libraryRoots)
|
||||||
{
|
{
|
||||||
var content = new PlsContent();
|
var content = new PlsContent();
|
||||||
var playlist = content.GetFromStream(stream);
|
var playlist = content.GetFromStream(stream);
|
||||||
|
|
||||||
return playlist.PlaylistEntries.Select(i => new LinkedChild
|
return playlist.PlaylistEntries
|
||||||
{
|
.Select(i => GetLinkedChild(i.Path, playlistPath, libraryRoots))
|
||||||
Path = GetPlaylistItemPath(i.Path, path),
|
.Where(i => i is not null);
|
||||||
Type = LinkedChildType.Manual
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<LinkedChild> GetM3u8Items(Stream stream, string path)
|
private IEnumerable<LinkedChild> GetM3uItems(Stream stream, string playlistPath, List<string> libraryRoots)
|
||||||
{
|
{
|
||||||
var content = new M3uContent();
|
var content = new M3uContent();
|
||||||
var playlist = content.GetFromStream(stream);
|
var playlist = content.GetFromStream(stream);
|
||||||
|
|
||||||
return playlist.PlaylistEntries.Select(i => new LinkedChild
|
return playlist.PlaylistEntries
|
||||||
{
|
.Select(i => GetLinkedChild(i.Path, playlistPath, libraryRoots))
|
||||||
Path = GetPlaylistItemPath(i.Path, path),
|
.Where(i => i is not null);
|
||||||
Type = LinkedChildType.Manual
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<LinkedChild> GetM3uItems(Stream stream, string path)
|
private IEnumerable<LinkedChild> GetZplItems(Stream stream, string playlistPath, List<string> libraryRoots)
|
||||||
{
|
|
||||||
var content = new M3uContent();
|
|
||||||
var playlist = content.GetFromStream(stream);
|
|
||||||
|
|
||||||
return playlist.PlaylistEntries.Select(i => new LinkedChild
|
|
||||||
{
|
|
||||||
Path = GetPlaylistItemPath(i.Path, path),
|
|
||||||
Type = LinkedChildType.Manual
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<LinkedChild> GetZplItems(Stream stream, string path)
|
|
||||||
{
|
{
|
||||||
var content = new ZplContent();
|
var content = new ZplContent();
|
||||||
var playlist = content.GetFromStream(stream);
|
var playlist = content.GetFromStream(stream);
|
||||||
|
|
||||||
return playlist.PlaylistEntries.Select(i => new LinkedChild
|
return playlist.PlaylistEntries
|
||||||
{
|
.Select(i => GetLinkedChild(i.Path, playlistPath, libraryRoots))
|
||||||
Path = GetPlaylistItemPath(i.Path, path),
|
.Where(i => i is not null);
|
||||||
Type = LinkedChildType.Manual
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<LinkedChild> GetWplItems(Stream stream, string path)
|
private IEnumerable<LinkedChild> GetWplItems(Stream stream, string playlistPath, List<string> libraryRoots)
|
||||||
{
|
{
|
||||||
var content = new WplContent();
|
var content = new WplContent();
|
||||||
var playlist = content.GetFromStream(stream);
|
var playlist = content.GetFromStream(stream);
|
||||||
|
|
||||||
return playlist.PlaylistEntries.Select(i => new LinkedChild
|
return playlist.PlaylistEntries
|
||||||
{
|
.Select(i => GetLinkedChild(i.Path, playlistPath, libraryRoots))
|
||||||
Path = GetPlaylistItemPath(i.Path, path),
|
.Where(i => i is not null);
|
||||||
Type = LinkedChildType.Manual
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetPlaylistItemPath(string itemPath, string containingPlaylistFolder)
|
private LinkedChild GetLinkedChild(string itemPath, string playlistPath, List<string> libraryRoots)
|
||||||
{
|
{
|
||||||
if (!File.Exists(itemPath))
|
if (TryGetPlaylistItemPath(itemPath, playlistPath, libraryRoots, out var parsedPath))
|
||||||
{
|
{
|
||||||
var path = Path.Combine(Path.GetDirectoryName(containingPlaylistFolder), itemPath);
|
return new LinkedChild
|
||||||
if (File.Exists(path))
|
|
||||||
{
|
{
|
||||||
return path;
|
Path = parsedPath,
|
||||||
|
Type = LinkedChildType.Manual
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryGetPlaylistItemPath(string itemPath, string playlistPath, List<string> libraryPaths, out string path)
|
||||||
|
{
|
||||||
|
path = null;
|
||||||
|
string pathToCheck = _fileSystem.MakeAbsolutePath(Path.GetDirectoryName(playlistPath), itemPath);
|
||||||
|
if (!File.Exists(pathToCheck))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var libraryPath in libraryPaths)
|
||||||
|
{
|
||||||
|
if (pathToCheck.StartsWith(libraryPath, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
path = pathToCheck;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return itemPath;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasChanged(BaseItem item, IDirectoryService directoryService)
|
public bool HasChanged(BaseItem item, IDirectoryService directoryService)
|
||||||
|
|||||||
@@ -278,17 +278,12 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
|||||||
|
|
||||||
series.RunTimeTicks = seriesResult.EpisodeRunTime.Select(i => TimeSpan.FromMinutes(i).Ticks).FirstOrDefault();
|
series.RunTimeTicks = seriesResult.EpisodeRunTime.Select(i => TimeSpan.FromMinutes(i).Ticks).FirstOrDefault();
|
||||||
|
|
||||||
if (string.Equals(seriesResult.Status, "Ended", StringComparison.OrdinalIgnoreCase)
|
if (Emby.Naming.TV.TvParserHelpers.TryParseSeriesStatus(seriesResult.Status, out var seriesStatus))
|
||||||
|| string.Equals(seriesResult.Status, "Canceled", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
{
|
||||||
series.Status = SeriesStatus.Ended;
|
series.Status = seriesStatus;
|
||||||
series.EndDate = seriesResult.LastAirDate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
series.Status = SeriesStatus.Continuing;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
series.EndDate = seriesResult.LastAirDate;
|
||||||
series.PremiereDate = seriesResult.FirstAirDate;
|
series.PremiereDate = seriesResult.FirstAirDate;
|
||||||
|
|
||||||
var ids = seriesResult.ExternalIds;
|
var ids = seriesResult.ExternalIds;
|
||||||
|
|||||||
@@ -88,18 +88,22 @@ namespace MediaBrowser.Providers.TV
|
|||||||
|
|
||||||
var sourceItem = source.Item;
|
var sourceItem = source.Item;
|
||||||
var targetItem = target.Item;
|
var targetItem = target.Item;
|
||||||
var sourceSeasonNames = sourceItem.SeasonNames;
|
var sourceSeasonNames = sourceItem.GetSeasonNames();
|
||||||
var targetSeasonNames = targetItem.SeasonNames;
|
var targetSeasonNames = targetItem.GetSeasonNames();
|
||||||
|
|
||||||
if (replaceData || targetSeasonNames.Count == 0)
|
if (replaceData)
|
||||||
{
|
|
||||||
targetItem.SeasonNames = sourceSeasonNames;
|
|
||||||
}
|
|
||||||
else if (targetSeasonNames.Count != sourceSeasonNames.Count || !sourceSeasonNames.Keys.All(targetSeasonNames.ContainsKey))
|
|
||||||
{
|
{
|
||||||
foreach (var (number, name) in sourceSeasonNames)
|
foreach (var (number, name) in sourceSeasonNames)
|
||||||
{
|
{
|
||||||
targetSeasonNames.TryAdd(number, name);
|
targetItem.SetSeasonName(number, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var newSeasons = sourceSeasonNames.Where(s => !targetSeasonNames.ContainsKey(s.Key));
|
||||||
|
foreach (var (number, name) in newSeasons)
|
||||||
|
{
|
||||||
|
targetItem.SetSeasonName(number, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,7 +225,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
/// <returns>The async task.</returns>
|
/// <returns>The async task.</returns>
|
||||||
private async Task UpdateAndCreateSeasonsAsync(Series series, CancellationToken cancellationToken)
|
private async Task UpdateAndCreateSeasonsAsync(Series series, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var seasonNames = series.SeasonNames;
|
var seasonNames = series.GetSeasonNames();
|
||||||
var seriesChildren = series.GetRecursiveChildren(i => i is Episode || i is Season);
|
var seriesChildren = series.GetRecursiveChildren(i => i is Episode || i is Season);
|
||||||
var seasons = seriesChildren.OfType<Season>().ToList();
|
var seasons = seriesChildren.OfType<Season>().ToList();
|
||||||
var uniqueSeasonNumbers = seriesChildren
|
var uniqueSeasonNumbers = seriesChildren
|
||||||
@@ -245,7 +249,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
var season = await CreateSeasonAsync(series, seasonName, seasonNumber, cancellationToken).ConfigureAwait(false);
|
var season = await CreateSeasonAsync(series, seasonName, seasonNumber, cancellationToken).ConfigureAwait(false);
|
||||||
series.AddChild(season);
|
series.AddChild(season);
|
||||||
}
|
}
|
||||||
else if (!string.Equals(existingSeason.Name, seasonName, StringComparison.Ordinal))
|
else if (!existingSeason.LockedFields.Contains(MetadataField.Name) && !string.Equals(existingSeason.Name, seasonName, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
existingSeason.Name = seasonName;
|
existingSeason.Name = seasonName;
|
||||||
await existingSeason.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false);
|
await existingSeason.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using Emby.Naming.TV;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Extensions;
|
using MediaBrowser.Controller.Extensions;
|
||||||
@@ -87,7 +87,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(status))
|
if (!string.IsNullOrWhiteSpace(status))
|
||||||
{
|
{
|
||||||
if (Enum.TryParse(status, true, out SeriesStatus seriesStatus))
|
if (TvParserHelpers.TryParseSeriesStatus(status, out var seriesStatus))
|
||||||
{
|
{
|
||||||
item.Status = seriesStatus;
|
item.Status = seriesStatus;
|
||||||
}
|
}
|
||||||
@@ -107,7 +107,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(name) && parsed)
|
if (!string.IsNullOrWhiteSpace(name) && parsed)
|
||||||
{
|
{
|
||||||
item.SeasonNames[seasonNumber] = name;
|
item.SetSeasonName(seasonNumber, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("10.9.0")]
|
[assembly: AssemblyVersion("10.9.2")]
|
||||||
[assembly: AssemblyFileVersion("10.9.0")]
|
[assembly: AssemblyFileVersion("10.9.2")]
|
||||||
|
|||||||
@@ -8,12 +8,14 @@
|
|||||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
||||||
<IncludeSymbols>true</IncludeSymbols>
|
<IncludeSymbols>true</IncludeSymbols>
|
||||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||||
|
<!-- ICU4N.Transliterator only has prerelease versions -->
|
||||||
|
<NoWarn>NU5104</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors>Jellyfin Contributors</Authors>
|
<Authors>Jellyfin Contributors</Authors>
|
||||||
<PackageId>Jellyfin.Extensions</PackageId>
|
<PackageId>Jellyfin.Extensions</PackageId>
|
||||||
<VersionPrefix>10.9.0</VersionPrefix>
|
<VersionPrefix>10.9.2</VersionPrefix>
|
||||||
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
||||||
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace Jellyfin.LiveTv.Timers
|
|||||||
public TimerManager(ILogger<TimerManager> logger, IConfigurationManager config)
|
public TimerManager(ILogger<TimerManager> logger, IConfigurationManager config)
|
||||||
: base(
|
: base(
|
||||||
logger,
|
logger,
|
||||||
Path.Combine(config.CommonApplicationPaths.DataPath, "livetv"),
|
Path.Combine(config.CommonApplicationPaths.DataPath, "livetv/timers.json"),
|
||||||
(r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase))
|
(r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ namespace Jellyfin.LiveTv.TunerHosts
|
|||||||
{
|
{
|
||||||
private static readonly string[] _disallowedMimeTypes =
|
private static readonly string[] _disallowedMimeTypes =
|
||||||
{
|
{
|
||||||
|
"text/plain",
|
||||||
|
"text/html",
|
||||||
"video/x-matroska",
|
"video/x-matroska",
|
||||||
"video/mp4",
|
"video/mp4",
|
||||||
"application/vnd.apple.mpegurl",
|
"application/vnd.apple.mpegurl",
|
||||||
@@ -118,12 +120,12 @@ namespace Jellyfin.LiveTv.TunerHosts
|
|||||||
|
|
||||||
if (response.IsSuccessStatusCode)
|
if (response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
if (!_disallowedMimeTypes.Contains(response.Content.Headers.ContentType?.ToString(), StringComparison.OrdinalIgnoreCase))
|
if (!_disallowedMimeTypes.Contains(response.Content.Headers.ContentType?.MediaType, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return new SharedHttpStream(mediaSource, tunerHost, streamId, FileSystem, _httpClientFactory, Logger, Config, _appHost, _streamHelper);
|
return new SharedHttpStream(mediaSource, tunerHost, streamId, FileSystem, _httpClientFactory, Logger, Config, _appHost, _streamHelper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (response.StatusCode == HttpStatusCode.MethodNotAllowed || response.StatusCode == HttpStatusCode.NotImplemented)
|
else
|
||||||
{
|
{
|
||||||
// Fallback to check path extension when the server does not support HEAD method
|
// Fallback to check path extension when the server does not support HEAD method
|
||||||
// Use UriBuilder to remove all query string as GetExtension will include them when used directly
|
// Use UriBuilder to remove all query string as GetExtension will include them when used directly
|
||||||
@@ -133,10 +135,6 @@ namespace Jellyfin.LiveTv.TunerHosts
|
|||||||
return new SharedHttpStream(mediaSource, tunerHost, streamId, FileSystem, _httpClientFactory, Logger, Config, _appHost, _streamHelper);
|
return new SharedHttpStream(mediaSource, tunerHost, streamId, FileSystem, _httpClientFactory, Logger, Config, _appHost, _streamHelper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
response.EnsureSuccessStatusCode();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new LiveStream(mediaSource, tunerHost, FileSystem, Logger, Config, _streamHelper);
|
return new LiveStream(mediaSource, tunerHost, FileSystem, Logger, Config, _streamHelper);
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ using MediaBrowser.Common.Configuration;
|
|||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Model.Net;
|
using MediaBrowser.Model.Net;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.HttpOverrides;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using static MediaBrowser.Controller.Extensions.ConfigurationExtensions;
|
using static MediaBrowser.Controller.Extensions.ConfigurationExtensions;
|
||||||
@@ -237,7 +236,7 @@ public class NetworkManager : INetworkManager, IDisposable
|
|||||||
var mac = adapter.GetPhysicalAddress();
|
var mac = adapter.GetPhysicalAddress();
|
||||||
|
|
||||||
// Populate MAC list
|
// Populate MAC list
|
||||||
if (adapter.NetworkInterfaceType != NetworkInterfaceType.Loopback && PhysicalAddress.None.Equals(mac))
|
if (adapter.NetworkInterfaceType != NetworkInterfaceType.Loopback && !PhysicalAddress.None.Equals(mac))
|
||||||
{
|
{
|
||||||
macAddresses.Add(mac);
|
macAddresses.Add(mac);
|
||||||
}
|
}
|
||||||
@@ -412,7 +411,9 @@ public class NetworkManager : INetworkManager, IDisposable
|
|||||||
interfaces.RemoveAll(x => x.AddressFamily == AddressFamily.InterNetworkV6);
|
interfaces.RemoveAll(x => x.AddressFamily == AddressFamily.InterNetworkV6);
|
||||||
}
|
}
|
||||||
|
|
||||||
_interfaces = interfaces;
|
// Users may have complex networking configuration that multiple interfaces sharing the same IP address
|
||||||
|
// Only return one IP for binding, and let the OS handle the rest
|
||||||
|
_interfaces = interfaces.DistinctBy(iface => iface.Address).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -737,7 +738,9 @@ public class NetworkManager : INetworkManager, IDisposable
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IReadOnlyList<IPData> GetAllBindInterfaces(bool individualInterfaces = false)
|
public IReadOnlyList<IPData> GetAllBindInterfaces(bool individualInterfaces = false)
|
||||||
{
|
{
|
||||||
if (_interfaces.Count > 0 || individualInterfaces)
|
var config = _configurationManager.GetNetworkConfiguration();
|
||||||
|
var localNetworkAddresses = config.LocalNetworkAddresses;
|
||||||
|
if ((localNetworkAddresses.Length > 0 && !string.IsNullOrWhiteSpace(localNetworkAddresses[0]) && _interfaces.Count > 0) || individualInterfaces)
|
||||||
{
|
{
|
||||||
return _interfaces;
|
return _interfaces;
|
||||||
}
|
}
|
||||||
@@ -1017,7 +1020,7 @@ public class NetworkManager : INetworkManager, IDisposable
|
|||||||
result = string.Empty;
|
result = string.Empty;
|
||||||
|
|
||||||
int count = _interfaces.Count;
|
int count = _interfaces.Count;
|
||||||
if (count == 1 && (_interfaces[0].Equals(IPAddress.Any) || _interfaces[0].Equals(IPAddress.IPv6Any)))
|
if (count == 1 && (_interfaces[0].Address.Equals(IPAddress.Any) || _interfaces[0].Address.Equals(IPAddress.IPv6Any)))
|
||||||
{
|
{
|
||||||
// Ignore IPAny addresses.
|
// Ignore IPAny addresses.
|
||||||
count = 0;
|
count = 0;
|
||||||
@@ -1049,7 +1052,7 @@ public class NetworkManager : INetworkManager, IDisposable
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogWarning("{Source}: External request received, no matching external bind address found, trying internal addresses.", source);
|
_logger.LogDebug("{Source}: External request received, no matching external bind address found, trying internal addresses", source);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1087,7 +1090,7 @@ public class NetworkManager : INetworkManager, IDisposable
|
|||||||
if (extResult.Length == 0)
|
if (extResult.Length == 0)
|
||||||
{
|
{
|
||||||
result = string.Empty;
|
result = string.Empty;
|
||||||
_logger.LogWarning("{Source}: External request received, but no external interface found. Need to route through internal network.", source);
|
_logger.LogDebug("{Source}: External request received, but no external interface found. Need to route through internal network", source);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1114,12 +1117,13 @@ public class NetworkManager : INetworkManager, IDisposable
|
|||||||
var logLevel = debug ? LogLevel.Debug : LogLevel.Information;
|
var logLevel = debug ? LogLevel.Debug : LogLevel.Information;
|
||||||
if (_logger.IsEnabled(logLevel))
|
if (_logger.IsEnabled(logLevel))
|
||||||
{
|
{
|
||||||
_logger.Log(logLevel, "Defined LAN addresses: {0}", _lanSubnets.Select(s => s.Prefix + "/" + s.PrefixLength));
|
_logger.Log(logLevel, "Defined LAN subnets: {Subnets}", _lanSubnets.Select(s => s.Prefix + "/" + s.PrefixLength));
|
||||||
_logger.Log(logLevel, "Defined LAN exclusions: {0}", _excludedSubnets.Select(s => s.Prefix + "/" + s.PrefixLength));
|
_logger.Log(logLevel, "Defined LAN exclusions: {Subnets}", _excludedSubnets.Select(s => s.Prefix + "/" + s.PrefixLength));
|
||||||
_logger.Log(logLevel, "Using LAN addresses: {0}", _lanSubnets.Where(s => !_excludedSubnets.Contains(s)).Select(s => s.Prefix + "/" + s.PrefixLength));
|
_logger.Log(logLevel, "Used LAN subnets: {Subnets}", _lanSubnets.Where(s => !_excludedSubnets.Contains(s)).Select(s => s.Prefix + "/" + s.PrefixLength));
|
||||||
_logger.Log(logLevel, "Using bind addresses: {0}", _interfaces.OrderByDescending(x => x.AddressFamily == AddressFamily.InterNetwork).Select(x => x.Address));
|
_logger.Log(logLevel, "Filtered interface addresses: {Addresses}", _interfaces.OrderByDescending(x => x.AddressFamily == AddressFamily.InterNetwork).Select(x => x.Address));
|
||||||
_logger.Log(logLevel, "Remote IP filter is {0}", config.IsRemoteIPFilterBlacklist ? "Blocklist" : "Allowlist");
|
_logger.Log(logLevel, "Bind Addresses {Addresses}", GetAllBindInterfaces(false).OrderByDescending(x => x.AddressFamily == AddressFamily.InterNetwork).Select(x => x.Address));
|
||||||
_logger.Log(logLevel, "Filter list: {0}", _remoteAddressFilter.Select(s => s.Prefix + "/" + s.PrefixLength));
|
_logger.Log(logLevel, "Remote IP filter is {Type}", config.IsRemoteIPFilterBlacklist ? "Blocklist" : "Allowlist");
|
||||||
|
_logger.Log(logLevel, "Filtered subnets: {Subnets}", _remoteAddressFilter.Select(s => s.Prefix + "/" + s.PrefixLength));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,27 @@ namespace Jellyfin.Api.Tests.Auth.FirstTimeSetupPolicy
|
|||||||
Assert.Equal(shouldSucceed, context.HasSucceeded);
|
Assert.Equal(shouldSucceed, context.HasSucceeded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(UserRoles.Administrator, true)]
|
||||||
|
[InlineData(UserRoles.Guest, false)]
|
||||||
|
[InlineData(UserRoles.User, true)]
|
||||||
|
public async Task ShouldRequireUserIfNotRequiresAdmin(string userRole, bool shouldSucceed)
|
||||||
|
{
|
||||||
|
TestHelpers.SetupConfigurationManager(_configurationManagerMock, true);
|
||||||
|
var claims = TestHelpers.SetupUser(
|
||||||
|
_userManagerMock,
|
||||||
|
_httpContextAccessor,
|
||||||
|
userRole);
|
||||||
|
|
||||||
|
var context = new AuthorizationHandlerContext(
|
||||||
|
new List<IAuthorizationRequirement> { new FirstTimeSetupRequirement(false, false) },
|
||||||
|
claims,
|
||||||
|
null);
|
||||||
|
|
||||||
|
await _firstTimeSetupHandler.HandleAsync(context);
|
||||||
|
Assert.Equal(shouldSucceed, context.HasSucceeded);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task ShouldAllowAdminApiKeyIfStartupWizardComplete()
|
public async Task ShouldAllowAdminApiKeyIfStartupWizardComplete()
|
||||||
{
|
{
|
||||||
|
|||||||
31
tests/Jellyfin.Naming.Tests/TV/TvParserHelpersTest.cs
Normal file
31
tests/Jellyfin.Naming.Tests/TV/TvParserHelpersTest.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using Emby.Naming.TV;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Jellyfin.Naming.Tests.TV;
|
||||||
|
|
||||||
|
public class TvParserHelpersTest
|
||||||
|
{
|
||||||
|
[Theory]
|
||||||
|
[InlineData("Ended", SeriesStatus.Ended)]
|
||||||
|
[InlineData("Cancelled", SeriesStatus.Ended)]
|
||||||
|
[InlineData("Continuing", SeriesStatus.Continuing)]
|
||||||
|
[InlineData("Returning", SeriesStatus.Continuing)]
|
||||||
|
[InlineData("Returning Series", SeriesStatus.Continuing)]
|
||||||
|
[InlineData("Unreleased", SeriesStatus.Unreleased)]
|
||||||
|
public void SeriesStatusParserTest_Valid(string statusString, SeriesStatus? status)
|
||||||
|
{
|
||||||
|
var successful = TvParserHelpers.TryParseSeriesStatus(statusString, out var parsered);
|
||||||
|
Assert.True(successful);
|
||||||
|
Assert.Equal(status, parsered);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("XXX")]
|
||||||
|
public void SeriesStatusParserTest_InValid(string statusString)
|
||||||
|
{
|
||||||
|
var successful = TvParserHelpers.TryParseSeriesStatus(statusString, out var parsered);
|
||||||
|
Assert.False(successful);
|
||||||
|
Assert.Null(parsered);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,26 +20,37 @@ namespace Jellyfin.Server.Implementations.Tests.IO
|
|||||||
_sut = _fixture.Create<ManagedFileSystem>();
|
_sut = _fixture.Create<ManagedFileSystem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[SkippableTheory]
|
||||||
[InlineData("/Volumes/Library/Sample/Music/Playlists/", "../Beethoven/Misc/Moonlight Sonata.mp3", "/Volumes/Library/Sample/Music/Beethoven/Misc/Moonlight Sonata.mp3")]
|
[InlineData("/Volumes/Library/Sample/Music/Playlists/", "../Beethoven/Misc/Moonlight Sonata.mp3", "/Volumes/Library/Sample/Music/Beethoven/Misc/Moonlight Sonata.mp3")]
|
||||||
[InlineData("/Volumes/Library/Sample/Music/Playlists/", "../../Beethoven/Misc/Moonlight Sonata.mp3", "/Volumes/Library/Sample/Beethoven/Misc/Moonlight Sonata.mp3")]
|
[InlineData("/Volumes/Library/Sample/Music/Playlists/", "../../Beethoven/Misc/Moonlight Sonata.mp3", "/Volumes/Library/Sample/Beethoven/Misc/Moonlight Sonata.mp3")]
|
||||||
[InlineData("/Volumes/Library/Sample/Music/Playlists/", "Beethoven/Misc/Moonlight Sonata.mp3", "/Volumes/Library/Sample/Music/Playlists/Beethoven/Misc/Moonlight Sonata.mp3")]
|
[InlineData("/Volumes/Library/Sample/Music/Playlists/", "Beethoven/Misc/Moonlight Sonata.mp3", "/Volumes/Library/Sample/Music/Playlists/Beethoven/Misc/Moonlight Sonata.mp3")]
|
||||||
public void MakeAbsolutePathCorrectlyHandlesRelativeFilePaths(
|
[InlineData("/Volumes/Library/Sample/Music/Playlists/", "/mnt/Beethoven/Misc/Moonlight Sonata.mp3", "/mnt/Beethoven/Misc/Moonlight Sonata.mp3")]
|
||||||
|
public void MakeAbsolutePathCorrectlyHandlesRelativeFilePathsOnUnixLike(
|
||||||
string folderPath,
|
string folderPath,
|
||||||
string filePath,
|
string filePath,
|
||||||
string expectedAbsolutePath)
|
string expectedAbsolutePath)
|
||||||
{
|
{
|
||||||
|
Skip.If(OperatingSystem.IsWindows());
|
||||||
|
|
||||||
|
var generatedPath = _sut.MakeAbsolutePath(folderPath, filePath);
|
||||||
|
Assert.Equal(expectedAbsolutePath, generatedPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
[SkippableTheory]
|
||||||
|
[InlineData(@"C:\\Volumes\Library\Sample\Music\Playlists\", @"..\Beethoven\Misc\Moonlight Sonata.mp3", @"C:\Volumes\Library\Sample\Music\Beethoven\Misc\Moonlight Sonata.mp3")]
|
||||||
|
[InlineData(@"C:\\Volumes\Library\Sample\Music\Playlists\", @"..\..\Beethoven\Misc\Moonlight Sonata.mp3", @"C:\Volumes\Library\Sample\Beethoven\Misc\Moonlight Sonata.mp3")]
|
||||||
|
[InlineData(@"C:\\Volumes\Library\Sample\Music\Playlists\", @"Beethoven\Misc\Moonlight Sonata.mp3", @"C:\Volumes\Library\Sample\Music\Playlists\Beethoven\Misc\Moonlight Sonata.mp3")]
|
||||||
|
[InlineData(@"C:\\Volumes\Library\Sample\Music\Playlists\", @"D:\\Beethoven\Misc\Moonlight Sonata.mp3", @"D:\\Beethoven\Misc\Moonlight Sonata.mp3")]
|
||||||
|
public void MakeAbsolutePathCorrectlyHandlesRelativeFilePathsOnWindows(
|
||||||
|
string folderPath,
|
||||||
|
string filePath,
|
||||||
|
string expectedAbsolutePath)
|
||||||
|
{
|
||||||
|
Skip.If(!OperatingSystem.IsWindows());
|
||||||
|
|
||||||
var generatedPath = _sut.MakeAbsolutePath(folderPath, filePath);
|
var generatedPath = _sut.MakeAbsolutePath(folderPath, filePath);
|
||||||
|
|
||||||
if (OperatingSystem.IsWindows())
|
Assert.Equal(expectedAbsolutePath, generatedPath);
|
||||||
{
|
|
||||||
var expectedWindowsPath = expectedAbsolutePath.Replace('/', '\\');
|
|
||||||
Assert.Equal(expectedWindowsPath, generatedPath.Split(':')[1]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Assert.Equal(expectedAbsolutePath, generatedPath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Emby.Server.Implementations.Localization;
|
using Emby.Server.Implementations.Localization;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
@@ -157,6 +158,20 @@ namespace Jellyfin.Server.Implementations.Tests.Localization
|
|||||||
Assert.Null(localizationManager.GetRatingLevel("n/a"));
|
Assert.Null(localizationManager.GetRatingLevel("n/a"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("-NO RATING SHOWN-")]
|
||||||
|
[InlineData(":NO RATING SHOWN:")]
|
||||||
|
public async Task GetRatingLevel_Split_Success(string value)
|
||||||
|
{
|
||||||
|
var localizationManager = Setup(new ServerConfiguration()
|
||||||
|
{
|
||||||
|
UICulture = "en-US"
|
||||||
|
});
|
||||||
|
await localizationManager.LoadAll();
|
||||||
|
|
||||||
|
Assert.Null(localizationManager.GetRatingLevel(value));
|
||||||
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("Default", "Default")]
|
[InlineData("Default", "Default")]
|
||||||
[InlineData("HeaderLiveTV", "Live TV")]
|
[InlineData("HeaderLiveTV", "Live TV")]
|
||||||
|
|||||||
Reference in New Issue
Block a user