mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
commit
fb31918f9c
@ -499,6 +499,24 @@ namespace Emby.Common.Implementations.IO
|
|||||||
CopyFile(temp1, file2, true);
|
CopyFile(temp1, file2, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool AreEqual(string path1, string path2)
|
||||||
|
{
|
||||||
|
if (path1 == null && path2 == null)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path1 == null || path2 == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
path1 = path1.TrimEnd(DirectorySeparatorChar);
|
||||||
|
path2 = path2.TrimEnd(DirectorySeparatorChar);
|
||||||
|
|
||||||
|
return string.Equals(path1, path2, StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
public bool ContainsSubPath(string parentPath, string path)
|
public bool ContainsSubPath(string parentPath, string path)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(parentPath))
|
if (string.IsNullOrEmpty(parentPath))
|
||||||
|
@ -87,7 +87,7 @@ namespace Emby.Server.Core.IO
|
|||||||
public bool IsPathLocked(string path)
|
public bool IsPathLocked(string path)
|
||||||
{
|
{
|
||||||
var lockedPaths = _tempIgnoredPaths.Keys.ToList();
|
var lockedPaths = _tempIgnoredPaths.Keys.ToList();
|
||||||
return lockedPaths.Any(i => string.Equals(i, path, StringComparison.OrdinalIgnoreCase) || _fileSystem.ContainsSubPath(i, path));
|
return lockedPaths.Any(i => _fileSystem.AreEqual(i, path) || _fileSystem.ContainsSubPath(i, path));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void ReportFileSystemChangeComplete(string path, bool refreshPath)
|
public async void ReportFileSystemChangeComplete(string path, bool refreshPath)
|
||||||
|
@ -925,7 +925,11 @@ namespace Emby.Server.Implementations.Connect
|
|||||||
}
|
}
|
||||||
|
|
||||||
_data.PendingAuthorizations = newPendingList;
|
_data.PendingAuthorizations = newPendingList;
|
||||||
|
|
||||||
|
if (!newPendingList.Select(i => i.Id).SequenceEqual(currentPendingList.Select(i => i.Id), StringComparer.Ordinal))
|
||||||
|
{
|
||||||
CacheData();
|
CacheData();
|
||||||
|
}
|
||||||
|
|
||||||
await RefreshGuestNames(list, refreshImages).ConfigureAwait(false);
|
await RefreshGuestNames(list, refreshImages).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
@ -137,6 +137,11 @@ namespace Emby.Server.Implementations.Data
|
|||||||
var numComplete = 0;
|
var numComplete = 0;
|
||||||
var numItems = result.Count;
|
var numItems = result.Count;
|
||||||
|
|
||||||
|
var allLibraryPaths = _libraryManager
|
||||||
|
.GetVirtualFolders()
|
||||||
|
.SelectMany(i => i.Locations)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
foreach (var item in result)
|
foreach (var item in result)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
@ -170,9 +175,8 @@ namespace Emby.Server.Implementations.Data
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Folder.IsPathOffline(path))
|
if (Folder.IsPathOffline(path, allLibraryPaths))
|
||||||
{
|
{
|
||||||
await libraryItem.UpdateIsOffline(true).ConfigureAwait(false);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,10 +361,7 @@ namespace Emby.Server.Implementations.Dto
|
|||||||
if (collectionFolder != null)
|
if (collectionFolder != null)
|
||||||
{
|
{
|
||||||
dto.OriginalCollectionType = collectionFolder.CollectionType;
|
dto.OriginalCollectionType = collectionFolder.CollectionType;
|
||||||
|
dto.CollectionType = collectionFolder.CollectionType;
|
||||||
dto.CollectionType = user == null ?
|
|
||||||
collectionFolder.CollectionType :
|
|
||||||
collectionFolder.GetViewType(user);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fields.Contains(ItemFields.CanDelete))
|
if (fields.Contains(ItemFields.CanDelete))
|
||||||
|
@ -2010,7 +2010,7 @@ namespace Emby.Server.Implementations.Library
|
|||||||
|
|
||||||
private string GetContentTypeOverride(string path, bool inherit)
|
private string GetContentTypeOverride(string path, bool inherit)
|
||||||
{
|
{
|
||||||
var nameValuePair = ConfigurationManager.Configuration.ContentTypes.FirstOrDefault(i => string.Equals(i.Name, path, StringComparison.OrdinalIgnoreCase) || (inherit && !string.IsNullOrWhiteSpace(i.Name) && _fileSystem.ContainsSubPath(i.Name, path)));
|
var nameValuePair = ConfigurationManager.Configuration.ContentTypes.FirstOrDefault(i => _fileSystem.AreEqual(i.Name, path) || (inherit && !string.IsNullOrWhiteSpace(i.Name) && _fileSystem.ContainsSubPath(i.Name, path)));
|
||||||
if (nameValuePair != null)
|
if (nameValuePair != null)
|
||||||
{
|
{
|
||||||
return nameValuePair.Value;
|
return nameValuePair.Value;
|
||||||
@ -3066,7 +3066,7 @@ namespace Emby.Server.Implementations.Library
|
|||||||
{
|
{
|
||||||
removeList.Add(contentType);
|
removeList.Add(contentType);
|
||||||
}
|
}
|
||||||
else if (string.Equals(path, contentType.Name, StringComparison.OrdinalIgnoreCase)
|
else if (_fileSystem.AreEqual(path, contentType.Name)
|
||||||
|| _fileSystem.ContainsSubPath(path, contentType.Name))
|
|| _fileSystem.ContainsSubPath(path, contentType.Name))
|
||||||
{
|
{
|
||||||
removeList.Add(contentType);
|
removeList.Add(contentType);
|
||||||
|
@ -55,8 +55,6 @@ namespace Emby.Server.Implementations.Library
|
|||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
var plainFolderIds = user.Configuration.PlainFolderViews.Select(i => new Guid(i)).ToList();
|
|
||||||
|
|
||||||
var groupedFolders = new List<ICollectionFolder>();
|
var groupedFolders = new List<ICollectionFolder>();
|
||||||
|
|
||||||
var list = new List<Folder>();
|
var list = new List<Folder>();
|
||||||
@ -72,12 +70,6 @@ namespace Emby.Server.Implementations.Library
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plainFolderIds.Contains(folder.Id) && UserView.IsEligibleForEnhancedView(folderViewType))
|
|
||||||
{
|
|
||||||
list.Add(folder);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (collectionFolder != null && UserView.IsEligibleForGrouping(folder) && user.IsFolderGrouped(folder.Id))
|
if (collectionFolder != null && UserView.IsEligibleForGrouping(folder) && user.IsFolderGrouped(folder.Id))
|
||||||
{
|
{
|
||||||
groupedFolders.Add(collectionFolder);
|
groupedFolders.Add(collectionFolder);
|
||||||
|
@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
foreach (var recordingFolder in recordingFolders)
|
foreach (var recordingFolder in recordingFolders)
|
||||||
{
|
{
|
||||||
var pathsToCreate = recordingFolder.Locations
|
var pathsToCreate = recordingFolder.Locations
|
||||||
.Where(i => !allExistingPaths.Contains(i, StringComparer.OrdinalIgnoreCase))
|
.Where(i => !allExistingPaths.Any(p => _fileSystem.AreEqual(p, i)))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (pathsToCreate.Count == 0)
|
if (pathsToCreate.Count == 0)
|
||||||
|
@ -151,7 +151,9 @@ namespace Emby.Server.Implementations.UserViews
|
|||||||
string[] collectionStripViewTypes =
|
string[] collectionStripViewTypes =
|
||||||
{
|
{
|
||||||
CollectionType.Movies,
|
CollectionType.Movies,
|
||||||
CollectionType.TvShows
|
CollectionType.TvShows,
|
||||||
|
CollectionType.Playlists,
|
||||||
|
CollectionType.Photos
|
||||||
};
|
};
|
||||||
|
|
||||||
return collectionStripViewTypes.Contains(view.ViewType ?? string.Empty);
|
return collectionStripViewTypes.Contains(view.ViewType ?? string.Empty);
|
||||||
|
@ -272,9 +272,6 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public virtual string Path { get; set; }
|
public virtual string Path { get; set; }
|
||||||
|
|
||||||
[IgnoreDataMember]
|
|
||||||
public bool IsOffline { get; set; }
|
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public virtual SourceType SourceType { get; set; }
|
public virtual SourceType SourceType { get; set; }
|
||||||
|
|
||||||
@ -339,20 +336,6 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task UpdateIsOffline(bool newValue)
|
|
||||||
{
|
|
||||||
var item = this;
|
|
||||||
|
|
||||||
if (item.IsOffline != newValue)
|
|
||||||
{
|
|
||||||
item.IsOffline = newValue;
|
|
||||||
// this is creating too many repeated db updates
|
|
||||||
//return item.UpdateToRepository(ItemUpdateType.None, CancellationToken.None);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Task.FromResult(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the type of the location.
|
/// Gets or sets the type of the location.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -369,6 +369,11 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
var validChildren = new List<BaseItem>();
|
var validChildren = new List<BaseItem>();
|
||||||
|
|
||||||
|
var allLibraryPaths = LibraryManager
|
||||||
|
.GetVirtualFolders()
|
||||||
|
.SelectMany(i => i.Locations)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
if (locationType != LocationType.Remote && locationType != LocationType.Virtual)
|
if (locationType != LocationType.Remote && locationType != LocationType.Virtual)
|
||||||
{
|
{
|
||||||
IEnumerable<BaseItem> nonCachedChildren;
|
IEnumerable<BaseItem> nonCachedChildren;
|
||||||
@ -402,7 +407,6 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
if (currentChildren.TryGetValue(child.Id, out currentChild) && IsValidFromResolver(currentChild, child))
|
if (currentChildren.TryGetValue(child.Id, out currentChild) && IsValidFromResolver(currentChild, child))
|
||||||
{
|
{
|
||||||
await currentChild.UpdateIsOffline(false).ConfigureAwait(false);
|
|
||||||
validChildren.Add(currentChild);
|
validChildren.Add(currentChild);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@ -429,9 +433,8 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!string.IsNullOrEmpty(item.Path) && IsPathOffline(item.Path))
|
else if (!string.IsNullOrEmpty(item.Path) && IsPathOffline(item.Path, allLibraryPaths))
|
||||||
{
|
{
|
||||||
await item.UpdateIsOffline(true).ConfigureAwait(false);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -446,7 +449,6 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
Logger.Debug("Removed item: " + item.Path);
|
Logger.Debug("Removed item: " + item.Path);
|
||||||
|
|
||||||
item.SetParent(null);
|
item.SetParent(null);
|
||||||
item.IsOffline = false;
|
|
||||||
await LibraryManager.DeleteItem(item, new DeleteOptions { DeleteFileLocation = false }).ConfigureAwait(false);
|
await LibraryManager.DeleteItem(item, new DeleteOptions { DeleteFileLocation = false }).ConfigureAwait(false);
|
||||||
LibraryManager.ReportItemRemoved(item);
|
LibraryManager.ReportItemRemoved(item);
|
||||||
}
|
}
|
||||||
@ -611,6 +613,11 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
/// <returns><c>true</c> if the specified path is offline; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if the specified path is offline; otherwise, <c>false</c>.</returns>
|
||||||
public static bool IsPathOffline(string path)
|
public static bool IsPathOffline(string path)
|
||||||
|
{
|
||||||
|
return IsPathOffline(path, LibraryManager.GetVirtualFolders().SelectMany(i => i.Locations).ToList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsPathOffline(string path, List<string> allLibraryPaths)
|
||||||
{
|
{
|
||||||
if (FileSystem.FileExists(path))
|
if (FileSystem.FileExists(path))
|
||||||
{
|
{
|
||||||
@ -627,31 +634,20 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
path = System.IO.Path.GetDirectoryName(path);
|
if (allLibraryPaths.Contains(path, StringComparer.OrdinalIgnoreCase))
|
||||||
}
|
|
||||||
|
|
||||||
if (ContainsPath(LibraryManager.GetVirtualFolders(), originalPath))
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
path = System.IO.Path.GetDirectoryName(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
return allLibraryPaths.Any(i => ContainsPath(i, originalPath));
|
||||||
/// Determines whether the specified folders contains path.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="folders">The folders.</param>
|
|
||||||
/// <param name="path">The path.</param>
|
|
||||||
/// <returns><c>true</c> if the specified folders contains path; otherwise, <c>false</c>.</returns>
|
|
||||||
private static bool ContainsPath(IEnumerable<VirtualFolderInfo> folders, string path)
|
|
||||||
{
|
|
||||||
return folders.SelectMany(i => i.Locations).Any(i => ContainsPath(i, path));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool ContainsPath(string parent, string path)
|
private static bool ContainsPath(string parent, string path)
|
||||||
{
|
{
|
||||||
return string.Equals(parent, path, StringComparison.OrdinalIgnoreCase) || FileSystem.ContainsSubPath(parent, path);
|
return FileSystem.AreEqual(parent, path) || FileSystem.ContainsSubPath(parent, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -20,17 +20,4 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
bool EnableUserSpecificView { get; }
|
bool EnableUserSpecificView { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CollectionFolderExtensions
|
|
||||||
{
|
|
||||||
public static string GetViewType(this ICollectionFolder folder, User user)
|
|
||||||
{
|
|
||||||
if (user.Configuration.PlainFolderViews.Contains(folder.Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return folder.CollectionType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@ namespace MediaBrowser.Model.Configuration
|
|||||||
public string[] OrderedViews { get; set; }
|
public string[] OrderedViews { get; set; }
|
||||||
|
|
||||||
public string[] LatestItemsExcludes { get; set; }
|
public string[] LatestItemsExcludes { get; set; }
|
||||||
public string[] PlainFolderViews { get; set; }
|
|
||||||
|
|
||||||
public bool HidePlayedInLatest { get; set; }
|
public bool HidePlayedInLatest { get; set; }
|
||||||
|
|
||||||
@ -61,8 +60,6 @@ namespace MediaBrowser.Model.Configuration
|
|||||||
LatestItemsExcludes = new string[] { };
|
LatestItemsExcludes = new string[] { };
|
||||||
OrderedViews = new string[] { };
|
OrderedViews = new string[] { };
|
||||||
|
|
||||||
PlainFolderViews = new string[] { };
|
|
||||||
|
|
||||||
GroupedFolders = new string[] { };
|
GroupedFolders = new string[] { };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,6 +120,8 @@ namespace MediaBrowser.Model.IO
|
|||||||
/// <param name="file2">The file2.</param>
|
/// <param name="file2">The file2.</param>
|
||||||
void SwapFiles(string file1, string file2);
|
void SwapFiles(string file1, string file2);
|
||||||
|
|
||||||
|
bool AreEqual(string path1, string path2);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines whether [contains sub path] [the specified parent path].
|
/// Determines whether [contains sub path] [the specified parent path].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -846,7 +846,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||||||
|
|
||||||
AddUserData(item, writer, userManager, userDataRepo, options);
|
AddUserData(item, writer, userManager, userDataRepo, options);
|
||||||
|
|
||||||
AddActors(people, writer, libraryManager, fileSystem, config);
|
AddActors(people, writer, libraryManager, fileSystem, config, options.SaveImagePathsInNfo);
|
||||||
|
|
||||||
var folder = item as BoxSet;
|
var folder = item as BoxSet;
|
||||||
if (folder != null)
|
if (folder != null)
|
||||||
@ -974,7 +974,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AddActors(List<PersonInfo> people, XmlWriter writer, ILibraryManager libraryManager, IFileSystem fileSystem, IServerConfigurationManager config)
|
private static void AddActors(List<PersonInfo> people, XmlWriter writer, ILibraryManager libraryManager, IFileSystem fileSystem, IServerConfigurationManager config, bool saveImagePath)
|
||||||
{
|
{
|
||||||
var actors = people
|
var actors = people
|
||||||
.Where(i => !IsPersonType(i, PersonType.Director) && !IsPersonType(i, PersonType.Writer))
|
.Where(i => !IsPersonType(i, PersonType.Director) && !IsPersonType(i, PersonType.Writer))
|
||||||
@ -1004,6 +1004,8 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||||||
writer.WriteElementString("sortorder", person.SortOrder.Value.ToString(UsCulture));
|
writer.WriteElementString("sortorder", person.SortOrder.Value.ToString(UsCulture));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (saveImagePath)
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var personEntity = libraryManager.GetPerson(person.Name);
|
var personEntity = libraryManager.GetPerson(person.Name);
|
||||||
@ -1018,6 +1020,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||||||
{
|
{
|
||||||
// Already logged in core
|
// Already logged in core
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user