SystemStorageDto.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using MediaBrowser.Model.System;
  5. namespace Jellyfin.Api.Models.SystemInfoDtos;
  6. /// <summary>
  7. /// Contains informations about the systems storage.
  8. /// </summary>
  9. public record SystemStorageDto
  10. {
  11. /// <summary>
  12. /// Gets or sets the Storage information of the program data folder.
  13. /// </summary>
  14. public required FolderStorageDto ProgramDataFolder { get; set; }
  15. /// <summary>
  16. /// Gets or sets the Storage information of the web UI resources folder.
  17. /// </summary>
  18. public required FolderStorageDto WebFolder { get; set; }
  19. /// <summary>
  20. /// Gets or sets the Storage information of the folder where images are cached.
  21. /// </summary>
  22. public required FolderStorageDto ImageCacheFolder { get; set; }
  23. /// <summary>
  24. /// Gets or sets the Storage information of the cache folder.
  25. /// </summary>
  26. public required FolderStorageDto CacheFolder { get; set; }
  27. /// <summary>
  28. /// Gets or sets the Storage information of the folder where logfiles are saved to.
  29. /// </summary>
  30. public required FolderStorageDto LogFolder { get; set; }
  31. /// <summary>
  32. /// Gets or sets the Storage information of the folder where metadata is stored.
  33. /// </summary>
  34. public required FolderStorageDto InternalMetadataFolder { get; set; }
  35. /// <summary>
  36. /// Gets or sets the Storage information of the transcoding cache.
  37. /// </summary>
  38. public required FolderStorageDto TranscodingTempFolder { get; set; }
  39. /// <summary>
  40. /// Gets or sets the storage informations of all libraries.
  41. /// </summary>
  42. public required IReadOnlyCollection<LibraryStorageDto> Libraries { get; set; }
  43. internal static SystemStorageDto FromSystemStorageInfo(SystemStorageInfo model)
  44. {
  45. return new SystemStorageDto()
  46. {
  47. ProgramDataFolder = FolderStorageDto.FromFolderStorageInfo(model.ProgramDataFolder),
  48. WebFolder = FolderStorageDto.FromFolderStorageInfo(model.WebFolder),
  49. ImageCacheFolder = FolderStorageDto.FromFolderStorageInfo(model.ImageCacheFolder),
  50. CacheFolder = FolderStorageDto.FromFolderStorageInfo(model.CacheFolder),
  51. LogFolder = FolderStorageDto.FromFolderStorageInfo(model.LogFolder),
  52. InternalMetadataFolder = FolderStorageDto.FromFolderStorageInfo(model.InternalMetadataFolder),
  53. TranscodingTempFolder = FolderStorageDto.FromFolderStorageInfo(model.TranscodingTempFolder),
  54. Libraries = model.Libraries.Select(LibraryStorageDto.FromLibraryStorageModel).ToArray()
  55. };
  56. }
  57. }