#1458 #865 More work on landing

pull/1488/head
Jamie.Rees 7 years ago
parent 08b5527891
commit abd5a4889e

@ -1,6 +0,0 @@
;https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/
cd ..
dotnet restore
dotnet publish -c Release /p:AppRuntimeIdentifier=win10-x64
exit

@ -1,9 +0,0 @@
;https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/
cd ..
dotnet restore
dotnet publish -c Release /p:AppRuntimeIdentifier=win10-x64
dotnet publish -c Release /p:AppRuntimeIdentifier=osx.10.12-x64
dotnet publish -c Release /p:AppRuntimeIdentifier=ubuntu.16.10-x64
dotnet publish -c Release /p:AppRuntimeIdentifier=debian.8-x64
exit

@ -1,12 +1,22 @@
<div *ngIf="landingPageSettings && customizationSettings && background">
<style>
landingDiv {
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
landingDiv {
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
div.centered {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
img.bg {
/* Set rules to fill background */
@ -19,6 +29,8 @@
position: fixed;
top: 0;
left: 0;
z-index: -1;
/*background-image: linear-gradient(-10deg, transparent 20%, rgba(255, 255, 255, 0.3) 20%, rgba(0, 0, 255, 0.3) 80%, transparent 80%), url("https://assets.fanart.tv/fanart/movies/155/moviebackground/the-dark-knight-51f269c2ce53a.jpg")*/
}
@media screen and (max-width: 1024px) { /* Specific to this particular image */
@ -27,10 +39,14 @@
margin-left: -512px; /* 50% */
}
}
</style>
<img class="landingDiv bg" [style.background-image]="background" />
<img class="landingDiv bg" [style.background-image]="background"/>
<div class="centered">
<h3>Notice</h3>
</div>
</div>

@ -29,7 +29,7 @@ export class LandingPageComponent implements OnInit {
this.settingsService.getLandingPage().subscribe(x => this.landingPageSettings = x);
this.requestService.getRequestsCount().subscribe(x => this.requestCount = x);
this.images.getRandomBackground().subscribe(x => {
this.background = this.sanitizer.bypassSecurityTrustStyle('url(' + x.url + ')');
this.background = this.sanitizer.bypassSecurityTrustStyle('linear-gradient(-10deg, transparent 20%, rgba(0,0,0,0.3) 20.1%, rgba(0,0,0,0.3) 80.1%, transparent 80%), url(' + x.url + ')');
});
this.mediaServerStatus = true;

@ -0,0 +1,10 @@
namespace Ombi.Config
{
public class LandingPageBackground
{
public int[] Movies { get; set; }
public int[] TvShows { get; set; }
}
}

@ -5,43 +5,74 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Ombi.Config;
namespace Ombi.Controllers
{
[ApiV1]
public class ImagesController : Controller
{
public ImagesController(IFanartTvApi api, IApplicationConfigRepository config)
public ImagesController(IFanartTvApi api, IApplicationConfigRepository config, IOptions<LandingPageBackground> options)
{
Api = api;
Config = config;
Options = options.Value;
}
private IFanartTvApi Api { get; }
private IApplicationConfigRepository Config { get; }
private LandingPageBackground Options { get; }
[HttpGet("background")]
public async Task<object> GetBackgroundImage()
{
var moviesArray = new[]{
278,
238,
431483,
372058,
244786,
680,
155,
13,
1891,
399106
};
var moviesArray = Options.Movies;
var tvArray = Options.TvShows;
var key = await Config.Get(Store.Entities.ConfigurationTypes.FanartTv);
var rand = new Random();
var movieUrl = string.Empty;
var tvUrl = string.Empty;
var result = await Api.GetMovieImages(155, key.Value);
if (moviesArray.Any())
{
var item = rand.Next(moviesArray.Length);
var key = await Config.Get(Store.Entities.ConfigurationTypes.FanartTv);
var result = await Api.GetMovieImages(moviesArray[item], key.Value);
return new { url = result.moviebackground[0].url };
while (!result.moviebackground.Any())
{
result = await Api.GetMovieImages(moviesArray[item], key.Value);
}
movieUrl = result.moviebackground[0].url;
}
if(tvArray.Any())
{
var item = rand.Next(tvArray.Length);
var key = await Config.Get(Store.Entities.ConfigurationTypes.FanartTv);
var result = await Api.GetTvImages(tvArray[item], key.Value);
while (!result.showbackground.Any())
{
result = await Api.GetTvImages(tvArray[item], key.Value);
}
tvUrl = result.showbackground[0].url;
}
if (!string.IsNullOrEmpty(movieUrl) && !string.IsNullOrEmpty(tvUrl))
{
var result = rand.Next(2);
if (result == 0) return new { url = movieUrl };
if (result == 1) return new { url = tvUrl };
}
if (!string.IsNullOrEmpty(movieUrl))
{
return new { url = movieUrl };
}
return new { url = tvUrl };
}
}
}

@ -14,7 +14,7 @@ namespace Ombi
public static void Main(string[] args)
{
Console.Title = "Ombi";
var options = new Options();
int port = 0;
string host = string.Empty;
Parser.Default.ParseArguments<Options>(args)
@ -86,7 +86,7 @@ namespace Ombi
[Option('h', "host", Required = false, HelpText = "The Hostname default is http://*", Default ="http://*")]
public string Host { get; set; }
[Option('p', "port", Required = false, HelpText = "The port, default is 5000", Default =5000)]
[Option('p', "port", Required = false, HelpText = "The port, default is 5000", Default = 5000)]
public int Port { get; set; }
}
}

@ -155,6 +155,7 @@ namespace Ombi
//services.Configure<TokenAuthenticationOptions>(Configuration.GetSection("TokenAuthentication"));
services.Configure<ApplicationSettings>(Configuration.GetSection("ApplicationSettings"));
services.Configure<UserSettings>(Configuration.GetSection("UserSettings"));
services.Configure<LandingPageBackground>(Configuration.GetSection("LandingPageBackground"));
services.AddHangfire(x =>
{

@ -21,5 +21,24 @@
"Audience": "OmbiAudience",
"TokenPath": "/api/v1/token/",
"CookieName": "access_token"
},
"LandingPageBackground": {
"Movies": [
278,
244786,
680,
155,
13,
1891,
399106
],
"TvShows": [
121361,
74205,
81189,
79126,
79349,
275274
]
}
}

Loading…
Cancel
Save