Fixed a bunch of bugs in Ombi #865

pull/1510/head
tidusjar 7 years ago
parent 496e086e32
commit 42f48caf3b

@ -63,7 +63,7 @@ namespace Ombi.Core.Engine
if (result != null)
{
Logger.LogDebug("Search Result: {result}", result);
return await TransformMovieResultsToResponse(result);
return await TransformMovieResultsToResponse(result.Take(10)); // Take 10 to stop us overloading the API
}
}
@ -81,7 +81,7 @@ namespace Ombi.Core.Engine
if (result != null)
{
Logger.LogDebug("Search Result: {result}", result);
return await TransformMovieResultsToResponse(result);
return await TransformMovieResultsToResponse(result.Take(10)); // Take 10 to stop us overloading the API
}
return null;
}
@ -96,7 +96,7 @@ namespace Ombi.Core.Engine
if (result != null)
{
Logger.LogDebug("Search Result: {result}", result);
return await TransformMovieResultsToResponse(result);
return await TransformMovieResultsToResponse(result.Take(10)); // Take 10 to stop us overloading the API
}
return null;
}
@ -111,7 +111,7 @@ namespace Ombi.Core.Engine
if (result != null)
{
Logger.LogDebug("Search Result: {result}", result);
return await TransformMovieResultsToResponse(result);
return await TransformMovieResultsToResponse(result.Take(10)); // Take 10 to stop us overloading the API
}
return null;
}
@ -126,7 +126,7 @@ namespace Ombi.Core.Engine
if (result != null)
{
Logger.LogDebug("Search Result: {result}", result);
return await TransformMovieResultsToResponse(result);
return await TransformMovieResultsToResponse(result.Take(10)); // Take 10 to stop us overloading the API
}
return null;
}

@ -149,8 +149,6 @@
</tr>
<tr>
<td style="font-family: sans-serif; font-size: 14px; vertical-align: top;" valign="top">
<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;">Hi there!</p>
<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;">{@SUBJECT}</p>
<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;">{@BODY}</p>
</td>

@ -1,6 +1,12 @@
using System.Linq;
using System;
using System.Linq;
using System.Threading.Tasks;
using Hangfire;
using Microsoft.EntityFrameworkCore;
using Ombi.Core.Notifications;
using Ombi.Helpers;
using Ombi.Notifications.Models;
using Ombi.Store.Entities;
using Ombi.Store.Repository;
using Ombi.Store.Repository.Requests;
@ -8,16 +14,19 @@ namespace Ombi.Schedule.Jobs.Plex
{
public class PlexAvailabilityChecker : IPlexAvailabilityChecker
{
public PlexAvailabilityChecker(IPlexContentRepository repo, ITvRequestRepository tvRequest, IMovieRequestRepository movies)
public PlexAvailabilityChecker(IPlexContentRepository repo, ITvRequestRepository tvRequest, IMovieRequestRepository movies,
INotificationService notification)
{
_tvRepo = tvRequest;
_repo = repo;
_movieRepo = movies;
_notificationService = notification;
}
private readonly ITvRequestRepository _tvRepo;
private readonly IMovieRequestRepository _movieRepo;
private readonly IPlexContentRepository _repo;
private readonly INotificationService _notificationService;
public async Task Start()
{
@ -55,6 +64,13 @@ namespace Ombi.Schedule.Jobs.Plex
{
// We have fulfulled this request!
child.Available = true;
BackgroundJob.Enqueue(() => _notificationService.Publish(new NotificationOptions
{
DateTime = DateTime.Now,
NotificationType = NotificationType.RequestAvailable,
RequestId = child.ParentRequestId,
RequestType = RequestType.TvShow
}));
}
}
@ -76,6 +92,16 @@ namespace Ombi.Schedule.Jobs.Plex
}
movie.Available = true;
if (movie.Available)
{
BackgroundJob.Enqueue(() => _notificationService.Publish(new NotificationOptions
{
DateTime = DateTime.Now,
NotificationType = NotificationType.RequestAvailable,
RequestId = movie.Id,
RequestType = RequestType.Movie
}));
}
}
await _movieRepo.Save();

@ -41,7 +41,7 @@ namespace Ombi.Schedule.Jobs.Radarr
if (movies != null)
{
// Let's remove the old cached data
await _ctx.Database.ExecuteSqlCommandAsync("TRUNCATE TABLE RadarrCache");
await _ctx.Database.ExecuteSqlCommandAsync("DELETE FROM RadarrCache");
var movieIds = new List<RadarrCache>();
foreach (var m in movies)

@ -22,6 +22,7 @@
<ProjectReference Include="..\Ombi.Api.Plex\Ombi.Api.Plex.csproj" />
<ProjectReference Include="..\Ombi.Api.Radarr\Ombi.Api.Radarr.csproj" />
<ProjectReference Include="..\Ombi.Api.Service\Ombi.Api.Service.csproj" />
<ProjectReference Include="..\Ombi.Notifications\Ombi.Notifications.csproj" />
<ProjectReference Include="..\Ombi.Settings\Ombi.Settings.csproj" />
</ItemGroup>

@ -34,7 +34,7 @@ export class AuthService extends ServiceHelpers {
}
var json = this.jwtHelper.decodeToken(token);
var roles = json["role"];
var name = json["name"];
var name = json["sub"];
var u = { name: name, roles: [] as string[] };

@ -86,7 +86,7 @@
</div>
</div>
<div *ngIf="!result.available">
<div *ngIf="result.requested; then requestedBtn else notRequestedBtn"></div>
<div *ngIf="result.requested || result.approved; then requestedBtn else notRequestedBtn"></div>
<ng-template #requestedBtn>
<button style="text-align: right" class="btn btn-primary-outline disabled" [disabled]><i class="fa fa-check"></i> Requested</button>
</ng-template>

@ -25,12 +25,12 @@
</div>
<div class="form-group">
<!--<div class="form-group">
<div class="checkbox">
<input type="checkbox" id="enable" name="enable" [(ngModel)]="settings.timeLimit" ng-checked="settings.timeLimit">
<label for="enable">Only show the notification message between the below times</label>
</div>
</div>
</div>-->

@ -90,7 +90,7 @@
<label for="rootFolders" class="control-label">Default Root Folders</label>
<div id="rootFolders">
<select formControlName="defaultRootPath" class="form-control form-control-custom">
<option *ngFor='let folder of rootFolders' value='{{folder.id}}'>{{folder.path}}</option>
<option *ngFor='let folder of rootFolders' value='{{folder.path}}'>{{folder.path}}</option>
</select>
</div>
</div>

Loading…
Cancel
Save