fixed themoviedb search returning no results

This commit is contained in:
Luke Pulverenti
2014-02-17 16:35:08 -05:00
parent 4ebba2b2e8
commit 1a9e2dfd83
27 changed files with 696 additions and 594 deletions

View File

@@ -902,7 +902,7 @@ namespace MediaBrowser.Server.Implementations.Dto
{
var locationType = item.LocationType;
if (locationType == LocationType.FileSystem || locationType == LocationType.Offline)
if (locationType != LocationType.Remote && locationType != LocationType.Virtual)
{
dto.Path = GetMappedPath(item.Path);
}

View File

@@ -69,6 +69,11 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
/// <param name="e">The <see cref="ItemChangeEventArgs"/> instance containing the event data.</param>
void libraryManager_ItemAdded(object sender, ItemChangeEventArgs e)
{
if (e.Item.LocationType == LocationType.Virtual)
{
return;
}
lock (_libraryChangedSyncLock)
{
if (LibraryUpdateTimer == null)
@@ -97,6 +102,11 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
/// <param name="e">The <see cref="ItemChangeEventArgs"/> instance containing the event data.</param>
void libraryManager_ItemUpdated(object sender, ItemChangeEventArgs e)
{
if (e.Item.LocationType == LocationType.Virtual)
{
return;
}
lock (_libraryChangedSyncLock)
{
if (LibraryUpdateTimer == null)
@@ -120,6 +130,11 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
/// <param name="e">The <see cref="ItemChangeEventArgs"/> instance containing the event data.</param>
void libraryManager_ItemRemoved(object sender, ItemChangeEventArgs e)
{
if (e.Item.LocationType == LocationType.Virtual)
{
return;
}
lock (_libraryChangedSyncLock)
{
if (LibraryUpdateTimer == null)

View File

@@ -17,17 +17,15 @@ namespace MediaBrowser.Server.Implementations.Library
/// <summary>
/// Any folder named in this list will be ignored - can be added to at runtime for extensibility
/// </summary>
private static readonly Dictionary<string,string> IgnoreFolders = new List<string>
private static readonly Dictionary<string, string> IgnoreFolders = new List<string>
{
"metadata",
"certificate",
"backup",
"ps3_update",
"ps3_vprm",
"adv_obj",
"extrafanart",
"extrathumbs",
".actors"
"metadata",
"ps3_update",
"ps3_vprm",
"extrafanart",
"extrathumbs",
".actors",
".wd_tv"
}.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
@@ -51,7 +49,7 @@ namespace MediaBrowser.Server.Implementations.Library
// https://github.com/MediaBrowser/MediaBrowser/issues/427
if (filename.IndexOf("._", StringComparison.OrdinalIgnoreCase) == 0)
{
return true;
return true;
}
// Ignore hidden files and folders

View File

@@ -1312,7 +1312,8 @@ namespace MediaBrowser.Server.Implementations.Library
/// <returns>Task.</returns>
public async Task UpdateItem(BaseItem item, ItemUpdateType updateReason, CancellationToken cancellationToken)
{
if (item.LocationType == LocationType.FileSystem)
var locationType = item.LocationType;
if (locationType != LocationType.Remote && locationType != LocationType.Virtual)
{
await _providerManagerFactory().SaveMetadata(item, updateReason).ConfigureAwait(false);
}

View File

@@ -13,51 +13,46 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
/// </summary>
internal static class CountHelpers
{
/// <summary>
/// Adds to dictionary.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="counts">The counts.</param>
internal static void AddToDictionary(BaseItem item, Dictionary<CountType, int> counts)
private static CountType? GetCountType(BaseItem item)
{
if (item is Movie)
{
IncrementCount(counts, CountType.Movie);
return CountType.Movie;
}
else if (item is Trailer)
if (item is Episode)
{
IncrementCount(counts, CountType.Trailer);
return CountType.Episode;
}
else if (item is Series)
if (item is Game)
{
IncrementCount(counts, CountType.Series);
return CountType.Game;
}
else if (item is Game)
if (item is Audio)
{
IncrementCount(counts, CountType.Game);
return CountType.Song;
}
else if (item is Audio)
if (item is Trailer)
{
IncrementCount(counts, CountType.Song);
return CountType.Trailer;
}
else if (item is MusicAlbum)
if (item is Series)
{
IncrementCount(counts, CountType.MusicAlbum);
return CountType.Series;
}
else if (item is Episode)
if (item is MusicAlbum)
{
IncrementCount(counts, CountType.Episode);
return CountType.MusicAlbum;
}
else if (item is MusicVideo)
if (item is MusicVideo)
{
IncrementCount(counts, CountType.MusicVideo);
return CountType.MusicVideo;
}
else if (item is AdultVideo)
if (item is AdultVideo)
{
IncrementCount(counts, CountType.AdultVideo);
return CountType.AdultVideo;
}
IncrementCount(counts, CountType.Total);
return null;
}
/// <summary>
@@ -129,6 +124,8 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
/// <param name="masterDictionary">The master dictionary.</param>
internal static void SetItemCounts(Guid userId, BaseItem media, IEnumerable<string> names, Dictionary<string, Dictionary<Guid, Dictionary<CountType, int>>> masterDictionary)
{
var countType = GetCountType(media);
foreach (var name in names)
{
Dictionary<Guid, Dictionary<CountType, int>> libraryCounts;
@@ -148,7 +145,12 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
libraryCounts.Add(userLibId, userDictionary);
}
AddToDictionary(media, userDictionary);
if (countType.HasValue)
{
IncrementCount(userDictionary, countType.Value);
}
IncrementCount(userDictionary, CountType.Total);
}
}
}

View File

@@ -19,6 +19,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
private IDbCommand _deleteStreamsCommand;
private IDbCommand _saveStreamCommand;
private SqliteShrinkMemoryTimer _shrinkMemoryTimer;
public SqliteMediaStreamsRepository(IDbConnection connection, ILogManager logManager)
{
_connection = connection;
@@ -51,6 +53,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
_connection.RunQueries(queries, _logger);
PrepareStatements();
_shrinkMemoryTimer = new SqliteShrinkMemoryTimer(_connection, _writeLock, _logger);
}
private readonly string[] _saveColumns =
@@ -356,6 +360,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
{
lock (_disposeLock)
{
if (_shrinkMemoryTimer != null)
{
_shrinkMemoryTimer.Dispose();
_shrinkMemoryTimer = null;
}
if (_connection != null)
{
if (_connection.IsOpen())

View File

@@ -19,7 +19,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
_writeLock = writeLock;
_logger = logger;
_shrinkMemoryTimer = new Timer(TimerCallback, null, TimeSpan.FromMinutes(30), TimeSpan.FromMinutes(30));
_shrinkMemoryTimer = new Timer(TimerCallback, null, TimeSpan.FromMinutes(30), TimeSpan.FromMinutes(10));
}
private async void TimerCallback(object state)