diff options
| author | Tavares André <tavares_and@hotmail.com> | 2015-05-07 19:12:56 +0200 |
|---|---|---|
| committer | Tavares André <tavares_and@hotmail.com> | 2015-05-07 19:12:56 +0200 |
| commit | 48e7ca87254969f98abbedcfc46985fc1ea955c0 (patch) | |
| tree | c1084f29f6529d4bf5524fdab7a723686a379b2d /MediaBrowser.Server.Implementations | |
| parent | f2b800181252b6fd0bb3b51925d1dcb0623f21d2 (diff) | |
| parent | 63dc2512c5d272dbc3cb1515beb175e9b3572440 (diff) | |
Merge branch 'dev' of https://github.com/MediaBrowser/MediaBrowser into dev
Conflicts:
MediaBrowser.Server.Implementations/Localization/Server/server.json
Diffstat (limited to 'MediaBrowser.Server.Implementations')
22 files changed, 229 insertions, 514 deletions
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index 402bd4d98..1b55f47d5 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -1193,7 +1193,7 @@ namespace MediaBrowser.Server.Implementations.Dto { dto.Album = audio.Album; - var albumParent = audio.FindParent<MusicAlbum>(); + var albumParent = audio.AlbumEntity; if (albumParent != null) { @@ -1208,15 +1208,6 @@ namespace MediaBrowser.Server.Implementations.Dto //} } - var album = item as MusicAlbum; - - if (album != null) - { - dto.SoundtrackIds = album.SoundtrackIds - .Select(i => i.ToString("N")) - .ToArray(); - } - var hasArtist = item as IHasArtist; if (hasArtist != null) { diff --git a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs index d501d1210..2d4770fac 100644 --- a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs +++ b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs @@ -84,7 +84,7 @@ namespace MediaBrowser.Server.Implementations.IO // This is an arbitraty amount of time, but delay it because file system writes often trigger events after RemoveTempIgnore has been called. // Seeing long delays in some situations, especially over the network. // Seeing delays up to 40 seconds, but not going to ignore changes for that long. - await Task.Delay(1500).ConfigureAwait(false); + await Task.Delay(5000).ConfigureAwait(false); string val; _tempIgnoredPaths.TryRemove(path, out val); @@ -437,11 +437,11 @@ namespace MediaBrowser.Server.Implementations.IO { if (_updateTimer == null) { - _updateTimer = new Timer(TimerStopped, null, TimeSpan.FromSeconds(ConfigurationManager.Configuration.RealtimeMonitorDelay), TimeSpan.FromMilliseconds(-1)); + _updateTimer = new Timer(TimerStopped, null, TimeSpan.FromSeconds(ConfigurationManager.Configuration.RealtimeLibraryMonitorDelay), TimeSpan.FromMilliseconds(-1)); } else { - _updateTimer.Change(TimeSpan.FromSeconds(ConfigurationManager.Configuration.RealtimeMonitorDelay), TimeSpan.FromMilliseconds(-1)); + _updateTimer.Change(TimeSpan.FromSeconds(ConfigurationManager.Configuration.RealtimeLibraryMonitorDelay), TimeSpan.FromMilliseconds(-1)); } } } @@ -560,7 +560,7 @@ namespace MediaBrowser.Server.Implementations.IO /// <returns>Task.</returns> private async Task ProcessPathChanges(List<string> paths) { - var itemsToRefresh = paths.Select(Path.GetDirectoryName) + var itemsToRefresh = paths .Select(GetAffectedBaseItem) .Where(item => item != null) .Distinct() diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.cs index 02e1795f3..5012f2479 100644 --- a/MediaBrowser.Server.Implementations/Library/UserManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserManager.cs @@ -281,10 +281,10 @@ namespace MediaBrowser.Server.Implementations.Library if (newValue >= maxCount) { - _logger.Debug("Disabling user {0} due to {1} unsuccessful login attempts.", user.Name, newValue.ToString(CultureInfo.InvariantCulture)); - user.Policy.IsDisabled = true; + //_logger.Debug("Disabling user {0} due to {1} unsuccessful login attempts.", user.Name, newValue.ToString(CultureInfo.InvariantCulture)); + //user.Policy.IsDisabled = true; - fireLockout = true; + //fireLockout = true; } await UpdateUserPolicy(user, user.Policy, false).ConfigureAwait(false); diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/cs.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/cs.json index ea141645c..2dff86fce 100644 --- a/MediaBrowser.Server.Implementations/Localization/JavaScript/cs.json +++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/cs.json @@ -387,7 +387,6 @@ "ButtonSignOut": "Sign Out", "ButtonMyProfile": "My Profile", "ButtonMyPreferences": "My Preferences", - "MessageBrowserDoesNotSupportWebSockets": "This browser does not support web sockets. For a better experience, try a newer browser such as Chrome, Firefox, IE10+, Safari (iOS) or Opera.", "LabelInstallingPackage": "Installing {0}", "LabelPackageInstallCompleted": "{0} installation completed.", "LabelPackageInstallFailed": "{0} installation failed.", diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json index c15e520e2..ad6b159e7 100644 --- a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json +++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json @@ -440,7 +440,7 @@ "HeaderVideo": "Video", "HeaderRuntime": "Runtime", "HeaderCommunityRating": "Community rating", - "HeaderPasswordReset": "Password Reset", + "HeaderPasswordReset": "Password Reset", "HeaderParentalRating": "Parental rating", "HeaderReleaseDate": "Release date", "HeaderDateAdded": "Date added", @@ -766,5 +766,10 @@ "SyncJobItemStatusRemovedFromDevice": "Removed from device", "SyncJobItemStatusCancelled": "Cancelled", "LabelProfile": "Profile:", - "LabelBitrateMbps": "Bitrate (Mbps):" + "LabelBitrateMbps": "Bitrate (Mbps):", + "EmbyIntroDownloadMessage": "To download and install Emby Server visit {0}.", + "ButtonNewServer": "New Server", + "ButtonSignInWithConnect": "Sign in with Emby Connect", + "HeaderNewServer": "New Server", + "MyDevice": "My Device" } diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index caff2426a..368d11646 100644 --- a/MediaBrowser.Server.Implementations/Localization/Server/server.json +++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json @@ -882,7 +882,7 @@ "MessageNoSubtitleSearchResultsFound": "No search results founds.", "TabDisplay": "Display", "TabLanguages": "Languages", - "TabWebClient": "Web Client", + "TabAppSettings": "App Settings", "LabelEnableThemeSongs": "Enable theme songs", "LabelEnableBackdrops": "Enable backdrops", "LabelEnableThemeSongsHelp": "If enabled, theme songs will be played in the background while browsing the library.", @@ -1436,10 +1436,17 @@ "LabelSelectViewStyles": "Enable enhanced presentations for:", "LabelSelectViewStylesHelp": "If enabled, views will be built with metadata to offer categories such as Suggestions, Latest, Genres, and more. If disabled, they'll be displayed with simple folders.", "TabPhotos": "Photos", - "TabVideos": "Videos", - "OptionReportList": "List View", - "OptionReportStatistics": "Statistics", - "OptionReportGrouping": "Grouping", - "OptionReportExport": "Report Export", - "OptionReportColumns": "Report Columns" + "TabVideos": "Videos", + "HeaderWelcomeToEmby": "Welcome to Emby", + "EmbyIntroMessage": "With Emby you can easily stream videos, music and photos to smart phones, tablets and other devices from your Emby Server.", + "ButtonSkip": "Skip", + "TextConnectToServerManually": "Connect to server manually", + "ButtonSignInWithConnect": "Sign in with Emby Connect", + "ButtonConnect": "Connect", + "LabelServerHost": "Host:", + "LabelServerHostHelp": "192.168.1.100 or https://myserver.com", + "LabelServerPort": "Port:", + "HeaderNewServer": "New Server", + "ButtonChangeServer": "Change Server", + "HeaderConnectToServer": "Connect to Server" } diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index 9e7810c76..572aa3a12 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -48,9 +48,8 @@ <Reference Include="Interfaces.IO"> <HintPath>..\packages\Interfaces.IO.1.0.0.5\lib\portable-net45+sl4+wp71+win8+wpa81\Interfaces.IO.dll</HintPath> </Reference> - <Reference Include="MediaBrowser.Naming, Version=1.0.5509.27636, Culture=neutral, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\packages\MediaBrowser.Naming.1.0.0.34\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath> + <Reference Include="MediaBrowser.Naming"> + <HintPath>..\packages\MediaBrowser.Naming.1.0.0.35\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath> </Reference> <Reference Include="Mono.Nat, Version=1.2.24.0, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> @@ -226,6 +225,7 @@ <Compile Include="Localization\LocalizationManager.cs" /> <Compile Include="Logging\PatternsLogger.cs" /> <Compile Include="MediaEncoder\EncodingManager.cs" /> + <Compile Include="Persistence\BaseSqliteRepository.cs" /> <Compile Include="Sorting\StartDateComparer.cs" /> <Compile Include="Sync\SyncHelper.cs" /> <Compile Include="Sync\SyncJobOptions.cs" /> @@ -242,7 +242,6 @@ <Compile Include="Persistence\SqliteMediaStreamsRepository.cs" /> <Compile Include="Notifications\SqliteNotificationsRepository.cs" /> <Compile Include="Persistence\SqliteProviderInfoRepository.cs" /> - <Compile Include="Persistence\SqliteShrinkMemoryTimer.cs" /> <Compile Include="Persistence\TypeMapper.cs" /> <Compile Include="Photos\BaseDynamicImageProvider.cs" /> <Compile Include="Playlists\ManualPlaylistsFolder.cs" /> diff --git a/MediaBrowser.Server.Implementations/Persistence/BaseSqliteRepository.cs b/MediaBrowser.Server.Implementations/Persistence/BaseSqliteRepository.cs new file mode 100644 index 000000000..15d76fb60 --- /dev/null +++ b/MediaBrowser.Server.Implementations/Persistence/BaseSqliteRepository.cs @@ -0,0 +1,56 @@ +using MediaBrowser.Model.Logging; +using System; +using System.Threading; + +namespace MediaBrowser.Server.Implementations.Persistence +{ + public abstract class BaseSqliteRepository : IDisposable + { + protected readonly SemaphoreSlim WriteLock = new SemaphoreSlim(1, 1); + protected ILogger Logger; + + protected BaseSqliteRepository(ILogManager logManager) + { + Logger = logManager.GetLogger(GetType().Name); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private readonly object _disposeLock = new object(); + + /// <summary> + /// Releases unmanaged and - optionally - managed resources. + /// </summary> + /// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> + protected virtual void Dispose(bool dispose) + { + if (dispose) + { + try + { + lock (_disposeLock) + { + WriteLock.Wait(); + + CloseConnection(); + } + } + catch (Exception ex) + { + Logger.ErrorException("Error disposing database", ex); + } + } + } + + protected virtual void DisposeInternal() + { + + } + + protected abstract void CloseConnection(); + } +} diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteChapterRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteChapterRepository.cs index 77b993205..075ef4239 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteChapterRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteChapterRepository.cs @@ -32,8 +32,6 @@ namespace MediaBrowser.Server.Implementations.Persistence _logger = logManager.GetLogger(GetType().Name); } - private SqliteShrinkMemoryTimer _shrinkMemoryTimer; - /// <summary> /// Opens the connection to the database /// </summary> @@ -54,8 +52,6 @@ namespace MediaBrowser.Server.Implementations.Persistence _connection.RunQueries(queries, _logger); PrepareStatements(); - - _shrinkMemoryTimer = new SqliteShrinkMemoryTimer(_connection, _writeLock, _logger); } /// <summary> @@ -286,12 +282,6 @@ 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/SqliteDisplayPreferencesRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteDisplayPreferencesRepository.cs index 3dfa74727..c9ab43e63 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteDisplayPreferencesRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteDisplayPreferencesRepository.cs @@ -16,11 +16,15 @@ namespace MediaBrowser.Server.Implementations.Persistence /// <summary> /// Class SQLiteDisplayPreferencesRepository /// </summary> - public class SqliteDisplayPreferencesRepository : IDisplayPreferencesRepository + public class SqliteDisplayPreferencesRepository : BaseSqliteRepository, IDisplayPreferencesRepository { private IDbConnection _connection; - private readonly ILogger _logger; + public SqliteDisplayPreferencesRepository(ILogManager logManager, IJsonSerializer jsonSerializer, IApplicationPaths appPaths) : base(logManager) + { + _jsonSerializer = jsonSerializer; + _appPaths = appPaths; + } /// <summary> /// Gets the name of the repository @@ -44,36 +48,6 @@ namespace MediaBrowser.Server.Implementations.Persistence /// </summary> private readonly IApplicationPaths _appPaths; - private readonly SemaphoreSlim _writeLock = new SemaphoreSlim(1, 1); - - /// <summary> - /// Initializes a new instance of the <see cref="SqliteDisplayPreferencesRepository" /> class. - /// </summary> - /// <param name="appPaths">The app paths.</param> - /// <param name="jsonSerializer">The json serializer.</param> - /// <param name="logManager">The log manager.</param> - /// <exception cref="System.ArgumentNullException"> - /// jsonSerializer - /// or - /// appPaths - /// </exception> - public SqliteDisplayPreferencesRepository(IApplicationPaths appPaths, IJsonSerializer jsonSerializer, ILogManager logManager) - { - if (jsonSerializer == null) - { - throw new ArgumentNullException("jsonSerializer"); - } - if (appPaths == null) - { - throw new ArgumentNullException("appPaths"); - } - - _jsonSerializer = jsonSerializer; - _appPaths = appPaths; - - _logger = logManager.GetLogger(GetType().Name); - } - /// <summary> /// Opens the connection to the database /// </summary> @@ -82,7 +56,7 @@ namespace MediaBrowser.Server.Implementations.Persistence { var dbFile = Path.Combine(_appPaths.DataPath, "displaypreferences.db"); - _connection = await SqliteExtensions.ConnectToDb(dbFile, _logger).ConfigureAwait(false); + _connection = await SqliteExtensions.ConnectToDb(dbFile, Logger).ConfigureAwait(false); string[] queries = { @@ -95,7 +69,7 @@ namespace MediaBrowser.Server.Implementations.Persistence "pragma shrink_memory" }; - _connection.RunQueries(queries, _logger); + _connection.RunQueries(queries, Logger); } /// <summary> @@ -122,7 +96,7 @@ namespace MediaBrowser.Server.Implementations.Persistence var serialized = _jsonSerializer.SerializeToBytes(displayPreferences); - await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false); + await WriteLock.WaitAsync(cancellationToken).ConfigureAwait(false); IDbTransaction transaction = null; @@ -157,7 +131,7 @@ namespace MediaBrowser.Server.Implementations.Persistence } catch (Exception e) { - _logger.ErrorException("Failed to save display preferences:", e); + Logger.ErrorException("Failed to save display preferences:", e); if (transaction != null) { @@ -173,7 +147,7 @@ namespace MediaBrowser.Server.Implementations.Persistence transaction.Dispose(); } - _writeLock.Release(); + WriteLock.Release(); } } @@ -194,7 +168,7 @@ namespace MediaBrowser.Server.Implementations.Persistence cancellationToken.ThrowIfCancellationRequested(); - await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false); + await WriteLock.WaitAsync(cancellationToken).ConfigureAwait(false); IDbTransaction transaction = null; @@ -235,7 +209,7 @@ namespace MediaBrowser.Server.Implementations.Persistence } catch (Exception e) { - _logger.ErrorException("Failed to save display preferences:", e); + Logger.ErrorException("Failed to save display preferences:", e); if (transaction != null) { @@ -251,7 +225,7 @@ namespace MediaBrowser.Server.Implementations.Persistence transaction.Dispose(); } - _writeLock.Release(); + WriteLock.Release(); } } @@ -322,45 +296,17 @@ namespace MediaBrowser.Server.Implementations.Persistence } } - /// <summary> - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// </summary> - public void Dispose() + protected override void CloseConnection() { - Dispose(true); - GC.SuppressFinalize(this); - } - - private readonly object _disposeLock = new object(); - - /// <summary> - /// Releases unmanaged and - optionally - managed resources. - /// </summary> - /// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> - protected virtual void Dispose(bool dispose) - { - if (dispose) + if (_connection != null) { - try + if (_connection.IsOpen()) { - lock (_disposeLock) - { - if (_connection != null) - { - if (_connection.IsOpen()) - { - _connection.Close(); - } - - _connection.Dispose(); - _connection = null; - } - } - } - catch (Exception ex) - { - _logger.ErrorException("Error disposing database", ex); + _connection.Close(); } + + _connection.Dispose(); + _connection = null; } } } diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteFileOrganizationRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteFileOrganizationRepository.cs index 5d5855bf8..2d5aad04d 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteFileOrganizationRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteFileOrganizationRepository.cs @@ -14,14 +14,10 @@ using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.Persistence { - public class SqliteFileOrganizationRepository : IFileOrganizationRepository, IDisposable + public class SqliteFileOrganizationRepository : BaseSqliteRepository, IFileOrganizationRepository, IDisposable { private IDbConnection _connection; - private readonly ILogger _logger; - - private readonly SemaphoreSlim _writeLock = new SemaphoreSlim(1, 1); - private SqliteShrinkMemoryTimer _shrinkMemoryTimer; private readonly IServerApplicationPaths _appPaths; private readonly CultureInfo _usCulture = new CultureInfo("en-US"); @@ -30,11 +26,9 @@ namespace MediaBrowser.Server.Implementations.Persistence private IDbCommand _deleteResultCommand; private IDbCommand _deleteAllCommand; - public SqliteFileOrganizationRepository(ILogManager logManager, IServerApplicationPaths appPaths) + public SqliteFileOrganizationRepository(ILogManager logManager, IServerApplicationPaths appPaths) : base(logManager) { _appPaths = appPaths; - - _logger = logManager.GetLogger(GetType().Name); } /// <summary> @@ -45,7 +39,7 @@ namespace MediaBrowser.Server.Implementations.Persistence { var dbFile = Path.Combine(_appPaths.DataPath, "fileorganization.db"); - _connection = await SqliteExtensions.ConnectToDb(dbFile, _logger).ConfigureAwait(false); + _connection = await SqliteExtensions.ConnectToDb(dbFile, Logger).ConfigureAwait(false); string[] queries = { @@ -58,11 +52,9 @@ namespace MediaBrowser.Server.Implementations.Persistence "pragma shrink_memory" }; - _connection.RunQueries(queries, _logger); + _connection.RunQueries(queries, Logger); PrepareStatements(); - - _shrinkMemoryTimer = new SqliteShrinkMemoryTimer(_connection, _writeLock, _logger); } private void PrepareStatements() @@ -103,7 +95,7 @@ namespace MediaBrowser.Server.Implementations.Persistence cancellationToken.ThrowIfCancellationRequested(); - await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false); + await WriteLock.WaitAsync(cancellationToken).ConfigureAwait(false); IDbTransaction transaction = null; @@ -145,7 +137,7 @@ namespace MediaBrowser.Server.Implementations.Persistence } catch (Exception e) { - _logger.ErrorException("Failed to save FileOrganizationResult:", e); + Logger.ErrorException("Failed to save FileOrganizationResult:", e); if (transaction != null) { @@ -161,7 +153,7 @@ namespace MediaBrowser.Server.Implementations.Persistence transaction.Dispose(); } - _writeLock.Release(); + WriteLock.Release(); } } @@ -172,7 +164,7 @@ namespace MediaBrowser.Server.Implementations.Persistence throw new ArgumentNullException("id"); } - await _writeLock.WaitAsync().ConfigureAwait(false); + await WriteLock.WaitAsync().ConfigureAwait(false); IDbTransaction transaction = null; @@ -199,7 +191,7 @@ namespace MediaBrowser.Server.Implementations.Persistence } catch (Exception e) { - _logger.ErrorException("Failed to delete FileOrganizationResult:", e); + Logger.ErrorException("Failed to delete FileOrganizationResult:", e); if (transaction != null) { @@ -215,13 +207,13 @@ namespace MediaBrowser.Server.Implementations.Persistence transaction.Dispose(); } - _writeLock.Release(); + WriteLock.Release(); } } public async Task DeleteAll() { - await _writeLock.WaitAsync().ConfigureAwait(false); + await WriteLock.WaitAsync().ConfigureAwait(false); IDbTransaction transaction = null; @@ -246,7 +238,7 @@ namespace MediaBrowser.Server.Implementations.Persistence } catch (Exception e) { - _logger.ErrorException("Failed to delete results", e); + Logger.ErrorException("Failed to delete results", e); if (transaction != null) { @@ -262,7 +254,7 @@ namespace MediaBrowser.Server.Implementations.Persistence transaction.Dispose(); } - _writeLock.Release(); + WriteLock.Release(); } } @@ -423,51 +415,17 @@ namespace MediaBrowser.Server.Implementations.Persistence return result; } - /// <summary> - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// </summary> - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - private readonly object _disposeLock = new object(); - - /// <summary> - /// Releases unmanaged and - optionally - managed resources. - /// </summary> - /// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> - protected virtual void Dispose(bool dispose) + protected override void CloseConnection() { - if (dispose) + if (_connection != null) { - try - { - lock (_disposeLock) - { - if (_shrinkMemoryTimer != null) - { - _shrinkMemoryTimer.Dispose(); - _shrinkMemoryTimer = null; - } - - if (_connection != null) - { - if (_connection.IsOpen()) - { - _connection.Close(); - } - - _connection.Dispose(); - _connection = null; - } - } - } - catch (Exception ex) + if (_connection.IsOpen()) { - _logger.ErrorException("Error disposing database", ex); + _connection.Close(); } + + _connection.Dispose(); + _connection = null; } } } diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index e063d44dc..c5a9db87b 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -130,12 +130,8 @@ namespace MediaBrowser.Server.Implementations.Persistence _mediaStreamsRepository.Initialize(); _chapterRepository.Initialize(); - - _shrinkMemoryTimer = new SqliteShrinkMemoryTimer(_connection, _writeLock, _logger); } - private SqliteShrinkMemoryTimer _shrinkMemoryTimer; - /// <summary> /// The _write lock /// </summary> @@ -430,12 +426,6 @@ namespace MediaBrowser.Server.Implementations.Persistence { lock (_disposeLock) { - if (_shrinkMemoryTimer != null) - { - _shrinkMemoryTimer.Dispose(); - _shrinkMemoryTimer = null; - } - _writeLock.Wait(); if (_connection != null) diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteMediaStreamsRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteMediaStreamsRepository.cs index 293da3f0f..994397624 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteMediaStreamsRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteMediaStreamsRepository.cs @@ -1,5 +1,4 @@ -using System.Globalization; -using MediaBrowser.Controller.Persistence; +using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using System; @@ -21,8 +20,6 @@ namespace MediaBrowser.Server.Implementations.Persistence private IDbCommand _deleteStreamsCommand; private IDbCommand _saveStreamCommand; - private SqliteShrinkMemoryTimer _shrinkMemoryTimer; - public SqliteMediaStreamsRepository(IDbConnection connection, ILogManager logManager) { _connection = connection; @@ -64,8 +61,6 @@ namespace MediaBrowser.Server.Implementations.Persistence AddRefFramesCommand(); PrepareStatements(); - - _shrinkMemoryTimer = new SqliteShrinkMemoryTimer(_connection, _writeLock, _logger); } private void AddPixelFormatColumnCommand() @@ -563,12 +558,6 @@ 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/SqliteProviderInfoRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteProviderInfoRepository.cs index 743d8fed6..bce33e834 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteProviderInfoRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteProviderInfoRepository.cs @@ -1,33 +1,28 @@ -using System.Text; -using MediaBrowser.Common.Configuration; +using MediaBrowser.Common.Configuration; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Logging; using System; using System.Data; using System.IO; using System.Linq; +using System.Text; using System.Threading; using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.Persistence { - public class SqliteProviderInfoRepository : IProviderRepository + public class SqliteProviderInfoRepository : BaseSqliteRepository, IProviderRepository { private IDbConnection _connection; - private readonly ILogger _logger; - private IDbCommand _saveStatusCommand; private readonly IApplicationPaths _appPaths; - public SqliteProviderInfoRepository(IApplicationPaths appPaths, ILogManager logManager) + public SqliteProviderInfoRepository(ILogManager logManager, IApplicationPaths appPaths) : base(logManager) { _appPaths = appPaths; - _logger = logManager.GetLogger(GetType().Name); } - private SqliteShrinkMemoryTimer _shrinkMemoryTimer; - /// <summary> /// Gets the name of the repository /// </summary> @@ -48,7 +43,7 @@ namespace MediaBrowser.Server.Implementations.Persistence { var dbFile = Path.Combine(_appPaths.DataPath, "refreshinfo.db"); - _connection = await SqliteExtensions.ConnectToDb(dbFile, _logger).ConfigureAwait(false); + _connection = await SqliteExtensions.ConnectToDb(dbFile, Logger).ConfigureAwait(false); string[] queries = { @@ -61,13 +56,11 @@ namespace MediaBrowser.Server.Implementations.Persistence "pragma shrink_memory" }; - _connection.RunQueries(queries, _logger); + _connection.RunQueries(queries, Logger); AddItemDateModifiedCommand(); PrepareStatements(); - - _shrinkMemoryTimer = new SqliteShrinkMemoryTimer(_connection, _writeLock, _logger); } private static readonly string[] StatusColumns = @@ -113,15 +106,10 @@ namespace MediaBrowser.Server.Implementations.Persistence builder.AppendLine("alter table MetadataStatus"); builder.AppendLine("add column ItemDateModified DateTime NULL"); - _connection.RunQueries(new[] { builder.ToString() }, _logger); + _connection.RunQueries(new[] { builder.ToString() }, Logger); } /// <summary> - /// The _write lock - /// </summary> - private readonly SemaphoreSlim _writeLock = new SemaphoreSlim(1, 1); - - /// <summary> /// Prepares the statements. /// </summary> private void PrepareStatements() @@ -227,7 +215,7 @@ namespace MediaBrowser.Server.Implementations.Persistence cancellationToken.ThrowIfCancellationRequested(); - await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false); + await WriteLock.WaitAsync(cancellationToken).ConfigureAwait(false); IDbTransaction transaction = null; @@ -264,7 +252,7 @@ namespace MediaBrowser.Server.Implementations.Persistence } catch (Exception e) { - _logger.ErrorException("Failed to save provider info:", e); + Logger.ErrorException("Failed to save provider info:", e); if (transaction != null) { @@ -280,55 +268,21 @@ namespace MediaBrowser.Server.Implementations.Persistence transaction.Dispose(); } - _writeLock.Release(); + WriteLock.Release(); } } - /// <summary> - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// </summary> - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - private readonly object _disposeLock = new object(); - - /// <summary> - /// Releases unmanaged and - optionally - managed resources. - /// </summary> - /// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> - protected virtual void Dispose(bool dispose) + protected override void CloseConnection() { - if (dispose) + if (_connection != null) { - try + if (_connection.IsOpen()) { - lock (_disposeLock) - { - if (_shrinkMemoryTimer != null) - { - _shrinkMemoryTimer.Dispose(); - _shrinkMemoryTimer = null; - } - - if (_connection != null) - { - if (_connection.IsOpen()) - { - _connection.Close(); - } - - _connection.Dispose(); - _connection = null; - } - } - } - catch (Exception ex) - { - _logger.ErrorException("Error disposing database", ex); + _connection.Close(); } + + _connection.Dispose(); + _connection = null; } } } diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteShrinkMemoryTimer.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteShrinkMemoryTimer.cs deleted file mode 100644 index b5a0c10b1..000000000 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteShrinkMemoryTimer.cs +++ /dev/null @@ -1,84 +0,0 @@ -using MediaBrowser.Model.Logging; -using System; -using System.Data; -using System.Threading; - -namespace MediaBrowser.Server.Implementations.Persistence -{ - class SqliteShrinkMemoryTimer : IDisposable - { - private Timer _shrinkMemoryTimer; - - private readonly SemaphoreSlim _writeLock; - private readonly ILogger _logger; - private readonly IDbConnection _connection; - - public SqliteShrinkMemoryTimer(IDbConnection connection, SemaphoreSlim writeLock, ILogger logger) - { - _connection = connection; - _writeLock = writeLock; - _logger = logger; - - _shrinkMemoryTimer = new Timer(TimerCallback, null, TimeSpan.FromMinutes(30), TimeSpan.FromMinutes(10)); - } - - private async void TimerCallback(object state) - { - await _writeLock.WaitAsync(CancellationToken.None).ConfigureAwait(false); - - IDbTransaction transaction = null; - - try - { - transaction = _connection.BeginTransaction(); - - using (var cmd = _connection.CreateCommand()) - { - cmd.Transaction = transaction; - cmd.CommandText = "pragma shrink_memory"; - cmd.ExecuteNonQuery(); - } - - transaction.Commit(); - } - catch (OperationCanceledException) - { - if (transaction != null) - { - transaction.Rollback(); - } - - throw; - } - catch (Exception e) - { - _logger.ErrorException("Failed to save items:", e); - - if (transaction != null) - { - transaction.Rollback(); - } - - throw; - } - finally - { - if (transaction != null) - { - transaction.Dispose(); - } - - _writeLock.Release(); - } - } - - public void Dispose() - { - if (_shrinkMemoryTimer != null) - { - _shrinkMemoryTimer.Dispose(); - _shrinkMemoryTimer = null; - } - } - } -} diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteUserDataRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteUserDataRepository.cs index 0f0488168..8b86d19a2 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteUserDataRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteUserDataRepository.cs @@ -11,13 +11,15 @@ using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.Persistence { - public class SqliteUserDataRepository : IUserDataRepository + public class SqliteUserDataRepository : BaseSqliteRepository, IUserDataRepository { - private readonly ILogger _logger; - - private readonly SemaphoreSlim _writeLock = new SemaphoreSlim(1, 1); - private IDbConnection _connection; + private readonly IApplicationPaths _appPaths; + + public SqliteUserDataRepository(ILogManager logManager, IApplicationPaths appPaths) : base(logManager) + { + _appPaths = appPaths; + } /// <summary> /// Gets the name of the repository @@ -32,32 +34,6 @@ namespace MediaBrowser.Server.Implementations.Persistence } /// <summary> - /// The _app paths - /// </summary> - private readonly IApplicationPaths _appPaths; - - /// <summary> - /// Initializes a new instance of the <see cref="SqliteUserDataRepository" /> class. - /// </summary> - /// <param name="appPaths">The app paths.</param> - /// <param name="logManager">The log manager.</param> - /// <exception cref="System.ArgumentNullException">jsonSerializer - /// or - /// appPaths</exception> - public SqliteUserDataRepository(IApplicationPaths appPaths, ILogManager logManager) - { - if (appPaths == null) - { - throw new ArgumentNullException("appPaths"); - } - - _appPaths = appPaths; - _logger = logManager.GetLogger(GetType().Name); - } - - private SqliteShrinkMemoryTimer _shrinkMemoryTimer; - - /// <summary> /// Opens the connection to the database /// </summary> /// <returns>Task.</returns> @@ -65,7 +41,7 @@ namespace MediaBrowser.Server.Implementations.Persistence { var dbFile = Path.Combine(_appPaths.DataPath, "userdata_v2.db"); - _connection = await SqliteExtensions.ConnectToDb(dbFile, _logger).ConfigureAwait(false); + _connection = await SqliteExtensions.ConnectToDb(dbFile, Logger).ConfigureAwait(false); string[] queries = { @@ -79,9 +55,7 @@ namespace MediaBrowser.Server.Implementations.Persistence "pragma shrink_memory" }; - _connection.RunQueries(queries, _logger); - - _shrinkMemoryTimer = new SqliteShrinkMemoryTimer(_connection, _writeLock, _logger); + _connection.RunQueries(queries, Logger); } /// <summary> @@ -143,7 +117,7 @@ namespace MediaBrowser.Server.Implementations.Persistence { cancellationToken.ThrowIfCancellationRequested(); - await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false); + await WriteLock.WaitAsync(cancellationToken).ConfigureAwait(false); IDbTransaction transaction = null; @@ -182,7 +156,7 @@ namespace MediaBrowser.Server.Implementations.Persistence } catch (Exception e) { - _logger.ErrorException("Failed to save user data:", e); + Logger.ErrorException("Failed to save user data:", e); if (transaction != null) { @@ -198,7 +172,7 @@ namespace MediaBrowser.Server.Implementations.Persistence transaction.Dispose(); } - _writeLock.Release(); + WriteLock.Release(); } } @@ -213,7 +187,7 @@ namespace MediaBrowser.Server.Implementations.Persistence { cancellationToken.ThrowIfCancellationRequested(); - await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false); + await WriteLock.WaitAsync(cancellationToken).ConfigureAwait(false); IDbTransaction transaction = null; @@ -257,7 +231,7 @@ namespace MediaBrowser.Server.Implementations.Persistence } catch (Exception e) { - _logger.ErrorException("Failed to save user data:", e); + Logger.ErrorException("Failed to save user data:", e); if (transaction != null) { @@ -273,7 +247,7 @@ namespace MediaBrowser.Server.Implementations.Persistence transaction.Dispose(); } - _writeLock.Release(); + WriteLock.Release(); } } @@ -379,51 +353,17 @@ namespace MediaBrowser.Server.Implementations.Persistence return userData; } - /// <summary> - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// </summary> - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - private readonly object _disposeLock = new object(); - - /// <summary> - /// Releases unmanaged and - optionally - managed resources. - /// </summary> - /// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> - protected virtual void Dispose(bool dispose) + protected override void CloseConnection() { - if (dispose) + if (_connection != null) { - try + if (_connection.IsOpen()) { - lock (_disposeLock) - { - if (_shrinkMemoryTimer != null) - { - _shrinkMemoryTimer.Dispose(); - _shrinkMemoryTimer = null; - } - - if (_connection != null) - { - if (_connection.IsOpen()) - { - _connection.Close(); - } - - _connection.Dispose(); - _connection = null; - } - } - } - catch (Exception ex) - { - _logger.ErrorException("Error disposing database", ex); + _connection.Close(); } + + _connection.Dispose(); + _connection = null; } } } diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteUserRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteUserRepository.cs index d97a55ae6..ad784ae5d 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteUserRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteUserRepository.cs @@ -15,14 +15,17 @@ namespace MediaBrowser.Server.Implementations.Persistence /// <summary> /// Class SQLiteUserRepository /// </summary> - public class SqliteUserRepository : IUserRepository + public class SqliteUserRepository : BaseSqliteRepository, IUserRepository { - private readonly ILogger _logger; - - private readonly SemaphoreSlim _writeLock = new SemaphoreSlim(1, 1); - private IDbConnection _connection; private readonly IServerApplicationPaths _appPaths; + private readonly IJsonSerializer _jsonSerializer; + + public SqliteUserRepository(ILogManager logManager, IServerApplicationPaths appPaths, IJsonSerializer jsonSerializer) : base(logManager) + { + _appPaths = appPaths; + _jsonSerializer = jsonSerializer; + } /// <summary> /// Gets the name of the repository @@ -37,32 +40,6 @@ namespace MediaBrowser.Server.Implementations.Persistence } /// <summary> - /// Gets the json serializer. - /// </summary> - /// <value>The json serializer.</value> - private readonly IJsonSerializer _jsonSerializer; - - /// <summary> - /// Initializes a new instance of the <see cref="SqliteUserRepository" /> class. - /// </summary> - /// <param name="jsonSerializer">The json serializer.</param> - /// <param name="logManager">The log manager.</param> - /// <param name="appPaths">The app paths.</param> - /// <exception cref="System.ArgumentNullException">appPaths</exception> - public SqliteUserRepository(IJsonSerializer jsonSerializer, ILogManager logManager, IServerApplicationPaths appPaths) - { - if (jsonSerializer == null) - { - throw new ArgumentNullException("jsonSerializer"); - } - - _jsonSerializer = jsonSerializer; - _appPaths = appPaths; - - _logger = logManager.GetLogger(GetType().Name); - } - - /// <summary> /// Opens the connection to the database /// </summary> /// <returns>Task.</returns> @@ -70,7 +47,7 @@ namespace MediaBrowser.Server.Implementations.Persistence { var dbFile = Path.Combine(_appPaths.DataPath, "users.db"); - _connection = await SqliteExtensions.ConnectToDb(dbFile, _logger).ConfigureAwait(false); + _connection = await SqliteExtensions.ConnectToDb(dbFile, Logger).ConfigureAwait(false); string[] queries = { @@ -84,7 +61,7 @@ namespace MediaBrowser.Server.Implementations.Persistence "pragma shrink_memory" }; - _connection.RunQueries(queries, _logger); + _connection.RunQueries(queries, Logger); } /// <summary> @@ -107,8 +84,8 @@ namespace MediaBrowser.Server.Implementations.Persistence cancellationToken.ThrowIfCancellationRequested(); - await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false); - + await WriteLock.WaitAsync(cancellationToken).ConfigureAwait(false); + IDbTransaction transaction = null; try @@ -139,7 +116,7 @@ namespace MediaBrowser.Server.Implementations.Persistence } catch (Exception e) { - _logger.ErrorException("Failed to save user:", e); + Logger.ErrorException("Failed to save user:", e); if (transaction != null) { @@ -155,7 +132,7 @@ namespace MediaBrowser.Server.Implementations.Persistence transaction.Dispose(); } - _writeLock.Release(); + WriteLock.Release(); } } @@ -199,7 +176,7 @@ namespace MediaBrowser.Server.Implementations.Persistence cancellationToken.ThrowIfCancellationRequested(); - await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false); + await WriteLock.WaitAsync(cancellationToken).ConfigureAwait(false); IDbTransaction transaction = null; @@ -231,7 +208,7 @@ namespace MediaBrowser.Server.Implementations.Persistence } catch (Exception e) { - _logger.ErrorException("Failed to delete user:", e); + Logger.ErrorException("Failed to delete user:", e); if (transaction != null) { @@ -247,49 +224,21 @@ namespace MediaBrowser.Server.Implementations.Persistence transaction.Dispose(); } - _writeLock.Release(); + WriteLock.Release(); } } - /// <summary> - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// </summary> - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - private readonly object _disposeLock = new object(); - - /// <summary> - /// Releases unmanaged and - optionally - managed resources. - /// </summary> - /// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> - protected virtual void Dispose(bool dispose) + protected override void CloseConnection() { - if (dispose) + if (_connection != null) { - try - { - lock (_disposeLock) - { - if (_connection != null) - { - if (_connection.IsOpen()) - { - _connection.Close(); - } - - _connection.Dispose(); - _connection = null; - } - } - } - catch (Exception ex) + if (_connection.IsOpen()) { - _logger.ErrorException("Error disposing database", ex); + _connection.Close(); } + + _connection.Dispose(); + _connection = null; } } } diff --git a/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs b/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs index be71a6408..bd22a8a70 100644 --- a/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs +++ b/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs @@ -191,6 +191,8 @@ namespace MediaBrowser.Server.Implementations.Photos throw new ArgumentException("Unexpected image type"); } + private const int MaxImageAgeDays = 7; + public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date) { if (!Supports(item)) @@ -198,6 +200,11 @@ namespace MediaBrowser.Server.Implementations.Photos return false; } + if (item is UserView) + { + return HasChanged(item, ImageType.Primary) || HasChanged(item, ImageType.Thumb); + } + var items = GetItemsWithImages(item).Result; var cacheKey = GetConfigurationCacheKey(items, item.Name); @@ -216,7 +223,6 @@ namespace MediaBrowser.Server.Implementations.Photos } var currentPathCacheKey = (Path.GetFileNameWithoutExtension(image.Path) ?? string.Empty).Split('_').LastOrDefault(); - if (string.Equals(cacheKey, currentPathCacheKey, StringComparison.OrdinalIgnoreCase)) { return false; @@ -226,6 +232,27 @@ namespace MediaBrowser.Server.Implementations.Photos return true; } + protected bool HasChanged(IHasImages item, ImageType type) + { + var image = item.GetImageInfo(type, 0); + + if (image != null) + { + if (!FileSystem.ContainsSubPath(item.GetInternalMetadataPath(), image.Path)) + { + return false; + } + + var age = DateTime.UtcNow - image.DateModified; + if (age.TotalDays <= MaxImageAgeDays) + { + return false; + } + } + + return true; + } + protected List<BaseItem> GetFinalItems(List<BaseItem> items) { return GetFinalItems(items, 4); @@ -234,7 +261,7 @@ namespace MediaBrowser.Server.Implementations.Photos protected virtual List<BaseItem> GetFinalItems(List<BaseItem> items, int limit) { // Rotate the images once every x days - var random = DateTime.Now.DayOfYear % 7; + var random = DateTime.Now.DayOfYear % MaxImageAgeDays; return items .OrderBy(i => (random + "" + items.IndexOf(i)).GetMD5()) diff --git a/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs b/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs index 8c142b646..f04c0bf77 100644 --- a/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs +++ b/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs @@ -11,7 +11,8 @@ namespace MediaBrowser.Server.Implementations.Photos { //public class PhotoAlbumImageProvider : BaseDynamicImageProvider<PhotoAlbum> //{ - // public PhotoAlbumImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor) : base(fileSystem, providerManager, applicationPaths, imageProcessor) + // public PhotoAlbumImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor) + // : base(fileSystem, providerManager, applicationPaths, imageProcessor) // { // } diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 112778ec8..757e6938a 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -1550,7 +1550,7 @@ namespace MediaBrowser.Server.Implementations.Session if (info.PrimaryImageTag == null) { - var album = audio.Parents.OfType<MusicAlbum>().FirstOrDefault(); + var album = audio.AlbumEntity; if (album != null && album.HasImage(ImageType.Primary)) { diff --git a/MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs b/MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs index 93a9bc8f6..930762696 100644 --- a/MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs +++ b/MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs @@ -21,13 +21,11 @@ namespace MediaBrowser.Server.Implementations.UserViews public class DynamicImageProvider : BaseDynamicImageProvider<UserView> { private readonly IUserManager _userManager; - private readonly ILibraryManager _libraryManager; - public DynamicImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor, IUserManager userManager, ILibraryManager libraryManager) + public DynamicImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor, IUserManager userManager) : base(fileSystem, providerManager, applicationPaths, imageProcessor) { _userManager = userManager; - _libraryManager = libraryManager; } public override IEnumerable<ImageType> GetSupportedImages(IHasImages item) @@ -122,7 +120,7 @@ namespace MediaBrowser.Server.Implementations.UserViews var audio = i as Audio; if (audio != null) { - var album = audio.FindParent<MusicAlbum>(); + var album = audio.AlbumEntity; if (album != null && album.HasImage(ImageType.Primary)) { return album; diff --git a/MediaBrowser.Server.Implementations/packages.config b/MediaBrowser.Server.Implementations/packages.config index 7fb369106..0b81c1866 100644 --- a/MediaBrowser.Server.Implementations/packages.config +++ b/MediaBrowser.Server.Implementations/packages.config @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Interfaces.IO" version="1.0.0.5" targetFramework="net45" />
- <package id="MediaBrowser.Naming" version="1.0.0.34" targetFramework="net45" />
+ <package id="MediaBrowser.Naming" version="1.0.0.35" targetFramework="net45" />
<package id="Mono.Nat" version="1.2.24.0" targetFramework="net45" />
<package id="morelinq" version="1.1.0" targetFramework="net45" />
<package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" />
- <package id="SocketHttpListener" version="1.0.0.5" targetFramework="net45" />
+ <package id="SocketHttpListener" version="1.0.0.6" targetFramework="net45" />
</packages>
\ No newline at end of file |
