update nuget

This commit is contained in:
Luke Pulverenti 2017-05-06 01:18:54 -04:00
parent 91cb7e06e9
commit 59f2463efd
7 changed files with 13 additions and 146 deletions

View file

@ -71,10 +71,9 @@ namespace Emby.Server.Implementations.Data
double newPercentCommplete = 45 + .55 * p;
progress.Report(newPercentCommplete);
});
await CleanDeletedItems(cancellationToken, innerProgress).ConfigureAwait(false);
progress.Report(100);
await _itemRepo.UpdateInheritedValues(cancellationToken).ConfigureAwait(false);
progress.Report(100);
}
private async Task CleanDeadItems(CancellationToken cancellationToken, IProgress<double> progress)
@ -115,115 +114,6 @@ namespace Emby.Server.Implementations.Data
progress.Report(100);
}
private async Task CleanDeletedItems(CancellationToken cancellationToken, IProgress<double> progress)
{
var result = _itemRepo.GetItemIdsWithPath(new InternalItemsQuery
{
LocationTypes = new[] { LocationType.FileSystem },
//Limit = limit,
// These have their own cleanup routines
ExcludeItemTypes = new[]
{
typeof(Person).Name,
typeof(Genre).Name,
typeof(MusicGenre).Name,
typeof(GameGenre).Name,
typeof(Studio).Name,
typeof(Year).Name,
typeof(Channel).Name,
typeof(AggregateFolder).Name,
typeof(CollectionFolder).Name
}
});
var numComplete = 0;
var numItems = result.Count;
var allLibraryPaths = _libraryManager
.GetVirtualFolders()
.SelectMany(i => i.Locations)
.ToList();
foreach (var item in result)
{
cancellationToken.ThrowIfCancellationRequested();
var path = item.Item2;
try
{
var isPathInLibrary = false;
if (allLibraryPaths.Any(i => path.StartsWith(i, StringComparison.Ordinal)) ||
allLibraryPaths.Contains(path, StringComparer.Ordinal) ||
path.StartsWith(_appPaths.ProgramDataPath, StringComparison.Ordinal))
{
isPathInLibrary = true;
if (_fileSystem.FileExists(path) || _fileSystem.DirectoryExists(path))
{
continue;
}
}
var libraryItem = _libraryManager.GetItemById(item.Item1);
if (libraryItem == null)
{
continue;
}
if (libraryItem.IsTopParent)
{
continue;
}
var hasDualAccess = libraryItem as IHasDualAccess;
if (hasDualAccess != null && hasDualAccess.IsAccessedByName)
{
continue;
}
var libraryItemPath = libraryItem.Path;
if (!string.Equals(libraryItemPath, path, StringComparison.OrdinalIgnoreCase))
{
_logger.Error("CleanDeletedItems aborting delete for item {0}-{1} because paths don't match. {2}---{3}", libraryItem.Id, libraryItem.Name, libraryItem.Path ?? string.Empty, path ?? string.Empty);
continue;
}
if (Folder.IsPathOffline(path, allLibraryPaths))
{
continue;
}
if (isPathInLibrary)
{
_logger.Info("Deleting item from database {0} because path no longer exists. type: {1} path: {2}", libraryItem.Name, libraryItem.GetType().Name, libraryItemPath ?? string.Empty);
}
else
{
_logger.Info("Deleting item from database {0} because path is no longer in the server library. type: {1} path: {2}", libraryItem.Name, libraryItem.GetType().Name, libraryItemPath ?? string.Empty);
}
await libraryItem.OnFileDeleted().ConfigureAwait(false);
}
catch (OperationCanceledException)
{
throw;
}
catch (Exception ex)
{
_logger.ErrorException("Error in CleanDeletedItems. File {0}", ex, path);
}
numComplete++;
double percent = numComplete;
percent /= numItems;
progress.Report(percent * 100);
}
}
/// <summary>
/// Creates the triggers that define when the task will run
/// </summary>

View file

@ -209,7 +209,6 @@ namespace Emby.Server.Implementations.Data
AddColumn(db, "TypedBaseItems", "DateModified", "DATETIME", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ForcedSortName", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "LocationType", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsSeries", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsLive", "BIT", existingColumnNames);
@ -555,7 +554,6 @@ namespace Emby.Server.Implementations.Data
"DateCreated",
"DateModified",
"ForcedSortName",
"LocationType",
"PreferredMetadataLanguage",
"PreferredMetadataCountryCode",
"IsHD",
@ -835,7 +833,6 @@ namespace Emby.Server.Implementations.Data
saveItemStatement.TryBind("@DateModified", item.DateModified);
saveItemStatement.TryBind("@ForcedSortName", item.ForcedSortName);
saveItemStatement.TryBind("@LocationType", item.LocationType.ToString());
saveItemStatement.TryBind("@PreferredMetadataLanguage", item.PreferredMetadataLanguage);
saveItemStatement.TryBind("@PreferredMetadataCountryCode", item.PreferredMetadataCountryCode);
@ -4077,27 +4074,6 @@ namespace Emby.Server.Implementations.Data
whereClauses.Add("ProductionYear in (" + val + ")");
}
if (query.LocationTypes.Length == 1)
{
if (query.LocationTypes[0] == LocationType.Virtual && _config.Configuration.SchemaVersion >= 90)
{
query.IsVirtualItem = true;
}
else
{
whereClauses.Add("LocationType=@LocationType");
if (statement != null)
{
statement.TryBind("@LocationType", query.LocationTypes[0].ToString());
}
}
}
else if (query.LocationTypes.Length > 1)
{
var val = string.Join(",", query.LocationTypes.Select(i => "'" + i + "'").ToArray());
whereClauses.Add("LocationType in (" + val + ")");
}
if (query.IsVirtualItem.HasValue)
{
whereClauses.Add("IsVirtualItem=@IsVirtualItem");

View file

@ -300,11 +300,6 @@ namespace MediaBrowser.Api.Reports
}
}
if (!string.IsNullOrEmpty(request.LocationTypes))
{
query.LocationTypes = request.LocationTypes.Split(',').Select(d => (LocationType)Enum.Parse(typeof(LocationType), d, true)).ToArray();
}
// Min official rating
if (!string.IsNullOrWhiteSpace(request.MinOfficialRating))
{

View file

@ -328,7 +328,15 @@ namespace MediaBrowser.Api.UserLibrary
if (!string.IsNullOrEmpty(request.LocationTypes))
{
query.LocationTypes = request.LocationTypes.Split(',').Select(d => (LocationType)Enum.Parse(typeof(LocationType), d, true)).ToArray();
var requestedLocationTypes =
request.LocationTypes.Split(',')
.Select(d => (LocationType) Enum.Parse(typeof (LocationType), d, true))
.ToList();
if (requestedLocationTypes.Count > 0 && requestedLocationTypes.Count < 4)
{
query.IsVirtualItem = requestedLocationTypes.Contains(LocationType.Virtual);
}
}
// Min official rating

View file

@ -129,7 +129,6 @@ namespace MediaBrowser.Controller.Entities
public string[] AncestorIds { get; set; }
public string[] TopParentIds { get; set; }
public LocationType[] LocationTypes { get; set; }
public string[] PresetViews { get; set; }
public SourceType[] SourceTypes { get; set; }
public SourceType[] ExcludeSourceTypes { get; set; }
@ -229,7 +228,6 @@ namespace MediaBrowser.Controller.Entities
TopParentIds = new string[] { };
ExcludeTags = new string[] { };
ExcludeInheritedTags = new string[] { };
LocationTypes = new LocationType[] { };
PresetViews = new string[] { };
SourceTypes = new SourceType[] { };
ExcludeSourceTypes = new SourceType[] { };

View file

@ -37,8 +37,8 @@
<Reference Include="Emby.Server.Core">
<HintPath>..\ThirdParty\emby\Emby.Server.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IO.RecyclableMemoryStream, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IO.RecyclableMemoryStream.1.2.1\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll</HintPath>
<Reference Include="Microsoft.IO.RecyclableMemoryStream, Version=1.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IO.RecyclableMemoryStream.1.2.2\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.IO.RecyclableMemoryStream" version="1.2.1" targetFramework="net46" />
<package id="Microsoft.IO.RecyclableMemoryStream" version="1.2.2" targetFramework="net46" />
</packages>