Merge pull request #4449 from Ombi-app/more-fixes

pull/4453/head
Jamie 3 years ago committed by GitHub
commit 22beb934c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,14 +16,16 @@ namespace Ombi.Schedule.Jobs.Ombi
private readonly ISettingsService<OmbiSettings> _ombiSettings;
private readonly IMovieRequestRepository _movieRequests;
private readonly ITvRequestRepository _tvRequestRepository;
private readonly IMusicRequestRepository _musicRequestRepository;
private readonly ILogger<AutoDeleteRequests> _logger;
public AutoDeleteRequests(ISettingsService<OmbiSettings> ombiSettings, IMovieRequestRepository movieRequest,
ILogger<AutoDeleteRequests> logger, ITvRequestRepository tvRequestRepository)
ILogger<AutoDeleteRequests> logger, ITvRequestRepository tvRequestRepository, IMusicRequestRepository musicRequestRepository)
{
_ombiSettings = ombiSettings;
_movieRequests = movieRequest;
_tvRequestRepository = tvRequestRepository;
_musicRequestRepository = _musicRequestRepository;
_logger = logger;
}
@ -37,6 +39,7 @@ namespace Ombi.Schedule.Jobs.Ombi
var date = DateTime.UtcNow.AddDays(-settings.AutoDeleteAfterDays).Date;
await ProcessMovieRequests(date);
await ProcessTvRequests(date);
await ProcessMusicRequests(date);
}
private async Task ProcessMovieRequests(DateTime date)
@ -66,6 +69,20 @@ namespace Ombi.Schedule.Jobs.Ombi
await _tvRequestRepository.DeleteRange(parentRequests);
}
private async Task ProcessMusicRequests(DateTime date)
{
var requestsToDelete = await _musicRequestRepository.GetAll().Where(x => x.Available && x.MarkedAsAvailable.HasValue && x.MarkedAsAvailable.Value < date).ToListAsync();
_logger.LogInformation($"Deleting {requestsToDelete.Count} music requests that have now been scheduled for deletion, All available requests before {date::MM/dd/yyyy} will be deleted");
foreach (var r in requestsToDelete)
{
_logger.LogInformation($"Deleting music title {r.Title} as it was approved on {r.MarkedAsApproved:MM/dd/yyyy hh:mm tt}");
}
await _musicRequestRepository.DeleteRange(requestsToDelete);
}
private bool _disposed;
protected virtual void Dispose(bool disposing)

@ -20,6 +20,7 @@
"mass-email",
"issues",
"emby",
"availability-rules"
"availability-rules",
"details"
]
}

@ -34,11 +34,8 @@
"node_modules/@fortawesome/fontawesome-free/scss/brands.scss",
"node_modules/primeng/resources/primeng.min.css",
"node_modules/primeicons/primeicons.css",
"node_modules/please-wait/src/please-wait.scss",
"node_modules/@fullcalendar/core/main.min.css",
"node_modules/@fullcalendar/daygrid/main.min.css",
"node_modules/spinkit/scss/spinners/11-folding-cube.scss",
"node_modules/spinkit/scss/spinkit.scss"
"node_modules/@fullcalendar/daygrid/main.min.css"
],
"scripts": [
"node_modules/jquery/dist/jquery.min.js",

@ -52,13 +52,11 @@
"ngx-infinite-scroll": "^9.0.0",
"ngx-moment": "^3.0.1",
"ngx-order-pipe": "^2.1.1",
"please-wait": "^0.0.5",
"popper.js": "^1.14.3",
"primeicons": "^4.1.0",
"primeng": "^12.2.0",
"rxjs": "^7.4.0",
"sass-recursive-map-merge": "^1.0.1",
"spinkit": "^1.2.5",
"store": "^2.0.12",
"ts-md5": "^1.2.7",
"tslib": "^1.10.0",

@ -72,6 +72,12 @@
{{'Common.Request' | translate }}
</button>
</ng-template>
<span *ngIf="!isAdmin && movie.showSubscribe" >
<button *ngIf="!movie.subscribed" (click)="notify()" id="notifyBtn" mat-raised-button class="btn-spacing" > <i class="fas fa-bell"></i>
{{ 'Requests.Notify' | translate }}</button>
<button *ngIf="movie.subscribed" (click)="unNotify()" id="unnotifyBtn" mat-raised-button class="btn-spacing" > <i class="fas fa-bell-slash"></i>
{{ 'Requests.RemoveNotification' | translate }}</button>
</span>
</span>
<span *ngIf="isAdmin && hasRequest">
<button id="approveBtn" *ngIf="!movie.approved " (click)="approve()" mat-raised-button class="btn-spacing" color="accent">

@ -213,6 +213,28 @@ export class MovieDetailsComponent {
});
}
public notify() {
this.requestService.subscribeToMovie(this.movieRequest.id).subscribe(result => {
if (result) {
this.movie.subscribed = true;
this.messageService.send(this.translate.instant("Requests.SuccessfulNotify", {title: this.movie.title}), "Ok");
} else {
this.messageService.send(this.translate.instant("Requests.CouldntNotify", {title: this.movie.title}), "Ok");
}
});
}
public unNotify() {
this.requestService.unSubscribeToMovie(this.movieRequest.id).subscribe(result => {
if (result) {
this.movie.subscribed = false;
this.messageService.send(this.translate.instant("Requests.SuccessfulUnNotify", {title: this.movie.title}), "Ok");
} else {
this.messageService.send(this.translate.instant("Requests.CouldntNotify", {title: this.movie.title}), "Ok");
}
});
}
private loadBanner() {
this.imageService.getMovieBanner(this.theMovidDbId.toString()).subscribe(x => {
if (!this.movie.backdropPath) {

@ -6191,11 +6191,6 @@ pkg-dir@^4.1.0:
dependencies:
find-up "^4.0.0"
please-wait@^0.0.5:
version "0.0.5"
resolved "https://registry.yarnpkg.com/please-wait/-/please-wait-0.0.5.tgz#67098ce6260e92e0809e2d3b7c23f1d167dad960"
integrity sha1-ZwmM5iYOkuCAni07fCPx0Wfa2WA=
pngjs@^3.3.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-3.4.0.tgz#99ca7d725965fb655814eaf65f38f12bbdbf555f"
@ -7700,11 +7695,6 @@ spdy@^4.0.2:
select-hose "^2.0.0"
spdy-transport "^3.0.0"
spinkit@^1.2.5:
version "1.2.5"
resolved "https://registry.yarnpkg.com/spinkit/-/spinkit-1.2.5.tgz#90f9f466a20e8e39ef24da959c1e611c2a30dd54"
integrity sha1-kPn0ZqIOjjnvJNqVnB5hHCow3VQ=
split-string@^3.0.1, split-string@^3.0.2:
version "3.1.0"
resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2"

@ -226,7 +226,12 @@
"MovieRequestQuotaExceeded":"You have exceeded your Movie request quota!",
"TvRequestQuotaExceeded":"You have exceeded your Episode request quota!",
"AlbumRequestQuotaExceeded":"You have exceeded your Album request quota!"
}
},
"Notify": "Notify",
"RemoveNotification": "Remove Notifications",
"SuccessfulNotify":"You will now be notified for title {{title}}",
"SuccessfulUnNotify":"You will no longer be notified for title {{title}}",
"CouldntNotify":"Couldn't notify title {{title}}"
},
"Issues": {
"Title": "Issues",

Loading…
Cancel
Save