The Free Software Media System - Server Backend & API
add more play buttons
Luke Pulverentife3b4a1230c2
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.csindex f6c69d8d69..9fef0560d6 100644--- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs+++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs@@ -55,6 +55,8 @@ namespace MediaBrowser.Server.Implementations.LiveTvprivate readonly SemaphoreSlim _refreshRecordingsLock = new SemaphoreSlim(1, 1);+ private ConcurrentDictionary<Guid, Guid> _refreshedPrograms = new ConcurrentDictionary<Guid, Guid>();+public LiveTvManager(IApplicationHost appHost, IServerConfigurationManager config, ILogger logger, IItemRepository itemRepo, IImageProcessor imageProcessor, IUserDataManager userDataManager, IDtoService dtoService, IUserManager userManager, ILibraryManager libraryManager, ITaskManager taskManager, ILocalizationManager localization, IJsonSerializer jsonSerializer, IProviderManager providerManager){_config = config;@@ -615,11 +617,24 @@ namespace MediaBrowser.Server.Implementations.LiveTvawait _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false);}- _providerManager.QueueRefresh(item.Id, new MetadataRefreshOptions());+ var maxStartDate = DateTime.UtcNow.AddDays(3);++ _providerManager.QueueRefresh(item.Id, new MetadataRefreshOptions+ {+ ImageRefreshMode = info.StartDate <= maxStartDate ? ImageRefreshMode.Default : ImageRefreshMode.ValidationOnly+ });return item;}+ private void RefreshIfNeeded(LiveTvProgram program)+ {+ if (_refreshedPrograms.TryAdd(program.Id, program.Id))+ {+ _providerManager.QueueRefresh(program.Id, new MetadataRefreshOptions());+ }+ }+private async Task<Guid> CreateRecordingRecord(RecordingInfo info, string serviceName, CancellationToken cancellationToken){var isNew = false;@@ -720,6 +735,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv{var program = GetInternalProgram(id);+ RefreshIfNeeded(program);+var dto = _dtoService.GetBaseItemDto(program, new DtoOptions(), user);await AddRecordingInfo(new[] { dto }, cancellationToken).ConfigureAwait(false);@@ -786,7 +803,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv}var returnArray = returnPrograms- .Select(i => _dtoService.GetBaseItemDto(i, new DtoOptions(), user))+ .Select(i =>+ {+ RefreshIfNeeded(i);+ return _dtoService.GetBaseItemDto(i, new DtoOptions(), user);+ }).ToArray();await AddRecordingInfo(returnArray, cancellationToken).ConfigureAwait(false);@@ -851,6 +872,11 @@ namespace MediaBrowser.Server.Implementations.LiveTvvar returnArray = programList.ToArray();+ foreach (var program in returnArray)+ {+ RefreshIfNeeded(program);+ }+var result = new QueryResult<LiveTvProgram>{Items = returnArray,@@ -1038,6 +1064,8 @@ namespace MediaBrowser.Server.Implementations.LiveTvawait CleanDatabaseInternal(newChannelIdList, new[] { typeof(LiveTvChannel).Name }, progress, cancellationToken).ConfigureAwait(false);await CleanDatabaseInternal(newProgramIdList, new[] { typeof(LiveTvProgram).Name }, progress, cancellationToken).ConfigureAwait(false);+ _refreshedPrograms.Clear();+// Load these now which will prefetch metadatavar dtoOptions = new DtoOptions();dtoOptions.Fields.Remove(ItemFields.SyncInfo);diff --git a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.csindex 8a7d10bd74..5c5bc10e7e 100644--- a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs+++ b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs@@ -33,7 +33,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpegcase OperatingSystem.Linux:info.ArchiveType = "7z";- info.Version = "20150331";+ info.Version = "20150717";break;case OperatingSystem.Osx:@@ -54,7 +54,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeginfo.FFMpegFilename = "ffmpeg.exe";info.FFProbeFilename = "ffprobe.exe";- info.Version = "20150331";+ info.Version = "20150717";info.ArchiveType = "7z";switch (environment.SystemArchitecture)@@ -83,14 +83,14 @@ namespace MediaBrowser.Server.Startup.Common.FFMpegcase Architecture.X86_X64:return new[]{- "http://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20150331-git-5cba529-win64-static.7z",- "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20150331-git-5cba529-win64-static.7z"+ "http://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20150717-git-8250943-win64-static.7z",+ "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20150717-git-8250943-win64-static.7z"};case Architecture.X86:return new[]{- "http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20150331-git-5cba529-win32-static.7z",- "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20150331-git-5cba529-win32-static.7z"+ "http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20150717-git-8250943-win32-static.7z",+ "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20150717-git-8250943-win32-static.7z"};}break;@@ -119,12 +119,12 @@ namespace MediaBrowser.Server.Startup.Common.FFMpegcase Architecture.X86_X64:return new[]{- "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-2.6.1-64bit-static.7z"+ "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-2.7.1-64bit-static.7z"};case Architecture.X86:return new[]{- "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-2.6.1-32bit-static.7z"+ "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-2.7.1-32bit-static.7z"};}break;diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.csindex d6adfc68e7..adf4ce8955 100644--- a/MediaBrowser.WebDashboard/Api/DashboardService.cs+++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs@@ -136,7 +136,7 @@ namespace MediaBrowser.WebDashboard.Api{var page = ServerEntryPoint.Instance.PluginConfigurationPages.First(p => p.Name.Equals(request.Name, StringComparison.OrdinalIgnoreCase));- return ResultFactory.GetStaticResult(Request, page.Plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => GetPackageCreator().ModifyHtml(page.GetHtmlStream(), null, null, false));+ return ResultFactory.GetStaticResult(Request, page.Plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => GetPackageCreator().ModifyHtml(page.GetHtmlStream(), null, _appHost.ApplicationVersion.ToString(), null, false));}/// <summary>diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.csindex f501475521..7f7aa4a2dd 100644--- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs+++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs@@ -63,7 +63,7 @@ namespace MediaBrowser.WebDashboard.Api{if (IsCoreHtml(path)){- resourceStream = await ModifyHtml(resourceStream, mode, localizationCulture, enableMinification).ConfigureAwait(false);+ resourceStream = await ModifyHtml(resourceStream, mode, appVersion, localizationCulture, enableMinification).ConfigureAwait(false);}}else if (IsFormat(path, "js"))@@ -243,10 +243,11 @@ namespace MediaBrowser.WebDashboard.Api/// </summary>/// <param name="sourceStream">The source stream.</param>/// <param name="mode">The mode.</param>+ /// <param name="appVersion">The application version.</param>/// <param name="localizationCulture">The localization culture.</param>/// <param name="enableMinification">if set to <c>true</c> [enable minification].</param>/// <returns>Task{Stream}.</returns>- public async Task<Stream> ModifyHtml(Stream sourceStream, string mode, string localizationCulture, bool enableMinification)+ public async Task<Stream> ModifyHtml(Stream sourceStream, string mode, string appVersion, string localizationCulture, bool enableMinification){using (sourceStream){@@ -305,9 +306,9 @@ namespace MediaBrowser.WebDashboard.Apivar version = GetType().Assembly.GetName().Version;- var imports = new string[]+ var imports = new[]{- "vulcanize-out.html"+ "vulcanize-out.html?v=" + appVersion};var importsHtml = string.Join("", imports.Select(i => "<link rel=\"import\" href=\"" + i + "\">").ToArray());