mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
#254 MOSTLY DONE! At last, this took a while.
So currently if a series exists then we will correctly monitor the episodes selected. TODO: When the series doesn't exist in sonarr we need to add the series and then wait for the episode metadata to be populated. Also need to add in all of the regular checks and notification e.g. whitelist etc.
This commit is contained in:
parent
8b46925f08
commit
b14fd36ecd
21 changed files with 1380 additions and 861 deletions
|
@ -69,14 +69,14 @@ namespace PlexRequests.UI
|
|||
private IKernel _kernel;
|
||||
protected override IKernel GetApplicationContainer()
|
||||
{
|
||||
Debug.WriteLine("GetAppContainer");
|
||||
Debug.WriteLine("GetAppContainer");
|
||||
_kernel.Load<FactoryModule>();
|
||||
return _kernel;
|
||||
}
|
||||
|
||||
protected override void ApplicationStartup(IKernel container, IPipelines pipelines)
|
||||
{
|
||||
Debug.WriteLine("Bootstrapper.ApplicationStartup");
|
||||
Debug.WriteLine("Bootstrapper.ApplicationStartup");
|
||||
ConfigureContainer(container);
|
||||
|
||||
JsonSettings.MaxJsonLength = int.MaxValue;
|
||||
|
@ -119,21 +119,22 @@ namespace PlexRequests.UI
|
|||
#endif
|
||||
protected override void ConfigureConventions(NancyConventions nancyConventions)
|
||||
{
|
||||
Debug.WriteLine("Configuring the conventions");
|
||||
Debug.WriteLine("Configuring the conventions");
|
||||
base.ConfigureConventions(nancyConventions);
|
||||
Debug.WriteLine("Finished BASE");
|
||||
|
||||
var settingsService = new SettingsServiceV2<PlexRequestSettings>(new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider()));
|
||||
var settings = settingsService.GetSettings();
|
||||
var assetLocation = settings.BaseUrl ?? string.Empty;
|
||||
var assetLocation = string.Empty;
|
||||
if (!string.IsNullOrEmpty(settings.BaseUrl))
|
||||
{
|
||||
assetLocation = $"{settings.BaseUrl}/";
|
||||
}
|
||||
|
||||
Debug.WriteLine($"AssetLocation {assetLocation}");
|
||||
nancyConventions.StaticContentsConventions.Add(
|
||||
StaticContentConventionBuilder.AddDirectory($"{assetLocation}/Content_{AssemblyHelper.GetProductVersion()}", "Content")
|
||||
);
|
||||
Debug.WriteLine("Added Content");
|
||||
nancyConventions.StaticContentsConventions.AddDirectory($"{assetLocation}/docs", "swagger-ui");
|
||||
Debug.WriteLine($"AssetLocation {assetLocation}");
|
||||
|
||||
nancyConventions.StaticContentsConventions.AddDirectory($"{assetLocation}/fonts", "Content/fonts");
|
||||
nancyConventions.StaticContentsConventions.AddDirectory($"{assetLocation}Content", "Content");
|
||||
nancyConventions.StaticContentsConventions.AddDirectory($"{assetLocation}docs", "swagger-ui");
|
||||
nancyConventions.StaticContentsConventions.AddDirectory($"{assetLocation}fonts", "Content/fonts");
|
||||
}
|
||||
|
||||
protected override DiagnosticsConfiguration DiagnosticsConfiguration => new DiagnosticsConfiguration { Password = @"password" };
|
||||
|
@ -170,10 +171,9 @@ Debug.WriteLine("Added Content");
|
|||
notificationService.Subscribe(new SlackNotification(container.Get<ISlackApi>(), slackService));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override void RequestStartup(IKernel container, IPipelines pipelines, NancyContext context)
|
||||
{
|
||||
Debug.WriteLine("RequestStartup");
|
||||
//CORS Enable
|
||||
pipelines.AfterRequest.AddItemToEndOfPipeline((ctx) =>
|
||||
{
|
||||
|
@ -187,7 +187,7 @@ Debug.WriteLine("Added Content");
|
|||
|
||||
private void ConfigureContainer(IKernel container)
|
||||
{
|
||||
Debug.WriteLine("Configuring ServiceLoc/Container");
|
||||
Debug.WriteLine("Configuring ServiceLoc/Container");
|
||||
var loc = ServiceLocator.Instance;
|
||||
loc.SetContainer(container);
|
||||
}
|
||||
|
|
39
PlexRequests.UI/Content/search.js
vendored
39
PlexRequests.UI/Content/search.js
vendored
|
@ -538,6 +538,7 @@ $(function () {
|
|||
});
|
||||
|
||||
$('#episodesModal').on('show.bs.modal', function (event) {
|
||||
finishLoading("episodesRequest", "primary");
|
||||
var button = $(event.relatedTarget); // Button that triggered the modal
|
||||
var id = button.data('identifier'); // Extract info from data-* attributes
|
||||
var url = createBaseUrl(base, '/search/episodes/');
|
||||
|
@ -552,8 +553,6 @@ $(function () {
|
|||
$content.html("");
|
||||
$('#selectedEpisodeId').val(id);
|
||||
results.forEach(function (result) {
|
||||
|
||||
|
||||
var episodes = buildEpisodesView(result);
|
||||
|
||||
if (!seenSeasons.find(x => x === episodes.season)) {
|
||||
|
@ -572,6 +571,42 @@ $(function () {
|
|||
}
|
||||
});
|
||||
|
||||
// Save Modal click
|
||||
$("#episodesRequest").click(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var tvId = $('#selectedEpisodeId').val();
|
||||
|
||||
$("#episodesRequest").prop("disabled", true);
|
||||
loadingButton("episodesRequest", "primary");
|
||||
|
||||
|
||||
var $form = $('#form' + tvId);
|
||||
|
||||
var model = [];
|
||||
|
||||
|
||||
|
||||
var $checkedEpisodes = $('.selectedEpisodes:checkbox:checked');
|
||||
$checkedEpisodes.each(function (index, element) {
|
||||
var $element = $('#' + element.id);
|
||||
var tempObj = {};
|
||||
tempObj.episodeNumber = $element.attr("epNumber");
|
||||
tempObj.seasonNumber = $element.attr("epSeason");
|
||||
model.push(tempObj);
|
||||
});
|
||||
|
||||
var finalObj = {
|
||||
ShowId: tvId,
|
||||
Episodes: model
|
||||
}
|
||||
|
||||
var url = createBaseUrl(mainBaseUrl, "search/request/tvEpisodes");
|
||||
var type = $form.prop('method');
|
||||
|
||||
sendRequestAjax(JSON.stringify(finalObj), type, url, tvId);
|
||||
});
|
||||
|
||||
function buildSeasonsContext(result) {
|
||||
var context = {
|
||||
id: result
|
||||
|
|
2
PlexRequests.UI/Content/site.js
vendored
2
PlexRequests.UI/Content/site.js
vendored
|
@ -8,6 +8,8 @@
|
|||
return s;
|
||||
}
|
||||
|
||||
var mainBaseUrl = $('#baseUrl').text();
|
||||
|
||||
function Humanize(date) {
|
||||
var mNow = moment();
|
||||
var mDate = moment(date).local();
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace PlexRequests.UI.Helpers
|
|||
if (settings.ThemeName == "PlexBootstrap.css") settings.ThemeName = Themes.PlexTheme;
|
||||
if (settings.ThemeName == "OriginalBootstrap.css") settings.ThemeName = Themes.OriginalTheme;
|
||||
|
||||
var startUrl = $"{content}/Content_{Assembly}";
|
||||
var startUrl = $"{content}/Content";
|
||||
|
||||
var styleAssets = new List<string>
|
||||
{
|
||||
|
@ -123,7 +123,7 @@ namespace PlexRequests.UI.Helpers
|
|||
|
||||
var content = GetContentUrl(assetLocation);
|
||||
|
||||
sb.AppendLine($"<script src=\"{content}/Content_{Assembly}/search.js\" type=\"text/javascript\"></script>");
|
||||
sb.AppendLine($"<script src=\"{content}/Content/search.js\" type=\"text/javascript\"></script>");
|
||||
|
||||
return helper.Raw(sb.ToString());
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ namespace PlexRequests.UI.Helpers
|
|||
|
||||
var content = GetContentUrl(assetLocation);
|
||||
|
||||
sb.AppendLine($"<script src=\"{content}/Content_{Assembly}/requests.js\" type=\"text/javascript\"></script>");
|
||||
sb.AppendLine($"<script src=\"{content}/Content/requests.js\" type=\"text/javascript\"></script>");
|
||||
|
||||
return helper.Raw(sb.ToString());
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ namespace PlexRequests.UI.Helpers
|
|||
|
||||
var content = GetContentUrl(assetLocation);
|
||||
|
||||
sb.AppendLine($"<script src=\"{content}/Content_{Assembly}/issues.js\" type=\"text/javascript\"></script>");
|
||||
sb.AppendLine($"<script src=\"{content}/Content/issues.js\" type=\"text/javascript\"></script>");
|
||||
|
||||
return helper.Raw(sb.ToString());
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ namespace PlexRequests.UI.Helpers
|
|||
var assetLocation = GetBaseUrl();
|
||||
var content = GetContentUrl(assetLocation);
|
||||
|
||||
var asset = $"<script src=\"{content}/Content_{Assembly}/issue-details.js\" type=\"text/javascript\"></script>";
|
||||
var asset = $"<script src=\"{content}/Content/issue-details.js\" type=\"text/javascript\"></script>";
|
||||
|
||||
return helper.Raw(asset);
|
||||
}
|
||||
|
@ -169,8 +169,8 @@ namespace PlexRequests.UI.Helpers
|
|||
|
||||
var content = GetContentUrl(assetLocation);
|
||||
|
||||
sb.AppendLine($"<script src=\"{content}/Content_{Assembly}/datatables.min.js\" type=\"text/javascript\"></script>");
|
||||
sb.AppendLine($"<link rel=\"stylesheet\" type=\"text/css\" href=\"{content}/Content_{Assembly}/dataTables.bootstrap.css\" />");
|
||||
sb.AppendLine($"<script src=\"{content}/Content/datatables.min.js\" type=\"text/javascript\"></script>");
|
||||
sb.AppendLine($"<link rel=\"stylesheet\" type=\"text/css\" href=\"{content}/Content/dataTables.bootstrap.css\" />");
|
||||
|
||||
return helper.Raw(sb.ToString());
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ namespace PlexRequests.UI.Helpers
|
|||
var assetLocation = GetBaseUrl();
|
||||
var content = GetContentUrl(assetLocation);
|
||||
|
||||
var asset = $"<script src=\"{content}/Content_{Assembly}/analytics.js\" type=\"text/javascript\"></script>";
|
||||
var asset = $"<script src=\"{content}/Content/analytics.js\" type=\"text/javascript\"></script>";
|
||||
|
||||
return helper.Raw(asset);
|
||||
}
|
||||
|
|
|
@ -44,24 +44,34 @@ namespace PlexRequests.UI.Helpers
|
|||
/// </summary>
|
||||
public IEnumerable<IBinding> Resolve(Multimap<Type, IBinding> bindings, Type service)
|
||||
{
|
||||
Debug.WriteLine("Contrar thing");
|
||||
|
||||
if (service.IsGenericType)
|
||||
{
|
||||
var genericType = service.GetGenericTypeDefinition();
|
||||
var genericArguments = genericType.GetGenericArguments();
|
||||
if (!genericArguments.Any())
|
||||
{
|
||||
return Enumerable.Empty<IBinding>();
|
||||
}
|
||||
if (!genericArguments.Any())
|
||||
{
|
||||
return Enumerable.Empty<IBinding>();
|
||||
}
|
||||
if (genericArguments.Length == 1 && genericArguments.Single().GenericParameterAttributes.HasFlag(GenericParameterAttributes.Contravariant))
|
||||
{
|
||||
var argument = service.GetGenericArguments().Single();
|
||||
var argument = service.GetGenericArguments().FirstOrDefault();
|
||||
if (argument == null)
|
||||
{
|
||||
return Enumerable.Empty<IBinding>();
|
||||
}
|
||||
|
||||
var matches =
|
||||
bindings.Where(
|
||||
kvp =>
|
||||
kvp.Key.IsGenericType && kvp.Key.GetGenericTypeDefinition() == genericType && kvp.Key.GetGenericArguments().Single() != argument
|
||||
&& kvp.Key.GetGenericArguments().Single().IsAssignableFrom(argument)).SelectMany(kvp => kvp.Value);
|
||||
{
|
||||
var assignableFrom = kvp.Key.GetGenericArguments().FirstOrDefault();
|
||||
|
||||
return kvp.Key.IsGenericType && kvp.Key.GetGenericTypeDefinition() == genericType &&
|
||||
kvp.Key.GetGenericArguments().FirstOrDefault() != argument
|
||||
&& assignableFrom.IsAssignableFrom(argument);
|
||||
|
||||
|
||||
}).SelectMany(kvp => kvp.Value);
|
||||
return matches;
|
||||
}
|
||||
}
|
||||
|
|
41
PlexRequests.UI/Models/EpisodeRequestModel.cs
Normal file
41
PlexRequests.UI/Models/EpisodeRequestModel.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: EpisodeRequestModel.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
namespace PlexRequests.UI.Models
|
||||
{
|
||||
public class EpisodeRequestModel
|
||||
{
|
||||
public int ShowId { get; set; }
|
||||
public EpisodesModel[] Episodes { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class EpisodesModel
|
||||
{
|
||||
public int SeasonNumber { get; set; }
|
||||
public int EpisodeNumber { get; set; }
|
||||
}
|
||||
}
|
|
@ -49,8 +49,10 @@ using PlexRequests.UI.Models;
|
|||
using System.Threading.Tasks;
|
||||
|
||||
using Nancy.Extensions;
|
||||
using Nancy.ModelBinding;
|
||||
using Nancy.Responses;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using PlexRequests.Api.Models.Sonarr;
|
||||
using PlexRequests.Api.Models.Tv;
|
||||
using PlexRequests.Core.Models;
|
||||
using PlexRequests.Helpers.Analytics;
|
||||
|
@ -103,7 +105,7 @@ namespace PlexRequests.UI.Modules
|
|||
TvApi = new TvMazeApi();
|
||||
|
||||
|
||||
Get["SearchIndex","/", true] = async (x, ct) => await RequestLoad();
|
||||
Get["SearchIndex", "/", true] = async (x, ct) => await RequestLoad();
|
||||
|
||||
Get["movie/{searchTerm}", true] = async (x, ct) => await SearchMovie((string)x.searchTerm);
|
||||
Get["tv/{searchTerm}", true] = async (x, ct) => await SearchTvShow((string)x.searchTerm);
|
||||
|
@ -115,6 +117,7 @@ namespace PlexRequests.UI.Modules
|
|||
|
||||
Post["request/movie", true] = async (x, ct) => await RequestMovie((int)Request.Form.movieId);
|
||||
Post["request/tv", true] = async (x, ct) => await RequestTvShow((int)Request.Form.tvId, (string)Request.Form.seasons);
|
||||
Post["request/tvEpisodes", true] = async (x, ct) => await RequestEpisodes();
|
||||
Post["request/album", true] = async (x, ct) => await RequestAlbum((string)Request.Form.albumId);
|
||||
|
||||
Post["/notifyuser", true] = async (x, ct) => await NotifyUser((bool)Request.Form.notify);
|
||||
|
@ -436,7 +439,7 @@ namespace PlexRequests.UI.Modules
|
|||
Analytics.TrackEventAsync(Category.Search, Action.Request, "Movie", Username, CookieHelper.GetAnalyticClientId(Cookies));
|
||||
var movieInfo = MovieApi.GetMovieInformation(movieId).Result;
|
||||
var fullMovieName = $"{movieInfo.Title}{(movieInfo.ReleaseDate.HasValue ? $" ({movieInfo.ReleaseDate.Value.Year})" : string.Empty)}";
|
||||
|
||||
|
||||
var existingRequest = await RequestService.CheckRequestAsync(movieId);
|
||||
if (existingRequest != null)
|
||||
{
|
||||
|
@ -449,7 +452,7 @@ namespace PlexRequests.UI.Modules
|
|||
|
||||
return Response.AsJson(new JsonResponseModel { Result = true, Message = settings.UsersCanViewOnlyOwnRequests ? $"{fullMovieName} {Resources.UI.Search_SuccessfullyAdded}" : $"{fullMovieName} {Resources.UI.Search_AlreadyRequested}" });
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
var movies = Checker.GetPlexMovies();
|
||||
|
@ -533,9 +536,8 @@ namespace PlexRequests.UI.Modules
|
|||
return Response.AsJson(new JsonResponseModel { Result = false, Message = Resources.UI.Search_WeeklyRequestLimitTVShow });
|
||||
}
|
||||
Analytics.TrackEventAsync(Category.Search, Action.Request, "TvShow", Username, CookieHelper.GetAnalyticClientId(Cookies));
|
||||
var tvApi = new TvMazeApi();
|
||||
|
||||
var showInfo = tvApi.ShowLookupByTheTvDbId(showId);
|
||||
var showInfo = TvApi.ShowLookupByTheTvDbId(showId);
|
||||
DateTime firstAir;
|
||||
DateTime.TryParse(showInfo.premiered, out firstAir);
|
||||
string fullShowName = $"{showInfo.name} ({firstAir.Year})";
|
||||
|
@ -687,7 +689,7 @@ namespace PlexRequests.UI.Modules
|
|||
}
|
||||
Analytics.TrackEventAsync(Category.Search, Action.Request, "Album", Username, CookieHelper.GetAnalyticClientId(Cookies));
|
||||
var existingRequest = await RequestService.CheckRequestAsync(releaseId);
|
||||
|
||||
|
||||
if (existingRequest != null)
|
||||
{
|
||||
if (!existingRequest.UserHasRequested(Username))
|
||||
|
@ -697,7 +699,7 @@ namespace PlexRequests.UI.Modules
|
|||
}
|
||||
return Response.AsJson(new JsonResponseModel { Result = true, Message = settings.UsersCanViewOnlyOwnRequests ? $"{existingRequest.Title} {Resources.UI.Search_SuccessfullyAdded}" : $"{existingRequest.Title} {Resources.UI.Search_AlreadyRequested}" });
|
||||
}
|
||||
|
||||
|
||||
var albumInfo = MusicBrainzApi.GetAlbum(releaseId);
|
||||
DateTime release;
|
||||
DateTimeHelper.CustomParse(albumInfo.ReleaseEvents?.FirstOrDefault()?.date, out release);
|
||||
|
@ -954,5 +956,65 @@ namespace PlexRequests.UI.Modules
|
|||
|
||||
return Response.AsJson(new JsonResponseModel { Result = true, Message = message });
|
||||
}
|
||||
|
||||
private async Task<Response> RequestEpisodes()
|
||||
{
|
||||
var req = (Dictionary<string, object>.ValueCollection)this.Request.Form.Values;
|
||||
var json = req.FirstOrDefault().ToString();
|
||||
var model = JsonConvert.DeserializeObject<EpisodeRequestModel>(json);
|
||||
//var model = this.Bind<EpisodeRequestModel>();
|
||||
if (model == null)
|
||||
{
|
||||
return Nancy.Response.NoBody;
|
||||
}
|
||||
var sonarrSettings = await SonarrService.GetSettingsAsync();
|
||||
if (!sonarrSettings.Enabled)
|
||||
{
|
||||
return Response.AsJson("Need sonarr");
|
||||
}
|
||||
|
||||
var existingRequest = await RequestService.CheckRequestAsync(model.ShowId);
|
||||
|
||||
|
||||
|
||||
|
||||
// Find the correct series
|
||||
var task = await Task.Run(() => SonarrApi.GetSeries(sonarrSettings.ApiKey, sonarrSettings.FullUri)).ConfigureAwait(false);
|
||||
var selectedSeries = task.FirstOrDefault(series => series.tvdbId == model.ShowId);
|
||||
if (selectedSeries == null)
|
||||
{
|
||||
|
||||
// Need to add the series as unmonitored.
|
||||
return Response.AsJson("");
|
||||
}
|
||||
|
||||
// Show Exists
|
||||
// Look up all episodes
|
||||
var episodes = SonarrApi.GetEpisodes(selectedSeries.id.ToString(), sonarrSettings.ApiKey, sonarrSettings.FullUri).ToList();
|
||||
var internalEpisodeIds = new List<int>();
|
||||
var tasks = new List<Task>();
|
||||
foreach (var r in model.Episodes)
|
||||
{
|
||||
var episode =
|
||||
episodes.FirstOrDefault(
|
||||
x => x.episodeNumber == r.EpisodeNumber && x.seasonNumber == r.SeasonNumber);
|
||||
if (episode == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var episodeInfo = SonarrApi.GetEpisode(episode.id.ToString(), sonarrSettings.ApiKey, sonarrSettings.FullUri);
|
||||
episodeInfo.monitored = true; // Set the episode to monitored
|
||||
tasks.Add(Task.Run(() => SonarrApi.UpdateEpisode(episodeInfo, sonarrSettings.ApiKey,
|
||||
sonarrSettings.FullUri)));
|
||||
internalEpisodeIds.Add(episode.id);
|
||||
}
|
||||
Task.WaitAll(tasks.ToArray());
|
||||
|
||||
SonarrApi.SearchForEpisodes(internalEpisodeIds.ToArray(), sonarrSettings.ApiKey, sonarrSettings.FullUri);
|
||||
|
||||
|
||||
return Response.AsJson(new JsonResponseModel() { Result = true });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,6 +200,7 @@
|
|||
<Compile Include="ModelDataProviders\UserUpdateViewModelDataProvider.cs" />
|
||||
<Compile Include="ModelDataProviders\RequestedModelDataProvider.cs" />
|
||||
<Compile Include="Models\DatatablesModel.cs" />
|
||||
<Compile Include="Models\EpisodeRequestModel.cs" />
|
||||
<Compile Include="Models\IssuesDetailsViewModel.cs" />
|
||||
<Compile Include="Models\IssuesViewMOdel.cs" />
|
||||
<Compile Include="Models\JsonUpdateAvailableModel.cs" />
|
||||
|
|
|
@ -172,33 +172,34 @@
|
|||
<div class="col-sm-2 col-sm-push-3">
|
||||
<form method="POST" action="@url/search/request/{{type}}" id="form{{id}}">
|
||||
<input name="{{type}}Id" type="text" value="{{id}}" hidden="hidden" />
|
||||
{{#if_eq available true}}
|
||||
<button style="text-align: right" class="btn btn-success-outline disabled" disabled><i class="fa fa-check"></i> @UI.Search_Available</button>
|
||||
{{else}}
|
||||
{{#if_eq requested true}}
|
||||
<button style="text-align: right" class="btn btn-primary-outline disabled" disabled><i class="fa fa-check"></i> @UI.Search_Requested</button>
|
||||
{{else}}
|
||||
{{#if_eq type "movie"}}
|
||||
<button id="{{id}}" style="text-align: right" class="btn btn-primary-outline requestMovie" type="submit"><i class="fa fa-plus"></i> @UI.Search_Request</button>
|
||||
{{#if_eq available true}}
|
||||
<button style="text-align: right" class="btn btn-success-outline disabled" disabled><i class="fa fa-check"></i> @UI.Search_Available</button>
|
||||
{{else}}
|
||||
{{#if_eq requested true}}
|
||||
<button style="text-align: right" class="btn btn-primary-outline disabled" disabled><i class="fa fa-check"></i> @UI.Search_Requested</button>
|
||||
{{else}}
|
||||
<button id="{{id}}" style="text-align: right" class="btn btn-primary-outline requestMovie" type="submit"><i class="fa fa-plus"></i> @UI.Search_Request</button>
|
||||
{{/if_eq}}
|
||||
{{/if_eq}}
|
||||
{{/if_eq}}
|
||||
{{#if_eq type "tv"}}
|
||||
<div class="dropdown">
|
||||
<button id="{{id}}" class="btn btn-primary-outline dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
<i class="fa fa-plus"></i> @UI.Search_Request
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
||||
<li><a id="{{id}}" season-select="0" class="dropdownTv " href="#">@UI.Search_AllSeasons</a></li>
|
||||
<li><a id="{{id}}" season-select="1" class="dropdownTv" href="#">@UI.Search_FirstSeason</a></li>
|
||||
<li><a id="{{id}}" season-select="2" class="dropdownTv" href="#">@UI.Search_LatestSeason</a></li>
|
||||
<li><a id="SeasonSelect" data-identifier="{{id}}" data-toggle="modal" data-target="#seasonsModal" href="#">@UI.Search_SelectSeason...</a></li>
|
||||
<li><a id="EpisodeSelect" data-identifier="{{id}}" data-toggle="modal" data-target="#episodesModal" href="#">@UI.Search_SelectEpisode...</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
{{/if_eq}}
|
||||
{{/if_eq}}
|
||||
<div class="dropdown">
|
||||
<button id="{{id}}" class="btn btn-primary-outline dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
<i class="fa fa-plus"></i> @UI.Search_Request
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
||||
<li><a id="{{id}}" season-select="0" class="dropdownTv " href="#">@UI.Search_AllSeasons</a></li>
|
||||
<li><a id="{{id}}" season-select="1" class="dropdownTv" href="#">@UI.Search_FirstSeason</a></li>
|
||||
<li><a id="{{id}}" season-select="2" class="dropdownTv" href="#">@UI.Search_LatestSeason</a></li>
|
||||
<li><a id="SeasonSelect" data-identifier="{{id}}" data-toggle="modal" data-target="#seasonsModal" href="#">@UI.Search_SelectSeason...</a></li>
|
||||
<li><a id="EpisodeSelect" data-identifier="{{id}}" data-toggle="modal" data-target="#episodesModal" href="#">@UI.Search_SelectEpisode...</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
{{/if_eq}}
|
||||
|
||||
|
||||
<br />
|
||||
</form>
|
||||
{{#if_eq available true}}
|
||||
|
@ -304,6 +305,7 @@
|
|||
</div>
|
||||
|
||||
<div hidden="hidden" id="selectedEpisodeId"></div>
|
||||
<div hidden="hidden" id="episodeTvID"></div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">@UI.Common_Close</button>
|
||||
<button type="button" id="episodesRequest" class="btn btn-primary">@UI.Search_Request</button>
|
||||
|
@ -345,7 +347,9 @@
|
|||
</script>
|
||||
|
||||
<script id="seasonNumber-template" type="text/x-handlebars-template">
|
||||
<div class="row"></div>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<div id="seasonNumber{{seasonNumber}}">
|
||||
<strong>@UI.Search_Season {{seasonNumber}}</strong>
|
||||
</div>
|
||||
|
@ -357,7 +361,7 @@
|
|||
<script id="episode-template" type="text/x-handlebars-template">
|
||||
<div class="form-group col-md-6">
|
||||
<div class="checkbox" style="margin-bottom:0px; margin-top:0px;">
|
||||
<input type="checkbox" class="selectedEpisodes" id="{{id}}" name="{{id}}"><label for="{{id}}">{{number}}. {{name}}</label>
|
||||
<input type="checkbox" class="selectedEpisodes" id="{{id}}" epNumber="{{number}}" epSeason="{{season}}" name="{{id}}"><label for="{{id}}">{{number}}. {{name}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue