commit
801aa02a4c
|
@ -117,7 +117,7 @@ namespace MediaBrowser.Api
|
||||||
config.EnableStandaloneMusicKeys = true;
|
config.EnableStandaloneMusicKeys = true;
|
||||||
config.EnableCaseSensitiveItemIds = true;
|
config.EnableCaseSensitiveItemIds = true;
|
||||||
//config.EnableFolderView = true;
|
//config.EnableFolderView = true;
|
||||||
config.SchemaVersion = 108;
|
config.SchemaVersion = 109;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Post(UpdateStartupConfiguration request)
|
public void Post(UpdateStartupConfiguration request)
|
||||||
|
|
|
@ -16,6 +16,9 @@ namespace MediaBrowser.Controller.Providers
|
||||||
private readonly ConcurrentDictionary<string, Dictionary<string, FileSystemMetadata>> _cache =
|
private readonly ConcurrentDictionary<string, Dictionary<string, FileSystemMetadata>> _cache =
|
||||||
new ConcurrentDictionary<string, Dictionary<string, FileSystemMetadata>>(StringComparer.OrdinalIgnoreCase);
|
new ConcurrentDictionary<string, Dictionary<string, FileSystemMetadata>>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
private readonly ConcurrentDictionary<string, FileSystemMetadata> _fileCache =
|
||||||
|
new ConcurrentDictionary<string, FileSystemMetadata>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
public DirectoryService(ILogger logger, IFileSystem fileSystem)
|
public DirectoryService(ILogger logger, IFileSystem fileSystem)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
@ -100,29 +103,19 @@ namespace MediaBrowser.Controller.Providers
|
||||||
|
|
||||||
public FileSystemMetadata GetFile(string path)
|
public FileSystemMetadata GetFile(string path)
|
||||||
{
|
{
|
||||||
return _fileSystem.GetFileInfo(path);
|
FileSystemMetadata file;
|
||||||
//var directory = Path.GetDirectoryName(path);
|
if (!_fileCache.TryGetValue(path, out file))
|
||||||
|
{
|
||||||
|
file = _fileSystem.GetFileInfo(path);
|
||||||
|
|
||||||
//if (string.IsNullOrWhiteSpace(directory))
|
if (file != null)
|
||||||
//{
|
{
|
||||||
// _logger.Debug("Parent path is null for {0}", path);
|
_fileCache.TryAdd(path, file);
|
||||||
// return null;
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
//try
|
return file;
|
||||||
//{
|
//return _fileSystem.GetFileInfo(path);
|
||||||
// var dict = GetFileSystemDictionary(directory, false);
|
|
||||||
|
|
||||||
// FileSystemMetadata entry;
|
|
||||||
// dict.TryGetValue(path, out entry);
|
|
||||||
|
|
||||||
// return entry;
|
|
||||||
//}
|
|
||||||
//catch (Exception ex)
|
|
||||||
//{
|
|
||||||
// _logger.ErrorException("Error in GetFileSystemDictionary. Directory: :{0}. Original path: {1}", ex, directory, path);
|
|
||||||
// return null;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<FileSystemMetadata> GetDirectories(string path)
|
public IEnumerable<FileSystemMetadata> GetDirectories(string path)
|
||||||
|
|
|
@ -349,9 +349,6 @@ namespace MediaBrowser.Providers.Manager
|
||||||
|
|
||||||
if (!runAllProviders)
|
if (!runAllProviders)
|
||||||
{
|
{
|
||||||
// Avoid implicitly captured closure
|
|
||||||
var currentItem = item;
|
|
||||||
|
|
||||||
var providersWithChanges = providers
|
var providersWithChanges = providers
|
||||||
.Where(i =>
|
.Where(i =>
|
||||||
{
|
{
|
||||||
|
@ -361,12 +358,6 @@ namespace MediaBrowser.Providers.Manager
|
||||||
return HasChanged(item, hasFileChangeMonitor, options.DirectoryService);
|
return HasChanged(item, hasFileChangeMonitor, options.DirectoryService);
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasChangeMonitor = i as IHasChangeMonitor;
|
|
||||||
if (hasChangeMonitor != null)
|
|
||||||
{
|
|
||||||
return HasChanged(item, hasChangeMonitor, currentItem.DateLastSaved, options.DirectoryService);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -726,27 +717,6 @@ namespace MediaBrowser.Providers.Manager
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool HasChanged(IHasMetadata item, IHasChangeMonitor changeMonitor, DateTime date, IDirectoryService directoryService)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var hasChanged = changeMonitor.HasChanged(item, directoryService, date);
|
|
||||||
|
|
||||||
//if (hasChanged)
|
|
||||||
//{
|
|
||||||
// Logger.Debug("{0} reports change to {1} since {2}", changeMonitor.GetType().Name,
|
|
||||||
// item.Path ?? item.Name, date);
|
|
||||||
//}
|
|
||||||
|
|
||||||
return hasChanged;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger.ErrorException("Error in {0}.HasChanged", ex, changeMonitor.GetType().Name);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RefreshResult
|
public class RefreshResult
|
||||||
|
|
|
@ -125,7 +125,6 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||||
|
|
||||||
var hasMetdata = !string.IsNullOrWhiteSpace(item.Overview);
|
var hasMetdata = !string.IsNullOrWhiteSpace(item.Overview);
|
||||||
var performFullRefresh = !hasMetdata && (DateTime.UtcNow - item.DateLastRefreshed).TotalDays >= 90;
|
var performFullRefresh = !hasMetdata && (DateTime.UtcNow - item.DateLastRefreshed).TotalDays >= 90;
|
||||||
performFullRefresh = false;
|
|
||||||
|
|
||||||
var defaultMetadataRefreshMode = performFullRefresh
|
var defaultMetadataRefreshMode = performFullRefresh
|
||||||
? MetadataRefreshMode.FullRefresh
|
? MetadataRefreshMode.FullRefresh
|
||||||
|
@ -138,7 +137,8 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||||
var options = new MetadataRefreshOptions(_fileSystem)
|
var options = new MetadataRefreshOptions(_fileSystem)
|
||||||
{
|
{
|
||||||
MetadataRefreshMode = person.Value ? defaultMetadataRefreshMode : MetadataRefreshMode.ValidationOnly,
|
MetadataRefreshMode = person.Value ? defaultMetadataRefreshMode : MetadataRefreshMode.ValidationOnly,
|
||||||
ImageRefreshMode = person.Value ? imageRefreshMode : ImageRefreshMode.ValidationOnly
|
ImageRefreshMode = person.Value ? imageRefreshMode : ImageRefreshMode.ValidationOnly,
|
||||||
|
ForceSave = performFullRefresh
|
||||||
};
|
};
|
||||||
|
|
||||||
await item.RefreshMetadata(options, cancellationToken).ConfigureAwait(false);
|
await item.RefreshMetadata(options, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
|
@ -73,8 +73,8 @@
|
||||||
<HintPath>..\packages\SimpleInjector.3.2.0\lib\net45\SimpleInjector.dll</HintPath>
|
<HintPath>..\packages\SimpleInjector.3.2.0\lib\net45\SimpleInjector.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SocketHttpListener, Version=1.0.6060.27027, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="SocketHttpListener, Version=1.0.6062.28575, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\SocketHttpListener.1.0.0.37\lib\net45\SocketHttpListener.dll</HintPath>
|
<HintPath>..\packages\SocketHttpListener.1.0.0.38\lib\net45\SocketHttpListener.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
|
|
@ -95,7 +95,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
private IDbCommand _updateInheritedRatingCommand;
|
private IDbCommand _updateInheritedRatingCommand;
|
||||||
private IDbCommand _updateInheritedTagsCommand;
|
private IDbCommand _updateInheritedTagsCommand;
|
||||||
|
|
||||||
public const int LatestSchemaVersion = 108;
|
public const int LatestSchemaVersion = 109;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
|
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
|
||||||
|
@ -915,7 +915,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_saveItemCommand.GetParameter(index++).Value = item.Name.RemoveDiacritics();
|
_saveItemCommand.GetParameter(index++).Value = GetCleanValue(item.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
_saveItemCommand.GetParameter(index++).Value = item.PresentationUniqueKey;
|
_saveItemCommand.GetParameter(index++).Value = item.PresentationUniqueKey;
|
||||||
|
@ -2763,13 +2763,13 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
if (!string.IsNullOrWhiteSpace(query.Name))
|
if (!string.IsNullOrWhiteSpace(query.Name))
|
||||||
{
|
{
|
||||||
whereClauses.Add("CleanName=@Name");
|
whereClauses.Add("CleanName=@Name");
|
||||||
cmd.Parameters.Add(cmd, "@Name", DbType.String).Value = query.Name.RemoveDiacritics();
|
cmd.Parameters.Add(cmd, "@Name", DbType.String).Value = GetCleanValue(query.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(query.NameContains))
|
if (!string.IsNullOrWhiteSpace(query.NameContains))
|
||||||
{
|
{
|
||||||
whereClauses.Add("CleanName like @NameContains");
|
whereClauses.Add("CleanName like @NameContains");
|
||||||
cmd.Parameters.Add(cmd, "@NameContains", DbType.String).Value = "%" + query.NameContains.RemoveDiacritics() + "%";
|
cmd.Parameters.Add(cmd, "@NameContains", DbType.String).Value = "%" + GetCleanValue(query.NameContains) + "%";
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrWhiteSpace(query.NameStartsWith))
|
if (!string.IsNullOrWhiteSpace(query.NameStartsWith))
|
||||||
{
|
{
|
||||||
|
@ -2877,7 +2877,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
foreach (var artist in query.ArtistNames)
|
foreach (var artist in query.ArtistNames)
|
||||||
{
|
{
|
||||||
clauses.Add("@ArtistName" + index + " in (select CleanValue from itemvalues where ItemId=Guid and Type <= 1)");
|
clauses.Add("@ArtistName" + index + " in (select CleanValue from itemvalues where ItemId=Guid and Type <= 1)");
|
||||||
cmd.Parameters.Add(cmd, "@ArtistName" + index, DbType.String).Value = artist.RemoveDiacritics();
|
cmd.Parameters.Add(cmd, "@ArtistName" + index, DbType.String).Value = GetCleanValue(artist);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
var clause = "(" + string.Join(" OR ", clauses.ToArray()) + ")";
|
var clause = "(" + string.Join(" OR ", clauses.ToArray()) + ")";
|
||||||
|
@ -2894,7 +2894,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
if (artistItem != null)
|
if (artistItem != null)
|
||||||
{
|
{
|
||||||
clauses.Add("@ExcludeArtistName" + index + " not in (select CleanValue from itemvalues where ItemId=Guid and Type <= 1)");
|
clauses.Add("@ExcludeArtistName" + index + " not in (select CleanValue from itemvalues where ItemId=Guid and Type <= 1)");
|
||||||
cmd.Parameters.Add(cmd, "@ExcludeArtistName" + index, DbType.String).Value = artistItem.Name.RemoveDiacritics();
|
cmd.Parameters.Add(cmd, "@ExcludeArtistName" + index, DbType.String).Value = GetCleanValue(artistItem.Name);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2915,7 +2915,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
foreach (var item in query.Genres)
|
foreach (var item in query.Genres)
|
||||||
{
|
{
|
||||||
clauses.Add("@Genre" + index + " in (select CleanValue from itemvalues where ItemId=Guid and Type=2)");
|
clauses.Add("@Genre" + index + " in (select CleanValue from itemvalues where ItemId=Guid and Type=2)");
|
||||||
cmd.Parameters.Add(cmd, "@Genre" + index, DbType.String).Value = item.RemoveDiacritics();
|
cmd.Parameters.Add(cmd, "@Genre" + index, DbType.String).Value = GetCleanValue(item);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
var clause = "(" + string.Join(" OR ", clauses.ToArray()) + ")";
|
var clause = "(" + string.Join(" OR ", clauses.ToArray()) + ")";
|
||||||
|
@ -2929,7 +2929,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
foreach (var item in query.Tags)
|
foreach (var item in query.Tags)
|
||||||
{
|
{
|
||||||
clauses.Add("@Tag" + index + " in (select CleanValue from itemvalues where ItemId=Guid and Type=4)");
|
clauses.Add("@Tag" + index + " in (select CleanValue from itemvalues where ItemId=Guid and Type=4)");
|
||||||
cmd.Parameters.Add(cmd, "@Tag" + index, DbType.String).Value = item.RemoveDiacritics();
|
cmd.Parameters.Add(cmd, "@Tag" + index, DbType.String).Value = GetCleanValue(item);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
var clause = "(" + string.Join(" OR ", clauses.ToArray()) + ")";
|
var clause = "(" + string.Join(" OR ", clauses.ToArray()) + ")";
|
||||||
|
@ -2949,7 +2949,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
foreach (var item in query.Studios)
|
foreach (var item in query.Studios)
|
||||||
{
|
{
|
||||||
clauses.Add("@Studio" + index + " in (select CleanValue from itemvalues where ItemId=Guid and Type=3)");
|
clauses.Add("@Studio" + index + " in (select CleanValue from itemvalues where ItemId=Guid and Type=3)");
|
||||||
cmd.Parameters.Add(cmd, "@Studio" + index, DbType.String).Value = item.RemoveDiacritics();
|
cmd.Parameters.Add(cmd, "@Studio" + index, DbType.String).Value = GetCleanValue(item);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
var clause = "(" + string.Join(" OR ", clauses.ToArray()) + ")";
|
var clause = "(" + string.Join(" OR ", clauses.ToArray()) + ")";
|
||||||
|
@ -2963,7 +2963,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
foreach (var item in query.Keywords)
|
foreach (var item in query.Keywords)
|
||||||
{
|
{
|
||||||
clauses.Add("@Keyword" + index + " in (select CleanValue from itemvalues where ItemId=Guid and Type=5)");
|
clauses.Add("@Keyword" + index + " in (select CleanValue from itemvalues where ItemId=Guid and Type=5)");
|
||||||
cmd.Parameters.Add(cmd, "@Keyword" + index, DbType.String).Value = item.RemoveDiacritics();
|
cmd.Parameters.Add(cmd, "@Keyword" + index, DbType.String).Value = GetCleanValue(item);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
var clause = "(" + string.Join(" OR ", clauses.ToArray()) + ")";
|
var clause = "(" + string.Join(" OR ", clauses.ToArray()) + ")";
|
||||||
|
@ -3298,6 +3298,16 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
return whereClauses;
|
return whereClauses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetCleanValue(string value)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(value))
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return value.RemoveDiacritics().ToLower();
|
||||||
|
}
|
||||||
|
|
||||||
private bool EnableGroupByPresentationUniqueKey(InternalItemsQuery query)
|
private bool EnableGroupByPresentationUniqueKey(InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
if (!query.GroupByPresentationUniqueKey)
|
if (!query.GroupByPresentationUniqueKey)
|
||||||
|
@ -4024,7 +4034,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
? (CommandBehavior.SequentialAccess | CommandBehavior.SingleResult)
|
? (CommandBehavior.SequentialAccess | CommandBehavior.SingleResult)
|
||||||
: CommandBehavior.SequentialAccess;
|
: CommandBehavior.SequentialAccess;
|
||||||
|
|
||||||
//Logger.Debug("GetItemValues: " + cmd.CommandText);
|
Logger.Debug("GetItemValues: " + cmd.CommandText);
|
||||||
|
|
||||||
using (var reader = cmd.ExecuteReader(commandBehavior))
|
using (var reader = cmd.ExecuteReader(commandBehavior))
|
||||||
{
|
{
|
||||||
|
@ -4268,7 +4278,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_saveItemValuesCommand.GetParameter(3).Value = pair.Item2.RemoveDiacritics();
|
_saveItemValuesCommand.GetParameter(3).Value = GetCleanValue(pair.Item2);
|
||||||
}
|
}
|
||||||
_saveItemValuesCommand.Transaction = transaction;
|
_saveItemValuesCommand.Transaction = transaction;
|
||||||
|
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
<package id="morelinq" version="1.4.0" targetFramework="net45" />
|
<package id="morelinq" version="1.4.0" targetFramework="net45" />
|
||||||
<package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" />
|
<package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" />
|
||||||
<package id="SimpleInjector" version="3.2.0" targetFramework="net45" />
|
<package id="SimpleInjector" version="3.2.0" targetFramework="net45" />
|
||||||
<package id="SocketHttpListener" version="1.0.0.37" targetFramework="net45" />
|
<package id="SocketHttpListener" version="1.0.0.38" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
Loading…
Reference in New Issue
Block a user