mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-06 13:11:13 -07:00
fix(availability): 🐛 Fixed an issue where with 4k content, we could repeat notifications
This commit is contained in:
parent
60cfd41f68
commit
f9ebc1cc2e
5 changed files with 33 additions and 18 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
@ -191,7 +191,7 @@ jobs:
|
|||
with:
|
||||
prerelease: true
|
||||
generate_release_notes: true
|
||||
# body: ${{ needs.versioning.outputs.changelog }}
|
||||
body: ${{ needs.versioning.outputs.changelog }}
|
||||
name: ${{ needs.versioning.outputs.tag }}
|
||||
tag_name: ${{ needs.versioning.outputs.tag }}
|
||||
files: |
|
||||
|
|
|
@ -76,19 +76,23 @@ namespace Ombi.Schedule.Jobs.Emby
|
|||
|
||||
_log.LogInformation("We have found the request {0} on Emby, sending the notification", movie?.Title ?? string.Empty);
|
||||
|
||||
if (has4kRequest && embyContent.Has4K)
|
||||
var notify = false;
|
||||
|
||||
if (has4kRequest && embyContent.Has4K && !movie.Available4K)
|
||||
{
|
||||
movie.Available4K = true;
|
||||
movie.MarkedAsAvailable4K = DateTime.Now;
|
||||
notify = true;
|
||||
}
|
||||
|
||||
// If we have a non-4k versison then mark as available
|
||||
if (embyContent.Quality.HasValue())
|
||||
if (embyContent.Quality.HasValue() && !movie.Available)
|
||||
{
|
||||
movie.Available = true;
|
||||
movie.MarkedAsAvailable = DateTime.Now;
|
||||
notify = true;
|
||||
}
|
||||
if (movie.Available)
|
||||
if (notify)
|
||||
{
|
||||
var recipient = movie.RequestedUser.Email.HasValue() ? movie.RequestedUser.Email : string.Empty;
|
||||
|
||||
|
|
|
@ -103,20 +103,24 @@ namespace Ombi.Schedule.Jobs.Jellyfin
|
|||
|
||||
_log.LogInformation("We have found the request {0} on Jellyfin, sending the notification", movie?.Title ?? string.Empty);
|
||||
|
||||
if (has4kRequest && jellyfinContent.Has4K)
|
||||
var notify = false;
|
||||
|
||||
if (has4kRequest && jellyfinContent.Has4K && !movie.Available4K)
|
||||
{
|
||||
movie.Available4K = true;
|
||||
movie.MarkedAsAvailable4K = DateTime.Now;
|
||||
notify = true;
|
||||
}
|
||||
|
||||
// If we have a non-4k versison then mark as available
|
||||
if (jellyfinContent.Quality.HasValue())
|
||||
if (jellyfinContent.Quality.HasValue() && !movie.Available)
|
||||
{
|
||||
movie.Available = true;
|
||||
movie.MarkedAsAvailable = DateTime.Now;
|
||||
notify = true;
|
||||
}
|
||||
|
||||
if (movie.Available)
|
||||
if (notify)
|
||||
{
|
||||
var recipient = movie.RequestedUser.Email.HasValue() ? movie.RequestedUser.Email : string.Empty;
|
||||
|
||||
|
|
|
@ -206,28 +206,35 @@ namespace Ombi.Schedule.Jobs.Plex
|
|||
|
||||
_log.LogInformation($"[PAC] - Movie request {movie.Title} - {movie.Id} is now available, sending notification");
|
||||
|
||||
if (has4kRequest && item.Has4K)
|
||||
var notify = false;
|
||||
|
||||
if (has4kRequest && item.Has4K && !movie.Available4K)
|
||||
{
|
||||
movie.Available4K = true;
|
||||
movie.Approved4K = true;
|
||||
movie.MarkedAsAvailable4K = DateTime.Now;
|
||||
await _movieRepo.SaveChangesAsync();
|
||||
notify = true;
|
||||
}
|
||||
|
||||
// If we have a non-4k versison then mark as available
|
||||
if (item.Quality.HasValue())
|
||||
if (item.Quality.HasValue() && !movie.Available)
|
||||
{
|
||||
movie.Available = true;
|
||||
movie.Approved = true;
|
||||
movie.MarkedAsAvailable = DateTime.Now;
|
||||
await _movieRepo.SaveChangesAsync();
|
||||
notify = true;
|
||||
}
|
||||
|
||||
itemsForAvailbility.Add(new AvailabilityModel
|
||||
if (notify)
|
||||
{
|
||||
Id = movie.Id,
|
||||
RequestedUser = movie.RequestedUser != null ? movie.RequestedUser.Email : string.Empty
|
||||
});
|
||||
itemsForAvailbility.Add(new AvailabilityModel
|
||||
{
|
||||
Id = movie.Id,
|
||||
RequestedUser = movie.RequestedUser != null ? movie.RequestedUser.Email : string.Empty
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var i in itemsForAvailbility.DistinctBy(x => x.Id))
|
||||
|
|
|
@ -340,11 +340,11 @@ namespace Ombi.Schedule.Jobs.Plex
|
|||
continue;
|
||||
}
|
||||
|
||||
var hasSameKey = await Repo.GetByKey(movie.ratingKey);
|
||||
if (hasSameKey != null)
|
||||
{
|
||||
await Repo.Delete(hasSameKey);
|
||||
}
|
||||
//var hasSameKey = await Repo.GetByKey(movie.ratingKey);
|
||||
//if (hasSameKey != null)
|
||||
//{
|
||||
// await Repo.Delete(hasSameKey);
|
||||
//}
|
||||
|
||||
Logger.LogDebug("Adding movie {0}", movie.title);
|
||||
var guids = new List<string>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue