mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-14 09:12:57 -07:00
parent
08b5527891
commit
abd5a4889e
9 changed files with 104 additions and 42 deletions
|
@ -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,6 +1,9 @@
|
||||||
<div *ngIf="landingPageSettings && customizationSettings && background">
|
<div *ngIf="landingPageSettings && customizationSettings && background">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
landingDiv {
|
landingDiv {
|
||||||
-webkit-background-size: cover;
|
-webkit-background-size: cover;
|
||||||
-moz-background-size: cover;
|
-moz-background-size: cover;
|
||||||
|
@ -8,6 +11,13 @@
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.centered {
|
||||||
|
position: fixed;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
|
|
||||||
img.bg {
|
img.bg {
|
||||||
/* Set rules to fill background */
|
/* Set rules to fill background */
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
|
@ -19,6 +29,8 @@
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 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 */
|
@media screen and (max-width: 1024px) { /* Specific to this particular image */
|
||||||
|
@ -27,10 +39,14 @@
|
||||||
margin-left: -512px; /* 50% */
|
margin-left: -512px; /* 50% */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</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>
|
</div>
|
||||||
|
|
|
@ -29,7 +29,7 @@ export class LandingPageComponent implements OnInit {
|
||||||
this.settingsService.getLandingPage().subscribe(x => this.landingPageSettings = x);
|
this.settingsService.getLandingPage().subscribe(x => this.landingPageSettings = x);
|
||||||
this.requestService.getRequestsCount().subscribe(x => this.requestCount = x);
|
this.requestService.getRequestsCount().subscribe(x => this.requestCount = x);
|
||||||
this.images.getRandomBackground().subscribe(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;
|
this.mediaServerStatus = true;
|
||||||
|
|
10
src/Ombi/Config/LandingPageBackground.cs
Normal file
10
src/Ombi/Config/LandingPageBackground.cs
Normal file
|
@ -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.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using Ombi.Config;
|
||||||
|
|
||||||
namespace Ombi.Controllers
|
namespace Ombi.Controllers
|
||||||
{
|
{
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
public class ImagesController : Controller
|
public class ImagesController : Controller
|
||||||
{
|
{
|
||||||
public ImagesController(IFanartTvApi api, IApplicationConfigRepository config)
|
public ImagesController(IFanartTvApi api, IApplicationConfigRepository config, IOptions<LandingPageBackground> options)
|
||||||
{
|
{
|
||||||
Api = api;
|
Api = api;
|
||||||
Config = config;
|
Config = config;
|
||||||
|
Options = options.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IFanartTvApi Api { get; }
|
private IFanartTvApi Api { get; }
|
||||||
private IApplicationConfigRepository Config { get; }
|
private IApplicationConfigRepository Config { get; }
|
||||||
|
private LandingPageBackground Options { get; }
|
||||||
|
|
||||||
[HttpGet("background")]
|
[HttpGet("background")]
|
||||||
public async Task<object> GetBackgroundImage()
|
public async Task<object> GetBackgroundImage()
|
||||||
{
|
{
|
||||||
var moviesArray = new[]{
|
var moviesArray = Options.Movies;
|
||||||
278,
|
var tvArray = Options.TvShows;
|
||||||
238,
|
|
||||||
431483,
|
|
||||||
372058,
|
|
||||||
244786,
|
|
||||||
680,
|
|
||||||
155,
|
|
||||||
13,
|
|
||||||
1891,
|
|
||||||
399106
|
|
||||||
};
|
|
||||||
|
|
||||||
|
var rand = new Random();
|
||||||
|
var movieUrl = string.Empty;
|
||||||
|
var tvUrl = string.Empty;
|
||||||
|
|
||||||
|
if (moviesArray.Any())
|
||||||
|
{
|
||||||
|
var item = rand.Next(moviesArray.Length);
|
||||||
var key = await Config.Get(Store.Entities.ConfigurationTypes.FanartTv);
|
var key = await Config.Get(Store.Entities.ConfigurationTypes.FanartTv);
|
||||||
|
var result = await Api.GetMovieImages(moviesArray[item], key.Value);
|
||||||
|
|
||||||
var result = await Api.GetMovieImages(155, key.Value);
|
while (!result.moviebackground.Any())
|
||||||
|
{
|
||||||
|
result = await Api.GetMovieImages(moviesArray[item], key.Value);
|
||||||
|
}
|
||||||
|
|
||||||
return new { url = result.moviebackground[0].url };
|
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)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Console.Title = "Ombi";
|
Console.Title = "Ombi";
|
||||||
var options = new Options();
|
|
||||||
int port = 0;
|
int port = 0;
|
||||||
string host = string.Empty;
|
string host = string.Empty;
|
||||||
Parser.Default.ParseArguments<Options>(args)
|
Parser.Default.ParseArguments<Options>(args)
|
||||||
|
@ -86,7 +86,7 @@ namespace Ombi
|
||||||
[Option('h', "host", Required = false, HelpText = "The Hostname default is http://*", Default ="http://*")]
|
[Option('h', "host", Required = false, HelpText = "The Hostname default is http://*", Default ="http://*")]
|
||||||
public string Host { get; set; }
|
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; }
|
public int Port { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,6 +155,7 @@ namespace Ombi
|
||||||
//services.Configure<TokenAuthenticationOptions>(Configuration.GetSection("TokenAuthentication"));
|
//services.Configure<TokenAuthenticationOptions>(Configuration.GetSection("TokenAuthentication"));
|
||||||
services.Configure<ApplicationSettings>(Configuration.GetSection("ApplicationSettings"));
|
services.Configure<ApplicationSettings>(Configuration.GetSection("ApplicationSettings"));
|
||||||
services.Configure<UserSettings>(Configuration.GetSection("UserSettings"));
|
services.Configure<UserSettings>(Configuration.GetSection("UserSettings"));
|
||||||
|
services.Configure<LandingPageBackground>(Configuration.GetSection("LandingPageBackground"));
|
||||||
|
|
||||||
services.AddHangfire(x =>
|
services.AddHangfire(x =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,5 +21,24 @@
|
||||||
"Audience": "OmbiAudience",
|
"Audience": "OmbiAudience",
|
||||||
"TokenPath": "/api/v1/token/",
|
"TokenPath": "/api/v1/token/",
|
||||||
"CookieName": "access_token"
|
"CookieName": "access_token"
|
||||||
|
},
|
||||||
|
"LandingPageBackground": {
|
||||||
|
"Movies": [
|
||||||
|
278,
|
||||||
|
244786,
|
||||||
|
680,
|
||||||
|
155,
|
||||||
|
13,
|
||||||
|
1891,
|
||||||
|
399106
|
||||||
|
],
|
||||||
|
"TvShows": [
|
||||||
|
121361,
|
||||||
|
74205,
|
||||||
|
81189,
|
||||||
|
79126,
|
||||||
|
79349,
|
||||||
|
275274
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue