| | | 1 | | using System.IO; |
| | | 2 | | using Emby.Server.Implementations.AppBase; |
| | | 3 | | using MediaBrowser.Controller; |
| | | 4 | | |
| | | 5 | | namespace Emby.Server.Implementations |
| | | 6 | | { |
| | | 7 | | /// <summary> |
| | | 8 | | /// Extends BaseApplicationPaths to add paths that are only applicable on the server. |
| | | 9 | | /// </summary> |
| | | 10 | | public class ServerApplicationPaths : BaseApplicationPaths, IServerApplicationPaths |
| | | 11 | | { |
| | | 12 | | /// <summary> |
| | | 13 | | /// Initializes a new instance of the <see cref="ServerApplicationPaths" /> class. |
| | | 14 | | /// </summary> |
| | | 15 | | /// <param name="programDataPath">The path for Jellyfin's data.</param> |
| | | 16 | | /// <param name="logDirectoryPath">The path for Jellyfin's logging directory.</param> |
| | | 17 | | /// <param name="configurationDirectoryPath">The path for Jellyfin's configuration directory.</param> |
| | | 18 | | /// <param name="cacheDirectoryPath">The path for Jellyfin's cache directory.</param> |
| | | 19 | | /// <param name="webDirectoryPath">The path for Jellyfin's web UI.</param> |
| | | 20 | | public ServerApplicationPaths( |
| | | 21 | | string programDataPath, |
| | | 22 | | string logDirectoryPath, |
| | | 23 | | string configurationDirectoryPath, |
| | | 24 | | string cacheDirectoryPath, |
| | | 25 | | string webDirectoryPath) |
| | 21 | 26 | | : base( |
| | 21 | 27 | | programDataPath, |
| | 21 | 28 | | logDirectoryPath, |
| | 21 | 29 | | configurationDirectoryPath, |
| | 21 | 30 | | cacheDirectoryPath, |
| | 21 | 31 | | webDirectoryPath) |
| | | 32 | | { |
| | | 33 | | // ProgramDataPath cannot change when the server is running, so cache these to avoid allocations. |
| | 21 | 34 | | RootFolderPath = Path.Join(ProgramDataPath, "root"); |
| | 21 | 35 | | DefaultUserViewsPath = Path.Combine(RootFolderPath, "default"); |
| | 21 | 36 | | DefaultInternalMetadataPath = Path.Combine(ProgramDataPath, "metadata"); |
| | 21 | 37 | | InternalMetadataPath = DefaultInternalMetadataPath; |
| | 21 | 38 | | } |
| | | 39 | | |
| | | 40 | | /// <summary> |
| | | 41 | | /// Gets the path to the base root media directory. |
| | | 42 | | /// </summary> |
| | | 43 | | /// <value>The root folder path.</value> |
| | | 44 | | public string RootFolderPath { get; } |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// Gets the path to the default user view directory. Used if no specific user view is defined. |
| | | 48 | | /// </summary> |
| | | 49 | | /// <value>The default user views path.</value> |
| | | 50 | | public string DefaultUserViewsPath { get; } |
| | | 51 | | |
| | | 52 | | /// <summary> |
| | | 53 | | /// Gets the path to the People directory. |
| | | 54 | | /// </summary> |
| | | 55 | | /// <value>The people path.</value> |
| | 1 | 56 | | public string PeoplePath => Path.Combine(InternalMetadataPath, "People"); |
| | | 57 | | |
| | | 58 | | /// <inheritdoc /> |
| | 0 | 59 | | public string ArtistsPath => Path.Combine(InternalMetadataPath, "artists"); |
| | | 60 | | |
| | | 61 | | /// <summary> |
| | | 62 | | /// Gets the path to the Genre directory. |
| | | 63 | | /// </summary> |
| | | 64 | | /// <value>The genre path.</value> |
| | 0 | 65 | | public string GenrePath => Path.Combine(InternalMetadataPath, "Genre"); |
| | | 66 | | |
| | | 67 | | /// <summary> |
| | | 68 | | /// Gets the path to the Genre directory. |
| | | 69 | | /// </summary> |
| | | 70 | | /// <value>The genre path.</value> |
| | 0 | 71 | | public string MusicGenrePath => Path.Combine(InternalMetadataPath, "MusicGenre"); |
| | | 72 | | |
| | | 73 | | /// <summary> |
| | | 74 | | /// Gets the path to the Studio directory. |
| | | 75 | | /// </summary> |
| | | 76 | | /// <value>The studio path.</value> |
| | 0 | 77 | | public string StudioPath => Path.Combine(InternalMetadataPath, "Studio"); |
| | | 78 | | |
| | | 79 | | /// <summary> |
| | | 80 | | /// Gets the path to the Year directory. |
| | | 81 | | /// </summary> |
| | | 82 | | /// <value>The year path.</value> |
| | 0 | 83 | | public string YearPath => Path.Combine(InternalMetadataPath, "Year"); |
| | | 84 | | |
| | | 85 | | /// <summary> |
| | | 86 | | /// Gets the path to the user configuration directory. |
| | | 87 | | /// </summary> |
| | | 88 | | /// <value>The user configuration directory path.</value> |
| | 0 | 89 | | public string UserConfigurationDirectoryPath => Path.Combine(ConfigurationDirectoryPath, "users"); |
| | | 90 | | |
| | | 91 | | /// <inheritdoc/> |
| | | 92 | | public string DefaultInternalMetadataPath { get; } |
| | | 93 | | |
| | | 94 | | /// <inheritdoc /> |
| | | 95 | | public string InternalMetadataPath { get; set; } |
| | | 96 | | |
| | | 97 | | /// <inheritdoc /> |
| | 164 | 98 | | public string VirtualInternalMetadataPath => "%MetadataPath%"; |
| | | 99 | | |
| | | 100 | | /// <inheritdoc/> |
| | | 101 | | public override void MakeSanityCheckOrThrow() |
| | | 102 | | { |
| | 0 | 103 | | base.MakeSanityCheckOrThrow(); |
| | 0 | 104 | | CreateAndCheckMarker(RootFolderPath, "root"); |
| | 0 | 105 | | } |
| | | 106 | | } |
| | | 107 | | } |