From 9f4407028bc5e4b42ac417b16a261d3e90b0e7c0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 1 May 2015 14:37:01 -0400 Subject: update photo resolving --- .../Photos/PhotoAlbumImageProvider.cs | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs b/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs index 8c142b646a..b55c76b8f8 100644 --- a/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs +++ b/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs @@ -9,18 +9,19 @@ using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.Photos { - //public class PhotoAlbumImageProvider : BaseDynamicImageProvider - //{ - // public PhotoAlbumImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor) : base(fileSystem, providerManager, applicationPaths, imageProcessor) - // { - // } + public class PhotoAlbumImageProvider : BaseDynamicImageProvider + { + public PhotoAlbumImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor) + : base(fileSystem, providerManager, applicationPaths, imageProcessor) + { + } - // protected override Task> GetItemsWithImages(IHasImages item) - // { - // var photoAlbum = (PhotoAlbum)item; - // var items = GetFinalItems(photoAlbum.Children.ToList()); + protected override Task> GetItemsWithImages(IHasImages item) + { + var photoAlbum = (PhotoAlbum)item; + var items = GetFinalItems(photoAlbum.Children.ToList()); - // return Task.FromResult(items); - // } - //} + return Task.FromResult(items); + } + } } -- cgit v1.2.3 From ee2fbf59d02cb63eed15e22e74d3f1dc9981eb37 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 2 May 2015 18:43:56 -0400 Subject: remove shrink mem timer --- .../MediaBrowser.Server.Implementations.csproj | 1 - .../Persistence/SqliteChapterRepository.cs | 10 --- .../SqliteFileOrganizationRepository.cs | 9 --- .../Persistence/SqliteItemRepository.cs | 10 --- .../Persistence/SqliteMediaStreamsRepository.cs | 13 +--- .../Persistence/SqliteProviderInfoRepository.cs | 10 --- .../Persistence/SqliteShrinkMemoryTimer.cs | 84 ---------------------- .../Persistence/SqliteUserDataRepository.cs | 10 --- 8 files changed, 1 insertion(+), 146 deletions(-) delete mode 100644 MediaBrowser.Server.Implementations/Persistence/SqliteShrinkMemoryTimer.cs (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index 9e7810c761..519b0f49c0 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -242,7 +242,6 @@ - diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteChapterRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteChapterRepository.cs index 77b9932059..075ef42398 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; - /// /// Opens the connection to the database /// @@ -54,8 +52,6 @@ namespace MediaBrowser.Server.Implementations.Persistence _connection.RunQueries(queries, _logger); PrepareStatements(); - - _shrinkMemoryTimer = new SqliteShrinkMemoryTimer(_connection, _writeLock, _logger); } /// @@ -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/SqliteFileOrganizationRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteFileOrganizationRepository.cs index 5d5855bf8b..b2a0004b42 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteFileOrganizationRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteFileOrganizationRepository.cs @@ -21,7 +21,6 @@ namespace MediaBrowser.Server.Implementations.Persistence 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"); @@ -61,8 +60,6 @@ namespace MediaBrowser.Server.Implementations.Persistence _connection.RunQueries(queries, _logger); PrepareStatements(); - - _shrinkMemoryTimer = new SqliteShrinkMemoryTimer(_connection, _writeLock, _logger); } private void PrepareStatements() @@ -446,12 +443,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/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index e063d44dc6..c5a9db87bf 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; - /// /// The _write lock /// @@ -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 293da3f0f9..9943976243 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 743d8fed6b..62f63395ab 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteProviderInfoRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteProviderInfoRepository.cs @@ -26,8 +26,6 @@ namespace MediaBrowser.Server.Implementations.Persistence _logger = logManager.GetLogger(GetType().Name); } - private SqliteShrinkMemoryTimer _shrinkMemoryTimer; - /// /// Gets the name of the repository /// @@ -66,8 +64,6 @@ namespace MediaBrowser.Server.Implementations.Persistence AddItemDateModifiedCommand(); PrepareStatements(); - - _shrinkMemoryTimer = new SqliteShrinkMemoryTimer(_connection, _writeLock, _logger); } private static readonly string[] StatusColumns = @@ -307,12 +303,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/SqliteShrinkMemoryTimer.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteShrinkMemoryTimer.cs deleted file mode 100644 index b5a0c10b1e..0000000000 --- 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 0f04881684..786c77605f 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteUserDataRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteUserDataRepository.cs @@ -55,8 +55,6 @@ namespace MediaBrowser.Server.Implementations.Persistence _logger = logManager.GetLogger(GetType().Name); } - private SqliteShrinkMemoryTimer _shrinkMemoryTimer; - /// /// Opens the connection to the database /// @@ -80,8 +78,6 @@ namespace MediaBrowser.Server.Implementations.Persistence }; _connection.RunQueries(queries, _logger); - - _shrinkMemoryTimer = new SqliteShrinkMemoryTimer(_connection, _writeLock, _logger); } /// @@ -402,12 +398,6 @@ namespace MediaBrowser.Server.Implementations.Persistence { lock (_disposeLock) { - if (_shrinkMemoryTimer != null) - { - _shrinkMemoryTimer.Dispose(); - _shrinkMemoryTimer = null; - } - if (_connection != null) { if (_connection.IsOpen()) -- cgit v1.2.3 From ae99233759749494c911b0c0aa2114df5a78b3a2 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 2 May 2015 18:59:01 -0400 Subject: rework repo disposal --- .../MediaBrowser.Server.Implementations.csproj | 1 + .../Persistence/BaseSqliteRepository.cs | 56 ++++++++++++ .../SqliteDisplayPreferencesRepository.cs | 96 +++++---------------- .../SqliteFileOrganizationRepository.cs | 73 +++++----------- .../Persistence/SqliteProviderInfoRepository.cs | 70 ++++----------- .../Persistence/SqliteUserDataRepository.cs | 94 +++++--------------- .../Persistence/SqliteUserRepository.cs | 99 ++++++---------------- .../ApplicationHost.cs | 8 +- 8 files changed, 165 insertions(+), 332 deletions(-) create mode 100644 MediaBrowser.Server.Implementations/Persistence/BaseSqliteRepository.cs (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index 519b0f49c0..0bbea3acc7 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -226,6 +226,7 @@ + diff --git a/MediaBrowser.Server.Implementations/Persistence/BaseSqliteRepository.cs b/MediaBrowser.Server.Implementations/Persistence/BaseSqliteRepository.cs new file mode 100644 index 0000000000..15d76fb603 --- /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(); + + /// + /// Releases unmanaged and - optionally - managed resources. + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + 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/SqliteDisplayPreferencesRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteDisplayPreferencesRepository.cs index 3dfa747273..c9ab43e63e 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteDisplayPreferencesRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteDisplayPreferencesRepository.cs @@ -16,11 +16,15 @@ namespace MediaBrowser.Server.Implementations.Persistence /// /// Class SQLiteDisplayPreferencesRepository /// - 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; + } /// /// Gets the name of the repository @@ -44,36 +48,6 @@ namespace MediaBrowser.Server.Implementations.Persistence /// private readonly IApplicationPaths _appPaths; - private readonly SemaphoreSlim _writeLock = new SemaphoreSlim(1, 1); - - /// - /// Initializes a new instance of the class. - /// - /// The app paths. - /// The json serializer. - /// The log manager. - /// - /// jsonSerializer - /// or - /// appPaths - /// - 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); - } - /// /// Opens the connection to the database /// @@ -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); } /// @@ -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 } } - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public void Dispose() + protected override void CloseConnection() { - Dispose(true); - GC.SuppressFinalize(this); - } - - private readonly object _disposeLock = new object(); - - /// - /// Releases unmanaged and - optionally - managed resources. - /// - /// true to release both managed and unmanaged resources; false to release only unmanaged resources. - 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 b2a0004b42..2d5aad04df 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteFileOrganizationRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteFileOrganizationRepository.cs @@ -14,13 +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 readonly IServerApplicationPaths _appPaths; private readonly CultureInfo _usCulture = new CultureInfo("en-US"); @@ -29,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); } /// @@ -44,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 = { @@ -57,7 +52,7 @@ namespace MediaBrowser.Server.Implementations.Persistence "pragma shrink_memory" }; - _connection.RunQueries(queries, _logger); + _connection.RunQueries(queries, Logger); PrepareStatements(); } @@ -100,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; @@ -142,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) { @@ -158,7 +153,7 @@ namespace MediaBrowser.Server.Implementations.Persistence transaction.Dispose(); } - _writeLock.Release(); + WriteLock.Release(); } } @@ -169,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; @@ -196,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) { @@ -212,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; @@ -243,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) { @@ -259,7 +254,7 @@ namespace MediaBrowser.Server.Implementations.Persistence transaction.Dispose(); } - _writeLock.Release(); + WriteLock.Release(); } } @@ -420,45 +415,17 @@ namespace MediaBrowser.Server.Implementations.Persistence return result; } - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public void Dispose() + protected override void CloseConnection() { - Dispose(true); - GC.SuppressFinalize(this); - } - - private readonly object _disposeLock = new object(); - - /// - /// Releases unmanaged and - optionally - managed resources. - /// - /// true to release both managed and unmanaged resources; false to release only unmanaged resources. - 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/SqliteProviderInfoRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteProviderInfoRepository.cs index 62f63395ab..bce33e834d 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteProviderInfoRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteProviderInfoRepository.cs @@ -1,29 +1,26 @@ -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); } /// @@ -46,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 = { @@ -59,7 +56,7 @@ namespace MediaBrowser.Server.Implementations.Persistence "pragma shrink_memory" }; - _connection.RunQueries(queries, _logger); + _connection.RunQueries(queries, Logger); AddItemDateModifiedCommand(); @@ -109,14 +106,9 @@ 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); } - /// - /// The _write lock - /// - private readonly SemaphoreSlim _writeLock = new SemaphoreSlim(1, 1); - /// /// Prepares the statements. /// @@ -223,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; @@ -260,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) { @@ -276,49 +268,21 @@ namespace MediaBrowser.Server.Implementations.Persistence transaction.Dispose(); } - _writeLock.Release(); + WriteLock.Release(); } } - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - private readonly object _disposeLock = new object(); - - /// - /// Releases unmanaged and - optionally - managed resources. - /// - /// true to release both managed and unmanaged resources; false to release only unmanaged resources. - protected virtual void Dispose(bool dispose) + protected override void CloseConnection() { - 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/SqliteUserDataRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteUserDataRepository.cs index 786c77605f..8b86d19a2f 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; + } /// /// Gets the name of the repository @@ -31,30 +33,6 @@ namespace MediaBrowser.Server.Implementations.Persistence } } - /// - /// The _app paths - /// - private readonly IApplicationPaths _appPaths; - - /// - /// Initializes a new instance of the class. - /// - /// The app paths. - /// The log manager. - /// jsonSerializer - /// or - /// appPaths - public SqliteUserDataRepository(IApplicationPaths appPaths, ILogManager logManager) - { - if (appPaths == null) - { - throw new ArgumentNullException("appPaths"); - } - - _appPaths = appPaths; - _logger = logManager.GetLogger(GetType().Name); - } - /// /// Opens the connection to the database /// @@ -63,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 = { @@ -77,7 +55,7 @@ namespace MediaBrowser.Server.Implementations.Persistence "pragma shrink_memory" }; - _connection.RunQueries(queries, _logger); + _connection.RunQueries(queries, Logger); } /// @@ -139,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; @@ -178,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) { @@ -194,7 +172,7 @@ namespace MediaBrowser.Server.Implementations.Persistence transaction.Dispose(); } - _writeLock.Release(); + WriteLock.Release(); } } @@ -209,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; @@ -253,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) { @@ -269,7 +247,7 @@ namespace MediaBrowser.Server.Implementations.Persistence transaction.Dispose(); } - _writeLock.Release(); + WriteLock.Release(); } } @@ -375,45 +353,17 @@ namespace MediaBrowser.Server.Implementations.Persistence return userData; } - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public void Dispose() + protected override void CloseConnection() { - Dispose(true); - GC.SuppressFinalize(this); - } - - private readonly object _disposeLock = new object(); - - /// - /// Releases unmanaged and - optionally - managed resources. - /// - /// true to release both managed and unmanaged resources; false to release only unmanaged resources. - protected virtual void Dispose(bool dispose) - { - 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/Persistence/SqliteUserRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteUserRepository.cs index d97a55ae64..ad784ae5d6 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteUserRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteUserRepository.cs @@ -15,14 +15,17 @@ namespace MediaBrowser.Server.Implementations.Persistence /// /// Class SQLiteUserRepository /// - 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; + } /// /// Gets the name of the repository @@ -36,32 +39,6 @@ namespace MediaBrowser.Server.Implementations.Persistence } } - /// - /// Gets the json serializer. - /// - /// The json serializer. - private readonly IJsonSerializer _jsonSerializer; - - /// - /// Initializes a new instance of the class. - /// - /// The json serializer. - /// The log manager. - /// The app paths. - /// appPaths - public SqliteUserRepository(IJsonSerializer jsonSerializer, ILogManager logManager, IServerApplicationPaths appPaths) - { - if (jsonSerializer == null) - { - throw new ArgumentNullException("jsonSerializer"); - } - - _jsonSerializer = jsonSerializer; - _appPaths = appPaths; - - _logger = logManager.GetLogger(GetType().Name); - } - /// /// Opens the connection to the database /// @@ -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); } /// @@ -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(); } } - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - private readonly object _disposeLock = new object(); - - /// - /// Releases unmanaged and - optionally - managed resources. - /// - /// true to release both managed and unmanaged resources; false to release only unmanaged resources. - 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.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index c9a2d3f22c..4c25c968cf 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs @@ -392,13 +392,13 @@ namespace MediaBrowser.Server.Startup.Common UserRepository = await GetUserRepository().ConfigureAwait(false); RegisterSingleInstance(UserRepository); - DisplayPreferencesRepository = new SqliteDisplayPreferencesRepository(ApplicationPaths, JsonSerializer, LogManager); + DisplayPreferencesRepository = new SqliteDisplayPreferencesRepository(LogManager, JsonSerializer, ApplicationPaths); RegisterSingleInstance(DisplayPreferencesRepository); ItemRepository = new SqliteItemRepository(ApplicationPaths, JsonSerializer, LogManager); RegisterSingleInstance(ItemRepository); - ProviderRepository = new SqliteProviderInfoRepository(ApplicationPaths, LogManager); + ProviderRepository = new SqliteProviderInfoRepository(LogManager, ApplicationPaths); RegisterSingleInstance(ProviderRepository); FileOrganizationRepository = await GetFileOrganizationRepository().ConfigureAwait(false); @@ -614,7 +614,7 @@ namespace MediaBrowser.Server.Startup.Common /// Task{IUserRepository}. private async Task GetUserRepository() { - var repo = new SqliteUserRepository(JsonSerializer, LogManager, ApplicationPaths); + var repo = new SqliteUserRepository(LogManager, ApplicationPaths, JsonSerializer); await repo.Initialize().ConfigureAwait(false); @@ -704,7 +704,7 @@ namespace MediaBrowser.Server.Startup.Common /// Task. private async Task ConfigureUserDataRepositories() { - var repo = new SqliteUserDataRepository(ApplicationPaths, LogManager); + var repo = new SqliteUserDataRepository(LogManager, ApplicationPaths); await repo.Initialize().ConfigureAwait(false); -- cgit v1.2.3 From d34ddf3ebde6685f336382c0e475c49677469492 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 2 May 2015 19:08:02 -0400 Subject: adjust top left menu --- .../Photos/PhotoAlbumImageProvider.cs | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs b/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs index b55c76b8f8..f04c0bf770 100644 --- a/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs +++ b/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs @@ -9,19 +9,19 @@ using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.Photos { - public class PhotoAlbumImageProvider : BaseDynamicImageProvider - { - public PhotoAlbumImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor) - : base(fileSystem, providerManager, applicationPaths, imageProcessor) - { - } + //public class PhotoAlbumImageProvider : BaseDynamicImageProvider + //{ + // public PhotoAlbumImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor) + // : base(fileSystem, providerManager, applicationPaths, imageProcessor) + // { + // } - protected override Task> GetItemsWithImages(IHasImages item) - { - var photoAlbum = (PhotoAlbum)item; - var items = GetFinalItems(photoAlbum.Children.ToList()); + // protected override Task> GetItemsWithImages(IHasImages item) + // { + // var photoAlbum = (PhotoAlbum)item; + // var items = GetFinalItems(photoAlbum.Children.ToList()); - return Task.FromResult(items); - } - } + // return Task.FromResult(items); + // } + //} } -- cgit v1.2.3 From a38f04b1b95aa8c80b51590bfaefbdf28819d029 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 4 May 2015 10:35:38 -0400 Subject: added headroom scrolling --- MediaBrowser.Api/Images/ImageService.cs | 4 +- MediaBrowser.Api/Library/LibraryService.cs | 53 +--------------------- MediaBrowser.Controller/Entities/Audio/Audio.cs | 38 ++++------------ .../Entities/Audio/MusicAlbum.cs | 47 ------------------- MediaBrowser.Controller/Entities/BaseItem.cs | 34 +------------- MediaBrowser.Controller/Entities/TV/Episode.cs | 23 ---------- MediaBrowser.Controller/Entities/TV/Season.cs | 44 +----------------- MediaBrowser.Controller/Entities/TV/Series.cs | 13 ------ .../Profiles/SonyBravia2010Profile.cs | 6 +++ .../Profiles/SonyBravia2011Profile.cs | 6 +++ .../Profiles/SonyBravia2012Profile.cs | 6 +++ .../Profiles/SonyBravia2013Profile.cs | 6 +++ .../MediaInfo/AudioImageProvider.cs | 2 +- .../Dto/DtoService.cs | 11 +---- .../IO/LibraryMonitor.cs | 2 +- .../Session/SessionManager.cs | 2 +- .../UserViews/DynamicImageProvider.cs | 2 +- MediaBrowser.WebDashboard/Api/PackageCreator.cs | 2 + .../MediaBrowser.WebDashboard.csproj | 3 ++ 19 files changed, 47 insertions(+), 257 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs index 7da11a405c..639c1f54b0 100644 --- a/MediaBrowser.Api/Images/ImageService.cs +++ b/MediaBrowser.Api/Images/ImageService.cs @@ -648,10 +648,8 @@ namespace MediaBrowser.Api.Images var serverFormats = _imageProcessor.GetSupportedImageOutputFormats(); - var clientFormats = GetClientSupportedFormats(); - if (serverFormats.Contains(ImageFormat.Webp) && - clientFormats.Contains(ImageFormat.Webp)) + GetClientSupportedFormats().Contains(ImageFormat.Webp)) { return ImageFormat.Webp; } diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs index f89a703406..269f4cb201 100644 --- a/MediaBrowser.Api/Library/LibraryService.cs +++ b/MediaBrowser.Api/Library/LibraryService.cs @@ -617,36 +617,14 @@ namespace MediaBrowser.Api.Library : (Folder)_libraryManager.RootFolder) : _libraryManager.GetItemById(request.Id); - var originalItem = item; - while (GetThemeSongIds(item).Count == 0 && request.InheritFromParent && item.Parent != null) { item = item.Parent; } - var themeSongIds = GetThemeSongIds(item); - - if (themeSongIds.Count == 0 && request.InheritFromParent) - { - var album = originalItem as MusicAlbum; - - if (album != null) - { - var linkedItemWithThemes = album.SoundtrackIds - .Select(i => _libraryManager.GetItemById(i)) - .FirstOrDefault(i => GetThemeSongIds(i).Count > 0); - - if (linkedItemWithThemes != null) - { - themeSongIds = GetThemeSongIds(linkedItemWithThemes); - item = linkedItemWithThemes; - } - } - } - var dtoOptions = GetDtoOptions(request); - var dtos = themeSongIds.Select(_libraryManager.GetItemById) + var dtos = GetThemeSongIds(item).Select(_libraryManager.GetItemById) .OrderBy(i => i.SortName) .Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user, item)); @@ -682,41 +660,14 @@ namespace MediaBrowser.Api.Library : (Folder)_libraryManager.RootFolder) : _libraryManager.GetItemById(request.Id); - var originalItem = item; - while (GetThemeVideoIds(item).Count == 0 && request.InheritFromParent && item.Parent != null) { item = item.Parent; } - var themeVideoIds = GetThemeVideoIds(item); - - if (themeVideoIds.Count == 0 && request.InheritFromParent) - { - var album = originalItem as MusicAlbum; - - if (album == null) - { - album = originalItem.Parents.OfType().FirstOrDefault(); - } - - if (album != null) - { - var linkedItemWithThemes = album.SoundtrackIds - .Select(i => _libraryManager.GetItemById(i)) - .FirstOrDefault(i => GetThemeVideoIds(i).Count > 0); - - if (linkedItemWithThemes != null) - { - themeVideoIds = GetThemeVideoIds(linkedItemWithThemes); - item = linkedItemWithThemes; - } - } - } - var dtoOptions = GetDtoOptions(request); - var dtos = themeVideoIds.Select(_libraryManager.GetItemById) + var dtos = GetThemeVideoIds(item).Select(_libraryManager.GetItemById) .OrderBy(i => i.SortName) .Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user, item)); diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index 100633d7ff..623329ca66 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -52,34 +52,6 @@ namespace MediaBrowser.Controller.Entities.Audio /// true if this instance has embedded image; otherwise, false. public bool HasEmbeddedImage { get; set; } - /// - /// Override this to true if class should be grouped under a container in indicies - /// The container class should be defined via IndexContainer - /// - /// true if [group in index]; otherwise, false. - [IgnoreDataMember] - public override bool GroupInIndex - { - get - { - return true; - } - } - - /// - /// Override this to return the folder that should be used to construct a container - /// for this item in an index. GroupInIndex should be true as well. - /// - /// The index container. - [IgnoreDataMember] - public override Folder IndexContainer - { - get - { - return LatestItemsIndexContainer ?? new MusicAlbum { Name = "Unknown Album" }; - } - } - [IgnoreDataMember] protected override bool SupportsOwnedItems { @@ -94,7 +66,7 @@ namespace MediaBrowser.Controller.Entities.Audio { get { - return Parents.OfType().FirstOrDefault(); + return AlbumEntity; } } @@ -148,6 +120,12 @@ namespace MediaBrowser.Controller.Entities.Audio /// The album. public string Album { get; set; } + [IgnoreDataMember] + public MusicAlbum AlbumEntity + { + get { return FindParent(); } + } + /// /// Gets the type of the media. /// @@ -177,7 +155,7 @@ namespace MediaBrowser.Controller.Entities.Audio /// System.String. protected override string CreateUserDataKey() { - var parent = FindParent(); + var parent = AlbumEntity; if (parent != null) { diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs index dc3f13b01d..c060f53a69 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -2,7 +2,6 @@ using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Users; -using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; @@ -14,11 +13,8 @@ namespace MediaBrowser.Controller.Entities.Audio /// public class MusicAlbum : Folder, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasLookupInfo { - public List SoundtrackIds { get; set; } - public MusicAlbum() { - SoundtrackIds = new List(); Artists = new List(); AlbumArtists = new List(); } @@ -77,49 +73,6 @@ namespace MediaBrowser.Controller.Entities.Audio return Tracks; } - /// - /// Songs will group into us so don't also include us in the index - /// - /// true if [include in index]; otherwise, false. - [IgnoreDataMember] - public override bool IncludeInIndex - { - get - { - return false; - } - } - - /// - /// Override this to true if class should be grouped under a container in indicies - /// The container class should be defined via IndexContainer - /// - /// true if [group in index]; otherwise, false. - [IgnoreDataMember] - public override bool GroupInIndex - { - get - { - return true; - } - } - - /// - /// The unknwon artist - /// - private static readonly MusicArtist UnknwonArtist = new MusicArtist { Name = "" }; - - /// - /// Override this to return the folder that should be used to construct a container - /// for this item in an index. GroupInIndex should be true as well. - /// - /// The index container. - [IgnoreDataMember] - public override Folder IndexContainer - { - get { return Parent as MusicArtist ?? UnknwonArtist; } - } - public List Artists { get; set; } /// diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 3313f45fd1..bbc3b6fd31 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -496,7 +496,7 @@ namespace MediaBrowser.Controller.Entities /// /// /// ``0. - public T FindParent() + protected T FindParent() where T : Folder { return Parents.OfType().FirstOrDefault(); @@ -906,38 +906,6 @@ namespace MediaBrowser.Controller.Entities /// The provider ids. public Dictionary ProviderIds { get; set; } - /// - /// Override this to false if class should be ignored for indexing purposes - /// - /// true if [include in index]; otherwise, false. - [IgnoreDataMember] - public virtual bool IncludeInIndex - { - get { return true; } - } - - /// - /// Override this to true if class should be grouped under a container in indicies - /// The container class should be defined via IndexContainer - /// - /// true if [group in index]; otherwise, false. - [IgnoreDataMember] - public virtual bool GroupInIndex - { - get { return false; } - } - - /// - /// Override this to return the folder that should be used to construct a container - /// for this item in an index. GroupInIndex should be true as well. - /// - /// The index container. - [IgnoreDataMember] - public virtual Folder IndexContainer - { - get { return null; } - } - [IgnoreDataMember] public virtual Folder LatestItemsIndexContainer { diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index c8408365d3..8f5b8f6cff 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -45,16 +45,6 @@ namespace MediaBrowser.Controller.Entities.TV /// The index number. public int? IndexNumberEnd { get; set; } - /// - /// We want to group into series not show individually in an index - /// - /// true if [group in index]; otherwise, false. - [IgnoreDataMember] - public override bool GroupInIndex - { - get { return true; } - } - [IgnoreDataMember] protected override bool SupportsOwnedItems { @@ -91,19 +81,6 @@ namespace MediaBrowser.Controller.Entities.TV } } - /// - /// We roll up into series - /// - /// The index container. - [IgnoreDataMember] - public override Folder IndexContainer - { - get - { - return Season; - } - } - [IgnoreDataMember] public override Folder LatestItemsIndexContainer { diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs index a99b8c659a..cfd6b46e0f 100644 --- a/MediaBrowser.Controller/Entities/TV/Season.cs +++ b/MediaBrowser.Controller/Entities/TV/Season.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Controller.Localization; -using MediaBrowser.Controller.Providers; +using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; using MediaBrowser.Model.Users; @@ -15,20 +14,6 @@ namespace MediaBrowser.Controller.Entities.TV /// public class Season : Folder, IHasSeries, IHasLookupInfo { - - /// - /// Seasons are just containers - /// - /// true if [include in index]; otherwise, false. - [IgnoreDataMember] - public override bool IncludeInIndex - { - get - { - return false; - } - } - [IgnoreDataMember] public override bool SupportsAddingToPlaylist { @@ -50,33 +35,6 @@ namespace MediaBrowser.Controller.Entities.TV get { return Series ?? Parent; } } - /// - /// We want to group into our Series - /// - /// true if [group in index]; otherwise, false. - [IgnoreDataMember] - public override bool GroupInIndex - { - get - { - return true; - } - } - - /// - /// Override this to return the folder that should be used to construct a container - /// for this item in an index. GroupInIndex should be true as well. - /// - /// The index container. - [IgnoreDataMember] - public override Folder IndexContainer - { - get - { - return Series; - } - } - // Genre, Rating and Stuido will all be the same protected override IEnumerable GetIndexByOptions() { diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index 4696afeb62..2663d19e8f 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -94,19 +94,6 @@ namespace MediaBrowser.Controller.Entities.TV } } - /// - /// Series aren't included directly in indices - Their Episodes will roll up to them - /// - /// true if [include in index]; otherwise, false. - [IgnoreDataMember] - public override bool IncludeInIndex - { - get - { - return false; - } - } - /// /// Gets the user data key. /// diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs index 71f8772325..78e90af26e 100644 --- a/MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs +++ b/MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs @@ -293,6 +293,12 @@ namespace MediaBrowser.Dlna.Profiles Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.Height, Value = "1080" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.VideoFramerate, + Value = "30" } } }, diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs index 0b157ae336..b435c63642 100644 --- a/MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs +++ b/MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs @@ -310,6 +310,12 @@ namespace MediaBrowser.Dlna.Profiles Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.Height, Value = "1080" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.VideoFramerate, + Value = "30" } } }, diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs index 0d974cbc0e..b0cbb0970d 100644 --- a/MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs +++ b/MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs @@ -250,6 +250,12 @@ namespace MediaBrowser.Dlna.Profiles Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.Height, Value = "1080" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.VideoFramerate, + Value = "30" } } }, diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs index ac4cb21312..ca4e802a16 100644 --- a/MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs +++ b/MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs @@ -284,6 +284,12 @@ namespace MediaBrowser.Dlna.Profiles Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.Height, Value = "1080" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.VideoFramerate, + Value = "30" } } } diff --git a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs index 99be102f85..bd83862a8a 100644 --- a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs @@ -93,7 +93,7 @@ namespace MediaBrowser.Providers.MediaInfo private string GetAudioImagePath(Audio item) { - var album = item.Parent as MusicAlbum; + var album = item.AlbumEntity; var filename = item.Album ?? string.Empty; filename += string.Join(",", item.Artists.ToArray()); diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index 402bd4d985..1b55f47d5e 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(); + 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 d501d1210b..5f63a8d08a 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); diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 112778ec8a..757e6938ad 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().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 93a9bc8f6f..8bbc746cb3 100644 --- a/MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs +++ b/MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs @@ -122,7 +122,7 @@ namespace MediaBrowser.Server.Implementations.UserViews var audio = i as Audio; if (audio != null) { - var album = audio.FindParent(); + var album = audio.AlbumEntity; if (album != null && album.HasImage(ImageType.Primary)) { return album; diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs index 26f2f8babd..6c812acce0 100644 --- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs +++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs @@ -281,6 +281,8 @@ namespace MediaBrowser.WebDashboard.Api await AppendResource(memoryStream, "thirdparty/jstree3.0.8/jstree.js", newLineBytes).ConfigureAwait(false); + await AppendResource(memoryStream, "thirdparty/headroom.js", newLineBytes).ConfigureAwait(false); + await AppendLocalization(memoryStream, culture).ConfigureAwait(false); await memoryStream.WriteAsync(newLineBytes, 0, newLineBytes.Length).ConfigureAwait(false); diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 5c4aab1e4f..0da2d56606 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -999,6 +999,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest -- cgit v1.2.3 From 923899fcce9ff8890ebfd55718c51280ca61aa1e Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 4 May 2015 13:44:25 -0400 Subject: adjust debug logging --- MediaBrowser.Api/Playback/BaseStreamingService.cs | 7 +++++-- MediaBrowser.Api/Playback/Dash/MpegDashService.cs | 3 ++- MediaBrowser.Api/Playback/Hls/BaseHlsService.cs | 3 ++- MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs | 3 ++- MediaBrowser.Api/Playback/Hls/VideoHlsService.cs | 3 ++- MediaBrowser.Api/Playback/Progressive/AudioService.cs | 3 ++- .../Progressive/BaseProgressiveStreamingService.cs | 3 ++- MediaBrowser.Api/Playback/Progressive/VideoService.cs | 3 ++- MediaBrowser.Dlna/Ssdp/Datagram.cs | 19 +++++++++++++++---- MediaBrowser.Dlna/Ssdp/SsdpHandler.cs | 4 +++- .../Configuration/ServerConfiguration.cs | 6 ++---- .../IO/LibraryMonitor.cs | 4 ++-- 12 files changed, 41 insertions(+), 20 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index ba20c0c587..34fb29b94a 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -23,6 +23,7 @@ using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Model.Serialization; namespace MediaBrowser.Api.Playback { @@ -68,12 +69,14 @@ namespace MediaBrowser.Api.Playback protected ISubtitleEncoder SubtitleEncoder { get; private set; } protected IMediaSourceManager MediaSourceManager { get; private set; } protected IZipClient ZipClient { get; private set; } + protected IJsonSerializer JsonSerializer { get; private set; } /// /// Initializes a new instance of the class. /// - protected BaseStreamingService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient) + protected BaseStreamingService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer) { + JsonSerializer = jsonSerializer; ZipClient = zipClient; MediaSourceManager = mediaSourceManager; DeviceManager = deviceManager; @@ -1005,7 +1008,7 @@ namespace MediaBrowser.Api.Playback // FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory. state.LogFileStream = FileSystem.GetFileStream(logFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, true); - var commandLineLogMessageBytes = Encoding.UTF8.GetBytes(Request.AbsoluteUri + Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine); + var commandLineLogMessageBytes = Encoding.UTF8.GetBytes(Request.AbsoluteUri + Environment.NewLine + Environment.NewLine + JsonSerializer.SerializeToString(state.MediaSource) + Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine); await state.LogFileStream.WriteAsync(commandLineLogMessageBytes, 0, commandLineLogMessageBytes.Length, cancellationTokenSource.Token).ConfigureAwait(false); process.Exited += (sender, args) => OnFfMpegProcessExited(process, transcodingJob, state); diff --git a/MediaBrowser.Api/Playback/Dash/MpegDashService.cs b/MediaBrowser.Api/Playback/Dash/MpegDashService.cs index 0692c4863e..1a90dbb531 100644 --- a/MediaBrowser.Api/Playback/Dash/MpegDashService.cs +++ b/MediaBrowser.Api/Playback/Dash/MpegDashService.cs @@ -8,6 +8,7 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.Net; using MediaBrowser.Model.IO; +using MediaBrowser.Model.Serialization; using ServiceStack; using System; using System.Collections.Generic; @@ -53,7 +54,7 @@ namespace MediaBrowser.Api.Playback.Dash public class MpegDashService : BaseHlsService { - public MpegDashService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, INetworkManager networkManager) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient) + public MpegDashService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, INetworkManager networkManager) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer) { NetworkManager = networkManager; } diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs index 78dee4c448..b10c02e17c 100644 --- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs @@ -13,6 +13,7 @@ using System.IO; using System.Text; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Model.Serialization; namespace MediaBrowser.Api.Playback.Hls { @@ -21,7 +22,7 @@ namespace MediaBrowser.Api.Playback.Hls /// public abstract class BaseHlsService : BaseStreamingService { - protected BaseHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient) + protected BaseHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer) { } diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs index 4f938dc419..1f6bc242df 100644 --- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs @@ -10,6 +10,7 @@ using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Extensions; using MediaBrowser.Model.IO; +using MediaBrowser.Model.Serialization; using ServiceStack; using System; using System.Collections.Generic; @@ -61,7 +62,7 @@ namespace MediaBrowser.Api.Playback.Hls public class DynamicHlsService : BaseHlsService { - public DynamicHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, INetworkManager networkManager) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient) + public DynamicHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, INetworkManager networkManager) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer) { NetworkManager = networkManager; } diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs index 8e2854c5e8..626df59f25 100644 --- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs @@ -5,6 +5,7 @@ using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Model.IO; +using MediaBrowser.Model.Serialization; using ServiceStack; using System; @@ -40,7 +41,7 @@ namespace MediaBrowser.Api.Playback.Hls /// public class VideoHlsService : BaseHlsService { - public VideoHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient) + public VideoHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer) { } diff --git a/MediaBrowser.Api/Playback/Progressive/AudioService.cs b/MediaBrowser.Api/Playback/Progressive/AudioService.cs index fee5011596..67a9cab58f 100644 --- a/MediaBrowser.Api/Playback/Progressive/AudioService.cs +++ b/MediaBrowser.Api/Playback/Progressive/AudioService.cs @@ -8,6 +8,7 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Model.IO; +using MediaBrowser.Model.Serialization; using ServiceStack; using System.Collections.Generic; @@ -31,7 +32,7 @@ namespace MediaBrowser.Api.Playback.Progressive /// public class AudioService : BaseProgressiveStreamingService { - public AudioService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IImageProcessor imageProcessor, IHttpClient httpClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, imageProcessor, httpClient) + public AudioService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, IImageProcessor imageProcessor, IHttpClient httpClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer, imageProcessor, httpClient) { } diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs index 8ed17ca17e..835f3357eb 100644 --- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs +++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs @@ -10,6 +10,7 @@ using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.Net; using MediaBrowser.Model.IO; using MediaBrowser.Model.MediaInfo; +using MediaBrowser.Model.Serialization; using ServiceStack.Web; using System; using System.Collections.Generic; @@ -27,7 +28,7 @@ namespace MediaBrowser.Api.Playback.Progressive protected readonly IImageProcessor ImageProcessor; protected readonly IHttpClient HttpClient; - protected BaseProgressiveStreamingService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IImageProcessor imageProcessor, IHttpClient httpClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient) + protected BaseProgressiveStreamingService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, IImageProcessor imageProcessor, IHttpClient httpClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer) { ImageProcessor = imageProcessor; HttpClient = httpClient; diff --git a/MediaBrowser.Api/Playback/Progressive/VideoService.cs b/MediaBrowser.Api/Playback/Progressive/VideoService.cs index 0ded108b1d..27482c50c6 100644 --- a/MediaBrowser.Api/Playback/Progressive/VideoService.cs +++ b/MediaBrowser.Api/Playback/Progressive/VideoService.cs @@ -7,6 +7,7 @@ using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Model.IO; +using MediaBrowser.Model.Serialization; using ServiceStack; using System; using System.IO; @@ -61,7 +62,7 @@ namespace MediaBrowser.Api.Playback.Progressive /// public class VideoService : BaseProgressiveStreamingService { - public VideoService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IImageProcessor imageProcessor, IHttpClient httpClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, imageProcessor, httpClient) + public VideoService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, IImageProcessor imageProcessor, IHttpClient httpClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer, imageProcessor, httpClient) { } diff --git a/MediaBrowser.Dlna/Ssdp/Datagram.cs b/MediaBrowser.Dlna/Ssdp/Datagram.cs index ae79ab44f1..4a0bb6f48b 100644 --- a/MediaBrowser.Dlna/Ssdp/Datagram.cs +++ b/MediaBrowser.Dlna/Ssdp/Datagram.cs @@ -12,13 +12,15 @@ namespace MediaBrowser.Dlna.Ssdp public EndPoint FromEndPoint { get; private set; } public string Message { get; private set; } public bool IgnoreBindFailure { get; private set; } + public bool EnableDebugLogging { get; private set; } private readonly ILogger _logger; - public Datagram(EndPoint toEndPoint, EndPoint fromEndPoint, ILogger logger, string message, bool ignoreBindFailure) + public Datagram(EndPoint toEndPoint, EndPoint fromEndPoint, ILogger logger, string message, bool ignoreBindFailure, bool enableDebugLogging) { Message = message; _logger = logger; + EnableDebugLogging = enableDebugLogging; IgnoreBindFailure = ignoreBindFailure; FromEndPoint = fromEndPoint; ToEndPoint = toEndPoint; @@ -37,8 +39,13 @@ namespace MediaBrowser.Dlna.Ssdp { client.Bind(FromEndPoint); } - catch + catch (Exception ex) { + if (EnableDebugLogging) + { + _logger.ErrorException("Error binding datagram socket", ex); + } + if (!IgnoreBindFailure) throw; } } @@ -51,7 +58,7 @@ namespace MediaBrowser.Dlna.Ssdp } catch (Exception ex) { - if (!IgnoreBindFailure) + if (!IgnoreBindFailure || EnableDebugLogging) { _logger.ErrorException("Error sending Datagram to {0} from {1}: " + Message, ex, ToEndPoint, FromEndPoint == null ? "" : FromEndPoint.ToString()); } @@ -62,8 +69,12 @@ namespace MediaBrowser.Dlna.Ssdp { client.Close(); } - catch (Exception) + catch (Exception ex) { + if (EnableDebugLogging) + { + _logger.ErrorException("Error closing datagram socket", ex); + } } } }, null); diff --git a/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs b/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs index e21074bd40..a146047098 100644 --- a/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs +++ b/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs @@ -166,9 +166,11 @@ namespace MediaBrowser.Dlna.Ssdp var msg = new SsdpMessageBuilder().BuildMessage(header, values); var queued = false; + var enableDebugLogging = _config.GetDlnaConfiguration().EnableDebugLogging; + for (var i = 0; i < sendCount; i++) { - var dgram = new Datagram(endpoint, localAddress, _logger, msg, ignoreBindFailure); + var dgram = new Datagram(endpoint, localAddress, _logger, msg, ignoreBindFailure, enableDebugLogging); if (_messageQueue.Count == 0) { diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 8a3a2a3e43..2833e71677 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -158,7 +158,7 @@ namespace MediaBrowser.Model.Configuration /// different directories and files. /// /// The file watcher delay. - public int RealtimeMonitorDelay { get; set; } + public int RealtimeLibraryMonitorDelay { get; set; } /// /// Gets or sets a value indicating whether [enable dashboard response caching]. @@ -233,7 +233,7 @@ namespace MediaBrowser.Model.Configuration // 5 minutes MinResumeDurationSeconds = 300; - RealtimeMonitorDelay = 30; + RealtimeLibraryMonitorDelay = 40; EnableInternetProviders = true; FindInternetTrailers = true; @@ -261,8 +261,6 @@ namespace MediaBrowser.Model.Configuration "Chromecast", "iOS", "Unknown app", - "MediaPortal", - "Media Portal", "iPad", "iPhone", "Windows Phone" diff --git a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs index 5f63a8d08a..3d6a6c2f13 100644 --- a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs +++ b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs @@ -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)); } } } -- cgit v1.2.3 From b8fb177fc8d54a5b9e29995e9ef1d4ad30a37344 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 5 May 2015 11:24:47 -0400 Subject: added manual server form --- .../Localization/JavaScript/javascript.json | 3 ++- .../Localization/Server/server.json | 13 ++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json index c15e520e26..3fe1b7492e 100644 --- a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json +++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json @@ -766,5 +766,6 @@ "SyncJobItemStatusRemovedFromDevice": "Removed from device", "SyncJobItemStatusCancelled": "Cancelled", "LabelProfile": "Profile:", - "LabelBitrateMbps": "Bitrate (Mbps):" + "LabelBitrateMbps": "Bitrate (Mbps):", + "EmbyIntroDownloadMessage": "To download and install Emby Server visit {0}." } diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index 9b608513ff..1297ec0fc4 100644 --- a/MediaBrowser.Server.Implementations/Localization/Server/server.json +++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json @@ -1436,5 +1436,16 @@ "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" + "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", + "ButtonNewServer": "New Server", + "ButtonSignInWithConnect": "Sign in with Emby Connect", + "HeaderNewServer": "New Server", + "ButtonConnect": "Connect", + "LabelServerHost": "Host:", + "LabelServerHostHelp": "192.168.1.100 or https://myserver.com", + "LabelServerPort": "Port:" } -- cgit v1.2.3 From 4b83dd4b56c0457e46ac63e5c7cf9b40648a88ec Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 5 May 2015 11:25:00 -0400 Subject: rework dynamic image schedule --- .../Photos/BaseDynamicImageProvider.cs | 31 ++++++++++++++++++++-- .../UserViews/DynamicImageProvider.cs | 4 +-- 2 files changed, 30 insertions(+), 5 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs b/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs index be71a6408a..bd22a8a70b 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 GetFinalItems(List items) { return GetFinalItems(items, 4); @@ -234,7 +261,7 @@ namespace MediaBrowser.Server.Implementations.Photos protected virtual List GetFinalItems(List 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/UserViews/DynamicImageProvider.cs b/MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs index 8bbc746cb3..9307626960 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 { 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 GetSupportedImages(IHasImages item) -- cgit v1.2.3 From 32454bdfe1b5a58fa9901e092fd0d764482a0def Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 5 May 2015 19:15:47 -0400 Subject: update login page --- MediaBrowser.Controller/Entities/BaseItem.cs | 2 +- MediaBrowser.Server.Implementations/Library/UserManager.cs | 6 +++--- .../Localization/JavaScript/javascript.json | 7 +++++-- .../Localization/Server/server.json | 6 +++--- MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj | 2 +- 5 files changed, 13 insertions(+), 10 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index bbc3b6fd31..8b6cbdc931 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -496,7 +496,7 @@ namespace MediaBrowser.Controller.Entities /// /// /// ``0. - protected T FindParent() + public T FindParent() where T : Folder { return Parents.OfType().FirstOrDefault(); diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.cs index 02e1795f36..5012f24798 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/javascript.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json index 3fe1b7492e..9aa09a75bb 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", @@ -767,5 +767,8 @@ "SyncJobItemStatusCancelled": "Cancelled", "LabelProfile": "Profile:", "LabelBitrateMbps": "Bitrate (Mbps):", - "EmbyIntroDownloadMessage": "To download and install Emby Server visit {0}." + "EmbyIntroDownloadMessage": "To download and install Emby Server visit {0}.", + "ButtonNewServer": "New Server", + "ButtonSignInWithConnect": "Sign in with Emby Connect", + "HeaderNewServer": "New Server" } diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index 1297ec0fc4..ff99c40786 100644 --- a/MediaBrowser.Server.Implementations/Localization/Server/server.json +++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json @@ -1441,11 +1441,11 @@ "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", - "ButtonNewServer": "New Server", "ButtonSignInWithConnect": "Sign in with Emby Connect", - "HeaderNewServer": "New Server", "ButtonConnect": "Connect", "LabelServerHost": "Host:", "LabelServerHostHelp": "192.168.1.100 or https://myserver.com", - "LabelServerPort": "Port:" + "LabelServerPort": "Port:", + "HeaderNewServer": "New Server", + "ButtonChangeServer": "Change Server" } diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 0da2d56606..e39df9602c 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -93,7 +93,7 @@ PreserveNewest - + PreserveNewest -- cgit v1.2.3 From f6a90933a8f055302de83afa15a690c81fab7bdd Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 5 May 2015 19:19:33 -0400 Subject: package upgrades --- .../MediaBrowser.Common.Implementations.csproj | 7 ++----- MediaBrowser.Common.Implementations/packages.config | 2 +- .../MediaBrowser.Server.Implementations.csproj | 5 ++--- MediaBrowser.Server.Implementations/packages.config | 4 ++-- Nuget/MediaBrowser.Common.Internal.nuspec | 2 +- 5 files changed, 8 insertions(+), 12 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj index 967cf54a6d..e603ea3738 100644 --- a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj +++ b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj @@ -58,11 +58,8 @@ False - ..\packages\SimpleInjector.2.7.0\lib\net45\SimpleInjector.dll - - - False - ..\packages\SimpleInjector.2.7.0\lib\net45\SimpleInjector.Diagnostics.dll + ..\packages\SimpleInjector.2.8.0\lib\net45\SimpleInjector.dll + True diff --git a/MediaBrowser.Common.Implementations/packages.config b/MediaBrowser.Common.Implementations/packages.config index 56cb78031a..e57c874f2c 100644 --- a/MediaBrowser.Common.Implementations/packages.config +++ b/MediaBrowser.Common.Implementations/packages.config @@ -1,5 +1,5 @@  - + diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index 0bbea3acc7..572aa3a121 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -48,9 +48,8 @@ ..\packages\Interfaces.IO.1.0.0.5\lib\portable-net45+sl4+wp71+win8+wpa81\Interfaces.IO.dll - - False - ..\packages\MediaBrowser.Naming.1.0.0.34\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll + + ..\packages\MediaBrowser.Naming.1.0.0.35\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll False diff --git a/MediaBrowser.Server.Implementations/packages.config b/MediaBrowser.Server.Implementations/packages.config index 7fb3691060..0b81c1866d 100644 --- a/MediaBrowser.Server.Implementations/packages.config +++ b/MediaBrowser.Server.Implementations/packages.config @@ -1,9 +1,9 @@  - + - + \ No newline at end of file diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 497c1e070d..f2d46de3e9 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -14,7 +14,7 @@ - + -- cgit v1.2.3 From 2f05af4be4ffb1ea8ed5421a39963372ca5c7f18 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 5 May 2015 19:19:47 -0400 Subject: ease up device discovery --- MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs | 6 ++++-- MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs b/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs index 737eb4287a..94342bf31e 100644 --- a/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs +++ b/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Events; -using MediaBrowser.Common.Net; using MediaBrowser.Controller; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Dlna; @@ -143,7 +142,10 @@ namespace MediaBrowser.Dlna.Ssdp args.EndPoint = endPoint; args.LocalIp = localIp; - TryCreateDevice(args); + if (!_ssdpHandler.IsSelfNotification(args)) + { + TryCreateDevice(args); + } } } diff --git a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs index 3d6a6c2f13..2d4770fac7 100644 --- a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs +++ b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs @@ -560,7 +560,7 @@ namespace MediaBrowser.Server.Implementations.IO /// Task. private async Task ProcessPathChanges(List paths) { - var itemsToRefresh = paths.Select(Path.GetDirectoryName) + var itemsToRefresh = paths .Select(GetAffectedBaseItem) .Where(item => item != null) .Distinct() -- cgit v1.2.3 From 6c97afef23856890bed55759363c7b7516f99921 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 6 May 2015 08:56:26 -0400 Subject: updated bravia profiles --- .../Profiles/SonyBravia2010Profile.cs | 1 + .../Profiles/SonyBravia2011Profile.cs | 1 + .../Profiles/SonyBravia2012Profile.cs | 1 + .../Profiles/SonyBravia2013Profile.cs | 1 + .../Profiles/Xml/Sony Bravia (2010).xml | 2 +- .../Profiles/Xml/Sony Bravia (2011).xml | 2 +- .../Profiles/Xml/Sony Bravia (2012).xml | 2 +- .../Profiles/Xml/Sony Bravia (2013).xml | 2 +- MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 296 +++++++++++---------- MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs | 3 +- .../Manager/ItemImageProvider.cs | 22 +- .../Localization/Server/server.json | 3 +- MediaBrowser.WebDashboard/Api/PackageCreator.cs | 20 +- .../MediaBrowser.WebDashboard.csproj | 3 + 14 files changed, 197 insertions(+), 162 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs index 78e90af26e..3bd425cb38 100644 --- a/MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs +++ b/MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs @@ -47,6 +47,7 @@ namespace MediaBrowser.Dlna.Profiles "http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=81500000000000000000000000000000,http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_SM;DLNA.ORG_OP=00;DLNA.ORG_FLAGS=00D00000000000000000000000000000,http-get:*:video/mpeg:DLNA.ORG_PN=MPEG_PS_PAL;DLNA.ORG_OP=11;DLNA.ORG_FLAGS=81500000000000000000000000000000"; EnableSingleAlbumArtLimit = true; + EnableAlbumArtInDidl = true; TranscodingProfiles = new[] { diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs index b435c63642..de4f1d2b65 100644 --- a/MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs +++ b/MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs @@ -44,6 +44,7 @@ namespace MediaBrowser.Dlna.Profiles ManufacturerUrl = "http://www.microsoft.com/"; SonyAggregationFlags = "10"; EnableSingleAlbumArtLimit = true; + EnableAlbumArtInDidl = true; TranscodingProfiles = new[] { diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs index b0cbb0970d..5a5fb9e942 100644 --- a/MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs +++ b/MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs @@ -44,6 +44,7 @@ namespace MediaBrowser.Dlna.Profiles ManufacturerUrl = "http://www.microsoft.com/"; SonyAggregationFlags = "10"; EnableSingleAlbumArtLimit = true; + EnableAlbumArtInDidl = true; TranscodingProfiles = new[] { diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs index ca4e802a16..74a07f3892 100644 --- a/MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs +++ b/MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs @@ -44,6 +44,7 @@ namespace MediaBrowser.Dlna.Profiles ManufacturerUrl = "http://www.microsoft.com/"; SonyAggregationFlags = "10"; EnableSingleAlbumArtLimit = true; + EnableAlbumArtInDidl = true; TranscodingProfiles = new[] { diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2010).xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2010).xml index 68bfe85cf9..7afc8183d2 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2010).xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2010).xml @@ -15,7 +15,7 @@ Emby 3.0 http://www.microsoft.com/ - false + true true Audio,Photo,Video JPEG_TN diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2011).xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2011).xml index 4f9ca7550c..7400600e22 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2011).xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2011).xml @@ -15,7 +15,7 @@ Emby 3.0 http://www.microsoft.com/ - false + true true Audio,Photo,Video JPEG_TN diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2012).xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2012).xml index 682b2f3585..b8e3d6d309 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2012).xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2012).xml @@ -15,7 +15,7 @@ Emby 3.0 http://www.microsoft.com/ - false + true true Audio,Photo,Video JPEG_TN diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2013).xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2013).xml index 5032bf69a8..5733d9d0b1 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2013).xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2013).xml @@ -15,7 +15,7 @@ Emby 3.0 http://www.microsoft.com/ - false + true true Audio,Photo,Video JPEG_TN diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index a01f37f91d..4d5b669e2c 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -199,82 +199,83 @@ namespace MediaBrowser.MediaEncoding.Encoder await _ffProbeResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false); - var processWrapper = new ProcessWrapper(process, this); - - try - { - StartProcess(processWrapper); - } - catch (Exception ex) + using (var processWrapper = new ProcessWrapper(process, this)) { - _ffProbeResourcePool.Release(); + try + { + StartProcess(processWrapper); + } + catch (Exception ex) + { + _ffProbeResourcePool.Release(); - _logger.ErrorException("Error starting ffprobe", ex); + _logger.ErrorException("Error starting ffprobe", ex); - throw; - } + throw; + } - try - { - process.BeginErrorReadLine(); + try + { + process.BeginErrorReadLine(); - var result = _jsonSerializer.DeserializeFromStream(process.StandardOutput.BaseStream); + var result = _jsonSerializer.DeserializeFromStream(process.StandardOutput.BaseStream); - if (result != null) - { - if (result.streams != null) + if (result != null) { - // Normalize aspect ratio if invalid - foreach (var stream in result.streams) + if (result.streams != null) { - if (string.Equals(stream.display_aspect_ratio, "0:1", StringComparison.OrdinalIgnoreCase)) - { - stream.display_aspect_ratio = string.Empty; - } - if (string.Equals(stream.sample_aspect_ratio, "0:1", StringComparison.OrdinalIgnoreCase)) + // Normalize aspect ratio if invalid + foreach (var stream in result.streams) { - stream.sample_aspect_ratio = string.Empty; + if (string.Equals(stream.display_aspect_ratio, "0:1", StringComparison.OrdinalIgnoreCase)) + { + stream.display_aspect_ratio = string.Empty; + } + if (string.Equals(stream.sample_aspect_ratio, "0:1", StringComparison.OrdinalIgnoreCase)) + { + stream.sample_aspect_ratio = string.Empty; + } } } - } - var mediaInfo = new ProbeResultNormalizer(_logger, FileSystem).GetMediaInfo(result, videoType, isAudio, primaryPath, protocol); + var mediaInfo = new ProbeResultNormalizer(_logger, FileSystem).GetMediaInfo(result, videoType, isAudio, primaryPath, protocol); - if (extractKeyFrameInterval && mediaInfo.RunTimeTicks.HasValue) - { - foreach (var stream in mediaInfo.MediaStreams) + if (extractKeyFrameInterval && mediaInfo.RunTimeTicks.HasValue) { - if (stream.Type == MediaStreamType.Video && string.Equals(stream.Codec, "h264", StringComparison.OrdinalIgnoreCase)) + foreach (var stream in mediaInfo.MediaStreams) { - try - { - //stream.KeyFrames = await GetKeyFrames(inputPath, stream.Index, cancellationToken) - // .ConfigureAwait(false); - } - catch (OperationCanceledException) - { - - } - catch (Exception ex) + if (stream.Type == MediaStreamType.Video && string.Equals(stream.Codec, "h264", StringComparison.OrdinalIgnoreCase)) { - _logger.ErrorException("Error getting key frame interval", ex); + try + { + //stream.KeyFrames = await GetKeyFrames(inputPath, stream.Index, cancellationToken) + // .ConfigureAwait(false); + } + catch (OperationCanceledException) + { + + } + catch (Exception ex) + { + _logger.ErrorException("Error getting key frame interval", ex); + } } } } - } - return mediaInfo; + return mediaInfo; + } } - } - catch - { - StopProcess(processWrapper, 100, true); + catch + { + StopProcess(processWrapper, 100, true); - throw; - } - finally - { - _ffProbeResourcePool.Release(); + throw; + } + finally + { + _ffProbeResourcePool.Release(); + } } throw new ApplicationException(string.Format("FFProbe failed for {0}", inputPath)); @@ -307,31 +308,32 @@ namespace MediaBrowser.MediaEncoding.Encoder _logger.Debug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments); - var processWrapper = new ProcessWrapper(process, this); - - StartProcess(processWrapper); + using (var processWrapper = new ProcessWrapper(process, this)) + { + StartProcess(processWrapper); - var lines = new List(); + var lines = new List(); - try - { - process.BeginErrorReadLine(); + try + { + process.BeginErrorReadLine(); - await StartReadingOutput(process.StandardOutput.BaseStream, lines, 120000, cancellationToken).ConfigureAwait(false); - } - catch (OperationCanceledException) - { - if (cancellationToken.IsCancellationRequested) + await StartReadingOutput(process.StandardOutput.BaseStream, lines, 120000, cancellationToken).ConfigureAwait(false); + } + catch (OperationCanceledException) { - throw; + if (cancellationToken.IsCancellationRequested) + { + throw; + } + } + finally + { + StopProcess(processWrapper, 100, true); } - } - finally - { - StopProcess(processWrapper, 100, true); - } - return lines; + return lines; + } } private async Task StartReadingOutput(Stream source, List lines, int timeoutMs, CancellationToken cancellationToken) @@ -490,51 +492,53 @@ namespace MediaBrowser.MediaEncoding.Encoder await resourcePool.WaitAsync(cancellationToken).ConfigureAwait(false); - var processWrapper = new ProcessWrapper(process, this); - bool ranToCompletion; + using (var processWrapper = new ProcessWrapper(process, this)) + { + bool ranToCompletion; - var memoryStream = new MemoryStream(); + var memoryStream = new MemoryStream(); - try - { - StartProcess(processWrapper); + try + { + StartProcess(processWrapper); #pragma warning disable 4014 - // Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback - process.StandardOutput.BaseStream.CopyToAsync(memoryStream); + // Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback + process.StandardOutput.BaseStream.CopyToAsync(memoryStream); #pragma warning restore 4014 - // MUST read both stdout and stderr asynchronously or a deadlock may occurr - process.BeginErrorReadLine(); + // MUST read both stdout and stderr asynchronously or a deadlock may occurr + process.BeginErrorReadLine(); - ranToCompletion = process.WaitForExit(10000); + ranToCompletion = process.WaitForExit(10000); - if (!ranToCompletion) + if (!ranToCompletion) + { + StopProcess(processWrapper, 1000, false); + } + + } + finally { - StopProcess(processWrapper, 1000, false); + resourcePool.Release(); } - } - finally - { - resourcePool.Release(); - } + var exitCode = ranToCompletion ? processWrapper.ExitCode ?? 0 : -1; - var exitCode = ranToCompletion ? processWrapper.ExitCode ?? 0 : -1; + if (exitCode == -1 || memoryStream.Length == 0) + { + memoryStream.Dispose(); - if (exitCode == -1 || memoryStream.Length == 0) - { - memoryStream.Dispose(); + var msg = string.Format("ffmpeg image extraction failed for {0}", inputPath); - var msg = string.Format("ffmpeg image extraction failed for {0}", inputPath); + _logger.Error(msg); - _logger.Error(msg); + throw new ApplicationException(msg); + } - throw new ApplicationException(msg); + memoryStream.Position = 0; + return memoryStream; } - - memoryStream.Position = 0; - return memoryStream; } public string GetTimeParameter(long ticks) @@ -603,55 +607,56 @@ namespace MediaBrowser.MediaEncoding.Encoder bool ranToCompletion = false; - var processWrapper = new ProcessWrapper(process, this); - - try + using (var processWrapper = new ProcessWrapper(process, this)) { - StartProcess(processWrapper); + try + { + StartProcess(processWrapper); - // Need to give ffmpeg enough time to make all the thumbnails, which could be a while, - // but we still need to detect if the process hangs. - // Making the assumption that as long as new jpegs are showing up, everything is good. + // Need to give ffmpeg enough time to make all the thumbnails, which could be a while, + // but we still need to detect if the process hangs. + // Making the assumption that as long as new jpegs are showing up, everything is good. - bool isResponsive = true; - int lastCount = 0; + bool isResponsive = true; + int lastCount = 0; - while (isResponsive) - { - if (process.WaitForExit(30000)) + while (isResponsive) { - ranToCompletion = true; - break; - } + if (process.WaitForExit(30000)) + { + ranToCompletion = true; + break; + } + + cancellationToken.ThrowIfCancellationRequested(); - cancellationToken.ThrowIfCancellationRequested(); + var jpegCount = Directory.GetFiles(targetDirectory) + .Count(i => string.Equals(Path.GetExtension(i), ".jpg", StringComparison.OrdinalIgnoreCase)); - var jpegCount = Directory.GetFiles(targetDirectory) - .Count(i => string.Equals(Path.GetExtension(i), ".jpg", StringComparison.OrdinalIgnoreCase)); + isResponsive = (jpegCount > lastCount); + lastCount = jpegCount; + } - isResponsive = (jpegCount > lastCount); - lastCount = jpegCount; + if (!ranToCompletion) + { + StopProcess(processWrapper, 1000, false); + } } - - if (!ranToCompletion) + finally { - StopProcess(processWrapper, 1000, false); + resourcePool.Release(); } - } - finally - { - resourcePool.Release(); - } - var exitCode = ranToCompletion ? processWrapper.ExitCode ?? 0 : -1; + var exitCode = ranToCompletion ? processWrapper.ExitCode ?? 0 : -1; - if (exitCode == -1) - { - var msg = string.Format("ffmpeg image extraction failed for {0}", inputArgument); + if (exitCode == -1) + { + var msg = string.Format("ffmpeg image extraction failed for {0}", inputArgument); - _logger.Error(msg); + _logger.Error(msg); - throw new ApplicationException(msg); + throw new ApplicationException(msg); + } } } @@ -781,7 +786,7 @@ namespace MediaBrowser.MediaEncoding.Encoder } } - private class ProcessWrapper + private class ProcessWrapper : IDisposable { public readonly Process Process; public bool HasExited; @@ -810,6 +815,25 @@ namespace MediaBrowser.MediaEncoding.Encoder process.Dispose(); } + + private bool _disposed; + private readonly object _syncLock = new object(); + public void Dispose() + { + lock (_syncLock) + { + if (!_disposed) + { + if (Process != null) + { + Process.Exited -= Process_Exited; + Process.Dispose(); + } + } + + _disposed = true; + } + } } } } diff --git a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs index b3fe28561a..62463d196a 100644 --- a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs +++ b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs @@ -1,4 +1,5 @@ using MediaBrowser.Model.MediaInfo; +using System; using System.Collections.Generic; namespace MediaBrowser.Model.Dlna @@ -164,7 +165,7 @@ namespace MediaBrowser.Model.Dlna if (mediaProfile != null && !string.IsNullOrEmpty(mediaProfile.OrgPn)) { - orgPnValues.AddRange(mediaProfile.OrgPn.Split(',')); + orgPnValues.AddRange(mediaProfile.OrgPn.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)); } else { diff --git a/MediaBrowser.Providers/Manager/ItemImageProvider.cs b/MediaBrowser.Providers/Manager/ItemImageProvider.cs index c95cf67256..92fc1c2a80 100644 --- a/MediaBrowser.Providers/Manager/ItemImageProvider.cs +++ b/MediaBrowser.Providers/Manager/ItemImageProvider.cs @@ -38,12 +38,9 @@ namespace MediaBrowser.Providers.Manager { var hasChanges = false; - var localImageProviders = providers.OfType() - .ToList(); - - if (localImageProviders.Count > 0 || !(item is Photo)) + if (!(item is Photo)) { - var images = localImageProviders + var images = providers.OfType() .SelectMany(i => i.GetImages(item, directoryService)) .ToList(); @@ -425,19 +422,14 @@ namespace MediaBrowser.Providers.Manager var changed = false; var newImages = images.Where(i => i.Type == type).ToList(); - if (newImages.Count > 0) - { - var newImageFileInfos = images.Where(i => i.Type == type) + + var newImageFileInfos = newImages .Select(i => i.FileInfo) .ToList(); - if (newImageFileInfos.Count > 0) - { - if (item.AddImages(type, newImageFileInfos)) - { - changed = true; - } - } + if (item.AddImages(type, newImageFileInfos)) + { + changed = true; } return changed; diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index ff99c40786..0a922dd0a6 100644 --- a/MediaBrowser.Server.Implementations/Localization/Server/server.json +++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json @@ -1447,5 +1447,6 @@ "LabelServerHostHelp": "192.168.1.100 or https://myserver.com", "LabelServerPort": "Port:", "HeaderNewServer": "New Server", - "ButtonChangeServer": "Change Server" + "ButtonChangeServer": "Change Server", + "HeaderConnectToServer": "Connect to Server" } diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs index 6c812acce0..292f74a56d 100644 --- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs +++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs @@ -301,7 +301,7 @@ namespace MediaBrowser.WebDashboard.Api var builder = new StringBuilder(); - foreach (var file in new[] + var apiClientFiles = new[] { "thirdparty/apiclient/logger.js", "thirdparty/apiclient/md5.js", @@ -314,10 +314,20 @@ namespace MediaBrowser.WebDashboard.Api "thirdparty/apiclient/events.js", "thirdparty/apiclient/deferred.js", "thirdparty/apiclient/apiclient.js", - "thirdparty/apiclient/connectservice.js", - "thirdparty/apiclient/serverdiscovery.js", - "thirdparty/apiclient/connectionmanager.js" - }) + "thirdparty/apiclient/connectservice.js" + }.ToList(); + + if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase)) + { + apiClientFiles.Add("thirdparty/apiclient/cordova/serverdiscovery.js"); + } + else + { + apiClientFiles.Add("thirdparty/apiclient/serverdiscovery.js"); + } + apiClientFiles.Add("thirdparty/apiclient/connectionmanager.js"); + + foreach (var file in apiClientFiles) { using (var fs = _fileSystem.GetFileStream(GetDashboardResourcePath(file), FileMode.Open, FileAccess.Read, FileShare.ReadWrite, true)) { diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index e39df9602c..6b3a0ae7ea 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -210,6 +210,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest -- cgit v1.2.3 From e6d9d240e48ebdd0dcf2825d0c0cda60a431fb6f Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 6 May 2015 23:11:51 -0400 Subject: fix xbox one browser access --- .../Networking/BaseNetworkManager.cs | 43 +++++++--------------- MediaBrowser.Model/Dlna/CodecProfile.cs | 27 +++++++++++++- MediaBrowser.Model/Dlna/StreamBuilder.cs | 12 +++--- MediaBrowser.Providers/TV/TvdbEpisodeProvider.cs | 15 ++++++-- .../Localization/JavaScript/cs.json | 1 - .../Localization/JavaScript/javascript.json | 3 +- MediaBrowser.WebDashboard/Api/PackageCreator.cs | 1 + .../MediaBrowser.WebDashboard.csproj | 6 +++ 8 files changed, 65 insertions(+), 43 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs b/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs index 0fd4e27874..c27dfd68d4 100644 --- a/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs +++ b/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs @@ -6,16 +6,29 @@ using System.Linq; using System.Net; using System.Net.NetworkInformation; using System.Net.Sockets; +using System.Threading; namespace MediaBrowser.Common.Implementations.Networking { public abstract class BaseNetworkManager { protected ILogger Logger { get; private set; } + private Timer _clearCacheTimer; protected BaseNetworkManager(ILogger logger) { Logger = logger; + + // Can't use network change events due to a crash in Linux + _clearCacheTimer = new Timer(ClearCacheTimerCallback, null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1)); + } + + private void ClearCacheTimerCallback(object state) + { + lock (_localIpAddressSyncLock) + { + _localIpAddresses = null; + } } private volatile List _localIpAddresses; @@ -36,7 +49,6 @@ namespace MediaBrowser.Common.Implementations.Networking var addresses = GetLocalIpAddressesInternal().ToList(); _localIpAddresses = addresses; - BindEvents(); return addresses; } @@ -46,35 +58,6 @@ namespace MediaBrowser.Common.Implementations.Networking return _localIpAddresses; } - private void BindEvents() - { - NetworkChange.NetworkAddressChanged -= NetworkChange_NetworkAddressChanged; - NetworkChange.NetworkAvailabilityChanged -= NetworkChange_NetworkAvailabilityChanged; - - NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged; - NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged; - } - - void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e) - { - Logger.Debug("NetworkAvailabilityChanged fired. Resetting cached network info."); - - lock (_localIpAddressSyncLock) - { - _localIpAddresses = null; - } - } - - void NetworkChange_NetworkAddressChanged(object sender, EventArgs e) - { - Logger.Debug("NetworkAddressChanged fired. Resetting cached network info."); - - lock (_localIpAddressSyncLock) - { - _localIpAddresses = null; - } - } - private IEnumerable GetLocalIpAddressesInternal() { var list = GetIPsDefault() diff --git a/MediaBrowser.Model/Dlna/CodecProfile.cs b/MediaBrowser.Model/Dlna/CodecProfile.cs index c2d36dc792..7200f648cd 100644 --- a/MediaBrowser.Model/Dlna/CodecProfile.cs +++ b/MediaBrowser.Model/Dlna/CodecProfile.cs @@ -14,6 +14,9 @@ namespace MediaBrowser.Model.Dlna [XmlAttribute("codec")] public string Codec { get; set; } + [XmlAttribute("container")] + public string Container { get; set; } + public CodecProfile() { Conditions = new ProfileCondition[] {}; @@ -29,8 +32,30 @@ namespace MediaBrowser.Model.Dlna return list; } - public bool ContainsCodec(string codec) + public List GetContainers() + { + List list = new List(); + foreach (string i in (Container ?? string.Empty).Split(',')) + { + if (!string.IsNullOrEmpty(i)) list.Add(i); + } + return list; + } + + private bool ContainsContainer(string container) + { + List containers = GetContainers(); + + return containers.Count == 0 || ListHelper.ContainsIgnoreCase(containers, container ?? string.Empty); + } + + public bool ContainsCodec(string codec, string container) { + if (!ContainsContainer(container)) + { + return false; + } + List codecs = GetCodecs(); return codecs.Count == 0 || ListHelper.ContainsIgnoreCase(codecs, codec); diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index 715752d053..8400b204f9 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -131,7 +131,7 @@ namespace MediaBrowser.Model.Dlna List conditions = new List(); foreach (CodecProfile i in options.Profile.CodecProfiles) { - if (i.Type == CodecType.Audio && i.ContainsCodec(audioCodec)) + if (i.Type == CodecType.Audio && i.ContainsCodec(audioCodec, item.Container)) { foreach (ProfileCondition c in i.Conditions) { @@ -206,7 +206,7 @@ namespace MediaBrowser.Model.Dlna List audioCodecProfiles = new List(); foreach (CodecProfile i in options.Profile.CodecProfiles) { - if (i.Type == CodecType.Audio && i.ContainsCodec(transcodingProfile.AudioCodec)) + if (i.Type == CodecType.Audio && i.ContainsCodec(transcodingProfile.AudioCodec, transcodingProfile.Container)) { audioCodecProfiles.Add(i); } @@ -423,7 +423,7 @@ namespace MediaBrowser.Model.Dlna List videoTranscodingConditions = new List(); foreach (CodecProfile i in options.Profile.CodecProfiles) { - if (i.Type == CodecType.Video && i.ContainsCodec(transcodingProfile.VideoCodec)) + if (i.Type == CodecType.Video && i.ContainsCodec(transcodingProfile.VideoCodec, transcodingProfile.Container)) { foreach (ProfileCondition c in i.Conditions) { @@ -437,7 +437,7 @@ namespace MediaBrowser.Model.Dlna List audioTranscodingConditions = new List(); foreach (CodecProfile i in options.Profile.CodecProfiles) { - if (i.Type == CodecType.VideoAudio && i.ContainsCodec(transcodingProfile.AudioCodec)) + if (i.Type == CodecType.VideoAudio && i.ContainsCodec(transcodingProfile.AudioCodec, transcodingProfile.Container)) { foreach (ProfileCondition c in i.Conditions) { @@ -600,7 +600,7 @@ namespace MediaBrowser.Model.Dlna conditions = new List(); foreach (CodecProfile i in profile.CodecProfiles) { - if (i.Type == CodecType.Video && i.ContainsCodec(videoCodec)) + if (i.Type == CodecType.Video && i.ContainsCodec(videoCodec, container)) { foreach (ProfileCondition c in i.Conditions) { @@ -635,7 +635,7 @@ namespace MediaBrowser.Model.Dlna conditions = new List(); foreach (CodecProfile i in profile.CodecProfiles) { - if (i.Type == CodecType.VideoAudio && i.ContainsCodec(audioCodec)) + if (i.Type == CodecType.VideoAudio && i.ContainsCodec(audioCodec, container)) { foreach (ProfileCondition c in i.Conditions) { diff --git a/MediaBrowser.Providers/TV/TvdbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TvdbEpisodeProvider.cs index cbd3f0af06..68601b6b2f 100644 --- a/MediaBrowser.Providers/TV/TvdbEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/TvdbEpisodeProvider.cs @@ -5,6 +5,7 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Logging; using MediaBrowser.Model.Providers; using System; using System.Collections.Generic; @@ -29,12 +30,14 @@ namespace MediaBrowser.Providers.TV private readonly IFileSystem _fileSystem; private readonly IServerConfigurationManager _config; private readonly IHttpClient _httpClient; + private readonly ILogger _logger; - public TvdbEpisodeProvider(IFileSystem fileSystem, IServerConfigurationManager config, IHttpClient httpClient) + public TvdbEpisodeProvider(IFileSystem fileSystem, IServerConfigurationManager config, IHttpClient httpClient, ILogger logger) { _fileSystem = fileSystem; _config = config; _httpClient = httpClient; + _logger = logger; Current = this; } @@ -100,7 +103,8 @@ namespace MediaBrowser.Providers.TV try { - result.Item = FetchEpisodeData(searchInfo, identity, seriesDataPath, searchInfo.SeriesProviderIds, cancellationToken); + result.Item = FetchEpisodeData(searchInfo, identity, seriesDataPath, searchInfo.SeriesProviderIds, + cancellationToken); result.HasMetadata = result.Item != null; } catch (FileNotFoundException) @@ -112,6 +116,10 @@ namespace MediaBrowser.Providers.TV // Don't fail the provider because this will just keep on going and going. } } + else + { + _logger.Debug("No series identity found for {0}", searchInfo.Name); + } return result; } @@ -265,7 +273,6 @@ namespace MediaBrowser.Providers.TV FetchMainEpisodeInfo(episode, file, cancellationToken); usingAbsoluteData = true; - success = true; } var end = identity.IndexNumberEnd ?? episodeNumber; @@ -298,7 +305,7 @@ namespace MediaBrowser.Providers.TV episodeNumber++; } - return success ? episode : null; + return episode; } private readonly CultureInfo _usCulture = new CultureInfo("en-US"); diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/cs.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/cs.json index ea141645c9..2dff86fce9 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 9aa09a75bb..ad6b159e7c 100644 --- a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json +++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json @@ -770,5 +770,6 @@ "EmbyIntroDownloadMessage": "To download and install Emby Server visit {0}.", "ButtonNewServer": "New Server", "ButtonSignInWithConnect": "Sign in with Emby Connect", - "HeaderNewServer": "New Server" + "HeaderNewServer": "New Server", + "MyDevice": "My Device" } diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs index 292f74a56d..89ae4a9b61 100644 --- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs +++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs @@ -281,6 +281,7 @@ namespace MediaBrowser.WebDashboard.Api await AppendResource(memoryStream, "thirdparty/jstree3.0.8/jstree.js", newLineBytes).ConfigureAwait(false); + await AppendResource(memoryStream, "thirdparty/fastclick.js", newLineBytes).ConfigureAwait(false); await AppendResource(memoryStream, "thirdparty/headroom.js", newLineBytes).ConfigureAwait(false); await AppendLocalization(memoryStream, culture).ConfigureAwait(false); diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 6b3a0ae7ea..7582daab91 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -90,6 +90,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest @@ -993,6 +996,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest -- cgit v1.2.3 From 63dc2512c5d272dbc3cb1515beb175e9b3572440 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 7 May 2015 10:04:10 -0400 Subject: rename web client tab --- MediaBrowser.Server.Implementations/Localization/Server/server.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index 0a922dd0a6..368d116466 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.", -- cgit v1.2.3