add more play buttons

This commit is contained in:
Luke Pulverenti 2015-07-17 18:32:00 -04:00
parent caed649d7a
commit fe3b4a1230
4 changed files with 44 additions and 15 deletions

View File

@ -55,6 +55,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
private readonly SemaphoreSlim _refreshRecordingsLock = new SemaphoreSlim(1, 1); private 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) 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; _config = config;
@ -615,11 +617,24 @@ namespace MediaBrowser.Server.Implementations.LiveTv
await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false); await _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; 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) private async Task<Guid> CreateRecordingRecord(RecordingInfo info, string serviceName, CancellationToken cancellationToken)
{ {
var isNew = false; var isNew = false;
@ -720,6 +735,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
{ {
var program = GetInternalProgram(id); var program = GetInternalProgram(id);
RefreshIfNeeded(program);
var dto = _dtoService.GetBaseItemDto(program, new DtoOptions(), user); var dto = _dtoService.GetBaseItemDto(program, new DtoOptions(), user);
await AddRecordingInfo(new[] { dto }, cancellationToken).ConfigureAwait(false); await AddRecordingInfo(new[] { dto }, cancellationToken).ConfigureAwait(false);
@ -786,7 +803,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
} }
var returnArray = returnPrograms var returnArray = returnPrograms
.Select(i => _dtoService.GetBaseItemDto(i, new DtoOptions(), user)) .Select(i =>
{
RefreshIfNeeded(i);
return _dtoService.GetBaseItemDto(i, new DtoOptions(), user);
})
.ToArray(); .ToArray();
await AddRecordingInfo(returnArray, cancellationToken).ConfigureAwait(false); await AddRecordingInfo(returnArray, cancellationToken).ConfigureAwait(false);
@ -851,6 +872,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var returnArray = programList.ToArray(); var returnArray = programList.ToArray();
foreach (var program in returnArray)
{
RefreshIfNeeded(program);
}
var result = new QueryResult<LiveTvProgram> var result = new QueryResult<LiveTvProgram>
{ {
Items = returnArray, Items = returnArray,
@ -1038,6 +1064,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
await CleanDatabaseInternal(newChannelIdList, new[] { typeof(LiveTvChannel).Name }, progress, cancellationToken).ConfigureAwait(false); await CleanDatabaseInternal(newChannelIdList, new[] { typeof(LiveTvChannel).Name }, progress, cancellationToken).ConfigureAwait(false);
await CleanDatabaseInternal(newProgramIdList, new[] { typeof(LiveTvProgram).Name }, progress, cancellationToken).ConfigureAwait(false); await CleanDatabaseInternal(newProgramIdList, new[] { typeof(LiveTvProgram).Name }, progress, cancellationToken).ConfigureAwait(false);
_refreshedPrograms.Clear();
// Load these now which will prefetch metadata // Load these now which will prefetch metadata
var dtoOptions = new DtoOptions(); var dtoOptions = new DtoOptions();
dtoOptions.Fields.Remove(ItemFields.SyncInfo); dtoOptions.Fields.Remove(ItemFields.SyncInfo);

View File

@ -33,7 +33,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
case OperatingSystem.Linux: case OperatingSystem.Linux:
info.ArchiveType = "7z"; info.ArchiveType = "7z";
info.Version = "20150331"; info.Version = "20150717";
break; break;
case OperatingSystem.Osx: case OperatingSystem.Osx:
@ -54,7 +54,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
info.FFMpegFilename = "ffmpeg.exe"; info.FFMpegFilename = "ffmpeg.exe";
info.FFProbeFilename = "ffprobe.exe"; info.FFProbeFilename = "ffprobe.exe";
info.Version = "20150331"; info.Version = "20150717";
info.ArchiveType = "7z"; info.ArchiveType = "7z";
switch (environment.SystemArchitecture) switch (environment.SystemArchitecture)
@ -83,14 +83,14 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
case Architecture.X86_X64: case Architecture.X86_X64:
return new[] return new[]
{ {
"http://ffmpeg.zeranoe.com/builds/win64/static/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-20150331-git-5cba529-win64-static.7z" "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20150717-git-8250943-win64-static.7z"
}; };
case Architecture.X86: case Architecture.X86:
return new[] return new[]
{ {
"http://ffmpeg.zeranoe.com/builds/win32/static/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-20150331-git-5cba529-win32-static.7z" "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20150717-git-8250943-win32-static.7z"
}; };
} }
break; break;
@ -119,12 +119,12 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
case Architecture.X86_X64: case Architecture.X86_X64:
return new[] 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: case Architecture.X86:
return new[] 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; break;

View File

@ -136,7 +136,7 @@ namespace MediaBrowser.WebDashboard.Api
{ {
var page = ServerEntryPoint.Instance.PluginConfigurationPages.First(p => p.Name.Equals(request.Name, StringComparison.OrdinalIgnoreCase)); 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> /// <summary>

View File

@ -63,7 +63,7 @@ namespace MediaBrowser.WebDashboard.Api
{ {
if (IsCoreHtml(path)) 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")) else if (IsFormat(path, "js"))
@ -243,10 +243,11 @@ namespace MediaBrowser.WebDashboard.Api
/// </summary> /// </summary>
/// <param name="sourceStream">The source stream.</param> /// <param name="sourceStream">The source stream.</param>
/// <param name="mode">The mode.</param> /// <param name="mode">The mode.</param>
/// <param name="appVersion">The application version.</param>
/// <param name="localizationCulture">The localization culture.</param> /// <param name="localizationCulture">The localization culture.</param>
/// <param name="enableMinification">if set to <c>true</c> [enable minification].</param> /// <param name="enableMinification">if set to <c>true</c> [enable minification].</param>
/// <returns>Task{Stream}.</returns> /// <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) using (sourceStream)
{ {
@ -305,9 +306,9 @@ namespace MediaBrowser.WebDashboard.Api
var version = GetType().Assembly.GetName().Version; var 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()); var importsHtml = string.Join("", imports.Select(i => "<link rel=\"import\" href=\"" + i + "\">").ToArray());