fix merge conflits

pull/702/head
Luke Pulverenti 9 years ago
parent aeb4c520be
commit 155c519080

@ -28,6 +28,7 @@ namespace MediaBrowser.Controller.Entities
public List<Guid> ThemeSongIds { get; set; }
public List<Guid> ThemeVideoIds { get; set; }
public List<string> Tags { get; set; }
public Folder()
{
@ -35,6 +36,7 @@ namespace MediaBrowser.Controller.Entities
ThemeSongIds = new List<Guid>();
ThemeVideoIds = new List<Guid>();
Tags = new List<string>();
}
[IgnoreDataMember]
@ -149,15 +151,7 @@ namespace MediaBrowser.Controller.Entities
await LibraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
if (!EnableNewFolderQuerying())
{
await ItemRepository.SaveChildren(Id, ActualChildren.Select(i => i.Id).ToList(), cancellationToken).ConfigureAwait(false);
}
}
private static bool EnableNewFolderQuerying()
{
return ConfigurationManager.Configuration.MigrationVersion >= 1;
await ItemRepository.SaveChildren(Id, ActualChildren.Select(i => i.Id).ToList(), cancellationToken).ConfigureAwait(false);
}
protected void AddChildrenInternal(IEnumerable<BaseItem> children)
@ -202,6 +196,21 @@ namespace MediaBrowser.Controller.Entities
}
}
[IgnoreDataMember]
public override string OfficialRatingForComparison
{
get
{
// Never want folders to be blocked by "BlockNotRated"
if (this is Series)
{
return base.OfficialRatingForComparison;
}
return !string.IsNullOrWhiteSpace(base.OfficialRatingForComparison) ? base.OfficialRatingForComparison : "None";
}
}
/// <summary>
/// Removes the child.
/// </summary>
@ -215,12 +224,7 @@ namespace MediaBrowser.Controller.Entities
item.SetParent(null);
if (!EnableNewFolderQuerying())
{
return ItemRepository.SaveChildren(Id, ActualChildren.Select(i => i.Id).ToList(), cancellationToken);
}
return Task.FromResult(true);
return ItemRepository.SaveChildren(Id, ActualChildren.Select(i => i.Id).ToList(), cancellationToken);
}
/// <summary>
@ -453,25 +457,32 @@ namespace MediaBrowser.Controller.Entities
{
BaseItem currentChild;
if (currentChildren.TryGetValue(child.Id, out currentChild) && IsValidFromResolver(currentChild, child))
if (currentChildren.TryGetValue(child.Id, out currentChild))
{
var currentChildLocationType = currentChild.LocationType;
if (currentChildLocationType != LocationType.Remote &&
currentChildLocationType != LocationType.Virtual)
if (IsValidFromResolver(currentChild, child))
{
currentChild.DateModified = child.DateModified;
}
await UpdateIsOffline(currentChild, false).ConfigureAwait(false);
validChildren.Add(currentChild);
var currentChildLocationType = currentChild.LocationType;
if (currentChildLocationType != LocationType.Remote &&
currentChildLocationType != LocationType.Virtual)
{
currentChild.DateModified = child.DateModified;
}
continue;
await UpdateIsOffline(currentChild, false).ConfigureAwait(false);
validChildren.Add(currentChild);
}
else
{
newItems.Add(child);
validChildren.Add(child);
}
}
else
{
// Brand new item - needs to be added
newItems.Add(child);
validChildren.Add(child);
}
// Brand new item - needs to be added
child.SetParent(this);
newItems.Add(child);
validChildren.Add(child);
}
// If any items were added or removed....
@ -497,6 +508,7 @@ namespace MediaBrowser.Controller.Entities
}
else
{
await UpdateIsOffline(item, false).ConfigureAwait(false);
actualRemovals.Add(item);
}
}
@ -507,11 +519,6 @@ namespace MediaBrowser.Controller.Entities
foreach (var item in actualRemovals)
{
Logger.Debug("Removed item: " + item.Path);
item.SetParent(null);
item.IsOffline = false;
await LibraryManager.DeleteItem(item, new DeleteOptions { DeleteFileLocation = false }).ConfigureAwait(false);
LibraryManager.ReportItemRemoved(item);
}
}
@ -520,10 +527,7 @@ namespace MediaBrowser.Controller.Entities
AddChildrenInternal(newItems);
if (!EnableNewFolderQuerying())
{
await ItemRepository.SaveChildren(Id, ActualChildren.Select(i => i.Id).ToList(), cancellationToken).ConfigureAwait(false);
}
await ItemRepository.SaveChildren(Id, ActualChildren.Select(i => i.Id).ToList(), cancellationToken).ConfigureAwait(false);
}
}
@ -717,7 +721,7 @@ namespace MediaBrowser.Controller.Entities
return true;
}
return false;
return ContainsPath(LibraryManager.GetVirtualFolders(), originalPath);
}
/// <summary>
@ -753,16 +757,19 @@ namespace MediaBrowser.Controller.Entities
/// <returns>IEnumerable{BaseItem}.</returns>
protected IEnumerable<BaseItem> GetCachedChildren()
{
if (EnableNewFolderQuerying())
if (ConfigurationManager.Configuration.DisableStartupScan)
{
return ItemRepository.GetItemList(new InternalItemsQuery
{
ParentId = Id
return ItemRepository.GetChildrenItems(Id).Select(RetrieveChild).Where(i => i != null);
//return ItemRepository.GetItems(new InternalItemsQuery
//{
// ParentId = Id
}).Select(RetrieveChild).Where(i => i != null);
//}).Items.Select(RetrieveChild).Where(i => i != null);
}
else
{
return ItemRepository.GetChildrenItems(Id).Select(RetrieveChild).Where(i => i != null);
}
return ItemRepository.GetChildrenItems(Id).Select(RetrieveChild).Where(i => i != null);
}
private BaseItem RetrieveChild(BaseItem child)
@ -825,7 +832,19 @@ namespace MediaBrowser.Controller.Entities
return UserViewBuilder.PostFilterAndSort(items, this, null, query, LibraryManager);
}
/// <summary>
/// Gets allowed children of an item
/// </summary>
/// <param name="user">The user.</param>
/// <param name="includeLinkedChildren">if set to <c>true</c> [include linked children].</param>
/// <returns>IEnumerable{BaseItem}.</returns>
/// <exception cref="System.ArgumentNullException"></exception>
public virtual IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)
{
return GetChildren(user, includeLinkedChildren, false);
}
internal IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren, bool includeHidden)
{
if (user == null)
{
@ -837,7 +856,7 @@ namespace MediaBrowser.Controller.Entities
var result = new Dictionary<Guid, BaseItem>();
AddChildren(user, includeLinkedChildren, result, false, null);
AddChildren(user, includeLinkedChildren, result, includeHidden, false, null);
return result.Values;
}
@ -853,25 +872,29 @@ namespace MediaBrowser.Controller.Entities
/// <param name="user">The user.</param>
/// <param name="includeLinkedChildren">if set to <c>true</c> [include linked children].</param>
/// <param name="result">The result.</param>
/// <param name="includeHidden">if set to <c>true</c> [include hidden].</param>
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
/// <param name="filter">The filter.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
private void AddChildren(User user, bool includeLinkedChildren, Dictionary<Guid, BaseItem> result, bool recursive, Func<BaseItem, bool> filter)
private void AddChildren(User user, bool includeLinkedChildren, Dictionary<Guid, BaseItem> result, bool includeHidden, bool recursive, Func<BaseItem, bool> filter)
{
foreach (var child in GetEligibleChildrenForRecursiveChildren(user))
{
if (child.IsVisible(user))
{
if (filter == null || filter(child))
if (includeHidden || !child.IsHiddenFromUser(user))
{
result[child.Id] = child;
if (filter == null || filter(child))
{
result[child.Id] = child;
}
}
if (recursive && child.IsFolder)
{
var folder = (Folder)child;
folder.AddChildren(user, includeLinkedChildren, result, true, filter);
folder.AddChildren(user, includeLinkedChildren, result, includeHidden, true, filter);
}
}
}
@ -912,7 +935,7 @@ namespace MediaBrowser.Controller.Entities
var result = new Dictionary<Guid, BaseItem>();
AddChildren(user, true, result, true, filter);
AddChildren(user, true, result, false, true, filter);
return result.Values;
}
@ -1161,7 +1184,6 @@ namespace MediaBrowser.Controller.Entities
Recursive = true,
IsFolder = false,
IsUnaired = false
};
if (!user.Configuration.DisplayMissingEpisodes)

@ -251,7 +251,8 @@ namespace MediaBrowser.Dlna
case HeaderMatchType.Substring:
return value.IndexOf(header.Value, StringComparison.OrdinalIgnoreCase) != -1;
case HeaderMatchType.Regex:
return Regex.IsMatch(value, header.Value, RegexOptions.IgnoreCase);
// Reports of IgnoreCase not working on linux so try it a couple different ways.
return Regex.IsMatch(value, header.Value, RegexOptions.IgnoreCase) || Regex.IsMatch(value.ToUpper(), header.Value.ToUpper(), RegexOptions.IgnoreCase);
default:
throw new ArgumentException("Unrecognized HeaderMatchType");
}
@ -280,7 +281,7 @@ namespace MediaBrowser.Dlna
{
try
{
return _fileSystem.GetFiles(path)
return _fileSystem.GetFiles(path)
.Where(i => string.Equals(i.Extension, ".xml", StringComparison.OrdinalIgnoreCase))
.Select(i => ParseProfileXmlFile(i.FullName, type))
.Where(i => i != null)
@ -318,7 +319,7 @@ namespace MediaBrowser.Dlna
throw new ArgumentNullException("id");
}
var info = GetProfileInfosInternal().First(i => string.Equals(i.Info.Id, id));
var info = GetProfileInfosInternal().First(i => string.Equals(i.Info.Id, id, StringComparison.OrdinalIgnoreCase));
return ParseProfileXmlFile(info.Path, info.Info.Type);
}
@ -342,7 +343,7 @@ namespace MediaBrowser.Dlna
{
try
{
return _fileSystem.GetFiles(path)
return _fileSystem.GetFiles(path)
.Where(i => string.Equals(i.Extension, ".xml", StringComparison.OrdinalIgnoreCase))
.Select(i => new InternalProfileInfo
{
@ -384,7 +385,7 @@ namespace MediaBrowser.Dlna
if (!fileInfo.Exists || fileInfo.Length != stream.Length)
{
_fileSystem.CreateDirectory(systemProfilesPath);
_fileSystem.CreateDirectory(systemProfilesPath);
using (var fileStream = _fileSystem.GetFileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read))
{
@ -395,12 +396,12 @@ namespace MediaBrowser.Dlna
}
// Not necessary, but just to make it easy to find
_fileSystem.CreateDirectory(UserProfilesPath);
_fileSystem.CreateDirectory(UserProfilesPath);
}
public void DeleteProfile(string id)
{
var info = GetProfileInfosInternal().First(i => string.Equals(id, i.Info.Id));
var info = GetProfileInfosInternal().First(i => string.Equals(id, i.Info.Id, StringComparison.OrdinalIgnoreCase));
if (info.Info.Type == DeviceProfileType.System)
{
@ -448,7 +449,7 @@ namespace MediaBrowser.Dlna
{
_fileSystem.DeleteFile(current.Path);
}
_xmlSerializer.SerializeToFile(profile, path);
}

Loading…
Cancel
Save