mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 16:52:56 -07:00
Added a demo mode, this will only show movies and shows that are in the public domain. Dam that stupid fruit company
This commit is contained in:
parent
1565ebce0d
commit
65ea88925a
11 changed files with 360 additions and 13 deletions
106
src/Ombi.Core/Engine/Demo/DemoMovieSearchEngine.cs
Normal file
106
src/Ombi.Core/Engine/Demo/DemoMovieSearchEngine.cs
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Security.Principal;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using AutoMapper;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using Ombi.Api.TheMovieDb;
|
||||||
|
using Ombi.Api.TheMovieDb.Models;
|
||||||
|
using Ombi.Config;
|
||||||
|
using Ombi.Core.Authentication;
|
||||||
|
using Ombi.Core.Models.Requests;
|
||||||
|
using Ombi.Core.Models.Search;
|
||||||
|
using Ombi.Core.Rule.Interfaces;
|
||||||
|
using Ombi.Core.Settings;
|
||||||
|
using Ombi.Helpers;
|
||||||
|
using Ombi.Settings.Settings.Models;
|
||||||
|
using Ombi.Store.Entities;
|
||||||
|
using Ombi.Store.Repository;
|
||||||
|
|
||||||
|
namespace Ombi.Core.Engine.Demo
|
||||||
|
{
|
||||||
|
public class DemoMovieSearchEngine : MovieSearchEngine, IDemoMovieSearchEngine
|
||||||
|
{
|
||||||
|
public DemoMovieSearchEngine(IPrincipal identity, IRequestServiceMain service, IMovieDbApi movApi, IMapper mapper,
|
||||||
|
ILogger<MovieSearchEngine> logger, IRuleEvaluator r, OmbiUserManager um, ICacheService mem, ISettingsService<OmbiSettings> s,
|
||||||
|
IRepository<RequestSubscription> sub, IOptions<DemoLists> lists)
|
||||||
|
: base(identity, service, movApi, mapper, logger, r, um, mem, s, sub)
|
||||||
|
{
|
||||||
|
_demoLists = lists.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly DemoLists _demoLists;
|
||||||
|
|
||||||
|
public async Task<IEnumerable<SearchMovieViewModel>> Search(string search)
|
||||||
|
{
|
||||||
|
var result = await MovieApi.SearchMovie(search, null, "en");
|
||||||
|
|
||||||
|
for (var i = 0; i < result.Count; i++)
|
||||||
|
{
|
||||||
|
if (!_demoLists.Movies.Contains(result[i].Id))
|
||||||
|
{
|
||||||
|
result.RemoveAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(result.Count > 0)
|
||||||
|
return await TransformMovieResultsToResponse(result.Take(MovieLimit)); // Take x to stop us overloading the API
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<SearchMovieViewModel>> NowPlayingMovies()
|
||||||
|
{
|
||||||
|
var rand = new Random();
|
||||||
|
var responses = new List<SearchMovieViewModel>();
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
var item = rand.Next(_demoLists.Movies.Length);
|
||||||
|
var movie = _demoLists.Movies[item];
|
||||||
|
if (responses.Any(x => x.Id == movie))
|
||||||
|
{
|
||||||
|
i--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var movieResult = await MovieApi.GetMovieInformationWithExtraInfo(movie);
|
||||||
|
var viewMovie = Mapper.Map<SearchMovieViewModel>(movieResult);
|
||||||
|
|
||||||
|
responses.Add(await ProcessSingleMovie(viewMovie));
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<SearchMovieViewModel>> PopularMovies()
|
||||||
|
{
|
||||||
|
return await NowPlayingMovies();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<IEnumerable<SearchMovieViewModel>> TopRatedMovies()
|
||||||
|
{
|
||||||
|
return await NowPlayingMovies();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<SearchMovieViewModel>> UpcomingMovies()
|
||||||
|
{
|
||||||
|
|
||||||
|
return await NowPlayingMovies();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IDemoMovieSearchEngine
|
||||||
|
{
|
||||||
|
Task<IEnumerable<SearchMovieViewModel>> NowPlayingMovies();
|
||||||
|
|
||||||
|
Task<IEnumerable<SearchMovieViewModel>> PopularMovies();
|
||||||
|
|
||||||
|
Task<IEnumerable<SearchMovieViewModel>> Search(string search);
|
||||||
|
|
||||||
|
Task<IEnumerable<SearchMovieViewModel>> TopRatedMovies();
|
||||||
|
|
||||||
|
Task<IEnumerable<SearchMovieViewModel>> UpcomingMovies();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
96
src/Ombi.Core/Engine/Demo/DemoTvSearchEngine.cs
Normal file
96
src/Ombi.Core/Engine/Demo/DemoTvSearchEngine.cs
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
using AutoMapper;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using Ombi.Api.Trakt;
|
||||||
|
using Ombi.Api.TvMaze;
|
||||||
|
using Ombi.Config;
|
||||||
|
using Ombi.Core.Authentication;
|
||||||
|
using Ombi.Core.Models.Requests;
|
||||||
|
using Ombi.Core.Models.Search;
|
||||||
|
using Ombi.Core.Rule.Interfaces;
|
||||||
|
using Ombi.Core.Settings;
|
||||||
|
using Ombi.Core.Settings.Models.External;
|
||||||
|
using Ombi.Helpers;
|
||||||
|
using Ombi.Settings.Settings.Models;
|
||||||
|
using Ombi.Store.Entities;
|
||||||
|
using Ombi.Store.Repository;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Security.Principal;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Ombi.Core.Engine.Demo
|
||||||
|
{
|
||||||
|
public class DemoTvSearchEngine : TvSearchEngine, IDemoTvSearchEngine
|
||||||
|
{
|
||||||
|
|
||||||
|
public DemoTvSearchEngine(IPrincipal identity, IRequestServiceMain service, ITvMazeApi tvMaze, IMapper mapper,
|
||||||
|
ISettingsService<PlexSettings> plexSettings, ISettingsService<EmbySettings> embySettings, IPlexContentRepository repo,
|
||||||
|
IEmbyContentRepository embyRepo, ITraktApi trakt, IRuleEvaluator r, OmbiUserManager um, ICacheService memCache,
|
||||||
|
ISettingsService<OmbiSettings> s, IRepository<RequestSubscription> sub, IOptions<DemoLists> lists)
|
||||||
|
: base(identity, service, tvMaze, mapper, plexSettings, embySettings, repo, embyRepo, trakt, r, um, memCache, s, sub)
|
||||||
|
{
|
||||||
|
_demoLists = lists.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly DemoLists _demoLists;
|
||||||
|
|
||||||
|
public async Task<IEnumerable<SearchTvShowViewModel>> Search(string search)
|
||||||
|
{
|
||||||
|
var searchResult = await TvMazeApi.Search(search);
|
||||||
|
|
||||||
|
for (var i = 0; i < searchResult.Count; i++)
|
||||||
|
{
|
||||||
|
if (!_demoLists.TvShows.Contains(searchResult[i].show?.externals?.thetvdb ?? 0))
|
||||||
|
{
|
||||||
|
searchResult.RemoveAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (searchResult != null)
|
||||||
|
{
|
||||||
|
var retVal = new List<SearchTvShowViewModel>();
|
||||||
|
foreach (var tvMazeSearch in searchResult)
|
||||||
|
{
|
||||||
|
if (tvMazeSearch.show.externals == null || !(tvMazeSearch.show.externals?.thetvdb.HasValue ?? false))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
retVal.Add(ProcessResult(tvMazeSearch));
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<SearchTvShowViewModel>> NowPlayingMovies()
|
||||||
|
{
|
||||||
|
var rand = new Random();
|
||||||
|
var responses = new List<SearchTvShowViewModel>();
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
var item = rand.Next(_demoLists.TvShows.Length);
|
||||||
|
var tv = _demoLists.TvShows[item];
|
||||||
|
if (responses.Any(x => x.Id == tv))
|
||||||
|
{
|
||||||
|
i--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var movieResult = await TvMazeApi.ShowLookup(tv);
|
||||||
|
responses.Add(ProcessResult(movieResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IDemoTvSearchEngine
|
||||||
|
{
|
||||||
|
Task<IEnumerable<SearchTvShowViewModel>> Search(string search);
|
||||||
|
Task<IEnumerable<SearchTvShowViewModel>> NowPlayingMovies();
|
||||||
|
}
|
||||||
|
}
|
|
@ -31,11 +31,11 @@ namespace Ombi.Core.Engine
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IMovieDbApi MovieApi { get; }
|
protected IMovieDbApi MovieApi { get; }
|
||||||
private IMapper Mapper { get; }
|
protected IMapper Mapper { get; }
|
||||||
private ILogger<MovieSearchEngine> Logger { get; }
|
private ILogger<MovieSearchEngine> Logger { get; }
|
||||||
|
|
||||||
private const int MovieLimit = 10;
|
protected const int MovieLimit = 10;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Lookups the imdb information.
|
/// Lookups the imdb information.
|
||||||
|
@ -184,7 +184,7 @@ namespace Ombi.Core.Engine
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<List<SearchMovieViewModel>> TransformMovieResultsToResponse(
|
protected async Task<List<SearchMovieViewModel>> TransformMovieResultsToResponse(
|
||||||
IEnumerable<MovieSearchResult> movies)
|
IEnumerable<MovieSearchResult> movies)
|
||||||
{
|
{
|
||||||
var viewMovies = new List<SearchMovieViewModel>();
|
var viewMovies = new List<SearchMovieViewModel>();
|
||||||
|
@ -195,7 +195,7 @@ namespace Ombi.Core.Engine
|
||||||
return viewMovies;
|
return viewMovies;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<SearchMovieViewModel> ProcessSingleMovie(SearchMovieViewModel viewMovie, bool lookupExtraInfo = false)
|
protected async Task<SearchMovieViewModel> ProcessSingleMovie(SearchMovieViewModel viewMovie, bool lookupExtraInfo = false)
|
||||||
{
|
{
|
||||||
if (lookupExtraInfo && viewMovie.ImdbId.IsNullOrEmpty())
|
if (lookupExtraInfo && viewMovie.ImdbId.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
|
@ -213,7 +213,7 @@ namespace Ombi.Core.Engine
|
||||||
|
|
||||||
// This requires the rules to be run first to populate the RequestId property
|
// This requires the rules to be run first to populate the RequestId property
|
||||||
await CheckForSubscription(viewMovie);
|
await CheckForSubscription(viewMovie);
|
||||||
|
|
||||||
return viewMovie;
|
return viewMovie;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,8 @@ namespace Ombi.Core.Engine
|
||||||
EmbyContentRepo = embyRepo;
|
EmbyContentRepo = embyRepo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ITvMazeApi TvMazeApi { get; }
|
protected ITvMazeApi TvMazeApi { get; }
|
||||||
private IMapper Mapper { get; }
|
protected IMapper Mapper { get; }
|
||||||
private ISettingsService<PlexSettings> PlexSettings { get; }
|
private ISettingsService<PlexSettings> PlexSettings { get; }
|
||||||
private ISettingsService<EmbySettings> EmbySettings { get; }
|
private ISettingsService<EmbySettings> EmbySettings { get; }
|
||||||
private IPlexContentRepository PlexContentRepo { get; }
|
private IPlexContentRepository PlexContentRepo { get; }
|
||||||
|
@ -149,7 +149,7 @@ namespace Ombi.Core.Engine
|
||||||
return processed;
|
return processed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<SearchTvShowViewModel> ProcessResults<T>(IEnumerable<T> items)
|
protected IEnumerable<SearchTvShowViewModel> ProcessResults<T>(IEnumerable<T> items)
|
||||||
{
|
{
|
||||||
var retVal = new List<SearchTvShowViewModel>();
|
var retVal = new List<SearchTvShowViewModel>();
|
||||||
foreach (var tvMazeSearch in items)
|
foreach (var tvMazeSearch in items)
|
||||||
|
@ -159,7 +159,7 @@ namespace Ombi.Core.Engine
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SearchTvShowViewModel ProcessResult<T>(T tvMazeSearch)
|
protected SearchTvShowViewModel ProcessResult<T>(T tvMazeSearch)
|
||||||
{
|
{
|
||||||
return Mapper.Map<SearchTvShowViewModel>(tvMazeSearch);
|
return Mapper.Map<SearchTvShowViewModel>(tvMazeSearch);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ using Ombi.Updater;
|
||||||
using PlexContentCacher = Ombi.Schedule.Jobs.Plex;
|
using PlexContentCacher = Ombi.Schedule.Jobs.Plex;
|
||||||
using Ombi.Api.Telegram;
|
using Ombi.Api.Telegram;
|
||||||
using Ombi.Core.Authentication;
|
using Ombi.Core.Authentication;
|
||||||
|
using Ombi.Core.Engine.Demo;
|
||||||
using Ombi.Core.Processor;
|
using Ombi.Core.Processor;
|
||||||
using Ombi.Schedule.Jobs.Lidarr;
|
using Ombi.Schedule.Jobs.Lidarr;
|
||||||
using Ombi.Schedule.Jobs.Plex.Interfaces;
|
using Ombi.Schedule.Jobs.Plex.Interfaces;
|
||||||
|
@ -92,6 +93,8 @@ namespace Ombi.DependencyInjection
|
||||||
services.AddTransient<IMassEmailSender, MassEmailSender>();
|
services.AddTransient<IMassEmailSender, MassEmailSender>();
|
||||||
services.AddTransient<IPlexOAuthManager, PlexOAuthManager>();
|
services.AddTransient<IPlexOAuthManager, PlexOAuthManager>();
|
||||||
services.AddTransient<IVoteEngine, VoteEngine>();
|
services.AddTransient<IVoteEngine, VoteEngine>();
|
||||||
|
services.AddTransient<IDemoMovieSearchEngine, DemoMovieSearchEngine>();
|
||||||
|
services.AddTransient<IDemoTvSearchEngine, DemoTvSearchEngine>();
|
||||||
}
|
}
|
||||||
public static void RegisterHttp(this IServiceCollection services)
|
public static void RegisterHttp(this IServiceCollection services)
|
||||||
{
|
{
|
||||||
|
|
10
src/Ombi.Helpers/DemoLists.cs
Normal file
10
src/Ombi.Helpers/DemoLists.cs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
namespace Ombi.Config
|
||||||
|
{
|
||||||
|
public class DemoLists
|
||||||
|
{
|
||||||
|
public int[] Movies { get; set; }
|
||||||
|
public int[] TvShows { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
13
src/Ombi.Helpers/DemoSingleton.cs
Normal file
13
src/Ombi.Helpers/DemoSingleton.cs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
namespace Ombi.Helpers
|
||||||
|
{
|
||||||
|
public class DemoSingleton
|
||||||
|
{
|
||||||
|
private static DemoSingleton instance;
|
||||||
|
|
||||||
|
private DemoSingleton() { }
|
||||||
|
|
||||||
|
public static DemoSingleton Instance => instance ?? (instance = new DemoSingleton());
|
||||||
|
|
||||||
|
public bool Demo { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,6 +10,8 @@ using Ombi.Core.Models.Search;
|
||||||
using Ombi.Models;
|
using Ombi.Models;
|
||||||
using StackExchange.Profiling;
|
using StackExchange.Profiling;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Ombi.Core.Engine.Demo;
|
||||||
|
using Ombi.Helpers;
|
||||||
|
|
||||||
namespace Ombi.Controllers
|
namespace Ombi.Controllers
|
||||||
{
|
{
|
||||||
|
@ -19,18 +21,26 @@ namespace Ombi.Controllers
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class SearchController : Controller
|
public class SearchController : Controller
|
||||||
{
|
{
|
||||||
public SearchController(IMovieEngine movie, ITvSearchEngine tvEngine, ILogger<SearchController> logger, IMusicSearchEngine music)
|
public SearchController(IMovieEngine movie, ITvSearchEngine tvEngine, ILogger<SearchController> logger, IMusicSearchEngine music,
|
||||||
|
IDemoMovieSearchEngine demoMovieSearch, IDemoTvSearchEngine demoTvSearchEngine)
|
||||||
{
|
{
|
||||||
MovieEngine = movie;
|
MovieEngine = movie;
|
||||||
TvEngine = tvEngine;
|
TvEngine = tvEngine;
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
MusicEngine = music;
|
MusicEngine = music;
|
||||||
|
DemoMovieSearch = demoMovieSearch;
|
||||||
|
DemoTvSearch = demoTvSearchEngine;
|
||||||
|
IsDemo = DemoSingleton.Instance.Demo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ILogger<SearchController> Logger { get; }
|
private ILogger<SearchController> Logger { get; }
|
||||||
|
|
||||||
private IMovieEngine MovieEngine { get; }
|
private IMovieEngine MovieEngine { get; }
|
||||||
private ITvSearchEngine TvEngine { get; }
|
private ITvSearchEngine TvEngine { get; }
|
||||||
private IMusicSearchEngine MusicEngine { get; }
|
private IMusicSearchEngine MusicEngine { get; }
|
||||||
|
private IDemoMovieSearchEngine DemoMovieSearch { get; }
|
||||||
|
private IDemoTvSearchEngine DemoTvSearch { get; }
|
||||||
|
private readonly bool IsDemo;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Searches for a movie.
|
/// Searches for a movie.
|
||||||
|
@ -47,6 +57,10 @@ namespace Ombi.Controllers
|
||||||
{
|
{
|
||||||
Logger.LogDebug("Searching : {searchTerm}", searchTerm);
|
Logger.LogDebug("Searching : {searchTerm}", searchTerm);
|
||||||
|
|
||||||
|
if (IsDemo)
|
||||||
|
{
|
||||||
|
return await DemoMovieSearch.Search(searchTerm);
|
||||||
|
}
|
||||||
return await MovieEngine.Search(searchTerm, null, null);
|
return await MovieEngine.Search(searchTerm, null, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,6 +187,10 @@ namespace Ombi.Controllers
|
||||||
[ProducesDefaultResponseType]
|
[ProducesDefaultResponseType]
|
||||||
public async Task<IEnumerable<SearchMovieViewModel>> Popular()
|
public async Task<IEnumerable<SearchMovieViewModel>> Popular()
|
||||||
{
|
{
|
||||||
|
if (IsDemo)
|
||||||
|
{
|
||||||
|
return await DemoMovieSearch.PopularMovies();
|
||||||
|
}
|
||||||
return await MovieEngine.PopularMovies();
|
return await MovieEngine.PopularMovies();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -185,6 +203,10 @@ namespace Ombi.Controllers
|
||||||
[ProducesDefaultResponseType]
|
[ProducesDefaultResponseType]
|
||||||
public async Task<IEnumerable<SearchMovieViewModel>> NowPlayingMovies()
|
public async Task<IEnumerable<SearchMovieViewModel>> NowPlayingMovies()
|
||||||
{
|
{
|
||||||
|
if (IsDemo)
|
||||||
|
{
|
||||||
|
return await DemoMovieSearch.NowPlayingMovies();
|
||||||
|
}
|
||||||
return await MovieEngine.NowPlayingMovies();
|
return await MovieEngine.NowPlayingMovies();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -197,6 +219,10 @@ namespace Ombi.Controllers
|
||||||
[ProducesDefaultResponseType]
|
[ProducesDefaultResponseType]
|
||||||
public async Task<IEnumerable<SearchMovieViewModel>> TopRatedMovies()
|
public async Task<IEnumerable<SearchMovieViewModel>> TopRatedMovies()
|
||||||
{
|
{
|
||||||
|
if (IsDemo)
|
||||||
|
{
|
||||||
|
return await DemoMovieSearch.TopRatedMovies();
|
||||||
|
}
|
||||||
return await MovieEngine.TopRatedMovies();
|
return await MovieEngine.TopRatedMovies();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -209,6 +235,10 @@ namespace Ombi.Controllers
|
||||||
[ProducesDefaultResponseType]
|
[ProducesDefaultResponseType]
|
||||||
public async Task<IEnumerable<SearchMovieViewModel>> UpcomingMovies()
|
public async Task<IEnumerable<SearchMovieViewModel>> UpcomingMovies()
|
||||||
{
|
{
|
||||||
|
if (IsDemo)
|
||||||
|
{
|
||||||
|
return await DemoMovieSearch.UpcomingMovies();
|
||||||
|
}
|
||||||
return await MovieEngine.UpcomingMovies();
|
return await MovieEngine.UpcomingMovies();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,6 +253,10 @@ namespace Ombi.Controllers
|
||||||
[ProducesDefaultResponseType]
|
[ProducesDefaultResponseType]
|
||||||
public async Task<IEnumerable<SearchTvShowViewModel>> SearchTv(string searchTerm)
|
public async Task<IEnumerable<SearchTvShowViewModel>> SearchTv(string searchTerm)
|
||||||
{
|
{
|
||||||
|
if (IsDemo)
|
||||||
|
{
|
||||||
|
return await DemoTvSearch.Search(searchTerm);
|
||||||
|
}
|
||||||
return await TvEngine.Search(searchTerm);
|
return await TvEngine.Search(searchTerm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,6 +284,10 @@ namespace Ombi.Controllers
|
||||||
[ProducesDefaultResponseType]
|
[ProducesDefaultResponseType]
|
||||||
public async Task<IEnumerable<SearchTvShowViewModel>> PopularTv()
|
public async Task<IEnumerable<SearchTvShowViewModel>> PopularTv()
|
||||||
{
|
{
|
||||||
|
if (IsDemo)
|
||||||
|
{
|
||||||
|
return await DemoTvSearch.NowPlayingMovies();
|
||||||
|
}
|
||||||
return await TvEngine.Popular();
|
return await TvEngine.Popular();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,6 +301,10 @@ namespace Ombi.Controllers
|
||||||
[ProducesDefaultResponseType]
|
[ProducesDefaultResponseType]
|
||||||
public async Task<IEnumerable<SearchTvShowViewModel>> AnticipatedTv()
|
public async Task<IEnumerable<SearchTvShowViewModel>> AnticipatedTv()
|
||||||
{
|
{
|
||||||
|
if (IsDemo)
|
||||||
|
{
|
||||||
|
return await DemoTvSearch.NowPlayingMovies();
|
||||||
|
}
|
||||||
return await TvEngine.Anticipated();
|
return await TvEngine.Anticipated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,6 +319,10 @@ namespace Ombi.Controllers
|
||||||
[ProducesDefaultResponseType]
|
[ProducesDefaultResponseType]
|
||||||
public async Task<IEnumerable<SearchTvShowViewModel>> MostWatched()
|
public async Task<IEnumerable<SearchTvShowViewModel>> MostWatched()
|
||||||
{
|
{
|
||||||
|
if (IsDemo)
|
||||||
|
{
|
||||||
|
return await DemoTvSearch.NowPlayingMovies();
|
||||||
|
}
|
||||||
return await TvEngine.MostWatches();
|
return await TvEngine.MostWatches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,6 +336,10 @@ namespace Ombi.Controllers
|
||||||
[ProducesDefaultResponseType]
|
[ProducesDefaultResponseType]
|
||||||
public async Task<IEnumerable<SearchTvShowViewModel>> Trending()
|
public async Task<IEnumerable<SearchTvShowViewModel>> Trending()
|
||||||
{
|
{
|
||||||
|
if (IsDemo)
|
||||||
|
{
|
||||||
|
return await DemoTvSearch.NowPlayingMovies();
|
||||||
|
}
|
||||||
return await TvEngine.Trending();
|
return await TvEngine.Trending();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Ombi.Store.Context;
|
using Ombi.Store.Context;
|
||||||
using Ombi.Store.Entities;
|
using Ombi.Store.Entities;
|
||||||
using CommandLine;
|
using CommandLine;
|
||||||
|
@ -24,12 +23,14 @@ namespace Ombi
|
||||||
var host = string.Empty;
|
var host = string.Empty;
|
||||||
var storagePath = string.Empty;
|
var storagePath = string.Empty;
|
||||||
var baseUrl = string.Empty;
|
var baseUrl = string.Empty;
|
||||||
|
var demo = false;
|
||||||
var result = Parser.Default.ParseArguments<Options>(args)
|
var result = Parser.Default.ParseArguments<Options>(args)
|
||||||
.WithParsed(o =>
|
.WithParsed(o =>
|
||||||
{
|
{
|
||||||
host = o.Host;
|
host = o.Host;
|
||||||
storagePath = o.StoragePath;
|
storagePath = o.StoragePath;
|
||||||
baseUrl = o.BaseUrl;
|
baseUrl = o.BaseUrl;
|
||||||
|
demo = o.Demo;
|
||||||
}).WithNotParsed(err =>
|
}).WithNotParsed(err =>
|
||||||
{
|
{
|
||||||
foreach (var e in err)
|
foreach (var e in err)
|
||||||
|
@ -44,6 +45,8 @@ namespace Ombi
|
||||||
|
|
||||||
var urlValue = string.Empty;
|
var urlValue = string.Empty;
|
||||||
var instance = StoragePathSingleton.Instance;
|
var instance = StoragePathSingleton.Instance;
|
||||||
|
var demoInstance = DemoSingleton.Instance;
|
||||||
|
demoInstance.Demo = demo;
|
||||||
instance.StoragePath = storagePath ?? string.Empty;
|
instance.StoragePath = storagePath ?? string.Empty;
|
||||||
// Check if we need to migrate the settings
|
// Check if we need to migrate the settings
|
||||||
CheckAndMigrate();
|
CheckAndMigrate();
|
||||||
|
@ -269,5 +272,8 @@ namespace Ombi
|
||||||
[Option("baseurl", Required = false, HelpText = "The base URL for reverse proxy scenarios")]
|
[Option("baseurl", Required = false, HelpText = "The base URL for reverse proxy scenarios")]
|
||||||
public string BaseUrl { get; set; }
|
public string BaseUrl { get; set; }
|
||||||
|
|
||||||
|
[Option("demo", Required = false, HelpText = "Demo mode, you will never need to use this, fuck that fruit company...")]
|
||||||
|
public bool Demo { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,6 +109,7 @@ namespace Ombi
|
||||||
services.Configure<UserSettings>(configuration.GetSection("UserSettings"));
|
services.Configure<UserSettings>(configuration.GetSection("UserSettings"));
|
||||||
services.Configure<TokenAuthentication>(configuration.GetSection("TokenAuthentication"));
|
services.Configure<TokenAuthentication>(configuration.GetSection("TokenAuthentication"));
|
||||||
services.Configure<LandingPageBackground>(configuration.GetSection("LandingPageBackground"));
|
services.Configure<LandingPageBackground>(configuration.GetSection("LandingPageBackground"));
|
||||||
|
services.Configure<DemoLists>(configuration.GetSection("Demo"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddJwtAuthentication(this IServiceCollection services, IConfigurationRoot configuration)
|
public static void AddJwtAuthentication(this IServiceCollection services, IConfigurationRoot configuration)
|
||||||
|
|
|
@ -47,5 +47,67 @@
|
||||||
296762,
|
296762,
|
||||||
280619
|
280619
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
// Please ignore the below
|
||||||
|
"Demo": {
|
||||||
|
"Movies": [
|
||||||
|
//https://en.wikipedia.org/wiki/List_of_films_in_the_public_domain_in_the_United_States
|
||||||
|
130816,
|
||||||
|
20278,
|
||||||
|
22657,
|
||||||
|
29998,
|
||||||
|
22356,
|
||||||
|
120862,
|
||||||
|
23325,
|
||||||
|
22718,
|
||||||
|
10378,
|
||||||
|
22733,
|
||||||
|
144613,
|
||||||
|
156397,
|
||||||
|
43888,
|
||||||
|
262743,
|
||||||
|
92341,
|
||||||
|
75888,
|
||||||
|
53828,
|
||||||
|
38346,
|
||||||
|
33468,
|
||||||
|
72012,
|
||||||
|
22642,
|
||||||
|
15401,
|
||||||
|
16093,
|
||||||
|
4808,
|
||||||
|
111370,
|
||||||
|
22948,
|
||||||
|
165009,
|
||||||
|
43386,
|
||||||
|
105852,
|
||||||
|
166316,
|
||||||
|
18449,
|
||||||
|
28503,
|
||||||
|
20367,
|
||||||
|
41021 //The Devil Bat
|
||||||
|
],
|
||||||
|
"TvShows": [
|
||||||
|
//https://infogalactic.com/info/List_of_TV_series_with_episodes_in_the_public_domain
|
||||||
|
26741,
|
||||||
|
9475,
|
||||||
|
4379,
|
||||||
|
17434,
|
||||||
|
12751,
|
||||||
|
17436,
|
||||||
|
4378,
|
||||||
|
7792,
|
||||||
|
10643,
|
||||||
|
23503,
|
||||||
|
19339,
|
||||||
|
10632,
|
||||||
|
12740,
|
||||||
|
23466,
|
||||||
|
6910,
|
||||||
|
3327,
|
||||||
|
2122,
|
||||||
|
22148,
|
||||||
|
25941 // Front Row Center
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue