revise shortcut support
This commit is contained in:
parent
d1fd921280
commit
54dd38b2bd
|
@ -35,6 +35,15 @@ namespace MediaBrowser.Controller.Entities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
protected override bool SupportsShortcutChildren
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override bool CanDelete()
|
public override bool CanDelete()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using MediaBrowser.Common.Progress;
|
using MediaBrowser.Common.Progress;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Localization;
|
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
@ -14,7 +13,6 @@ using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Model.Users;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Entities
|
namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
|
@ -50,7 +48,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public virtual bool IsPreSorted
|
public virtual bool IsPreSorted
|
||||||
{
|
{
|
||||||
get { return false; }
|
get { return ConfigurationManager.Configuration.EnableWindowsShortcuts; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -122,7 +120,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
protected virtual bool SupportsShortcutChildren
|
protected virtual bool SupportsShortcutChildren
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -176,7 +174,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
protected void AddChildInternal(BaseItem child)
|
protected void AddChildInternal(BaseItem child)
|
||||||
{
|
{
|
||||||
var actualChildren = ActualChildren;
|
var actualChildren = ActualChildren;
|
||||||
|
|
||||||
lock (_childrenSyncLock)
|
lock (_childrenSyncLock)
|
||||||
{
|
{
|
||||||
var newChildren = actualChildren.ToList();
|
var newChildren = actualChildren.ToList();
|
||||||
|
@ -1070,7 +1068,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
var changesFound = false;
|
var changesFound = false;
|
||||||
|
|
||||||
if (SupportsShortcutChildren && LocationType == LocationType.FileSystem)
|
if (LocationType == LocationType.FileSystem)
|
||||||
{
|
{
|
||||||
if (RefreshLinkedChildren(fileSystemChildren))
|
if (RefreshLinkedChildren(fileSystemChildren))
|
||||||
{
|
{
|
||||||
|
@ -1092,37 +1090,43 @@ namespace MediaBrowser.Controller.Entities
|
||||||
var currentManualLinks = LinkedChildren.Where(i => i.Type == LinkedChildType.Manual).ToList();
|
var currentManualLinks = LinkedChildren.Where(i => i.Type == LinkedChildType.Manual).ToList();
|
||||||
var currentShortcutLinks = LinkedChildren.Where(i => i.Type == LinkedChildType.Shortcut).ToList();
|
var currentShortcutLinks = LinkedChildren.Where(i => i.Type == LinkedChildType.Shortcut).ToList();
|
||||||
|
|
||||||
var newShortcutLinks = fileSystemChildren
|
List<LinkedChild> newShortcutLinks;
|
||||||
.Where(i => (i.Attributes & FileAttributes.Directory) != FileAttributes.Directory && FileSystem.IsShortcut(i.FullName))
|
|
||||||
.Select(i =>
|
if (SupportsShortcutChildren)
|
||||||
{
|
{
|
||||||
try
|
newShortcutLinks = fileSystemChildren
|
||||||
|
.Where(i => (i.Attributes & FileAttributes.Directory) != FileAttributes.Directory && FileSystem.IsShortcut(i.FullName))
|
||||||
|
.Select(i =>
|
||||||
{
|
{
|
||||||
Logger.Debug("Found shortcut at {0}", i.FullName);
|
try
|
||||||
|
|
||||||
var resolvedPath = FileSystem.ResolveShortcut(i.FullName);
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(resolvedPath))
|
|
||||||
{
|
{
|
||||||
return new LinkedChild
|
Logger.Debug("Found shortcut at {0}", i.FullName);
|
||||||
|
|
||||||
|
var resolvedPath = FileSystem.ResolveShortcut(i.FullName);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(resolvedPath))
|
||||||
{
|
{
|
||||||
Path = resolvedPath,
|
return new LinkedChild
|
||||||
Type = LinkedChildType.Shortcut
|
{
|
||||||
};
|
Path = resolvedPath,
|
||||||
|
Type = LinkedChildType.Shortcut
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.Error("Error resolving shortcut {0}", i.FullName);
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
catch (IOException ex)
|
||||||
Logger.Error("Error resolving shortcut {0}", i.FullName);
|
{
|
||||||
|
Logger.ErrorException("Error resolving shortcut {0}", ex, i.FullName);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
})
|
||||||
{
|
.Where(i => i != null)
|
||||||
Logger.ErrorException("Error resolving shortcut {0}", ex, i.FullName);
|
.ToList();
|
||||||
return null;
|
}
|
||||||
}
|
else { newShortcutLinks = new List<LinkedChild>(); }
|
||||||
})
|
|
||||||
.Where(i => i != null)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
if (!newShortcutLinks.SequenceEqual(currentShortcutLinks, new LinkedChildComparer()))
|
if (!newShortcutLinks.SequenceEqual(currentShortcutLinks, new LinkedChildComparer()))
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,6 +74,15 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
protected override bool SupportsShortcutChildren
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override bool IsAuthorizedToDelete(User user)
|
public override bool IsAuthorizedToDelete(User user)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Controller.Providers;
|
using System.Runtime.Serialization;
|
||||||
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Library;
|
using MediaBrowser.Model.Library;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
@ -36,6 +37,16 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return PostFilterAndSort(result.Where(filter), query);
|
return PostFilterAndSort(result.Where(filter), query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
protected override bool SupportsShortcutChildren
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
public override bool IsPreSorted
|
public override bool IsPreSorted
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
@ -214,6 +214,7 @@ namespace MediaBrowser.Model.Configuration
|
||||||
public int SharingExpirationDays { get; set; }
|
public int SharingExpirationDays { get; set; }
|
||||||
|
|
||||||
public bool DisableXmlSavers { get; set; }
|
public bool DisableXmlSavers { get; set; }
|
||||||
|
public bool EnableWindowsShortcuts { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
|
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user