aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Models/SystemInfoDtos/SystemStorageDto.cs
blob: a09042439a46b78b86127459a0e82a22a8e5509d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System;
using System.Collections.Generic;
using System.Linq;
using MediaBrowser.Model.System;

namespace Jellyfin.Api.Models.SystemInfoDtos;

/// <summary>
/// Contains informations about the systems storage.
/// </summary>
public record SystemStorageDto
{
    /// <summary>
    /// Gets or sets the Storage information of the program data folder.
    /// </summary>
    public required FolderStorageDto ProgramDataFolder { get; set; }

    /// <summary>
    /// Gets or sets the Storage information of the web UI resources folder.
    /// </summary>
    public required FolderStorageDto WebFolder { get; set; }

    /// <summary>
    /// Gets or sets the Storage information of the folder where images are cached.
    /// </summary>
    public required FolderStorageDto ImageCacheFolder { get; set; }

    /// <summary>
    /// Gets or sets the Storage information of the cache folder.
    /// </summary>
    public required FolderStorageDto CacheFolder { get; set; }

    /// <summary>
    /// Gets or sets the Storage information of the folder where logfiles are saved to.
    /// </summary>
    public required FolderStorageDto LogFolder { get; set; }

    /// <summary>
    /// Gets or sets the Storage information of the folder where metadata is stored.
    /// </summary>
    public required FolderStorageDto InternalMetadataFolder { get; set; }

    /// <summary>
    /// Gets or sets the Storage information of the transcoding cache.
    /// </summary>
    public required FolderStorageDto TranscodingTempFolder { get; set; }

    /// <summary>
    /// Gets or sets the storage informations of all libraries.
    /// </summary>
    public required IReadOnlyCollection<LibraryStorageDto> Libraries { get; set; }

    internal static SystemStorageDto FromSystemStorageInfo(SystemStorageInfo model)
    {
        return new SystemStorageDto()
        {
            ProgramDataFolder = FolderStorageDto.FromFolderStorageInfo(model.ProgramDataFolder),
            WebFolder = FolderStorageDto.FromFolderStorageInfo(model.WebFolder),
            ImageCacheFolder = FolderStorageDto.FromFolderStorageInfo(model.ImageCacheFolder),
            CacheFolder = FolderStorageDto.FromFolderStorageInfo(model.CacheFolder),
            LogFolder = FolderStorageDto.FromFolderStorageInfo(model.LogFolder),
            InternalMetadataFolder = FolderStorageDto.FromFolderStorageInfo(model.InternalMetadataFolder),
            TranscodingTempFolder = FolderStorageDto.FromFolderStorageInfo(model.TranscodingTempFolder),
            Libraries = model.Libraries.Select(LibraryStorageDto.FromLibraryStorageModel).ToArray()
        };
    }
}