mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
commit
b20977dc25
@ -1117,7 +1117,7 @@ namespace Emby.Server.Implementations
|
|||||||
.Select(i => new WakeOnLanInfo(i))
|
.Select(i => new WakeOnLanInfo(i))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
public PublicSystemInfo GetPublicSystemInfo(IPAddress source)
|
public PublicSystemInfo GetPublicSystemInfo(IPAddress address)
|
||||||
{
|
{
|
||||||
return new PublicSystemInfo
|
return new PublicSystemInfo
|
||||||
{
|
{
|
||||||
@ -1126,7 +1126,7 @@ namespace Emby.Server.Implementations
|
|||||||
Id = SystemId,
|
Id = SystemId,
|
||||||
OperatingSystem = OperatingSystem.Id.ToString(),
|
OperatingSystem = OperatingSystem.Id.ToString(),
|
||||||
ServerName = FriendlyName,
|
ServerName = FriendlyName,
|
||||||
LocalAddress = GetSmartApiUrl(source),
|
LocalAddress = GetSmartApiUrl(address),
|
||||||
StartupWizardCompleted = ConfigurationManager.CommonConfiguration.IsStartupWizardCompleted
|
StartupWizardCompleted = ConfigurationManager.CommonConfiguration.IsStartupWizardCompleted
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1135,7 +1135,7 @@ namespace Emby.Server.Implementations
|
|||||||
public bool ListenWithHttps => Certificate != null && ConfigurationManager.GetNetworkConfiguration().EnableHttps;
|
public bool ListenWithHttps => Certificate != null && ConfigurationManager.GetNetworkConfiguration().EnableHttps;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string GetSmartApiUrl(IPAddress ipAddress, int? port = null)
|
public string GetSmartApiUrl(IPAddress remoteAddr, int? port = null)
|
||||||
{
|
{
|
||||||
// Published server ends with a /
|
// Published server ends with a /
|
||||||
if (!string.IsNullOrEmpty(PublishedServerUrl))
|
if (!string.IsNullOrEmpty(PublishedServerUrl))
|
||||||
@ -1144,7 +1144,7 @@ namespace Emby.Server.Implementations
|
|||||||
return PublishedServerUrl.Trim('/');
|
return PublishedServerUrl.Trim('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
string smart = NetManager.GetBindInterface(ipAddress, out port);
|
string smart = NetManager.GetBindInterface(remoteAddr, out port);
|
||||||
// If the smartAPI doesn't start with http then treat it as a host or ip.
|
// If the smartAPI doesn't start with http then treat it as a host or ip.
|
||||||
if (smart.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
if (smart.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
@ -1207,14 +1207,14 @@ namespace Emby.Server.Implementations
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string GetLocalApiUrl(string host, string scheme = null, int? port = null)
|
public string GetLocalApiUrl(string hostname, string scheme = null, int? port = null)
|
||||||
{
|
{
|
||||||
// NOTE: If no BaseUrl is set then UriBuilder appends a trailing slash, but if there is no BaseUrl it does
|
// NOTE: If no BaseUrl is set then UriBuilder appends a trailing slash, but if there is no BaseUrl it does
|
||||||
// not. For consistency, always trim the trailing slash.
|
// not. For consistency, always trim the trailing slash.
|
||||||
return new UriBuilder
|
return new UriBuilder
|
||||||
{
|
{
|
||||||
Scheme = scheme ?? (ListenWithHttps ? Uri.UriSchemeHttps : Uri.UriSchemeHttp),
|
Scheme = scheme ?? (ListenWithHttps ? Uri.UriSchemeHttps : Uri.UriSchemeHttp),
|
||||||
Host = host,
|
Host = hostname,
|
||||||
Port = port ?? (ListenWithHttps ? HttpsPort : HttpPort),
|
Port = port ?? (ListenWithHttps ? HttpsPort : HttpPort),
|
||||||
Path = ConfigurationManager.GetNetworkConfiguration().BaseUrl
|
Path = ConfigurationManager.GetNetworkConfiguration().BaseUrl
|
||||||
}.ToString().TrimEnd('/');
|
}.ToString().TrimEnd('/');
|
||||||
|
@ -2540,9 +2540,10 @@ namespace Emby.Server.Implementations.Library
|
|||||||
{
|
{
|
||||||
episodeInfo = resolver.Resolve(episode.Path, isFolder, null, null, isAbsoluteNaming);
|
episodeInfo = resolver.Resolve(episode.Path, isFolder, null, null, isAbsoluteNaming);
|
||||||
// Resolve from parent folder if it's not the Season folder
|
// Resolve from parent folder if it's not the Season folder
|
||||||
if (episodeInfo == null && episode.Parent.GetType() == typeof(Folder))
|
var parent = episode.GetParent();
|
||||||
|
if (episodeInfo == null && parent.GetType() == typeof(Folder))
|
||||||
{
|
{
|
||||||
episodeInfo = resolver.Resolve(episode.Parent.Path, true, null, null, isAbsoluteNaming);
|
episodeInfo = resolver.Resolve(parent.Path, true, null, null, isAbsoluteNaming);
|
||||||
if (episodeInfo != null)
|
if (episodeInfo != null)
|
||||||
{
|
{
|
||||||
// add the container
|
// add the container
|
||||||
|
@ -65,7 +65,7 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
throw new Exception($"Activity Log Retention days must be at least 0. Currently: {retentionDays}");
|
throw new Exception($"Activity Log Retention days must be at least 0. Currently: {retentionDays}");
|
||||||
}
|
}
|
||||||
|
|
||||||
var startDate = DateTime.UtcNow.AddDays(retentionDays.Value * -1);
|
var startDate = DateTime.UtcNow.AddDays(-retentionDays.Value);
|
||||||
return _activityManager.CleanAsync(startDate);
|
return _activityManager.CleanAsync(startDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,16 +79,11 @@ namespace MediaBrowser.Common.Net
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public override byte PrefixLength
|
public override byte PrefixLength
|
||||||
{
|
{
|
||||||
get
|
get => (byte)(ResolveHost() ? 128 : 32);
|
||||||
{
|
|
||||||
return (byte)(ResolveHost() ? 128 : 32);
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
// Not implemented, as a host object can only have a prefix length of 128 (IPv6) or 32 (IPv4) prefix length,
|
||||||
{
|
// which is automatically determined by it's IP type. Anything else is meaningless.
|
||||||
// Not implemented, as a host object can only have a prefix length of 128 (IPv6) or 32 (IPv4) prefix length,
|
set => throw new NotImplementedException();
|
||||||
// which is automatically determined by it's IP type. Anything else is meaningless.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -771,19 +771,6 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Guid ParentId { get; set; }
|
public Guid ParentId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the parent.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The parent.</value>
|
|
||||||
[JsonIgnore]
|
|
||||||
public Folder Parent
|
|
||||||
{
|
|
||||||
get => GetParent() as Folder;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetParent(Folder parent)
|
public void SetParent(Folder parent)
|
||||||
{
|
{
|
||||||
ParentId = parent == null ? Guid.Empty : parent.Id;
|
ParentId = parent == null ? Guid.Empty : parent.Id;
|
||||||
@ -822,8 +809,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
foreach (var parent in GetParents())
|
foreach (var parent in GetParents())
|
||||||
{
|
{
|
||||||
var item = parent as T;
|
if (parent is T item)
|
||||||
if (item != null)
|
|
||||||
{
|
{
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,25 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
public class UserView : Folder, IHasCollectionType
|
public class UserView : Folder, IHasCollectionType
|
||||||
{
|
{
|
||||||
|
private static readonly string[] _viewTypesEligibleForGrouping = new string[]
|
||||||
|
{
|
||||||
|
Model.Entities.CollectionType.Movies,
|
||||||
|
Model.Entities.CollectionType.TvShows,
|
||||||
|
string.Empty
|
||||||
|
};
|
||||||
|
|
||||||
|
private static readonly string[] _originalFolderViewTypes = new string[]
|
||||||
|
{
|
||||||
|
Model.Entities.CollectionType.Books,
|
||||||
|
Model.Entities.CollectionType.MusicVideos,
|
||||||
|
Model.Entities.CollectionType.HomeVideos,
|
||||||
|
Model.Entities.CollectionType.Photos,
|
||||||
|
Model.Entities.CollectionType.Music,
|
||||||
|
Model.Entities.CollectionType.BoxSets
|
||||||
|
};
|
||||||
|
|
||||||
|
public static ITVSeriesManager TVSeriesManager { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the view type.
|
/// Gets or sets the view type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -30,12 +49,22 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Guid? UserId { get; set; }
|
public Guid? UserId { get; set; }
|
||||||
|
|
||||||
public static ITVSeriesManager TVSeriesManager;
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string CollectionType => ViewType;
|
public string CollectionType => ViewType;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
[JsonIgnore]
|
||||||
|
public override bool SupportsInheritedParentImages => false;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
[JsonIgnore]
|
||||||
|
public override bool SupportsPlayedStatus => false;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
[JsonIgnore]
|
||||||
|
public override bool SupportsPeople => false;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override IEnumerable<Guid> GetIdsForAncestorQuery()
|
public override IEnumerable<Guid> GetIdsForAncestorQuery()
|
||||||
{
|
{
|
||||||
@ -53,17 +82,13 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
/// <inheritdoc />
|
||||||
public override bool SupportsInheritedParentImages => false;
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public override bool SupportsPlayedStatus => false;
|
|
||||||
|
|
||||||
public override int GetChildCount(User user)
|
public override int GetChildCount(User user)
|
||||||
{
|
{
|
||||||
return GetChildren(user, true).Count;
|
return GetChildren(user, true).Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query)
|
protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
var parent = this as Folder;
|
var parent = this as Folder;
|
||||||
@ -81,6 +106,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
.GetUserItems(parent, this, CollectionType, query);
|
.GetUserItems(parent, this, CollectionType, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren, InternalItemsQuery query)
|
public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
query ??= new InternalItemsQuery(user);
|
query ??= new InternalItemsQuery(user);
|
||||||
@ -91,16 +117,19 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
return result.ToList();
|
return result.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public override bool CanDelete()
|
public override bool CanDelete()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public override bool IsSaveLocalMetadataEnabled()
|
public override bool IsSaveLocalMetadataEnabled()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public override IEnumerable<BaseItem> GetRecursiveChildren(User user, InternalItemsQuery query)
|
public override IEnumerable<BaseItem> GetRecursiveChildren(User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
@ -111,32 +140,26 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
return GetItemList(query);
|
return GetItemList(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(User user)
|
protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(User user)
|
||||||
{
|
{
|
||||||
return GetChildren(user, false);
|
return GetChildren(user, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly string[] UserSpecificViewTypes = new string[]
|
|
||||||
{
|
|
||||||
Model.Entities.CollectionType.Playlists
|
|
||||||
};
|
|
||||||
|
|
||||||
public static bool IsUserSpecific(Folder folder)
|
public static bool IsUserSpecific(Folder folder)
|
||||||
{
|
{
|
||||||
var collectionFolder = folder as ICollectionFolder;
|
if (folder is not ICollectionFolder collectionFolder)
|
||||||
|
|
||||||
if (collectionFolder == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var supportsUserSpecific = folder as ISupportsUserSpecificView;
|
if (folder is ISupportsUserSpecificView supportsUserSpecific
|
||||||
if (supportsUserSpecific != null && supportsUserSpecific.EnableUserSpecificView)
|
&& supportsUserSpecific.EnableUserSpecificView)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return UserSpecificViewTypes.Contains(collectionFolder.CollectionType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
return string.Equals(Model.Entities.CollectionType.Playlists, collectionFolder.CollectionType, StringComparison.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsEligibleForGrouping(Folder folder)
|
public static bool IsEligibleForGrouping(Folder folder)
|
||||||
@ -145,39 +168,19 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
&& IsEligibleForGrouping(collectionFolder.CollectionType);
|
&& IsEligibleForGrouping(collectionFolder.CollectionType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string[] ViewTypesEligibleForGrouping = new string[]
|
|
||||||
{
|
|
||||||
Model.Entities.CollectionType.Movies,
|
|
||||||
Model.Entities.CollectionType.TvShows,
|
|
||||||
string.Empty
|
|
||||||
};
|
|
||||||
|
|
||||||
public static bool IsEligibleForGrouping(string viewType)
|
public static bool IsEligibleForGrouping(string viewType)
|
||||||
{
|
{
|
||||||
return ViewTypesEligibleForGrouping.Contains(viewType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
return _viewTypesEligibleForGrouping.Contains(viewType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string[] OriginalFolderViewTypes = new string[]
|
|
||||||
{
|
|
||||||
Model.Entities.CollectionType.Books,
|
|
||||||
Model.Entities.CollectionType.MusicVideos,
|
|
||||||
Model.Entities.CollectionType.HomeVideos,
|
|
||||||
Model.Entities.CollectionType.Photos,
|
|
||||||
Model.Entities.CollectionType.Music,
|
|
||||||
Model.Entities.CollectionType.BoxSets
|
|
||||||
};
|
|
||||||
|
|
||||||
public static bool EnableOriginalFolder(string viewType)
|
public static bool EnableOriginalFolder(string viewType)
|
||||||
{
|
{
|
||||||
return OriginalFolderViewTypes.Contains(viewType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
return _originalFolderViewTypes.Contains(viewType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Task ValidateChildrenInternal(IProgress<double> progress, bool recursive, bool refreshChildMetadata, Providers.MetadataRefreshOptions refreshOptions, Providers.IDirectoryService directoryService, System.Threading.CancellationToken cancellationToken)
|
protected override Task ValidateChildrenInternal(IProgress<double> progress, bool recursive, bool refreshChildMetadata, Providers.MetadataRefreshOptions refreshOptions, Providers.IDirectoryService directoryService, System.Threading.CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public override bool SupportsPeople => false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,10 @@ namespace Jellyfin.MediaEncoding.Tests
|
|||||||
public async Task Test(string fileName)
|
public async Task Test(string fileName)
|
||||||
{
|
{
|
||||||
var path = Path.Join("Test Data", fileName);
|
var path = Path.Join("Test Data", fileName);
|
||||||
using (var stream = File.OpenRead(path))
|
await using (var stream = File.OpenRead(path))
|
||||||
{
|
{
|
||||||
await JsonSerializer.DeserializeAsync<InternalMediaInfoResult>(stream, JsonDefaults.Options).ConfigureAwait(false);
|
var res = await JsonSerializer.DeserializeAsync<InternalMediaInfoResult>(stream, JsonDefaults.Options).ConfigureAwait(false);
|
||||||
|
Assert.NotNull(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user