diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-02-17 16:35:08 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-02-17 16:35:08 -0500 |
| commit | 1a9e2dfd83dbab2e9a5f277229c5994253fd8a9a (patch) | |
| tree | 157ac5c2ee2e226560d04d61fef79445b23c231d /MediaBrowser.Server.Implementations | |
| parent | 4ebba2b2e87e33f083c095957a2294b6f8ae3828 (diff) | |
fixed themoviedb search returning no results
Diffstat (limited to 'MediaBrowser.Server.Implementations')
7 files changed, 65 insertions, 39 deletions
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index ae08a7c3d..aba8c3353 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -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); } diff --git a/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs index a91033839..2928363e3 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs @@ -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) diff --git a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs index 98a87d03d..c830c13b8 100644 --- a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs +++ b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs @@ -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 diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index b42541204..a06e03c4a 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -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); } diff --git a/MediaBrowser.Server.Implementations/Library/Validators/CountHelpers.cs b/MediaBrowser.Server.Implementations/Library/Validators/CountHelpers.cs index 679eadb12..edb4e7382 100644 --- a/MediaBrowser.Server.Implementations/Library/Validators/CountHelpers.cs +++ b/MediaBrowser.Server.Implementations/Library/Validators/CountHelpers.cs @@ -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); } } } diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteMediaStreamsRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteMediaStreamsRepository.cs index b898398d8..f4e7fd0a6 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteMediaStreamsRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteMediaStreamsRepository.cs @@ -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()) diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteShrinkMemoryTimer.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteShrinkMemoryTimer.cs index 01784d540..b5a0c10b1 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteShrinkMemoryTimer.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteShrinkMemoryTimer.cs @@ -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) |
