From 6a5684c2f5ceabb0af18b7b166dac063f062bae5 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 23 Jul 2016 16:27:22 -0400 Subject: [PATCH 01/18] avoid completely empty next up view --- .../TV/TVSeriesManager.cs | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Server.Implementations/TV/TVSeriesManager.cs b/MediaBrowser.Server.Implementations/TV/TVSeriesManager.cs index c2a4339f0b..ddc1de9cdb 100644 --- a/MediaBrowser.Server.Implementations/TV/TVSeriesManager.cs +++ b/MediaBrowser.Server.Implementations/TV/TVSeriesManager.cs @@ -119,12 +119,29 @@ namespace MediaBrowser.Server.Implementations.TV // Avoid implicitly captured closure var currentUser = user; - return series + var allNextUp = series .Select(i => GetNextUp(i, currentUser)) + .Where(i => i.Item1 != null) // Include if an episode was found, and either the series is not unwatched or the specific series was requested - .Where(i => i.Item1 != null && (!i.Item3 || !string.IsNullOrWhiteSpace(request.SeriesId))) .OrderByDescending(i => i.Item2) .ThenByDescending(i => i.Item1.PremiereDate ?? DateTime.MinValue) + .ToList(); + + // If viewing all next up for all series, remove first episodes + if (string.IsNullOrWhiteSpace(request.SeriesId)) + { + var withoutFirstEpisode = allNextUp + .Where(i => !i.Item3) + .ToList(); + + // But if that returns empty, keep those first episodes (avoid completely empty view) + if (withoutFirstEpisode.Count > 0) + { + allNextUp = withoutFirstEpisode; + } + } + + return allNextUp .Select(i => i.Item1) .Take(request.Limit ?? int.MaxValue); } From 4a39fba7d3357128532fc0bd6eee27fd2374c9df Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 23 Jul 2016 19:02:22 -0400 Subject: [PATCH 02/18] 3.1.76 --- SharedVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index 17087a0981..4d6e7bfddc 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,4 +1,4 @@ using System.Reflection; //[assembly: AssemblyVersion("3.1.*")] -[assembly: AssemblyVersion("3.1.75")] +[assembly: AssemblyVersion("3.1.76")] From eb321dad3bf6f67c291d9f4857a6bfabc6586891 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 24 Jul 2016 12:46:17 -0400 Subject: [PATCH 03/18] fix DateModified not refreshing --- .../BaseProgressiveStreamingService.cs | 2 +- .../Progressive/ProgressiveStreamWriter.cs | 135 +++--------------- .../Entities/Audio/Audio.cs | 6 + MediaBrowser.Controller/Entities/BaseItem.cs | 5 +- MediaBrowser.Controller/Entities/Book.cs | 6 + MediaBrowser.Controller/Entities/Folder.cs | 7 - MediaBrowser.Controller/Entities/Game.cs | 8 ++ .../Entities/IHasImages.cs | 2 - .../Entities/IHasMetadata.cs | 4 +- MediaBrowser.Controller/Entities/Photo.cs | 6 + MediaBrowser.Controller/Entities/Video.cs | 6 + .../Providers/DirectoryService.cs | 6 + .../Manager/MetadataService.cs | 18 ++- .../MediaInfo/AudioImageProvider.cs | 5 +- .../MediaInfo/FFProbeProvider.cs | 8 +- .../MediaInfo/VideoImageProvider.cs | 8 +- .../Photos/PhotoProvider.cs | 5 +- .../Library/ResolverHelper.cs | 25 +--- .../Persistence/SqliteItemRepository.cs | 81 +++++------ 19 files changed, 137 insertions(+), 206 deletions(-) diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs index d8b7ce2ef3..d75b8947a8 100644 --- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs +++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs @@ -347,7 +347,7 @@ namespace MediaBrowser.Api.Playback.Progressive outputHeaders[item.Key] = item.Value; } - Func streamWriter = stream => new ProgressiveFileCopier(FileSystem, job, Logger).StreamFile(outputPath, stream); + Func streamWriter = stream => new ProgressiveFileCopier(FileSystem, job, Logger).StreamFile(outputPath, stream, CancellationToken.None); return ResultFactory.GetAsyncStreamWriter(streamWriter, outputHeaders); } diff --git a/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs b/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs index bf543579f7..13d59240f5 100644 --- a/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs +++ b/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs @@ -3,88 +3,12 @@ using ServiceStack.Web; using System; using System.Collections.Generic; using System.IO; +using System.Threading; using System.Threading.Tasks; using CommonIO; namespace MediaBrowser.Api.Playback.Progressive { - public class ProgressiveStreamWriter : IStreamWriter, IHasOptions - { - private string Path { get; set; } - private ILogger Logger { get; set; } - private readonly IFileSystem _fileSystem; - private readonly TranscodingJob _job; - - /// - /// The _options - /// - private readonly IDictionary _options = new Dictionary(); - /// - /// Gets the options. - /// - /// The options. - public IDictionary Options - { - get { return _options; } - } - - /// - /// Initializes a new instance of the class. - /// - /// The path. - /// The logger. - /// The file system. - public ProgressiveStreamWriter(string path, ILogger logger, IFileSystem fileSystem, TranscodingJob job) - { - Path = path; - Logger = logger; - _fileSystem = fileSystem; - _job = job; - } - - /// - /// Writes to. - /// - /// The response stream. - public void WriteTo(Stream responseStream) - { - var task = WriteToAsync(responseStream); - Task.WaitAll(task); - } - - /// - /// Writes to. - /// - /// The response stream. - public async Task WriteToAsync(Stream responseStream) - { - try - { - await new ProgressiveFileCopier(_fileSystem, _job, Logger).StreamFile(Path, responseStream).ConfigureAwait(false); - } - catch (IOException) - { - // These error are always the same so don't dump the whole stack trace - Logger.Error("Error streaming media. The client has most likely disconnected or transcoding has failed."); - - throw; - } - catch (Exception ex) - { - Logger.ErrorException("Error streaming media. The client has most likely disconnected or transcoding has failed.", ex); - - throw; - } - finally - { - if (_job != null) - { - ApiEntryPoint.Instance.OnTranscodeEndRequest(_job); - } - } - } - } - public class ProgressiveFileCopier { private readonly IFileSystem _fileSystem; @@ -103,22 +27,18 @@ namespace MediaBrowser.Api.Playback.Progressive _logger = logger; } - public async Task StreamFile(string path, Stream outputStream) + public async Task StreamFile(string path, Stream outputStream, CancellationToken cancellationToken) { var eofCount = 0; - long position = 0; using (var fs = _fileSystem.GetFileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, true)) { while (eofCount < 15) { - await CopyToInternal(fs, outputStream, BufferSize).ConfigureAwait(false); + var bytesRead = await CopyToAsyncInternal(fs, outputStream, BufferSize, cancellationToken).ConfigureAwait(false); - var fsPosition = fs.Position; - - var bytesRead = fsPosition - position; - - //Logger.Debug("Streamed {0} bytes from file {1}", bytesRead, path); + //var position = fs.Position; + //_logger.Debug("Streamed {0} bytes to position {1} from file {2}", bytesRead, position, path); if (bytesRead == 0) { @@ -126,57 +46,36 @@ namespace MediaBrowser.Api.Playback.Progressive { eofCount++; } - await Task.Delay(100).ConfigureAwait(false); + await Task.Delay(100, cancellationToken).ConfigureAwait(false); } else { eofCount = 0; } - - position = fsPosition; } } } - private async Task CopyToInternal(Stream source, Stream destination, int bufferSize) + private async Task CopyToAsyncInternal(Stream source, Stream destination, Int32 bufferSize, CancellationToken cancellationToken) { - var array = new byte[bufferSize]; - int count; - while ((count = await source.ReadAsync(array, 0, array.Length).ConfigureAwait(false)) != 0) + byte[] buffer = new byte[bufferSize]; + int bytesRead; + int totalBytesRead = 0; + + while ((bytesRead = await source.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false)) != 0) { - //if (_job != null) - //{ - // var didPause = false; - // var totalPauseTime = 0; + await destination.WriteAsync(buffer, 0, bytesRead, cancellationToken).ConfigureAwait(false); - // if (_job.IsUserPaused) - // { - // _logger.Debug("Pausing writing to network stream while user has paused playback."); - - // while (_job.IsUserPaused && totalPauseTime < 30000) - // { - // didPause = true; - // var pauseTime = 500; - // totalPauseTime += pauseTime; - // await Task.Delay(pauseTime).ConfigureAwait(false); - // } - // } - - // if (didPause) - // { - // _logger.Debug("Resuming writing to network stream due to user unpausing playback."); - // } - //} - - await destination.WriteAsync(array, 0, count).ConfigureAwait(false); - - _bytesWritten += count; + _bytesWritten += bytesRead; + totalBytesRead += bytesRead; if (_job != null) { _job.BytesDownloaded = Math.Max(_job.BytesDownloaded ?? _bytesWritten, _bytesWritten); } } + + return totalBytesRead; } } } diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index b3df34c4dc..1897511af7 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -46,6 +46,12 @@ namespace MediaBrowser.Controller.Entities.Audio } } + [IgnoreDataMember] + public override bool EnableForceSaveOnDateModifiedChange + { + get { return true; } + } + public Audio() { Artists = new List(); diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 0860cb61cb..c7a6b75ff2 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -455,7 +455,10 @@ namespace MediaBrowser.Controller.Entities public DateTime DateLastRefreshed { get; set; } [IgnoreDataMember] - public DateTime? DateModifiedDuringLastRefresh { get; set; } + public virtual bool EnableForceSaveOnDateModifiedChange + { + get { return false; } + } /// /// The logger diff --git a/MediaBrowser.Controller/Entities/Book.cs b/MediaBrowser.Controller/Entities/Book.cs index 2ca56bc706..59ab954378 100644 --- a/MediaBrowser.Controller/Entities/Book.cs +++ b/MediaBrowser.Controller/Entities/Book.cs @@ -34,6 +34,12 @@ namespace MediaBrowser.Controller.Entities return SeriesName; } + [IgnoreDataMember] + public override bool EnableForceSaveOnDateModifiedChange + { + get { return true; } + } + public Guid? FindSeriesId() { return SeriesId; diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 89b9479e7b..0397e9a88e 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -373,13 +373,6 @@ namespace MediaBrowser.Controller.Entities if (currentChildren.TryGetValue(child.Id, out currentChild) && IsValidFromResolver(currentChild, child)) { - var currentChildLocationType = currentChild.LocationType; - if (currentChildLocationType != LocationType.Remote && - currentChildLocationType != LocationType.Virtual) - { - currentChild.DateModified = child.DateModified; - } - await UpdateIsOffline(currentChild, false).ConfigureAwait(false); validChildren.Add(currentChild); diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs index 317c71529e..54386a1795 100644 --- a/MediaBrowser.Controller/Entities/Game.cs +++ b/MediaBrowser.Controller/Entities/Game.cs @@ -4,6 +4,7 @@ using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Serialization; namespace MediaBrowser.Controller.Entities { @@ -32,6 +33,12 @@ namespace MediaBrowser.Controller.Entities locationType != LocationType.Virtual; } + [IgnoreDataMember] + public override bool EnableForceSaveOnDateModifiedChange + { + get { return true; } + } + /// /// Gets or sets the remote trailers. /// @@ -42,6 +49,7 @@ namespace MediaBrowser.Controller.Entities /// Gets the type of the media. /// /// The type of the media. + [IgnoreDataMember] public override string MediaType { get { return Model.Entities.MediaType.Game; } diff --git a/MediaBrowser.Controller/Entities/IHasImages.cs b/MediaBrowser.Controller/Entities/IHasImages.cs index 897250caa1..2267480985 100644 --- a/MediaBrowser.Controller/Entities/IHasImages.cs +++ b/MediaBrowser.Controller/Entities/IHasImages.cs @@ -207,8 +207,6 @@ namespace MediaBrowser.Controller.Entities /// The image. /// The index. void SetImage(ItemImageInfo image, int index); - - DateTime? DateModifiedDuringLastRefresh { get; set; } } public static class HasImagesExtensions diff --git a/MediaBrowser.Controller/Entities/IHasMetadata.cs b/MediaBrowser.Controller/Entities/IHasMetadata.cs index c7940c8a97..378c4a390b 100644 --- a/MediaBrowser.Controller/Entities/IHasMetadata.cs +++ b/MediaBrowser.Controller/Entities/IHasMetadata.cs @@ -17,7 +17,7 @@ namespace MediaBrowser.Controller.Entities /// Gets the date modified. /// /// The date modified. - DateTime DateModified { get; } + DateTime DateModified { get; set; } /// /// Gets or sets the date last saved. @@ -51,5 +51,7 @@ namespace MediaBrowser.Controller.Entities bool SupportsPeople { get; } bool RequiresRefresh(); + + bool EnableForceSaveOnDateModifiedChange { get; } } } diff --git a/MediaBrowser.Controller/Entities/Photo.cs b/MediaBrowser.Controller/Entities/Photo.cs index de756563d8..804ea04a59 100644 --- a/MediaBrowser.Controller/Entities/Photo.cs +++ b/MediaBrowser.Controller/Entities/Photo.cs @@ -51,6 +51,12 @@ namespace MediaBrowser.Controller.Entities } } + [IgnoreDataMember] + public override bool EnableForceSaveOnDateModifiedChange + { + get { return true; } + } + public override bool CanDownload() { return true; diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index 73c893dd6e..eba1e466a2 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -58,6 +58,12 @@ namespace MediaBrowser.Controller.Entities } } + [IgnoreDataMember] + public override bool EnableForceSaveOnDateModifiedChange + { + get { return true; } + } + public int? TotalBitrate { get; set; } public ExtraType? ExtraType { get; set; } diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs index c057c97071..e7e3323c2b 100644 --- a/MediaBrowser.Controller/Providers/DirectoryService.cs +++ b/MediaBrowser.Controller/Providers/DirectoryService.cs @@ -102,6 +102,12 @@ namespace MediaBrowser.Controller.Providers { var directory = Path.GetDirectoryName(path); + if (string.IsNullOrWhiteSpace(directory)) + { + _logger.Debug("Parent path is null for {0}", path); + return null; + } + var dict = GetFileSystemDictionary(directory, false); FileSystemMetadata entry; diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index 678d495cbc..9776c4e2f5 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -143,6 +143,22 @@ namespace MediaBrowser.Providers.Manager var beforeSaveResult = await BeforeSave(itemOfType, isFirstRefresh || refreshOptions.ReplaceAllMetadata || refreshOptions.MetadataRefreshMode == MetadataRefreshMode.FullRefresh || requiresRefresh, updateType).ConfigureAwait(false); updateType = updateType | beforeSaveResult; + if (item.LocationType == LocationType.FileSystem) + { + var file = refreshOptions.DirectoryService.GetFile(item.Path); + if (file != null) + { + var fileLastWriteTime = file.LastWriteTimeUtc; + if (item.EnableForceSaveOnDateModifiedChange && fileLastWriteTime != item.DateModified) + { + Logger.Debug("Date modified for {0}. Old date {1} new date {2} Id {3}", item.Path, item.DateModified, fileLastWriteTime, item.Id); + requiresRefresh = true; + } + + item.DateModified = fileLastWriteTime; + } + } + // Save if changes were made, or it's never been saved before if (refreshOptions.ForceSave || updateType > ItemUpdateType.None || isFirstRefresh || refreshOptions.ReplaceAllMetadata || requiresRefresh) { @@ -155,12 +171,10 @@ namespace MediaBrowser.Providers.Manager if (hasRefreshedMetadata && hasRefreshedImages) { item.DateLastRefreshed = DateTime.UtcNow; - item.DateModifiedDuringLastRefresh = item.DateModified; } else { item.DateLastRefreshed = default(DateTime); - item.DateModifiedDuringLastRefresh = null; } // Save to database diff --git a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs index bec9280b3a..6c79189887 100644 --- a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs @@ -167,9 +167,10 @@ namespace MediaBrowser.Providers.MediaInfo public bool HasChanged(IHasMetadata item, IDirectoryService directoryService) { - if (item.DateModifiedDuringLastRefresh.HasValue) + var file = directoryService.GetFile(item.Path); + if (file != null && file.LastWriteTimeUtc != item.DateModified) { - return item.DateModifiedDuringLastRefresh.Value != item.DateModified; + return true; } return false; diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs index b89b0b9256..11280cff21 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs @@ -171,12 +171,10 @@ namespace MediaBrowser.Providers.MediaInfo public bool HasChanged(IHasMetadata item, IDirectoryService directoryService) { - if (item.DateModifiedDuringLastRefresh.HasValue) + var file = directoryService.GetFile(item.Path); + if (file != null && file.LastWriteTimeUtc != item.DateModified) { - if (item.DateModifiedDuringLastRefresh.Value != item.DateModified) - { - return true; - } + return true; } if (item.SupportsLocalMetadata) diff --git a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs index 9a1f072cd2..5fc3630627 100644 --- a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs @@ -195,12 +195,10 @@ namespace MediaBrowser.Providers.MediaInfo public bool HasChanged(IHasMetadata item, IDirectoryService directoryService) { - if (item.DateModifiedDuringLastRefresh.HasValue) + var file = directoryService.GetFile(item.Path); + if (file != null && file.LastWriteTimeUtc != item.DateModified) { - if (item.DateModifiedDuringLastRefresh.Value != item.DateModified) - { - return true; - } + return true; } return false; diff --git a/MediaBrowser.Providers/Photos/PhotoProvider.cs b/MediaBrowser.Providers/Photos/PhotoProvider.cs index 882363b2f8..619b726368 100644 --- a/MediaBrowser.Providers/Photos/PhotoProvider.cs +++ b/MediaBrowser.Providers/Photos/PhotoProvider.cs @@ -154,9 +154,10 @@ namespace MediaBrowser.Providers.Photos public bool HasChanged(IHasMetadata item, IDirectoryService directoryService) { - if (item.DateModifiedDuringLastRefresh.HasValue) + var file = directoryService.GetFile(item.Path); + if (file != null && file.LastWriteTimeUtc != item.DateModified) { - return item.DateModifiedDuringLastRefresh.Value != item.DateModified; + return true; } return false; diff --git a/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs b/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs index 60e7e2df33..9f949db92a 100644 --- a/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs +++ b/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs @@ -44,7 +44,6 @@ namespace MediaBrowser.Server.Implementations.Library // Make sure DateCreated and DateModified have values var fileInfo = directoryService.GetFile(item.Path); - item.DateModified = fileSystem.GetLastWriteTimeUtc(fileInfo); SetDateCreated(item, fileSystem, fileInfo); EnsureName(item, fileInfo); @@ -80,7 +79,7 @@ namespace MediaBrowser.Server.Implementations.Library item.GetParents().Any(i => i.IsLocked); // Make sure DateCreated and DateModified have values - EnsureDates(fileSystem, item, args, true); + EnsureDates(fileSystem, item, args); } /// @@ -125,8 +124,7 @@ namespace MediaBrowser.Server.Implementations.Library /// The file system. /// The item. /// The args. - /// if set to true [include creation time]. - private static void EnsureDates(IFileSystem fileSystem, BaseItem item, ItemResolveArgs args, bool includeCreationTime) + private static void EnsureDates(IFileSystem fileSystem, BaseItem item, ItemResolveArgs args) { if (fileSystem == null) { @@ -148,12 +146,7 @@ namespace MediaBrowser.Server.Implementations.Library if (childData != null) { - if (includeCreationTime) - { - SetDateCreated(item, fileSystem, childData); - } - - item.DateModified = fileSystem.GetLastWriteTimeUtc(childData); + SetDateCreated(item, fileSystem, childData); } else { @@ -161,21 +154,13 @@ namespace MediaBrowser.Server.Implementations.Library if (fileData.Exists) { - if (includeCreationTime) - { - SetDateCreated(item, fileSystem, fileData); - } - item.DateModified = fileSystem.GetLastWriteTimeUtc(fileData); + SetDateCreated(item, fileSystem, fileData); } } } else { - if (includeCreationTime) - { - SetDateCreated(item, fileSystem, args.FileInfo); - } - item.DateModified = fileSystem.GetLastWriteTimeUtc(args.FileInfo); + SetDateCreated(item, fileSystem, args.FileInfo); } } diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index 7f556cfb06..63dd29e0dd 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -257,7 +257,6 @@ namespace MediaBrowser.Server.Implementations.Persistence _connection.AddColumn(Logger, "TypedBaseItems", "TrailerTypes", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "CriticRating", "Float"); _connection.AddColumn(Logger, "TypedBaseItems", "CriticRatingSummary", "Text"); - _connection.AddColumn(Logger, "TypedBaseItems", "DateModifiedDuringLastRefresh", "DATETIME"); _connection.AddColumn(Logger, "TypedBaseItems", "InheritedTags", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "CleanName", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "PresentationUniqueKey", "Text"); @@ -402,7 +401,6 @@ namespace MediaBrowser.Server.Implementations.Persistence "Tags", "SourceType", "TrailerTypes", - "DateModifiedDuringLastRefresh", "OriginalTitle", "PrimaryVersionId", "DateLastMediaAdded", @@ -523,7 +521,6 @@ namespace MediaBrowser.Server.Implementations.Persistence "TrailerTypes", "CriticRating", "CriticRatingSummary", - "DateModifiedDuringLastRefresh", "InheritedTags", "CleanName", "PresentationUniqueKey", @@ -902,15 +899,6 @@ namespace MediaBrowser.Server.Implementations.Persistence _saveItemCommand.GetParameter(index++).Value = item.CriticRating; _saveItemCommand.GetParameter(index++).Value = item.CriticRatingSummary; - if (!item.DateModifiedDuringLastRefresh.HasValue || item.DateModifiedDuringLastRefresh.Value == default(DateTime)) - { - _saveItemCommand.GetParameter(index++).Value = null; - } - else - { - _saveItemCommand.GetParameter(index++).Value = item.DateModifiedDuringLastRefresh.Value; - } - var inheritedTags = item.GetInheritedTags(); if (inheritedTags.Count > 0) { @@ -1370,88 +1358,101 @@ namespace MediaBrowser.Server.Implementations.Persistence } } - if (!reader.IsDBNull(51)) - { - item.DateModifiedDuringLastRefresh = reader.GetDateTime(51).ToUniversalTime(); - } + var index = 51; - if (!reader.IsDBNull(52)) + if (!reader.IsDBNull(index)) { - item.OriginalTitle = reader.GetString(52); + item.OriginalTitle = reader.GetString(index); } + index++; var video = item as Video; if (video != null) { - if (!reader.IsDBNull(53)) + if (!reader.IsDBNull(index)) { - video.PrimaryVersionId = reader.GetString(53); + video.PrimaryVersionId = reader.GetString(index); } } + index++; var folder = item as Folder; - if (folder != null && !reader.IsDBNull(54)) + if (folder != null && !reader.IsDBNull(index)) { - folder.DateLastMediaAdded = reader.GetDateTime(54).ToUniversalTime(); + folder.DateLastMediaAdded = reader.GetDateTime(index).ToUniversalTime(); } + index++; - if (!reader.IsDBNull(55)) + if (!reader.IsDBNull(index)) { - item.Album = reader.GetString(55); + item.Album = reader.GetString(index); } + index++; - if (!reader.IsDBNull(56)) + if (!reader.IsDBNull(index)) { - item.CriticRating = reader.GetFloat(56); + item.CriticRating = reader.GetFloat(index); } + index++; - if (!reader.IsDBNull(57)) + if (!reader.IsDBNull(index)) { - item.CriticRatingSummary = reader.GetString(57); + item.CriticRatingSummary = reader.GetString(index); } + index++; - if (!reader.IsDBNull(58)) + if (!reader.IsDBNull(index)) { - item.IsVirtualItem = reader.GetBoolean(58); + item.IsVirtualItem = reader.GetBoolean(index); } + index++; var hasSeries = item as IHasSeries; if (hasSeries != null) { - if (!reader.IsDBNull(59)) + if (!reader.IsDBNull(index)) { - hasSeries.SeriesName = reader.GetString(59); + hasSeries.SeriesName = reader.GetString(index); } } + index++; var episode = item as Episode; if (episode != null) { - if (!reader.IsDBNull(60)) + if (!reader.IsDBNull(index)) { - episode.SeasonName = reader.GetString(60); + episode.SeasonName = reader.GetString(index); } - if (!reader.IsDBNull(61)) + index++; + if (!reader.IsDBNull(index)) { - episode.SeasonId = reader.GetGuid(61); + episode.SeasonId = reader.GetGuid(index); } } + else + { + index++; + } + index++; if (hasSeries != null) { - if (!reader.IsDBNull(62)) + if (!reader.IsDBNull(index)) { - hasSeries.SeriesId = reader.GetGuid(62); + hasSeries.SeriesId = reader.GetGuid(index); } } + index++; if (hasSeries != null) { - if (!reader.IsDBNull(63)) + if (!reader.IsDBNull(index)) { - hasSeries.SeriesSortName = reader.GetString(63); + hasSeries.SeriesSortName = reader.GetString(index); } } + index++; return item; } From 222b2492f6aa35f3d933c9ed3d142f574e9d6d20 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 24 Jul 2016 12:49:41 -0400 Subject: [PATCH 04/18] 3.1.77 --- SharedVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index 4d6e7bfddc..84b0d2282e 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,4 +1,4 @@ using System.Reflection; //[assembly: AssemblyVersion("3.1.*")] -[assembly: AssemblyVersion("3.1.76")] +[assembly: AssemblyVersion("3.1.77")] From 8b6b7e465498194ed650952345f821b752b5eae7 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 24 Jul 2016 14:25:32 -0400 Subject: [PATCH 05/18] removed dead css --- .../MediaBrowser.WebDashboard.csproj | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 44be96aa8d..e4150d85cf 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -113,6 +113,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest @@ -140,12 +143,6 @@ PreserveNewest - - PreserveNewest - - - PreserveNewest - PreserveNewest @@ -230,12 +227,6 @@ PreserveNewest - - PreserveNewest - - - PreserveNewest - PreserveNewest @@ -1512,9 +1503,6 @@ - - PreserveNewest - PreserveNewest From 03b26b939b512d3e88ffef8b4b29ebaad75c879b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 24 Jul 2016 14:58:21 -0400 Subject: [PATCH 06/18] updated nuget --- Nuget/MediaBrowser.Common.Internal.nuspec | 4 ++-- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index dc92b318e7..21173feaad 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.652 + 3.0.653 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Emby Theater and Emby Server. Not intended for plugin developer consumption. Copyright © Emby 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index a8b78b4e3d..2946858472 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.652 + 3.0.653 MediaBrowser.Common Emby Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 105d2c4784..18e8a5c13b 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.652 + 3.0.653 Media Browser.Server.Core Emby Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Emby Server. Copyright © Emby 2013 - + From b878dc15375c824da20d1ef793254373a27aeb40 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 24 Jul 2016 16:10:53 -0400 Subject: [PATCH 07/18] prevent incorrect default rating --- MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs index a6b6de7e51..1bf4ed6c00 100644 --- a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs +++ b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs @@ -199,7 +199,6 @@ namespace MediaBrowser.Providers.Movies var ourRelease = releases.FirstOrDefault(c => c.iso_3166_1.Equals(preferredCountryCode, StringComparison.OrdinalIgnoreCase)); var usRelease = releases.FirstOrDefault(c => c.iso_3166_1.Equals("US", StringComparison.OrdinalIgnoreCase)); - var minimunRelease = releases.OrderBy(c => c.release_date).FirstOrDefault(); if (ourRelease != null) { @@ -210,10 +209,6 @@ namespace MediaBrowser.Providers.Movies { movie.OfficialRating = usRelease.certification; } - else if (minimunRelease != null) - { - movie.OfficialRating = minimunRelease.iso_3166_1 + "-" + minimunRelease.certification; - } } if (!string.IsNullOrWhiteSpace(movieData.release_date)) From 8328f39834f042e1808fd8506bbc7c48151703ab Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 25 Jul 2016 01:12:38 -0400 Subject: [PATCH 08/18] update behavior with restricted transcoding access --- .../Playback/BaseStreamingService.cs | 15 +++- .../Playback/Hls/DynamicHlsService.cs | 12 --- MediaBrowser.Api/Playback/MediaInfoService.cs | 35 ++++++-- .../MediaBrowser.Model.Portable.csproj | 7 +- .../MediaBrowser.Model.net35.csproj | 7 +- MediaBrowser.Model/Dlna/AudioOptions.cs | 2 + MediaBrowser.Model/Dlna/ILocalPlayer.cs | 39 --------- MediaBrowser.Model/Dlna/ITranscoderSupport.cs | 15 ++++ MediaBrowser.Model/Dlna/NullLocalPlayer.cs | 21 ----- MediaBrowser.Model/Dlna/StreamBuilder.cs | 82 ++++++++----------- MediaBrowser.Model/MediaBrowser.Model.csproj | 3 +- .../Api/PackageCreator.cs | 10 +-- 12 files changed, 98 insertions(+), 150 deletions(-) delete mode 100644 MediaBrowser.Model/Dlna/ILocalPlayer.cs create mode 100644 MediaBrowser.Model/Dlna/ITranscoderSupport.cs delete mode 100644 MediaBrowser.Model/Dlna/NullLocalPlayer.cs diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index f60a106dac..ce3691095c 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -1669,7 +1669,7 @@ namespace MediaBrowser.Api.Playback RequestedUrl = url, UserAgent = Request.UserAgent }; - + //if ((Request.UserAgent ?? string.Empty).IndexOf("iphone", StringComparison.OrdinalIgnoreCase) != -1 || // (Request.UserAgent ?? string.Empty).IndexOf("ipad", StringComparison.OrdinalIgnoreCase) != -1 || // (Request.UserAgent ?? string.Empty).IndexOf("ipod", StringComparison.OrdinalIgnoreCase) != -1) @@ -1770,6 +1770,19 @@ namespace MediaBrowser.Api.Playback { state.OutputVideoCodec = "copy"; } + else + { + // If the user doesn't have access to transcoding, then force stream copy, regardless of whether it will be compatible or not + var auth = AuthorizationContext.GetAuthorizationInfo(Request); + if (!string.IsNullOrWhiteSpace(auth.UserId)) + { + var user = UserManager.GetUserById(auth.UserId); + if (!user.Policy.EnableVideoPlaybackTranscoding) + { + state.OutputVideoCodec = "copy"; + } + } + } if (state.AudioStream != null && CanStreamCopyAudio(state, state.SupportedAudioCodecs)) { diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs index f4ecf36934..e029d4e99a 100644 --- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs @@ -942,17 +942,5 @@ namespace MediaBrowser.Api.Playback.Hls { return isOutputVideo ? ".ts" : ".ts"; } - - protected override bool CanStreamCopyVideo(StreamState state) - { - var isLiveStream = IsLiveStream(state); - - //if (!isLiveStream && Request.QueryString["AllowCustomSegmenting"] != "true") - //{ - // return false; - //} - - return base.CanStreamCopyVideo(state); - } } } \ No newline at end of file diff --git a/MediaBrowser.Api/Playback/MediaInfoService.cs b/MediaBrowser.Api/Playback/MediaInfoService.cs index 2d9cc40c0a..0b989784c0 100644 --- a/MediaBrowser.Api/Playback/MediaInfoService.cs +++ b/MediaBrowser.Api/Playback/MediaInfoService.cs @@ -15,6 +15,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.MediaEncoding; namespace MediaBrowser.Api.Playback @@ -68,8 +69,9 @@ namespace MediaBrowser.Api.Playback private readonly IServerConfigurationManager _config; private readonly INetworkManager _networkManager; private readonly IMediaEncoder _mediaEncoder; + private readonly IUserManager _userManager; - public MediaInfoService(IMediaSourceManager mediaSourceManager, IDeviceManager deviceManager, ILibraryManager libraryManager, IServerConfigurationManager config, INetworkManager networkManager, IMediaEncoder mediaEncoder) + public MediaInfoService(IMediaSourceManager mediaSourceManager, IDeviceManager deviceManager, ILibraryManager libraryManager, IServerConfigurationManager config, INetworkManager networkManager, IMediaEncoder mediaEncoder, IUserManager userManager) { _mediaSourceManager = mediaSourceManager; _deviceManager = deviceManager; @@ -77,6 +79,7 @@ namespace MediaBrowser.Api.Playback _config = config; _networkManager = networkManager; _mediaEncoder = mediaEncoder; + _userManager = userManager; } public object Get(GetBitrateTestBytes request) @@ -119,7 +122,7 @@ namespace MediaBrowser.Api.Playback SetDeviceSpecificData(item, result.MediaSource, profile, authInfo, request.MaxStreamingBitrate, request.StartTimeTicks ?? 0, result.MediaSource.Id, request.AudioStreamIndex, - request.SubtitleStreamIndex, request.PlaySessionId); + request.SubtitleStreamIndex, request.PlaySessionId, request.UserId); } else { @@ -159,7 +162,7 @@ namespace MediaBrowser.Api.Playback { var mediaSourceId = request.MediaSourceId; - SetDeviceSpecificData(request.Id, info, profile, authInfo, request.MaxStreamingBitrate ?? profile.MaxStreamingBitrate, request.StartTimeTicks ?? 0, mediaSourceId, request.AudioStreamIndex, request.SubtitleStreamIndex); + SetDeviceSpecificData(request.Id, info, profile, authInfo, request.MaxStreamingBitrate ?? profile.MaxStreamingBitrate, request.StartTimeTicks ?? 0, mediaSourceId, request.AudioStreamIndex, request.SubtitleStreamIndex, request.UserId); } return ToOptimizedResult(info); @@ -221,13 +224,14 @@ namespace MediaBrowser.Api.Playback long startTimeTicks, string mediaSourceId, int? audioStreamIndex, - int? subtitleStreamIndex) + int? subtitleStreamIndex, + string userId) { var item = _libraryManager.GetItemById(itemId); foreach (var mediaSource in result.MediaSources) { - SetDeviceSpecificData(item, mediaSource, profile, auth, maxBitrate, startTimeTicks, mediaSourceId, audioStreamIndex, subtitleStreamIndex, result.PlaySessionId); + SetDeviceSpecificData(item, mediaSource, profile, auth, maxBitrate, startTimeTicks, mediaSourceId, audioStreamIndex, subtitleStreamIndex, result.PlaySessionId, userId); } SortMediaSources(result, maxBitrate); @@ -242,7 +246,8 @@ namespace MediaBrowser.Api.Playback string mediaSourceId, int? audioStreamIndex, int? subtitleStreamIndex, - string playSessionId) + string playSessionId, + string userId) { var streamBuilder = new StreamBuilder(_mediaEncoder, Logger); @@ -262,6 +267,8 @@ namespace MediaBrowser.Api.Playback options.SubtitleStreamIndex = subtitleStreamIndex; } + var user = _userManager.GetUserById(userId); + if (mediaSource.SupportsDirectPlay) { var supportsDirectStream = mediaSource.SupportsDirectStream; @@ -270,6 +277,14 @@ namespace MediaBrowser.Api.Playback mediaSource.SupportsDirectStream = true; options.MaxBitrate = maxBitrate; + if (item is Audio) + { + if (!user.Policy.EnableAudioPlaybackTranscoding) + { + options.ForceDirectPlay = true; + } + } + // The MediaSource supports direct stream, now test to see if the client supports it var streamInfo = string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase) ? streamBuilder.BuildAudioItem(options) : @@ -293,6 +308,14 @@ namespace MediaBrowser.Api.Playback { options.MaxBitrate = GetMaxBitrate(maxBitrate); + if (item is Audio) + { + if (!user.Policy.EnableAudioPlaybackTranscoding) + { + options.ForceDirectStream = true; + } + } + // The MediaSource supports direct stream, now test to see if the client supports it var streamInfo = string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase) ? streamBuilder.BuildAudioItem(options) : diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj index 862d95f7ee..7a9589c982 100644 --- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj +++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj @@ -346,8 +346,8 @@ Dlna\HttpHeaderInfo.cs - - Dlna\ILocalPlayer.cs + + Dlna\ITranscoderSupport.cs Dlna\MediaFormatProfile.cs @@ -355,9 +355,6 @@ Dlna\MediaFormatProfileResolver.cs - - Dlna\NullLocalPlayer.cs - Dlna\PlaybackErrorCode.cs diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj index 953e5b7bef..420b536ae4 100644 --- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj +++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj @@ -318,8 +318,8 @@ Dlna\HttpHeaderInfo.cs - - Dlna\ILocalPlayer.cs + + Dlna\ITranscoderSupport.cs Dlna\MediaFormatProfile.cs @@ -327,9 +327,6 @@ Dlna\MediaFormatProfileResolver.cs - - Dlna\NullLocalPlayer.cs - Dlna\PlaybackErrorCode.cs diff --git a/MediaBrowser.Model/Dlna/AudioOptions.cs b/MediaBrowser.Model/Dlna/AudioOptions.cs index 162b88c981..c208e8ab0b 100644 --- a/MediaBrowser.Model/Dlna/AudioOptions.cs +++ b/MediaBrowser.Model/Dlna/AudioOptions.cs @@ -18,6 +18,8 @@ namespace MediaBrowser.Model.Dlna public bool EnableDirectPlay { get; set; } public bool EnableDirectStream { get; set; } + public bool ForceDirectPlay { get; set; } + public bool ForceDirectStream { get; set; } public string ItemId { get; set; } public List MediaSources { get; set; } diff --git a/MediaBrowser.Model/Dlna/ILocalPlayer.cs b/MediaBrowser.Model/Dlna/ILocalPlayer.cs deleted file mode 100644 index 9de360023e..0000000000 --- a/MediaBrowser.Model/Dlna/ILocalPlayer.cs +++ /dev/null @@ -1,39 +0,0 @@ - -namespace MediaBrowser.Model.Dlna -{ - public interface ILocalPlayer - { - /// - /// Determines whether this instance [can access file] the specified path. - /// - /// The path. - /// true if this instance [can access file] the specified path; otherwise, false. - bool CanAccessFile(string path); - /// - /// Determines whether this instance [can access directory] the specified path. - /// - /// The path. - /// true if this instance [can access directory] the specified path; otherwise, false. - bool CanAccessDirectory(string path); - /// - /// Determines whether this instance [can access URL] the specified URL. - /// - /// The URL. - /// if set to true [requires custom request headers]. - /// true if this instance [can access URL] the specified URL; otherwise, false. - bool CanAccessUrl(string url, bool requiresCustomRequestHeaders); - } - - public interface ITranscoderSupport - { - bool CanEncodeToAudioCodec(string codec); - } - - public class FullTranscoderSupport : ITranscoderSupport - { - public bool CanEncodeToAudioCodec(string codec) - { - return true; - } - } -} diff --git a/MediaBrowser.Model/Dlna/ITranscoderSupport.cs b/MediaBrowser.Model/Dlna/ITranscoderSupport.cs new file mode 100644 index 0000000000..0dac234032 --- /dev/null +++ b/MediaBrowser.Model/Dlna/ITranscoderSupport.cs @@ -0,0 +1,15 @@ +namespace MediaBrowser.Model.Dlna +{ + public interface ITranscoderSupport + { + bool CanEncodeToAudioCodec(string codec); + } + + public class FullTranscoderSupport : ITranscoderSupport + { + public bool CanEncodeToAudioCodec(string codec) + { + return true; + } + } +} diff --git a/MediaBrowser.Model/Dlna/NullLocalPlayer.cs b/MediaBrowser.Model/Dlna/NullLocalPlayer.cs deleted file mode 100644 index c34b638871..0000000000 --- a/MediaBrowser.Model/Dlna/NullLocalPlayer.cs +++ /dev/null @@ -1,21 +0,0 @@ - -namespace MediaBrowser.Model.Dlna -{ - public class NullLocalPlayer : ILocalPlayer - { - public bool CanAccessFile(string path) - { - return false; - } - - public bool CanAccessDirectory(string path) - { - return false; - } - - public bool CanAccessUrl(string url, bool requiresCustomRequestHeaders) - { - return false; - } - } -} diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index 2863eba2e0..c05ca41878 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -11,29 +11,17 @@ namespace MediaBrowser.Model.Dlna { public class StreamBuilder { - private readonly ILocalPlayer _localPlayer; private readonly ILogger _logger; private readonly ITranscoderSupport _transcoderSupport; - public StreamBuilder(ILocalPlayer localPlayer, ITranscoderSupport transcoderSupport, ILogger logger) + public StreamBuilder(ITranscoderSupport transcoderSupport, ILogger logger) { _transcoderSupport = transcoderSupport; - _localPlayer = localPlayer; _logger = logger; } - public StreamBuilder(ITranscoderSupport transcoderSupport, ILogger logger) - : this(new NullLocalPlayer(), transcoderSupport, logger) - { - } - - public StreamBuilder(ILocalPlayer localPlayer, ILogger logger) - : this(localPlayer, new FullTranscoderSupport(), logger) - { - } - public StreamBuilder(ILogger logger) - : this(new NullLocalPlayer(), new FullTranscoderSupport(), logger) + : this(new FullTranscoderSupport(), logger) { } @@ -127,6 +115,20 @@ namespace MediaBrowser.Model.Dlna DeviceProfile = options.Profile }; + if (options.ForceDirectPlay) + { + playlistItem.PlayMethod = PlayMethod.DirectPlay; + playlistItem.Container = item.Container; + return playlistItem; + } + + if (options.ForceDirectStream) + { + playlistItem.PlayMethod = PlayMethod.DirectStream; + playlistItem.Container = item.Container; + return playlistItem; + } + MediaStream audioStream = item.GetDefaultAudioStream(null); List directPlayMethods = GetAudioDirectPlayMethods(item, audioStream, options); @@ -182,19 +184,7 @@ namespace MediaBrowser.Model.Dlna if (all) { - if (item.Protocol == MediaProtocol.File && - directPlayMethods.Contains(PlayMethod.DirectPlay) && - _localPlayer.CanAccessFile(item.Path)) - { - playlistItem.PlayMethod = PlayMethod.DirectPlay; - } - else if (item.Protocol == MediaProtocol.Http && - directPlayMethods.Contains(PlayMethod.DirectPlay) && - _localPlayer.CanAccessUrl(item.Path, item.RequiredHttpHeaders.Count > 0)) - { - playlistItem.PlayMethod = PlayMethod.DirectPlay; - } - else if (directPlayMethods.Contains(PlayMethod.DirectStream)) + if (directPlayMethods.Contains(PlayMethod.DirectStream)) { playlistItem.PlayMethod = PlayMethod.DirectStream; } @@ -413,8 +403,8 @@ namespace MediaBrowser.Model.Dlna MediaStream videoStream = item.VideoStream; // TODO: This doesn't accout for situation of device being able to handle media bitrate, but wifi connection not fast enough - bool isEligibleForDirectPlay = options.EnableDirectPlay && IsEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options), subtitleStream, options, PlayMethod.DirectPlay); - bool isEligibleForDirectStream = options.EnableDirectStream && IsEligibleForDirectPlay(item, options.GetMaxBitrate(), subtitleStream, options, PlayMethod.DirectStream); + bool isEligibleForDirectPlay = options.EnableDirectPlay && (options.ForceDirectPlay || IsEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options), subtitleStream, options, PlayMethod.DirectPlay)); + bool isEligibleForDirectStream = options.EnableDirectStream && (options.ForceDirectStream || IsEligibleForDirectPlay(item, options.GetMaxBitrate(), subtitleStream, options, PlayMethod.DirectStream)); _logger.Info("Profile: {0}, Path: {1}, isEligibleForDirectPlay: {2}, isEligibleForDirectStream: {3}", options.Profile.Name ?? "Unknown Profile", @@ -425,7 +415,7 @@ namespace MediaBrowser.Model.Dlna if (isEligibleForDirectPlay || isEligibleForDirectStream) { // See if it can be direct played - PlayMethod? directPlay = GetVideoDirectPlayProfile(options.Profile, item, videoStream, audioStream, isEligibleForDirectPlay, isEligibleForDirectStream); + PlayMethod? directPlay = GetVideoDirectPlayProfile(options, item, videoStream, audioStream, isEligibleForDirectPlay, isEligibleForDirectStream); if (directPlay != null) { @@ -645,13 +635,24 @@ namespace MediaBrowser.Model.Dlna return Math.Min(defaultBitrate, encoderAudioBitrateLimit); } - private PlayMethod? GetVideoDirectPlayProfile(DeviceProfile profile, + private PlayMethod? GetVideoDirectPlayProfile(VideoOptions options, MediaSourceInfo mediaSource, MediaStream videoStream, MediaStream audioStream, bool isEligibleForDirectPlay, bool isEligibleForDirectStream) { + DeviceProfile profile = options.Profile; + + if (options.ForceDirectPlay) + { + return PlayMethod.DirectPlay; + } + if (options.ForceDirectStream) + { + return PlayMethod.DirectStream; + } + if (videoStream == null) { _logger.Info("Profile: {0}, Cannot direct stream with no known video stream. Path: {1}", @@ -829,25 +830,6 @@ namespace MediaBrowser.Model.Dlna } } - if (isEligibleForDirectPlay && mediaSource.SupportsDirectPlay) - { - if (mediaSource.Protocol == MediaProtocol.Http) - { - if (_localPlayer.CanAccessUrl(mediaSource.Path, mediaSource.RequiredHttpHeaders.Count > 0)) - { - return PlayMethod.DirectPlay; - } - } - - else if (mediaSource.Protocol == MediaProtocol.File) - { - if (_localPlayer.CanAccessFile(mediaSource.Path)) - { - return PlayMethod.DirectPlay; - } - } - } - if (isEligibleForDirectStream && mediaSource.SupportsDirectStream) { return PlayMethod.DirectStream; diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 931b2ebcb2..e3c1e52a53 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -118,9 +118,8 @@ - + - diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs index 4c353c413e..b7b1f1dfd7 100644 --- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs +++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs @@ -440,15 +440,7 @@ namespace MediaBrowser.WebDashboard.Api files.Insert(0, "cordova.js"); } - var tags = files.Select(s => - { - if (s.IndexOf("require", StringComparison.OrdinalIgnoreCase) == -1 && s.IndexOf("alameda", StringComparison.OrdinalIgnoreCase) == -1) - { - return string.Format("", s); - } - return string.Format("", s); - - }).ToArray(); + var tags = files.Select(s => string.Format("", s)).ToArray(); builder.Append(string.Join(string.Empty, tags)); From e389d92e68a3f8d13da8a88b04bb9000f4d0e512 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 25 Jul 2016 12:59:43 -0400 Subject: [PATCH 09/18] 3.1.78 --- SharedVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index 84b0d2282e..7f0f8c8399 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,4 +1,4 @@ using System.Reflection; //[assembly: AssemblyVersion("3.1.*")] -[assembly: AssemblyVersion("3.1.77")] +[assembly: AssemblyVersion("3.1.78")] From aa434d591e8ad80c2f750221d2b44189a8e0ccda Mon Sep 17 00:00:00 2001 From: softworkz Date: Tue, 26 Jul 2016 05:29:05 +0200 Subject: [PATCH 10/18] Add StringUsageReporter StringUsageReporter reports usages of localization strings in the web application and can also list all unused strings --- .../Resources/SampleTransformed.htm | 1348 +++++++++++++++++ .../Resources/StringCheck.xslt | 145 ++ .../Resources/StringCheckSample.xml | 239 +++ .../ConsistencyTests/StringUsageReporter.cs | 260 ++++ .../TextIndexing/IndexBuilder.cs | 54 + .../TextIndexing/WordIndex.cs | 39 + .../TextIndexing/WordOccurrence.cs | 24 + .../TextIndexing/WordOccurrences.cs | 17 + MediaBrowser.Tests/MediaBrowser.Tests.csproj | 15 + 9 files changed, 2141 insertions(+) create mode 100644 MediaBrowser.Tests/ConsistencyTests/Resources/SampleTransformed.htm create mode 100644 MediaBrowser.Tests/ConsistencyTests/Resources/StringCheck.xslt create mode 100644 MediaBrowser.Tests/ConsistencyTests/Resources/StringCheckSample.xml create mode 100644 MediaBrowser.Tests/ConsistencyTests/StringUsageReporter.cs create mode 100644 MediaBrowser.Tests/ConsistencyTests/TextIndexing/IndexBuilder.cs create mode 100644 MediaBrowser.Tests/ConsistencyTests/TextIndexing/WordIndex.cs create mode 100644 MediaBrowser.Tests/ConsistencyTests/TextIndexing/WordOccurrence.cs create mode 100644 MediaBrowser.Tests/ConsistencyTests/TextIndexing/WordOccurrences.cs diff --git a/MediaBrowser.Tests/ConsistencyTests/Resources/SampleTransformed.htm b/MediaBrowser.Tests/ConsistencyTests/Resources/SampleTransformed.htm new file mode 100644 index 0000000000..9bff396d13 --- /dev/null +++ b/MediaBrowser.Tests/ConsistencyTests/Resources/SampleTransformed.htm @@ -0,0 +1,1348 @@ + + + + + String Usage Report + + + +

String Usage Report

+
+

Strings

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ LabelExit: "
+
Exit"
+
+
+
+
+ LabelVisitCommunity: "
+
Visit Community"
+
+
+
+
+ LabelGithub: "
+
Github"
+
+
+
+
+ LabelSwagger: "
+
Swagger"
+
+
+
+
+ LabelStandard: "
+
Standard"
+
+
+
+
+ LabelApiDocumentation: "
+
Api Documentation"
+
+
+
+
+ LabelDeveloperResources: "
+
Developer Resources"
+
+
+
+
+ LabelBrowseLibrary: "
+
Browse Library"
+
+
+
+
+ LabelConfigureServer: "
+
Configure Emby"
+
+
+
+
+ LabelOpenLibraryViewer: "
+
Open Library Viewer"
+
+
+
+
+ LabelRestartServer: "
+
Restart Server"
+
+
+
+
+ LabelShowLogWindow: "
+
Show Log Window"
+
+
+
+
+ LabelPrevious: "
+
Previous"
+
+
+ \wizardagreement.html:21 +
+ \wizardcomponents.html:54 +
+ \wizardfinish.html:40 +
+ \wizardlibrary.html:19 +
+ \wizardlivetvguide.html:30 +
+ \wizardlivetvtuner.html:31 +
+ \wizardservice.html:17 +
+ \wizardsettings.html:32 +
+ \wizarduser.html:27 +
+
+
+ LabelFinish: "
+
Finish"
+
+
+ \wizardfinish.html:41 +
+
+
+ LabelNext: "
+
Next"
+
+
+ \wizardagreement.html:22 +
+ \wizardcomponents.html:55 +
+ \wizardlibrary.html:20 +
+ \wizardlivetvguide.html:31 +
+ \wizardlivetvtuner.html:32 +
+ \wizardservice.html:18 +
+ \wizardsettings.html:33 +
+ \wizardstart.html:25 +
+ \wizarduser.html:28 +
+
+
+ LabelYoureDone: "
+
You're Done!"
+
+
+ \wizardfinish.html:7 +
+
+
+ WelcomeToProject: "
+
Welcome to Emby!"
+
+
+ \wizardstart.html:10 +
+
+
+ ThisWizardWillGuideYou: "
+
This wizard will help guide you through the setup process. To begin, please select your preferred language."
+
+
+ \wizardstart.html:16 +
+
+
+ TellUsAboutYourself: "
+
Tell us about yourself"
+
+
+ \wizarduser.html:8 +
+
+
+ ButtonQuickStartGuide: "
+
Quick start guide"
+
+
+ \wizardstart.html:12 +
+
+
+ LabelYourFirstName: "
+
Your first name:"
+
+
+ \wizarduser.html:14 +
+
+
+ MoreUsersCanBeAddedLater: "
+
More users can be added later within the Dashboard."
+
+
+ \wizarduser.html:15 +
+
+
+ UserProfilesIntro: "
+
Emby includes built-in support for user profiles, enabling each user to have their own display settings, playstate and parental controls."
+
+
+ \wizarduser.html:11 +
+
+
+ LabelWindowsService: "
+
Windows Service"
+
+
+ \wizardservice.html:7 +
+
+
+ AWindowsServiceHasBeenInstalled: "
+
A Windows Service has been installed."
+
+
+ \wizardservice.html:10 +
+
+
+ WindowsServiceIntro1: "
+
Emby Server normally runs as a desktop application with a tray icon, but if you prefer to run it as a background service, it can be started from the windows services control panel instead."
+
+
+ \wizardservice.html:12 +
+
+
+ WindowsServiceIntro2: "
+
If using the windows service, please note that it cannot be run at the same time as the tray icon, so you'll need to exit the tray in order to run the service. The service will also need to be configured with administrative privileges via the control panel. When running as a service, you will need to ensure that the service account has access to your media folders."
+
+
+ \wizardservice.html:14 +
+
+
+ WizardCompleted: "
+
That's all we need for now. Emby has begun collecting information about your media library. Check out some of our apps, and then click <b>Finish</b> to view the <b>Server Dashboard</b>."
+
+
+ \wizardfinish.html:10 +
+
+
+ LabelConfigureSettings: "
+
Configure settings"
+
+
+ \wizardsettings.html:8 +
+
+
+ LabelEnableVideoImageExtraction: "
+
Enable video image extraction"
+
+
+
+
+ VideoImageExtractionHelp: "
+
For videos that don't already have images, and that we're unable to find internet images for. This will add some additional time to the initial library scan but will result in a more pleasing presentation."
+
+
+
+
+ LabelEnableChapterImageExtractionForMovies: "
+
Extract chapter image extraction for Movies"
+
+
+
+
+ LabelChapterImageExtractionForMoviesHelp: "
+
Extracting chapter images will allow clients to display graphical scene selection menus. The process can be slow, cpu-intensive and may require several gigabytes of space. It runs as a nightly scheduled task, although this is configurable in the scheduled tasks area. It is not recommended to run this task during peak usage hours."
+
+
+
+
+ LabelEnableAutomaticPortMapping: "
+
Enable automatic port mapping"
+
+
+
+
+ LabelEnableAutomaticPortMappingHelp: "
+
UPnP allows automated router configuration for easy remote access. This may not work with some router models."
+
+
+
+
+ HeaderTermsOfService: "
+
Emby Terms of Service"
+
+
+ \wizardagreement.html:9 +
+
+
+ MessagePleaseAcceptTermsOfService: "
+
Please accept the terms of service and privacy policy before continuing."
+
+
+ \wizardagreement.html:12 +
+
+
+ OptionIAcceptTermsOfService: "
+
I accept the terms of service"
+
+
+ \wizardagreement.html:17 +
+
+
+ ButtonPrivacyPolicy: "
+
Privacy policy"
+
+
+ \wizardagreement.html:14 +
+
+
+ ButtonTermsOfService: "
+
Terms of Service"
+
+
+ \wizardagreement.html:15 +
+
+
+ HeaderDeveloperOptions: "
+
Developer Options"
+
+
+ \dashboardgeneral.html:108 +
+
+
+ OptionEnableWebClientResponseCache: "
+
Enable web response caching"
+
+
+ \dashboardgeneral.html:112 +
+
+
+ OptionDisableForDevelopmentHelp: "
+
Configure these as needed for web development purposes."
+
+
+ \dashboardgeneral.html:119 +
+
+
+ OptionEnableWebClientResourceMinification: "
+
Enable web resource minification"
+
+
+ \dashboardgeneral.html:116 +
+
+
+ LabelDashboardSourcePath: "
+
Web client source path:"
+
+
+ \dashboardgeneral.html:124 +
+
+
+ LabelDashboardSourcePathHelp: "
+
If running the server from source, specify the path to the dashboard-ui folder. All web client files will be served from this location."
+
+
+ \dashboardgeneral.html:126 +
+
+
+ ButtonConvertMedia: "
+
Convert media"
+
+
+ \syncactivity.html:22 +
+
+
+ ButtonOrganize: "
+
Organize"
+
+
+ \autoorganizelog.html:8 +
+ \scripts\autoorganizelog.js:293 +
+ \scripts\autoorganizelog.js:294 +
+ \scripts\autoorganizelog.js:296 +
+
+
+ LinkedToEmbyConnect: "
+
Linked to Emby Connect"
+
+
+
+
+ HeaderSupporterBenefits: "
+
Emby Premiere Benefits"
+
+
+
+
+ HeaderAddUser: "
+
Add User"
+
+
+
+
+ LabelAddConnectSupporterHelp: "
+
To add a user who isn't listed, you'll need to first link their account to Emby Connect from their user profile page."
+
+
+
+
+ LabelPinCode: "
+
Pin code:"
+
+
+
+
+ OptionHideWatchedContentFromLatestMedia: "
+
Hide watched content from latest media"
+
+
+ \mypreferenceshome.html:114 +
+
+
+ HeaderSync: "
+
Sync"
+
+
+ \mysyncsettings.html:7 +
+ \scripts\registrationservices.js:175 +
+ \useredit.html:82 +
+
+
+ ButtonOk: "
+
Ok"
+
+
+ \components\directorybrowser\directorybrowser.js:147 +
+ \components\fileorganizer\fileorganizer.template.html:45 +
+ \components\medialibrarycreator\medialibrarycreator.template.html:30 +
+ \components\metadataeditor\personeditor.template.html:33 +
+ \dlnaprofile.html:372 +
+ \dlnaprofile.html:453 +
+ \dlnaprofile.html:504 +
+ \dlnaprofile.html:542 +
+ \dlnaprofile.html:590 +
+ \dlnaprofile.html:630 +
+ \dlnaprofile.html:661 +
+ \dlnaprofile.html:706 +
+ \nowplaying.html:113 +
+ \scripts\ratingdialog.js:42 +
+
+
+ ButtonCancel: "
+
Cancel"
+
+
+ \components\tvproviders\schedulesdirect.template.html:68 +
+ \components\tvproviders\xmltv.template.html:48 +
+ \connectlogin.html:74 +
+ \connectlogin.html:108 +
+ \dlnaprofile.html:325 +
+ \dlnaprofile.html:375 +
+ \dlnaprofile.html:456 +
+ \dlnaprofile.html:507 +
+ \dlnaprofile.html:545 +
+ \dlnaprofile.html:593 +
+ \dlnaprofile.html:633 +
+ \dlnaprofile.html:664 +
+ \dlnaprofile.html:709 +
+ \forgotpassword.html:23 +
+ \forgotpasswordpin.html:22 +
+ \livetvseriestimer.html:62 +
+ \livetvtunerprovider-hdhomerun.html:35 +
+ \livetvtunerprovider-m3u.html:19 +
+ \livetvtunerprovider-satip.html:65 +
+ \login.html:27 +
+ \notificationsetting.html:64 +
+ \scheduledtask.html:85 +
+ \scripts\librarylist.js:349 +
+ \scripts\mediacontroller.js:167 +
+ \scripts\mediacontroller.js:436 +
+ \scripts\ratingdialog.js:43 +
+ \scripts\site.js:1025 +
+ \scripts\userprofilespage.js:198 +
+ \syncsettings.html:43 +
+ \useredit.html:111 +
+ \userlibraryaccess.html:57 +
+ \usernew.html:45 +
+ \userparentalcontrol.html:101 +
+
+
+ ButtonExit: "
+
Exit"
+
+
+
+
+ ButtonNew: "
+
New"
+
+
+ \components\fileorganizer\fileorganizer.template.html:18 +
+ \dlnaprofile.html:107 +
+ \dlnaprofile.html:278 +
+ \dlnaprofile.html:290 +
+ \dlnaprofile.html:296 +
+ \dlnaprofile.html:302 +
+ \dlnaprofile.html:308 +
+ \dlnaprofile.html:314 +
+ \dlnaprofiles.html:14 +
+ \serversecurity.html:8 +
+
+
+ HeaderTaskTriggers: "
+
Task Triggers"
+
+
+ \scheduledtask.html:11 +
+
+
+ HeaderTV: "
+
TV"
+
+
+ \librarysettings.html:113 +
+
+
+ HeaderAudio: "
+
Audio"
+
+
+ \librarysettings.html:39 +
+
+
+ HeaderVideo: "
+
Video"
+
+
+ \librarysettings.html:50 +
+
+
+ HeaderPaths: "
+
Paths"
+
+
+ \dashboard.html:92 +
+
+
+ CategorySync: "
+
Sync"
+
+
+
+
+ TabPlaylist: "
+
Playlist"
+
+
+ \nowplaying.html:20 +
+
+
+ HeaderEasyPinCode: "
+
Easy Pin Code"
+
+
+ \myprofile.html:69 +
+ \userpassword.html:42 +
+
+
+ HeaderGrownupsOnly: "
+
Grown-ups Only!"
+
+
+
+
+ DividerOr: "
+
-- or --"
+
+
+
+
+ HeaderInstalledServices: "
+
Installed Services"
+
+
+ \appservices.html:6 +
+
+
+ HeaderAvailableServices: "
+
Available Services"
+
+
+ \appservices.html:11 +
+
+
+ + \ No newline at end of file diff --git a/MediaBrowser.Tests/ConsistencyTests/Resources/StringCheck.xslt b/MediaBrowser.Tests/ConsistencyTests/Resources/StringCheck.xslt new file mode 100644 index 0000000000..39586022b3 --- /dev/null +++ b/MediaBrowser.Tests/ConsistencyTests/Resources/StringCheck.xslt @@ -0,0 +1,145 @@ + + + + + + + + + + + + +]> + + + + + + + + <xsl:value-of select="StringUsages/@ReportTitle"/> + + + + +

+ +

+
+

Strings

+
+ + + + + + + + + + + + + + +
+
: "
+
"
+
:
+
+
+ + +
+
\ No newline at end of file diff --git a/MediaBrowser.Tests/ConsistencyTests/Resources/StringCheckSample.xml b/MediaBrowser.Tests/ConsistencyTests/Resources/StringCheckSample.xml new file mode 100644 index 0000000000..118ed55aef --- /dev/null +++ b/MediaBrowser.Tests/ConsistencyTests/Resources/StringCheckSample.xml @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MediaBrowser.Tests/ConsistencyTests/StringUsageReporter.cs b/MediaBrowser.Tests/ConsistencyTests/StringUsageReporter.cs new file mode 100644 index 0000000000..d036a6c6d7 --- /dev/null +++ b/MediaBrowser.Tests/ConsistencyTests/StringUsageReporter.cs @@ -0,0 +1,260 @@ +using MediaBrowser.Tests.ConsistencyTests.TextIndexing; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; + +namespace MediaBrowser.Tests.ConsistencyTests +{ + /// + /// This class contains tests for reporting the usage of localization string tokens + /// in the dashboard-ui or similar. + /// + /// + /// Run one of the two tests using Visual Studio's "Test Explorer": + /// + /// + /// + /// + /// + /// + /// + /// On successful run, the bottom section of the test explorer will contain a link "Output". + /// This link will open the test results, displaying the trace and two attachment links. + /// One link will open the output folder, the other link will open the output xml file. + /// + /// + /// The output xml file contains a stylesheet link to render the results as html. + /// How that works depends on the default application configured for XML files: + /// + /// + /// Visual Studio + /// Will open in XML source view. To view the html result, click menu + /// 'XML' => 'Start XSLT without debugging' + /// Internet Explorer + /// XSL transform will be applied automatically. + /// Firefox + /// XSL transform will be applied automatically. + /// Chrome + /// Does not work. Chrome is unable/unwilling to apply xslt transforms from local files. + /// + /// + [TestClass] + public class StringUsageReporter + { + /// + /// Root path of the web application + /// + /// + /// Can be an absolute path or a path relative to the binaries folder (bin\Debug). + /// + public const string WebFolder = @"..\..\..\MediaBrowser.WebDashboard\dashboard-ui"; + + /// + /// Path to the strings file, relative to . + /// + public const string StringsFile = @"strings\en-US.json"; + + /// + /// Path to the output folder + /// + /// + /// Can be an absolute path or a path relative to the binaries folder (bin\Debug). + /// Important: When changing the output path, make sure that "StringCheck.xslt" is present + /// to make the XML transform work. + /// + public const string OutputPath = @"."; + + /// + /// List of file extension to search. + /// + public static string[] TargetExtensions = new[] { "js", "html" }; + + /// + /// List of paths to exclude from search. + /// + public static string[] ExcludePaths = new[] { @"\bower_components\", @"\thirdparty\" }; + + private TestContext testContextInstance; + + /// + ///Gets or sets the test context which provides + ///information about and functionality for the current test run. + /// + public TestContext TestContext + { + get + { + return testContextInstance; + } + set + { + testContextInstance = value; + } + } + + [TestMethod] + public void ReportStringUsage() + { + this.CheckDashboardStrings(false); + } + + [TestMethod] + public void ReportUnusedStrings() + { + this.CheckDashboardStrings(true); + } + + private void CheckDashboardStrings(Boolean unusedOnly) + { + // Init Folders + var currentDir = System.IO.Directory.GetCurrentDirectory(); + Trace("CurrentDir: {0}", currentDir); + + var rootFolderInfo = ResolveFolder(currentDir, WebFolder); + Trace("Web Root: {0}", rootFolderInfo.FullName); + + var outputFolderInfo = ResolveFolder(currentDir, OutputPath); + Trace("Output Path: {0}", outputFolderInfo.FullName); + + // Load Strings + var stringsFileName = Path.Combine(rootFolderInfo.FullName, StringsFile); + + if (!File.Exists(stringsFileName)) + { + throw new Exception(string.Format("Strings file not found: {0}", stringsFileName)); + } + + int lineNumbers; + var stringsDic = this.CreateStringsDictionary(new FileInfo(stringsFileName), out lineNumbers); + + Trace("Loaded {0} strings from strings file containing {1} lines", stringsDic.Count, lineNumbers); + + var allFiles = rootFolderInfo.GetFiles("*", SearchOption.AllDirectories); + + var filteredFiles1 = allFiles.Where(f => TargetExtensions.Any(e => f.Name.EndsWith(e))); + var filteredFiles2 = filteredFiles1.Where(f => !ExcludePaths.Any(p => f.FullName.Contains(p))); + + var selectedFiles = filteredFiles2.OrderBy(f => f.FullName).ToList(); + + var wordIndex = IndexBuilder.BuildIndexFromFiles(selectedFiles, rootFolderInfo.FullName); + + Trace("Created word index from {0} files containing {1} individual words", selectedFiles.Count, wordIndex.Keys.Count); + + var outputFileName = Path.Combine(outputFolderInfo.FullName, string.Format("StringCheck_{0:yyyyMMddHHmmss}.xml", DateTime.Now)); + var settings = new XmlWriterSettings + { + Indent = true, + Encoding = Encoding.UTF8, + WriteEndDocumentOnClose = true + }; + + Trace("Output file: {0}", outputFileName); + + using (XmlWriter writer = XmlWriter.Create(outputFileName, settings)) + { + writer.WriteStartDocument(true); + + // Write the Processing Instruction node. + string xslText = "type=\"text/xsl\" href=\"StringCheck.xslt\""; + writer.WriteProcessingInstruction("xml-stylesheet", xslText); + + writer.WriteStartElement("StringUsages"); + writer.WriteAttributeString("ReportTitle", unusedOnly ? "Unused Strings Report" : "String Usage Report"); + writer.WriteAttributeString("Mode", unusedOnly ? "UnusedOnly" : "All"); + + foreach (var kvp in stringsDic) + { + var occurences = wordIndex.Find(kvp.Key); + + if (occurences == null || !unusedOnly) + { + ////Trace("{0}: {1}", kvp.Key, kvp.Value); + writer.WriteStartElement("Dictionary"); + writer.WriteAttributeString("Token", kvp.Key); + writer.WriteAttributeString("Text", kvp.Value); + + if (occurences != null && !unusedOnly) + { + foreach (var occurence in occurences) + { + writer.WriteStartElement("Occurence"); + writer.WriteAttributeString("FileName", occurence.FileName); + writer.WriteAttributeString("FullPath", occurence.FullPath); + writer.WriteAttributeString("LineNumber", occurence.LineNumber.ToString()); + writer.WriteEndElement(); + ////Trace(" {0}:{1}", occurence.FileName, occurence.LineNumber); + } + } + + writer.WriteEndElement(); + } + } + } + + TestContext.AddResultFile(outputFileName); + TestContext.AddResultFile(outputFolderInfo.FullName); + } + + private SortedDictionary CreateStringsDictionary(FileInfo file, out int lineNumbers) + { + var dic = new SortedDictionary(); + lineNumbers = 0; + + using (var reader = file.OpenText()) + { + while (!reader.EndOfStream) + { + lineNumbers++; + var words = reader + .ReadLine() + .Split(new[] { "\":" }, StringSplitOptions.RemoveEmptyEntries); + + + if (words.Length == 2) + { + var token = words[0].Replace("\"", string.Empty).Trim(); + var text = words[1].Replace("\",", string.Empty).Replace("\"", string.Empty).Trim(); + + if (dic.Keys.Contains(token)) + { + throw new Exception(string.Format("Double string entry found: {0}", token)); + } + + dic.Add(token, text); + } + } + } + + return dic; + } + + private DirectoryInfo ResolveFolder(string currentDir, string folderPath) + { + if (folderPath.IndexOf(@"\:") != 1) + { + folderPath = Path.Combine(currentDir, folderPath); + } + + var folderInfo = new DirectoryInfo(folderPath); + + if (!folderInfo.Exists) + { + throw new Exception(string.Format("Folder not found: {0}", folderInfo.FullName)); + } + + return folderInfo; + } + + + private void Trace(string message, params object[] parameters) + { + var formatted = string.Format(message, parameters); + System.Diagnostics.Trace.WriteLine(formatted); + } + } +} diff --git a/MediaBrowser.Tests/ConsistencyTests/TextIndexing/IndexBuilder.cs b/MediaBrowser.Tests/ConsistencyTests/TextIndexing/IndexBuilder.cs new file mode 100644 index 0000000000..07c0df86c7 --- /dev/null +++ b/MediaBrowser.Tests/ConsistencyTests/TextIndexing/IndexBuilder.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MediaBrowser.Tests.ConsistencyTests.TextIndexing +{ + public class IndexBuilder + { + public const int MinumumWordLength = 4; + + public static char[] WordChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".ToCharArray(); + + public static WordIndex BuildIndexFromFiles(IEnumerable wordFiles, string rootFolderPath) + { + var index = new WordIndex(); + + var wordSeparators = Enumerable.Range(32, 127).Select(e => Convert.ToChar(e)).Where(c => !WordChars.Contains(c)).ToArray(); + wordSeparators = wordSeparators.Concat(new[] { '\t' }).ToArray(); // add tab + + foreach (var file in wordFiles) + { + var lineNumber = 1; + var displayFileName = file.FullName.Replace(rootFolderPath, string.Empty); + using (var reader = file.OpenText()) + { + while (!reader.EndOfStream) + { + var words = reader + .ReadLine() + .Split(wordSeparators, StringSplitOptions.RemoveEmptyEntries); + ////.Select(f => f.Trim()); + + var wordIndex = 1; + foreach (var word in words) + { + if (word.Length >= MinumumWordLength) + { + index.AddWordOccurrence(word, displayFileName, file.FullName, lineNumber, wordIndex++); + } + } + + lineNumber++; + } + } + } + + return index; + } + + } +} diff --git a/MediaBrowser.Tests/ConsistencyTests/TextIndexing/WordIndex.cs b/MediaBrowser.Tests/ConsistencyTests/TextIndexing/WordIndex.cs new file mode 100644 index 0000000000..4ced812373 --- /dev/null +++ b/MediaBrowser.Tests/ConsistencyTests/TextIndexing/WordIndex.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MediaBrowser.Tests.ConsistencyTests.TextIndexing +{ + public class WordIndex : Dictionary + { + public WordIndex() : base(StringComparer.InvariantCultureIgnoreCase) + { + } + + public void AddWordOccurrence(string word, string fileName, string fullPath, int lineNumber, int wordIndex) + { + WordOccurrences current; + if (!this.TryGetValue(word, out current)) + { + current = new WordOccurrences(); + this[word] = current; + } + + current.AddOccurrence(fileName, fullPath, lineNumber, wordIndex); + } + + public WordOccurrences Find(string word) + { + WordOccurrences found; + if (this.TryGetValue(word, out found)) + { + return found; + } + + return null; + } + + } +} diff --git a/MediaBrowser.Tests/ConsistencyTests/TextIndexing/WordOccurrence.cs b/MediaBrowser.Tests/ConsistencyTests/TextIndexing/WordOccurrence.cs new file mode 100644 index 0000000000..40631f5825 --- /dev/null +++ b/MediaBrowser.Tests/ConsistencyTests/TextIndexing/WordOccurrence.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MediaBrowser.Tests.ConsistencyTests.TextIndexing +{ + public struct WordOccurrence + { + public readonly string FileName; // file containing the word. + public readonly string FullPath; // file containing the word. + public readonly int LineNumber; // line within the file. + public readonly int WordIndex; // index within the line. + + public WordOccurrence(string fileName, string fullPath, int lineNumber, int wordIndex) + { + FileName = fileName; + FullPath = fullPath; + LineNumber = lineNumber; + WordIndex = wordIndex; + } + } +} diff --git a/MediaBrowser.Tests/ConsistencyTests/TextIndexing/WordOccurrences.cs b/MediaBrowser.Tests/ConsistencyTests/TextIndexing/WordOccurrences.cs new file mode 100644 index 0000000000..3ba3b59167 --- /dev/null +++ b/MediaBrowser.Tests/ConsistencyTests/TextIndexing/WordOccurrences.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MediaBrowser.Tests.ConsistencyTests.TextIndexing +{ + public class WordOccurrences : List + { + public void AddOccurrence(string fileName, string fullPath, int lineNumber, int wordIndex) + { + this.Add(new WordOccurrence(fileName, fullPath, lineNumber, wordIndex)); + } + + } +} diff --git a/MediaBrowser.Tests/MediaBrowser.Tests.csproj b/MediaBrowser.Tests/MediaBrowser.Tests.csproj index 0cfe8182c8..76a1861097 100644 --- a/MediaBrowser.Tests/MediaBrowser.Tests.csproj +++ b/MediaBrowser.Tests/MediaBrowser.Tests.csproj @@ -25,6 +25,7 @@ DEBUG;TRACE prompt 4 + bin\Debug\MediaBrowser.Tests.XML none @@ -36,6 +37,7 @@ + @@ -50,6 +52,11 @@ + + + + + @@ -98,6 +105,14 @@ PreserveNewest + + + Always + StringCheck.xslt + + + + From f539c9894c91e15189b2d9d676afa8ea08b3f179 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 26 Jul 2016 13:21:27 -0400 Subject: [PATCH 11/18] remove unused code --- MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj | 3 --- 1 file changed, 3 deletions(-) diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index e4150d85cf..7e4b39c364 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -173,9 +173,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest From eb78381a3523985745da11931f5d2e08b2e6a0ab Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 27 Jul 2016 00:54:38 -0400 Subject: [PATCH 12/18] update resource loading --- MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj | 5 ----- 1 file changed, 5 deletions(-) diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 7e4b39c364..5c520afcf2 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -1410,11 +1410,6 @@ PreserveNewest - - - PreserveNewest - - PreserveNewest From 2fed4c1ab8af48cfb6a0077189e6b8addbedb8d7 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 27 Jul 2016 02:24:59 -0400 Subject: [PATCH 13/18] keep season/episode info up to date --- .../TV/EpisodeMetadataService.cs | 33 ++++++++++++++++++- .../TV/SeasonMetadataService.cs | 15 +++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.Providers/TV/EpisodeMetadataService.cs b/MediaBrowser.Providers/TV/EpisodeMetadataService.cs index a15de48660..b51b113805 100644 --- a/MediaBrowser.Providers/TV/EpisodeMetadataService.cs +++ b/MediaBrowser.Providers/TV/EpisodeMetadataService.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Configuration; +using System; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; @@ -6,12 +7,42 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Providers.Manager; using System.Collections.Generic; +using System.Threading.Tasks; using CommonIO; namespace MediaBrowser.Providers.TV { public class EpisodeMetadataService : MetadataService { + protected override async Task BeforeSave(Episode item, bool isFullRefresh, ItemUpdateType currentUpdateType) + { + var updateType = await base.BeforeSave(item, isFullRefresh, currentUpdateType).ConfigureAwait(false); + + if (updateType <= ItemUpdateType.None) + { + if (!string.Equals(item.SeriesName, item.FindSeriesName(), StringComparison.Ordinal)) + { + updateType |= ItemUpdateType.MetadataImport; + } + } + if (updateType <= ItemUpdateType.None) + { + if (!string.Equals(item.SeriesSortName, item.FindSeriesSortName(), StringComparison.Ordinal)) + { + updateType |= ItemUpdateType.MetadataImport; + } + } + if (updateType <= ItemUpdateType.None) + { + if (!string.Equals(item.SeasonName, item.FindSeasonName(), StringComparison.Ordinal)) + { + updateType |= ItemUpdateType.MetadataImport; + } + } + + return updateType; + } + protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) { ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); diff --git a/MediaBrowser.Providers/TV/SeasonMetadataService.cs b/MediaBrowser.Providers/TV/SeasonMetadataService.cs index e4894915d6..f3e6f8e9c5 100644 --- a/MediaBrowser.Providers/TV/SeasonMetadataService.cs +++ b/MediaBrowser.Providers/TV/SeasonMetadataService.cs @@ -35,6 +35,21 @@ namespace MediaBrowser.Providers.TV updateType |= SaveIsVirtualItem(item, episodes); } + if (updateType <= ItemUpdateType.None) + { + if (!string.Equals(item.SeriesName, item.FindSeriesName(), StringComparison.Ordinal)) + { + updateType |= ItemUpdateType.MetadataImport; + } + } + if (updateType <= ItemUpdateType.None) + { + if (!string.Equals(item.SeriesSortName, item.FindSeriesSortName(), StringComparison.Ordinal)) + { + updateType |= ItemUpdateType.MetadataImport; + } + } + return updateType; } From dc855e3c60e24febf376bd84156164b7d55802cc Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 27 Jul 2016 02:29:41 -0400 Subject: [PATCH 14/18] 3.1.79 --- SharedVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index 7f0f8c8399..d1e5851a82 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,4 +1,4 @@ using System.Reflection; //[assembly: AssemblyVersion("3.1.*")] -[assembly: AssemblyVersion("3.1.78")] +[assembly: AssemblyVersion("3.1.79")] From 308233ceba2c1cd89678c91ab8f5ce2363c79e3d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 27 Jul 2016 13:11:05 -0400 Subject: [PATCH 15/18] update translations --- Nuget/MediaBrowser.Common.Internal.nuspec | 4 ++-- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 21173feaad..a1fb060607 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.653 + 3.0.654 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Emby Theater and Emby Server. Not intended for plugin developer consumption. Copyright © Emby 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 2946858472..ada11fd45a 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.653 + 3.0.654 MediaBrowser.Common Emby Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 18e8a5c13b..f4a79f454f 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.653 + 3.0.654 Media Browser.Server.Core Emby Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Emby Server. Copyright © Emby 2013 - + From 4f32b57e58b0568c7c0112146e87633c965efe88 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 27 Jul 2016 13:11:25 -0400 Subject: [PATCH 16/18] update buffer sizes --- MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs | 3 +-- .../Playback/Progressive/ProgressiveStreamWriter.cs | 2 +- MediaBrowser.Common/IO/StreamDefaults.cs | 4 ++-- .../HttpServer/RangeRequestWriter.cs | 3 +-- .../HttpServer/StreamWriter.cs | 3 +-- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs index e029d4e99a..7de3096997 100644 --- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs @@ -257,8 +257,7 @@ namespace MediaBrowser.Api.Playback.Hls return await GetSegmentResult(state, playlistPath, segmentPath, requestedIndex, job, cancellationToken).ConfigureAwait(false); } - // 256k - private const int BufferSize = 262144; + private const int BufferSize = 81920; private long GetStartPositionTicks(StreamState state, int requestedIndex) { diff --git a/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs b/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs index 13d59240f5..860e57b32e 100644 --- a/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs +++ b/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs @@ -16,7 +16,7 @@ namespace MediaBrowser.Api.Playback.Progressive private readonly ILogger _logger; // 256k - private const int BufferSize = 262144; + private const int BufferSize = 81920; private long _bytesWritten = 0; diff --git a/MediaBrowser.Common/IO/StreamDefaults.cs b/MediaBrowser.Common/IO/StreamDefaults.cs index 450d293d4b..8b16d89b3b 100644 --- a/MediaBrowser.Common/IO/StreamDefaults.cs +++ b/MediaBrowser.Common/IO/StreamDefaults.cs @@ -9,11 +9,11 @@ namespace MediaBrowser.Common.IO /// /// The default copy to buffer size /// - public const int DefaultCopyToBufferSize = 262144; + public const int DefaultCopyToBufferSize = 81920; /// /// The default file stream buffer size /// - public const int DefaultFileStreamBufferSize = 262144; + public const int DefaultFileStreamBufferSize = 81920; } } diff --git a/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs b/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs index 7ac92408b2..71cd20743a 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs @@ -28,8 +28,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer public Action OnComplete { get; set; } private readonly ILogger _logger; - // 256k - private const int BufferSize = 262144; + private const int BufferSize = 81920; /// /// The _options diff --git a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs index f5906f6b7b..ae408f8d68 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs @@ -75,8 +75,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer { } - // 256k - private const int BufferSize = 262144; + private const int BufferSize = 81920; /// /// Writes to. From 0ab7174548764390b7bab9b914a295842de30224 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 27 Jul 2016 13:18:53 -0400 Subject: [PATCH 17/18] 3.1.80 --- SharedVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index d1e5851a82..3b18c027ea 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,4 +1,4 @@ using System.Reflection; //[assembly: AssemblyVersion("3.1.*")] -[assembly: AssemblyVersion("3.1.79")] +[assembly: AssemblyVersion("3.1.80")] From f238005d2b2788eb5606c4ba315840fe9d525782 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 27 Jul 2016 13:26:10 -0400 Subject: [PATCH 18/18] update components --- .../MediaBrowser.Common.Implementations.csproj | 2 +- MediaBrowser.Common.Implementations/packages.config | 2 +- .../MediaBrowser.Server.Implementations.csproj | 4 ++-- MediaBrowser.Server.Implementations/packages.config | 2 +- Nuget/MediaBrowser.Common.Internal.nuspec | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj index 108eddcf9e..ced2dd5a32 100644 --- a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj +++ b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj @@ -55,7 +55,7 @@ ..\packages\morelinq.1.4.0\lib\net35\MoreLinq.dll - ..\packages\NLog.4.3.5\lib\net45\NLog.dll + ..\packages\NLog.4.3.6\lib\net45\NLog.dll True diff --git a/MediaBrowser.Common.Implementations/packages.config b/MediaBrowser.Common.Implementations/packages.config index 882acc9ffd..594b4c7c5d 100644 --- a/MediaBrowser.Common.Implementations/packages.config +++ b/MediaBrowser.Common.Implementations/packages.config @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index 0f91d52859..2c4c74b35c 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -56,8 +56,8 @@ ..\packages\Interfaces.IO.1.0.0.5\lib\portable-net45+sl4+wp71+win8+wpa81\Interfaces.IO.dll - - ..\packages\MediaBrowser.Naming.1.0.0.53\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll + + ..\packages\MediaBrowser.Naming.1.0.0.54\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll True diff --git a/MediaBrowser.Server.Implementations/packages.config b/MediaBrowser.Server.Implementations/packages.config index 9ae0a126a6..03f7160ae0 100644 --- a/MediaBrowser.Server.Implementations/packages.config +++ b/MediaBrowser.Server.Implementations/packages.config @@ -4,7 +4,7 @@ - + diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index a1fb060607..e96a77e647 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -13,7 +13,7 @@ Copyright © Emby 2013 - +