diff options
| author | JPVenson <github@jpb.email> | 2025-04-21 05:06:50 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-20 20:06:50 -0600 |
| commit | a0931baa8eb879898f4bc4049176ed3bdb4d80d1 (patch) | |
| tree | 69bca19c69930fb83a166ae9944273c4dd66fdb9 /MediaBrowser.Model | |
| parent | 5e4bd744c07d44d75c8e9eb7b6dc03b7ff4f147c (diff) | |
Add Api and startup check for sufficient storage capacity (#13888)
Diffstat (limited to 'MediaBrowser.Model')
| -rw-r--r-- | MediaBrowser.Model/System/FolderStorageInfo.cs | 32 | ||||
| -rw-r--r-- | MediaBrowser.Model/System/LibraryStorageInfo.cs | 25 | ||||
| -rw-r--r-- | MediaBrowser.Model/System/SystemInfo.cs | 254 | ||||
| -rw-r--r-- | MediaBrowser.Model/System/SystemStorageInfo.cs | 56 |
4 files changed, 243 insertions, 124 deletions
diff --git a/MediaBrowser.Model/System/FolderStorageInfo.cs b/MediaBrowser.Model/System/FolderStorageInfo.cs new file mode 100644 index 000000000..7b10e4ea5 --- /dev/null +++ b/MediaBrowser.Model/System/FolderStorageInfo.cs @@ -0,0 +1,32 @@ +namespace MediaBrowser.Model.System; + +/// <summary> +/// Contains information about a specific folder. +/// </summary> +public record FolderStorageInfo +{ + /// <summary> + /// Gets the path of the folder in question. + /// </summary> + public required string Path { get; init; } + + /// <summary> + /// Gets the free space of the underlying storage device of the <see cref="Path"/>. + /// </summary> + public long FreeSpace { get; init; } + + /// <summary> + /// Gets the used space of the underlying storage device of the <see cref="Path"/>. + /// </summary> + public long UsedSpace { get; init; } + + /// <summary> + /// Gets the kind of storage device of the <see cref="Path"/>. + /// </summary> + public string? StorageType { get; init; } + + /// <summary> + /// Gets the Device Identifier. + /// </summary> + public string? DeviceId { get; init; } +} diff --git a/MediaBrowser.Model/System/LibraryStorageInfo.cs b/MediaBrowser.Model/System/LibraryStorageInfo.cs new file mode 100644 index 000000000..d4111b29c --- /dev/null +++ b/MediaBrowser.Model/System/LibraryStorageInfo.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace MediaBrowser.Model.System; + +/// <summary> +/// Contains informations about a libraries storage informations. +/// </summary> +public class LibraryStorageInfo +{ + /// <summary> + /// Gets or sets the Library Id. + /// </summary> + public required Guid Id { get; set; } + + /// <summary> + /// Gets or sets the name of the library. + /// </summary> + public required string Name { get; set; } + + /// <summary> + /// Gets or sets the storage informations about the folders used in a library. + /// </summary> + public required IReadOnlyCollection<FolderStorageInfo> Folders { get; set; } +} diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.cs index f37ac6a14..232a2a6bc 100644 --- a/MediaBrowser.Model/System/SystemInfo.cs +++ b/MediaBrowser.Model/System/SystemInfo.cs @@ -6,133 +6,139 @@ using System.Collections.Generic; using System.ComponentModel; using MediaBrowser.Model.Updates; -namespace MediaBrowser.Model.System +namespace MediaBrowser.Model.System; + +/// <summary> +/// Class SystemInfo. +/// </summary> +public class SystemInfo : PublicSystemInfo { /// <summary> - /// Class SystemInfo. + /// Initializes a new instance of the <see cref="SystemInfo" /> class. /// </summary> - public class SystemInfo : PublicSystemInfo + public SystemInfo() { - /// <summary> - /// Initializes a new instance of the <see cref="SystemInfo" /> class. - /// </summary> - public SystemInfo() - { - CompletedInstallations = Array.Empty<InstallationInfo>(); - } - - /// <summary> - /// Gets or sets the display name of the operating system. - /// </summary> - /// <value>The display name of the operating system.</value> - [Obsolete("This is no longer set")] - public string OperatingSystemDisplayName { get; set; } = string.Empty; - - /// <summary> - /// Gets or sets the package name. - /// </summary> - /// <value>The value of the '-package' command line argument.</value> - public string PackageName { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether this instance has pending restart. - /// </summary> - /// <value><c>true</c> if this instance has pending restart; otherwise, <c>false</c>.</value> - public bool HasPendingRestart { get; set; } - - public bool IsShuttingDown { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether [supports library monitor]. - /// </summary> - /// <value><c>true</c> if [supports library monitor]; otherwise, <c>false</c>.</value> - public bool SupportsLibraryMonitor { get; set; } - - /// <summary> - /// Gets or sets the web socket port number. - /// </summary> - /// <value>The web socket port number.</value> - public int WebSocketPortNumber { get; set; } - - /// <summary> - /// Gets or sets the completed installations. - /// </summary> - /// <value>The completed installations.</value> - public InstallationInfo[] CompletedInstallations { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether this instance can self restart. - /// </summary> - /// <value><c>true</c>.</value> - [Obsolete("This is always true")] - [DefaultValue(true)] - public bool CanSelfRestart { get; set; } = true; - - [Obsolete("This is always false")] - [DefaultValue(false)] - public bool CanLaunchWebBrowser { get; set; } = false; - - /// <summary> - /// Gets or sets the program data path. - /// </summary> - /// <value>The program data path.</value> - public string ProgramDataPath { get; set; } - - /// <summary> - /// Gets or sets the web UI resources path. - /// </summary> - /// <value>The web UI resources path.</value> - public string WebPath { get; set; } - - /// <summary> - /// Gets or sets the items by name path. - /// </summary> - /// <value>The items by name path.</value> - public string ItemsByNamePath { get; set; } - - /// <summary> - /// Gets or sets the cache path. - /// </summary> - /// <value>The cache path.</value> - public string CachePath { get; set; } - - /// <summary> - /// Gets or sets the log path. - /// </summary> - /// <value>The log path.</value> - public string LogPath { get; set; } - - /// <summary> - /// Gets or sets the internal metadata path. - /// </summary> - /// <value>The internal metadata path.</value> - public string InternalMetadataPath { get; set; } - - /// <summary> - /// Gets or sets the transcode path. - /// </summary> - /// <value>The transcode path.</value> - public string TranscodingTempPath { get; set; } - - /// <summary> - /// Gets or sets the list of cast receiver applications. - /// </summary> - public IReadOnlyList<CastReceiverApplication> CastReceiverApplications { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether this instance has update available. - /// </summary> - /// <value><c>true</c> if this instance has update available; otherwise, <c>false</c>.</value> - [Obsolete("This should be handled by the package manager")] - [DefaultValue(false)] - public bool HasUpdateAvailable { get; set; } - - [Obsolete("This isn't set correctly anymore")] - [DefaultValue("System")] - public string EncoderLocation { get; set; } = "System"; - - [Obsolete("This is no longer set")] - [DefaultValue("X64")] - public string SystemArchitecture { get; set; } = "X64"; + CompletedInstallations = Array.Empty<InstallationInfo>(); } + + /// <summary> + /// Gets or sets the display name of the operating system. + /// </summary> + /// <value>The display name of the operating system.</value> + [Obsolete("This is no longer set")] + public string OperatingSystemDisplayName { get; set; } = string.Empty; + + /// <summary> + /// Gets or sets the package name. + /// </summary> + /// <value>The value of the '-package' command line argument.</value> + public string PackageName { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether this instance has pending restart. + /// </summary> + /// <value><c>true</c> if this instance has pending restart; otherwise, <c>false</c>.</value> + public bool HasPendingRestart { get; set; } + + public bool IsShuttingDown { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether [supports library monitor]. + /// </summary> + /// <value><c>true</c> if [supports library monitor]; otherwise, <c>false</c>.</value> + public bool SupportsLibraryMonitor { get; set; } + + /// <summary> + /// Gets or sets the web socket port number. + /// </summary> + /// <value>The web socket port number.</value> + public int WebSocketPortNumber { get; set; } + + /// <summary> + /// Gets or sets the completed installations. + /// </summary> + /// <value>The completed installations.</value> + public InstallationInfo[] CompletedInstallations { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether this instance can self restart. + /// </summary> + /// <value><c>true</c>.</value> + [Obsolete("This is always true")] + [DefaultValue(true)] + public bool CanSelfRestart { get; set; } = true; + + [Obsolete("This is always false")] + [DefaultValue(false)] + public bool CanLaunchWebBrowser { get; set; } = false; + + /// <summary> + /// Gets or sets the program data path. + /// </summary> + /// <value>The program data path.</value> + [Obsolete("Use the newer SystemStorageDto instead")] + public string ProgramDataPath { get; set; } + + /// <summary> + /// Gets or sets the web UI resources path. + /// </summary> + /// <value>The web UI resources path.</value> + [Obsolete("Use the newer SystemStorageDto instead")] + public string WebPath { get; set; } + + /// <summary> + /// Gets or sets the items by name path. + /// </summary> + /// <value>The items by name path.</value> + [Obsolete("Use the newer SystemStorageDto instead")] + public string ItemsByNamePath { get; set; } + + /// <summary> + /// Gets or sets the cache path. + /// </summary> + /// <value>The cache path.</value> + [Obsolete("Use the newer SystemStorageDto instead")] + public string CachePath { get; set; } + + /// <summary> + /// Gets or sets the log path. + /// </summary> + /// <value>The log path.</value> + [Obsolete("Use the newer SystemStorageDto instead")] + public string LogPath { get; set; } + + /// <summary> + /// Gets or sets the internal metadata path. + /// </summary> + /// <value>The internal metadata path.</value> + [Obsolete("Use the newer SystemStorageDto instead")] + public string InternalMetadataPath { get; set; } + + /// <summary> + /// Gets or sets the transcode path. + /// </summary> + /// <value>The transcode path.</value> + [Obsolete("Use the newer SystemStorageDto instead")] + public string TranscodingTempPath { get; set; } + + /// <summary> + /// Gets or sets the list of cast receiver applications. + /// </summary> + public IReadOnlyList<CastReceiverApplication> CastReceiverApplications { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether this instance has update available. + /// </summary> + /// <value><c>true</c> if this instance has update available; otherwise, <c>false</c>.</value> + [Obsolete("This should be handled by the package manager")] + [DefaultValue(false)] + public bool HasUpdateAvailable { get; set; } + + [Obsolete("This isn't set correctly anymore")] + [DefaultValue("System")] + public string EncoderLocation { get; set; } = "System"; + + [Obsolete("This is no longer set")] + [DefaultValue("X64")] + public string SystemArchitecture { get; set; } = "X64"; } diff --git a/MediaBrowser.Model/System/SystemStorageInfo.cs b/MediaBrowser.Model/System/SystemStorageInfo.cs new file mode 100644 index 000000000..42e7a37e0 --- /dev/null +++ b/MediaBrowser.Model/System/SystemStorageInfo.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Model.System; + +/// <summary> +/// Contains informations about the systems storage. +/// </summary> +public class SystemStorageInfo +{ + /// <summary> + /// Gets or sets the program data path. + /// </summary> + /// <value>The program data path.</value> + public required FolderStorageInfo ProgramDataFolder { get; set; } + + /// <summary> + /// Gets or sets the web UI resources path. + /// </summary> + /// <value>The web UI resources path.</value> + public required FolderStorageInfo WebFolder { get; set; } + + /// <summary> + /// Gets or sets the items by name path. + /// </summary> + /// <value>The items by name path.</value> + public required FolderStorageInfo ImageCacheFolder { get; set; } + + /// <summary> + /// Gets or sets the cache path. + /// </summary> + /// <value>The cache path.</value> + public required FolderStorageInfo CacheFolder { get; set; } + + /// <summary> + /// Gets or sets the log path. + /// </summary> + /// <value>The log path.</value> + public required FolderStorageInfo LogFolder { get; set; } + + /// <summary> + /// Gets or sets the internal metadata path. + /// </summary> + /// <value>The internal metadata path.</value> + public required FolderStorageInfo InternalMetadataFolder { get; set; } + + /// <summary> + /// Gets or sets the transcode path. + /// </summary> + /// <value>The transcode path.</value> + public required FolderStorageInfo TranscodingTempFolder { get; set; } + + /// <summary> + /// Gets or sets the storage informations of all libraries. + /// </summary> + public required IReadOnlyCollection<LibraryStorageInfo> Libraries { get; set; } +} |
