diff --git a/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs b/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs index ba6e445827..287980fc71 100644 --- a/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs +++ b/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs @@ -178,6 +178,16 @@ namespace MediaBrowser.Api.DefaultTheme .Take(3) .ToArray(); + var romanceGenres = new[] { "romance" }.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase); + + view.RomanticItems = moviesWithBackdrops + .Where(i => i.Genres.Any(romanceGenres.ContainsKey)) + .OrderBy(i => Guid.NewGuid()) + .Select(i => GetItemStub(i, ImageType.Backdrop)) + .Where(i => i != null) + .Take(3) + .ToArray(); + view.HDItems = hdMovies .Where(i => i.BackdropImagePaths.Count > 0) .OrderBy(i => Guid.NewGuid()) @@ -284,7 +294,8 @@ namespace MediaBrowser.Api.DefaultTheme var stub = new ItemStub { Id = _dtoService.GetDtoId(item), - Name = item.Name + Name = item.Name, + ImageType = imageType }; var imageManager = Kernel.Instance.ImageManager; diff --git a/MediaBrowser.Api/DefaultTheme/ItemStub.cs b/MediaBrowser.Api/DefaultTheme/ItemStub.cs index 6e1b872627..9681543501 100644 --- a/MediaBrowser.Api/DefaultTheme/ItemStub.cs +++ b/MediaBrowser.Api/DefaultTheme/ItemStub.cs @@ -1,4 +1,5 @@ -using System; +using MediaBrowser.Model.Entities; +using System; namespace MediaBrowser.Api.DefaultTheme { @@ -7,5 +8,6 @@ namespace MediaBrowser.Api.DefaultTheme public string Name { get; set; } public string Id { get; set; } public Guid ImageTag { get; set; } + public ImageType ImageType { get; set; } } } diff --git a/MediaBrowser.Api/DefaultTheme/MoviesView.cs b/MediaBrowser.Api/DefaultTheme/MoviesView.cs index 6bf1bfdd93..11a53a80a3 100644 --- a/MediaBrowser.Api/DefaultTheme/MoviesView.cs +++ b/MediaBrowser.Api/DefaultTheme/MoviesView.cs @@ -15,6 +15,8 @@ namespace MediaBrowser.Api.DefaultTheme public ItemStub[] FamilyMovies { get; set; } + public ItemStub[] RomanticItems { get; set; } + public double FamilyMoviePercentage { get; set; } public double HDMoviePercentage { get; set; } diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index 90cb59bbe2..bb8b7d80e5 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs @@ -149,7 +149,7 @@ namespace MediaBrowser.Common.Implementations /// /// The installation manager. protected IInstallationManager InstallationManager { get; set; } - + /// /// Initializes a new instance of the class. /// @@ -186,7 +186,7 @@ namespace MediaBrowser.Common.Implementations protected virtual void OnLoggerLoaded() { - + } /// @@ -471,7 +471,7 @@ namespace MediaBrowser.Common.Implementations { ConfigureAutoRunAtStartup(); } - + /// /// Configures the auto run at startup. /// @@ -480,7 +480,7 @@ namespace MediaBrowser.Common.Implementations if (ConfigurationManager.CommonConfiguration.RunAtStartup) { //Copy our shortut into the startup folder for this user - File.Copy(ProductShortcutPath, Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup),Path.GetFileName(ProductShortcutPath) ?? "MBstartup.lnk"), true); + File.Copy(ProductShortcutPath, Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), Path.GetFileName(ProductShortcutPath) ?? "MBstartup.lnk"), true); } else { @@ -566,56 +566,33 @@ namespace MediaBrowser.Common.Implementations /// The cancellation token. /// The progress. /// Task{CheckForUpdateResult}. - public async Task CheckForApplicationUpdate(CancellationToken cancellationToken, - IProgress progress) - { - var result = await CheckForApplicationUpdateInternal(cancellationToken, progress).ConfigureAwait(false); - - return result; - } + public abstract Task CheckForApplicationUpdate(CancellationToken cancellationToken, + IProgress progress); /// - /// Checks for application update internal. + /// Updates the application. /// + /// The package that contains the update /// The cancellation token. /// The progress. - /// Task{CheckForUpdateResult}. - private async Task CheckForApplicationUpdateInternal(CancellationToken cancellationToken, - IProgress progress) - { - var availablePackages = await InstallationManager.GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false); - - var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, ApplicationUpdatePackageName, ConfigurationManager.CommonConfiguration.SystemUpdateLevel); - - return version != null ? new CheckForUpdateResult { AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version } : - new CheckForUpdateResult { AvailableVersion = ApplicationVersion, IsUpdateAvailable = false }; - } + /// Task. + public abstract Task UpdateApplication(PackageVersionInfo package, CancellationToken cancellationToken, + IProgress progress); /// - /// Gets the name of the application update package. + /// Shuts down. /// - /// The name of the application update package. - protected abstract string ApplicationUpdatePackageName { get; } + public abstract void Shutdown(); /// - /// Updates the application. + /// Called when [application updated]. /// - /// The package that contains the update - /// The cancellation token. - /// The progress. - /// Task. - public async Task UpdateApplication(PackageVersionInfo package, CancellationToken cancellationToken, IProgress progress) + /// The new version. + protected void OnApplicationUpdated(Version newVersion) { - await InstallationManager.InstallPackage(package, progress, cancellationToken).ConfigureAwait(false); - - EventHelper.QueueEventIfNotNull(ApplicationUpdated, this, new GenericEventArgs { Argument = package.version }, Logger); + EventHelper.QueueEventIfNotNull(ApplicationUpdated, this, new GenericEventArgs { Argument = newVersion }, Logger); NotifyPendingRestart(); } - - /// - /// Shuts down. - /// - public abstract void Shutdown(); } } diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs index 57b39c209a..2cc9071449 100644 --- a/MediaBrowser.ServerApplication/ApplicationHost.cs +++ b/MediaBrowser.ServerApplication/ApplicationHost.cs @@ -29,6 +29,7 @@ using MediaBrowser.IsoMounter; using MediaBrowser.Model.IO; using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.System; +using MediaBrowser.Model.Updates; using MediaBrowser.Providers; using MediaBrowser.Server.Implementations; using MediaBrowser.Server.Implementations.BdInfo; @@ -687,11 +688,56 @@ namespace MediaBrowser.ServerApplication } } - protected override string ApplicationUpdatePackageName + /// + /// Checks for update. + /// + /// The cancellation token. + /// The progress. + /// Task{CheckForUpdateResult}. + public override async Task CheckForApplicationUpdate(CancellationToken cancellationToken, + IProgress progress) + { + var result = await CheckForApplicationUpdateInternal(cancellationToken, progress).ConfigureAwait(false); + + return result; + } + + /// + /// Checks for application update internal. + /// + /// The cancellation token. + /// The progress. + /// Task{CheckForUpdateResult}. + private async Task CheckForApplicationUpdateInternal(CancellationToken cancellationToken, + IProgress progress) { - get { return Constants.MbServerPkgName; } + var availablePackages = await InstallationManager.GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false); + + var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, Constants.MbServerPkgName, ConfigurationManager.CommonConfiguration.SystemUpdateLevel); + + return version != null ? new CheckForUpdateResult { AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version } : + new CheckForUpdateResult { AvailableVersion = ApplicationVersion, IsUpdateAvailable = false }; } + /// + /// Updates the application. + /// + /// The package that contains the update + /// The cancellation token. + /// The progress. + /// Task. + public override async Task UpdateApplication(PackageVersionInfo package, CancellationToken cancellationToken, IProgress progress) + { + await InstallationManager.InstallPackage(package, progress, cancellationToken).ConfigureAwait(false); + + OnApplicationUpdated(package.version); + } + + /// + /// Gets the HTTP message handler. + /// + /// if set to true [enable HTTP compression]. + /// HttpMessageHandler. protected override HttpMessageHandler GetHttpMessageHandler(bool enableHttpCompression) { return new WebRequestHandler diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 901e441932..88ea3d2dee 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.198 + 3.0.199 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 87a6a38563..48fad7b3a4 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.198 + 3.0.199 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 4f8cd13571..7ab55bbe30 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.198 + 3.0.199 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - +