mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-05 07:18:47 +01:00
stub out storage for new path substitution
This commit is contained in:
@@ -262,7 +262,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
Protocol = locationType == LocationType.Remote ? MediaProtocol.Http : MediaProtocol.File,
|
||||
MediaStreams = MediaSourceManager.GetMediaStreams(i.Id).ToList(),
|
||||
Name = i.Name,
|
||||
Path = enablePathSubstituion ? GetMappedPath(i.Path, locationType) : i.Path,
|
||||
Path = enablePathSubstituion ? GetMappedPath(i, i.Path, locationType) : i.Path,
|
||||
RunTimeTicks = i.RunTimeTicks,
|
||||
Container = i.Container,
|
||||
Size = i.Size
|
||||
|
||||
@@ -2121,11 +2121,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
return hasChanges;
|
||||
}
|
||||
|
||||
protected static string GetMappedPath(string path, LocationType locationType)
|
||||
protected static string GetMappedPath(BaseItem item, string path, LocationType locationType)
|
||||
{
|
||||
if (locationType == LocationType.FileSystem || locationType == LocationType.Offline)
|
||||
{
|
||||
return LibraryManager.GetPathAfterNetworkSubstitution(path);
|
||||
return LibraryManager.GetPathAfterNetworkSubstitution(path, item);
|
||||
}
|
||||
|
||||
return path;
|
||||
|
||||
@@ -48,24 +48,14 @@ namespace MediaBrowser.Controller.Entities
|
||||
private static readonly Dictionary<string, LibraryOptions> LibraryOptions = new Dictionary<string, LibraryOptions>();
|
||||
public LibraryOptions GetLibraryOptions()
|
||||
{
|
||||
lock (LibraryOptions)
|
||||
{
|
||||
LibraryOptions options;
|
||||
if (!LibraryOptions.TryGetValue(Path, out options))
|
||||
{
|
||||
options = LoadLibraryOptions();
|
||||
LibraryOptions[Path] = options;
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
return GetLibraryOptions(Path);
|
||||
}
|
||||
|
||||
private LibraryOptions LoadLibraryOptions()
|
||||
private static LibraryOptions LoadLibraryOptions(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = XmlSerializer.DeserializeFromFile(typeof(LibraryOptions), GetLibraryOptionsPath(Path)) as LibraryOptions;
|
||||
var result = XmlSerializer.DeserializeFromFile(typeof(LibraryOptions), GetLibraryOptionsPath(path)) as LibraryOptions;
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
@@ -100,6 +90,21 @@ namespace MediaBrowser.Controller.Entities
|
||||
SaveLibraryOptions(Path, options);
|
||||
}
|
||||
|
||||
public static LibraryOptions GetLibraryOptions(string path)
|
||||
{
|
||||
lock (LibraryOptions)
|
||||
{
|
||||
LibraryOptions options;
|
||||
if (!LibraryOptions.TryGetValue(path, out options))
|
||||
{
|
||||
options = LoadLibraryOptions(path);
|
||||
LibraryOptions[path] = options;
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveLibraryOptions(string path, LibraryOptions options)
|
||||
{
|
||||
lock (LibraryOptions)
|
||||
|
||||
@@ -600,7 +600,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
Protocol = locationType == LocationType.Remote ? MediaProtocol.Http : MediaProtocol.File,
|
||||
MediaStreams = mediaStreams,
|
||||
Name = GetMediaSourceName(i, mediaStreams),
|
||||
Path = enablePathSubstitution ? GetMappedPath(i.Path, locationType) : i.Path,
|
||||
Path = enablePathSubstitution ? GetMappedPath(i, i.Path, locationType) : i.Path,
|
||||
RunTimeTicks = i.RunTimeTicks,
|
||||
Video3DFormat = i.Video3DFormat,
|
||||
VideoType = i.VideoType,
|
||||
|
||||
@@ -506,7 +506,7 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <returns>QueryResult<BaseItem>.</returns>
|
||||
QueryResult<BaseItem> QueryItems(InternalItemsQuery query);
|
||||
|
||||
string GetPathAfterNetworkSubstitution(string path);
|
||||
string GetPathAfterNetworkSubstitution(string path, BaseItem ownerItem = null);
|
||||
|
||||
/// <summary>
|
||||
/// Substitutes the path.
|
||||
@@ -556,9 +556,9 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
bool IgnoreFile(FileSystemMetadata file, BaseItem parent);
|
||||
|
||||
void AddVirtualFolder(string name, string collectionType, string[] mediaPaths, LibraryOptions options, bool refreshLibrary);
|
||||
void AddVirtualFolder(string name, string collectionType, LibraryOptions options, bool refreshLibrary);
|
||||
void RemoveVirtualFolder(string name, bool refreshLibrary);
|
||||
void AddMediaPath(string virtualFolderName, string path);
|
||||
void AddMediaPath(string virtualFolderName, MediaPathInfo path);
|
||||
void RemoveMediaPath(string virtualFolderName, string path);
|
||||
|
||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetGenres(InternalItemsQuery query);
|
||||
|
||||
Reference in New Issue
Block a user