mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -07:00
feat: Done the media sync jobs
This commit is contained in:
parent
a1aacc1998
commit
dec4f317b2
23 changed files with 1378 additions and 66 deletions
|
@ -170,7 +170,7 @@ namespace Ombi.Api.Emby
|
||||||
|
|
||||||
request.AddQueryString("Recursive", true.ToString());
|
request.AddQueryString("Recursive", true.ToString());
|
||||||
request.AddQueryString("IncludeItemTypes", type);
|
request.AddQueryString("IncludeItemTypes", type);
|
||||||
request.AddQueryString("Fields", includeOverview ? "ProviderIds,Overview" : "ProviderIds");
|
request.AddQueryString("Fields", includeOverview ? "ProviderIds,MediaStreams,Overview" : "ProviderIds,MediaStreams ");
|
||||||
request.AddQueryString("startIndex", startIndex.ToString());
|
request.AddQueryString("startIndex", startIndex.ToString());
|
||||||
request.AddQueryString("limit", count.ToString());
|
request.AddQueryString("limit", count.ToString());
|
||||||
request.AddQueryString("sortBy", "DateCreated");
|
request.AddQueryString("sortBy", "DateCreated");
|
||||||
|
|
|
@ -157,7 +157,7 @@ namespace Ombi.Api.Jellyfin
|
||||||
|
|
||||||
request.AddQueryString("Recursive", true.ToString());
|
request.AddQueryString("Recursive", true.ToString());
|
||||||
request.AddQueryString("IncludeItemTypes", type);
|
request.AddQueryString("IncludeItemTypes", type);
|
||||||
request.AddQueryString("Fields", includeOverview ? "ProviderIds,Overview,ParentId" : "ProviderIds,ParentId");
|
request.AddQueryString("Fields", includeOverview ? "ProviderIds,MediaStreams Overview,ParentId" : "ProviderIds,ParentId,MediaStreams");
|
||||||
request.AddQueryString("startIndex", startIndex.ToString());
|
request.AddQueryString("startIndex", startIndex.ToString());
|
||||||
request.AddQueryString("limit", count.ToString());
|
request.AddQueryString("limit", count.ToString());
|
||||||
if(!string.IsNullOrEmpty(parentIdFilder))
|
if(!string.IsNullOrEmpty(parentIdFilder))
|
||||||
|
|
|
@ -2,35 +2,6 @@ namespace Ombi.Api.Jellyfin.Models.Movie
|
||||||
{
|
{
|
||||||
public class JellyfinMediastream
|
public class JellyfinMediastream
|
||||||
{
|
{
|
||||||
public string Codec { get; set; }
|
|
||||||
public string Language { get; set; }
|
|
||||||
public string TimeBase { get; set; }
|
|
||||||
public string CodecTimeBase { get; set; }
|
|
||||||
public string NalLengthSize { get; set; }
|
|
||||||
public bool IsInterlaced { get; set; }
|
|
||||||
public bool IsAVC { get; set; }
|
|
||||||
public int BitRate { get; set; }
|
|
||||||
public int BitDepth { get; set; }
|
|
||||||
public int RefFrames { get; set; }
|
|
||||||
public bool IsDefault { get; set; }
|
|
||||||
public bool IsForced { get; set; }
|
|
||||||
public int Height { get; set; }
|
|
||||||
public int Width { get; set; }
|
|
||||||
public float AverageFrameRate { get; set; }
|
|
||||||
public float RealFrameRate { get; set; }
|
|
||||||
public string Profile { get; set; }
|
|
||||||
public string Type { get; set; }
|
|
||||||
public string AspectRatio { get; set; }
|
|
||||||
public int Index { get; set; }
|
|
||||||
public bool IsExternal { get; set; }
|
|
||||||
public bool IsTextSubtitleStream { get; set; }
|
|
||||||
public bool SupportsExternalStream { get; set; }
|
|
||||||
public string PixelFormat { get; set; }
|
|
||||||
public int Level { get; set; }
|
|
||||||
public bool IsAnamorphic { get; set; }
|
|
||||||
public string DisplayTitle { get; set; }
|
public string DisplayTitle { get; set; }
|
||||||
public string ChannelLayout { get; set; }
|
|
||||||
public int Channels { get; set; }
|
|
||||||
public int SampleRate { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -30,5 +30,6 @@ namespace Ombi.Api.Jellyfin.Models.Movie
|
||||||
public int CriticRating { get; set; }
|
public int CriticRating { get; set; }
|
||||||
public string Overview { get; set; }
|
public string Overview { get; set; }
|
||||||
public JellyfinProviderids ProviderIds { get; set; }
|
public JellyfinProviderids ProviderIds { get; set; }
|
||||||
|
public JellyfinMediastream[] MediaStreams { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,7 +12,6 @@ namespace Ombi.Api.Plex.Models
|
||||||
public string contentRating { get; set; }
|
public string contentRating { get; set; }
|
||||||
public string summary { get; set; }
|
public string summary { get; set; }
|
||||||
public int index { get; set; }
|
public int index { get; set; }
|
||||||
public float rating { get; set; }
|
|
||||||
//public int viewCount { get; set; }
|
//public int viewCount { get; set; }
|
||||||
//public int lastViewedAt { get; set; }
|
//public int lastViewedAt { get; set; }
|
||||||
public int year { get; set; }
|
public int year { get; set; }
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace Ombi.Core.Tests.Rule.Search
|
||||||
SettingsMock.Setup(x => x.GetSettingsAsync()).ReturnsAsync(new EmbySettings());
|
SettingsMock.Setup(x => x.GetSettingsAsync()).ReturnsAsync(new EmbySettings());
|
||||||
ContextMock.Setup(x => x.GetByTheMovieDbId(It.IsAny<string>())).ReturnsAsync(new EmbyContent
|
ContextMock.Setup(x => x.GetByTheMovieDbId(It.IsAny<string>())).ReturnsAsync(new EmbyContent
|
||||||
{
|
{
|
||||||
ProviderId = "123"
|
TheMovieDbId = "123"
|
||||||
});
|
});
|
||||||
var search = new SearchMovieViewModel()
|
var search = new SearchMovieViewModel()
|
||||||
{
|
{
|
||||||
|
|
|
@ -133,12 +133,88 @@ namespace Ombi.Schedule.Tests
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
await _subject.MovieLoop(new PlexServers { Ip = "http://test.com/", Port = 80}, content, contentToAdd, contentProcessed);
|
await _subject.MovieLoop(new PlexServers { Ip = "http://test.com/", Port = 80 }, content, contentToAdd, contentProcessed);
|
||||||
|
|
||||||
var first = contentToAdd.First();
|
var first = contentToAdd.First();
|
||||||
Assert.That(first.ImdbId, Is.EqualTo("tt0322259"));
|
Assert.That(first.ImdbId, Is.EqualTo("tt0322259"));
|
||||||
|
|
||||||
_mocker.Verify<IPlexApi>(x => x.GetMetadata(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<int>()), Times.Once);
|
_mocker.Verify<IPlexApi>(x => x.GetMetadata(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<int>()), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task UpdatesExistingMovieWhen_WeFindAnotherQuality()
|
||||||
|
{
|
||||||
|
var content = new Mediacontainer
|
||||||
|
{
|
||||||
|
Metadata = new[]
|
||||||
|
{
|
||||||
|
new Metadata
|
||||||
|
{
|
||||||
|
ratingKey = 11,
|
||||||
|
title = "test1",
|
||||||
|
year = 2021,
|
||||||
|
type = "movie",
|
||||||
|
Media = new Medium[1]
|
||||||
|
{
|
||||||
|
new Medium
|
||||||
|
{
|
||||||
|
videoResolution = "4k"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var contentToAdd = new HashSet<PlexServerContent>();
|
||||||
|
var contentProcessed = new Dictionary<int, int>();
|
||||||
|
_mocker.Setup<IPlexContentRepository>(x =>
|
||||||
|
x.GetFirstContentByCustom(It.IsAny<Expression<Func<PlexServerContent, bool>>>()))
|
||||||
|
.Returns(Task.FromResult(new PlexServerContent
|
||||||
|
{
|
||||||
|
Quality = "1080"
|
||||||
|
}));
|
||||||
|
|
||||||
|
await _subject.MovieLoop(new PlexServers(), content, contentToAdd, contentProcessed);
|
||||||
|
|
||||||
|
Assert.That(contentToAdd, Is.Empty);
|
||||||
|
_mocker.Verify<IPlexContentRepository>(x => x.Update(It.Is<PlexServerContent>(x => x.Quality == "1080" && x.Has4K)), Times.Once);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task DoesNotUpdatesExistingMovieWhen_WeFindSameQuality()
|
||||||
|
{
|
||||||
|
var content = new Mediacontainer
|
||||||
|
{
|
||||||
|
Metadata = new[]
|
||||||
|
{
|
||||||
|
new Metadata
|
||||||
|
{
|
||||||
|
ratingKey = 11,
|
||||||
|
title = "test1",
|
||||||
|
year = 2021,
|
||||||
|
type = "movie",
|
||||||
|
Media = new Medium[1]
|
||||||
|
{
|
||||||
|
new Medium
|
||||||
|
{
|
||||||
|
videoResolution = "1080"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var contentToAdd = new HashSet<PlexServerContent>();
|
||||||
|
var contentProcessed = new Dictionary<int, int>();
|
||||||
|
_mocker.Setup<IPlexContentRepository>(x =>
|
||||||
|
x.GetFirstContentByCustom(It.IsAny<Expression<Func<PlexServerContent, bool>>>()))
|
||||||
|
.Returns(Task.FromResult(new PlexServerContent
|
||||||
|
{
|
||||||
|
Quality = "1080"
|
||||||
|
}));
|
||||||
|
|
||||||
|
await _subject.MovieLoop(new PlexServers(), content, contentToAdd, contentProcessed);
|
||||||
|
|
||||||
|
Assert.That(contentToAdd, Is.Empty);
|
||||||
|
_mocker.Verify<IPlexContentRepository>(x => x.Update(It.IsAny<PlexServerContent>()), Times.Never);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,6 +210,7 @@ namespace Ombi.Schedule.Jobs.Emby
|
||||||
var totalCount = movies.TotalRecordCount;
|
var totalCount = movies.TotalRecordCount;
|
||||||
var processed = 0;
|
var processed = 0;
|
||||||
var mediaToAdd = new HashSet<EmbyContent>();
|
var mediaToAdd = new HashSet<EmbyContent>();
|
||||||
|
var mediaToUpdate = new HashSet<EmbyContent>();
|
||||||
while (processed < totalCount)
|
while (processed < totalCount)
|
||||||
{
|
{
|
||||||
foreach (var movie in movies.Items)
|
foreach (var movie in movies.Items)
|
||||||
|
@ -220,13 +221,13 @@ namespace Ombi.Schedule.Jobs.Emby
|
||||||
await Api.GetCollection(movie.Id, server.ApiKey, server.AdministratorId, server.FullUri);
|
await Api.GetCollection(movie.Id, server.ApiKey, server.AdministratorId, server.FullUri);
|
||||||
foreach (var item in movieInfo.Items)
|
foreach (var item in movieInfo.Items)
|
||||||
{
|
{
|
||||||
await ProcessMovies(item, mediaToAdd, server);
|
await ProcessMovies(item, mediaToAdd, mediaToUpdate, server);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Regular movie
|
// Regular movie
|
||||||
await ProcessMovies(movie, mediaToAdd, server);
|
await ProcessMovies(movie, mediaToAdd, mediaToUpdate, server);
|
||||||
}
|
}
|
||||||
|
|
||||||
processed++;
|
processed++;
|
||||||
|
@ -239,29 +240,31 @@ namespace Ombi.Schedule.Jobs.Emby
|
||||||
movies = await Api.GetAllMovies(server.ApiKey, parentId, processed, AmountToTake, server.AdministratorId, server.FullUri);
|
movies = await Api.GetAllMovies(server.ApiKey, parentId, processed, AmountToTake, server.AdministratorId, server.FullUri);
|
||||||
}
|
}
|
||||||
await _repo.AddRange(mediaToAdd);
|
await _repo.AddRange(mediaToAdd);
|
||||||
|
await _repo.UpdateRange(mediaToUpdate);
|
||||||
mediaToAdd.Clear();
|
mediaToAdd.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ProcessMovies(EmbyMovie movieInfo, ICollection<EmbyContent> content, EmbyServers server)
|
private async Task ProcessMovies(EmbyMovie movieInfo, ICollection<EmbyContent> content, ICollection<EmbyContent> toUpdate, EmbyServers server)
|
||||||
{
|
{
|
||||||
|
var quality = movieInfo.MediaStreams?.FirstOrDefault()?.DisplayTitle ?? string.Empty;
|
||||||
|
var has4K = false;
|
||||||
|
if (quality.Contains("4K", CompareOptions.IgnoreCase))
|
||||||
|
{
|
||||||
|
has4K = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if it exists
|
// Check if it exists
|
||||||
var existingMovie = await _repo.GetByEmbyId(movieInfo.Id);
|
var existingMovie = await _repo.GetByEmbyId(movieInfo.Id);
|
||||||
var alreadyGoingToAdd = content.Any(x => x.EmbyId == movieInfo.Id);
|
var alreadyGoingToAdd = content.Any(x => x.EmbyId == movieInfo.Id);
|
||||||
if (existingMovie == null && !alreadyGoingToAdd)
|
if (existingMovie == null && !alreadyGoingToAdd)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!movieInfo.ProviderIds.Any())
|
if (!movieInfo.ProviderIds.Any())
|
||||||
{
|
{
|
||||||
_logger.LogWarning($"Movie {movieInfo.Name} has no relevant metadata. Skipping.");
|
_logger.LogWarning($"Movie {movieInfo.Name} has no relevant metadata. Skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_logger.LogDebug("Adding new movie {0}", movieInfo.Name);
|
_logger.LogDebug($"Adding new movie {movieInfo.Name}");
|
||||||
var quality = movieInfo.MediaStreams?.FirstOrDefault()?.DisplayTitle ?? string.Empty;
|
|
||||||
if (quality.Contains("4K", CompareOptions.IgnoreCase))
|
|
||||||
{
|
|
||||||
quality = "4K";
|
|
||||||
}
|
|
||||||
|
|
||||||
content.Add(new EmbyContent
|
content.Add(new EmbyContent
|
||||||
{
|
{
|
||||||
|
@ -272,13 +275,25 @@ namespace Ombi.Schedule.Jobs.Emby
|
||||||
EmbyId = movieInfo.Id,
|
EmbyId = movieInfo.Id,
|
||||||
Url = EmbyHelper.GetEmbyMediaUrl(movieInfo.Id, server?.ServerId, server.ServerHostname),
|
Url = EmbyHelper.GetEmbyMediaUrl(movieInfo.Id, server?.ServerId, server.ServerHostname),
|
||||||
AddedAt = DateTime.UtcNow,
|
AddedAt = DateTime.UtcNow,
|
||||||
Quality = quality
|
Quality = has4K ? null : quality,
|
||||||
|
Has4K = has4K
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// we have this
|
if (!existingMovie.Quality.Equals(quality, StringComparison.InvariantCultureIgnoreCase))
|
||||||
_logger.LogDebug("We already have movie {0}", movieInfo.Name);
|
{
|
||||||
|
_logger.LogDebug($"We have found another quality for Movie '{movieInfo.Name}', Quality: '{quality}'");
|
||||||
|
existingMovie.Quality = has4K ? null : quality;
|
||||||
|
existingMovie.Has4K = has4K;
|
||||||
|
|
||||||
|
toUpdate.Add(existingMovie);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// we have this
|
||||||
|
_logger.LogDebug($"We already have movie {movieInfo.Name}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.SignalR;
|
using Microsoft.AspNetCore.SignalR;
|
||||||
|
@ -77,9 +78,6 @@ namespace Ombi.Schedule.Jobs.Jellyfin
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//await _repo.ExecuteSql("DELETE FROM JellyfinEpisode");
|
|
||||||
//await _repo.ExecuteSql("DELETE FROM JellyfinContent");
|
|
||||||
|
|
||||||
if (server.JellyfinSelectedLibraries.Any() && server.JellyfinSelectedLibraries.Any(x => x.Enabled))
|
if (server.JellyfinSelectedLibraries.Any() && server.JellyfinSelectedLibraries.Any(x => x.Enabled))
|
||||||
{
|
{
|
||||||
var movieLibsToFilter = server.JellyfinSelectedLibraries.Where(x => x.Enabled && x.CollectionType == "movies");
|
var movieLibsToFilter = server.JellyfinSelectedLibraries.Where(x => x.Enabled && x.CollectionType == "movies");
|
||||||
|
@ -179,6 +177,7 @@ namespace Ombi.Schedule.Jobs.Jellyfin
|
||||||
var totalCount = movies.TotalRecordCount;
|
var totalCount = movies.TotalRecordCount;
|
||||||
var processed = 0;
|
var processed = 0;
|
||||||
var mediaToAdd = new HashSet<JellyfinContent>();
|
var mediaToAdd = new HashSet<JellyfinContent>();
|
||||||
|
var mediaToUpdate = new HashSet<JellyfinContent>();
|
||||||
while (processed < totalCount)
|
while (processed < totalCount)
|
||||||
{
|
{
|
||||||
foreach (var movie in movies.Items)
|
foreach (var movie in movies.Items)
|
||||||
|
@ -189,7 +188,7 @@ namespace Ombi.Schedule.Jobs.Jellyfin
|
||||||
await Api.GetCollection(movie.Id, server.ApiKey, server.AdministratorId, server.FullUri);
|
await Api.GetCollection(movie.Id, server.ApiKey, server.AdministratorId, server.FullUri);
|
||||||
foreach (var item in movieInfo.Items)
|
foreach (var item in movieInfo.Items)
|
||||||
{
|
{
|
||||||
await ProcessMovies(item, mediaToAdd, server);
|
await ProcessMovies(item, mediaToAdd, mediaToUpdate, server);
|
||||||
}
|
}
|
||||||
|
|
||||||
processed++;
|
processed++;
|
||||||
|
@ -198,20 +197,28 @@ namespace Ombi.Schedule.Jobs.Jellyfin
|
||||||
{
|
{
|
||||||
processed++;
|
processed++;
|
||||||
// Regular movie
|
// Regular movie
|
||||||
await ProcessMovies(movie, mediaToAdd, server);
|
await ProcessMovies(movie, mediaToAdd, mediaToUpdate, server);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the next batch
|
// Get the next batch
|
||||||
movies = await Api.GetAllMovies(server.ApiKey, parentId, processed, 200, server.AdministratorId, server.FullUri);
|
movies = await Api.GetAllMovies(server.ApiKey, parentId, processed, 200, server.AdministratorId, server.FullUri);
|
||||||
await _repo.AddRange(mediaToAdd);
|
await _repo.AddRange(mediaToAdd);
|
||||||
|
await _repo.UpdateRange(mediaToUpdate);
|
||||||
mediaToAdd.Clear();
|
mediaToAdd.Clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ProcessMovies(JellyfinMovie movieInfo, ICollection<JellyfinContent> content, JellyfinServers server)
|
private async Task ProcessMovies(JellyfinMovie movieInfo, ICollection<JellyfinContent> content, ICollection<JellyfinContent> toUpdate, JellyfinServers server)
|
||||||
{
|
{
|
||||||
|
var quality = movieInfo.MediaStreams?.FirstOrDefault()?.DisplayTitle ?? string.Empty;
|
||||||
|
var has4K = false;
|
||||||
|
if (quality.Contains("4K", CompareOptions.IgnoreCase))
|
||||||
|
{
|
||||||
|
has4K = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if it exists
|
// Check if it exists
|
||||||
var existingMovie = await _repo.GetByJellyfinId(movieInfo.Id);
|
var existingMovie = await _repo.GetByJellyfinId(movieInfo.Id);
|
||||||
var alreadyGoingToAdd = content.Any(x => x.JellyfinId == movieInfo.Id);
|
var alreadyGoingToAdd = content.Any(x => x.JellyfinId == movieInfo.Id);
|
||||||
|
@ -222,7 +229,7 @@ namespace Ombi.Schedule.Jobs.Jellyfin
|
||||||
_logger.LogWarning($"Movie {movieInfo.Name} has no relevant metadata. Skipping.");
|
_logger.LogWarning($"Movie {movieInfo.Name} has no relevant metadata. Skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_logger.LogDebug("Adding new movie {0}", movieInfo.Name);
|
_logger.LogDebug($"Adding new movie {movieInfo.Name}");
|
||||||
content.Add(new JellyfinContent
|
content.Add(new JellyfinContent
|
||||||
{
|
{
|
||||||
ImdbId = movieInfo.ProviderIds.Imdb,
|
ImdbId = movieInfo.ProviderIds.Imdb,
|
||||||
|
@ -231,13 +238,26 @@ namespace Ombi.Schedule.Jobs.Jellyfin
|
||||||
Type = MediaType.Movie,
|
Type = MediaType.Movie,
|
||||||
JellyfinId = movieInfo.Id,
|
JellyfinId = movieInfo.Id,
|
||||||
Url = JellyfinHelper.GetJellyfinMediaUrl(movieInfo.Id, server?.ServerId, server.ServerHostname),
|
Url = JellyfinHelper.GetJellyfinMediaUrl(movieInfo.Id, server?.ServerId, server.ServerHostname),
|
||||||
AddedAt = DateTime.UtcNow
|
AddedAt = DateTime.UtcNow,
|
||||||
|
Quality = has4K ? null : quality,
|
||||||
|
Has4K = has4K
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// we have this
|
if (!existingMovie.Quality.Equals(quality, StringComparison.InvariantCultureIgnoreCase))
|
||||||
_logger.LogDebug("We already have movie {0}", movieInfo.Name);
|
{
|
||||||
|
_logger.LogDebug($"We have found another quality for Movie '{movieInfo.Name}', Quality: '{quality}'");
|
||||||
|
existingMovie.Quality = has4K ? null : quality;
|
||||||
|
existingMovie.Has4K = has4K;
|
||||||
|
|
||||||
|
toUpdate.Add(existingMovie);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// we have this
|
||||||
|
_logger.LogDebug($"We already have movie {movieInfo.Name}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace Ombi.Schedule.Jobs.Ombi
|
||||||
_ombiSettings = ombiSettings;
|
_ombiSettings = ombiSettings;
|
||||||
_movieRequests = movieRequest;
|
_movieRequests = movieRequest;
|
||||||
_tvRequestRepository = tvRequestRepository;
|
_tvRequestRepository = tvRequestRepository;
|
||||||
_musicRequestRepository = _musicRequestRepository;
|
_musicRequestRepository = musicRequestRepository;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,7 @@ namespace Ombi.Schedule.Jobs.Plex
|
||||||
Dictionary<int, int> contentProcessed)
|
Dictionary<int, int> contentProcessed)
|
||||||
{
|
{
|
||||||
Logger.LogDebug("Processing Movies");
|
Logger.LogDebug("Processing Movies");
|
||||||
foreach (var movie in content?.Metadata ?? new Metadata[] { })
|
foreach (var movie in content?.Metadata ?? Array.Empty<Metadata>())
|
||||||
{
|
{
|
||||||
// Let's check if we have this movie
|
// Let's check if we have this movie
|
||||||
|
|
||||||
|
@ -302,11 +302,31 @@ namespace Ombi.Schedule.Jobs.Plex
|
||||||
var existing = await Repo.GetFirstContentByCustom(x => x.Title == movie.title
|
var existing = await Repo.GetFirstContentByCustom(x => x.Title == movie.title
|
||||||
&& x.ReleaseYear == movie.year.ToString()
|
&& x.ReleaseYear == movie.year.ToString()
|
||||||
&& x.Type == MediaType.Movie);
|
&& x.Type == MediaType.Movie);
|
||||||
// The rating key keeps changing
|
|
||||||
//var existing = await Repo.GetByKey(movie.ratingKey);
|
|
||||||
if (existing != null)
|
if (existing != null)
|
||||||
{
|
{
|
||||||
Logger.LogDebug("We already have movie {0}", movie.title);
|
// We need to see if this is a different quality,
|
||||||
|
// We want to know if this is a 4k content for example
|
||||||
|
var foundQualities = movie.Media?.Select(x => x.videoResolution);
|
||||||
|
|
||||||
|
foreach (var quality in foundQualities)
|
||||||
|
{
|
||||||
|
if (quality.Equals(existing.Quality))
|
||||||
|
{
|
||||||
|
// We got it
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We don't have this quality
|
||||||
|
if (quality.Equals("4k", StringComparison.InvariantCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
Logger.LogDebug($"We already have movie {movie.title}, But found a 4K version!");
|
||||||
|
existing.Has4K = true;
|
||||||
|
await Repo.Update(existing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Logger.LogDebug($"We already have movie {movie.title}");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,6 +369,10 @@ namespace Ombi.Schedule.Jobs.Plex
|
||||||
}
|
}
|
||||||
var providerIds = PlexHelper.GetProviderIdsFromMetadata(guids.ToArray());
|
var providerIds = PlexHelper.GetProviderIdsFromMetadata(guids.ToArray());
|
||||||
|
|
||||||
|
var qualities = movie.Media?.Select(x => x.videoResolution);
|
||||||
|
var is4k = qualities != null && qualities.Any(x => x.Equals("4k", StringComparison.InvariantCultureIgnoreCase));
|
||||||
|
var selectedQuality = is4k ? string.Empty : qualities?.OrderBy(x => x)?.FirstOrDefault() ?? string.Empty;
|
||||||
|
|
||||||
var item = new PlexServerContent
|
var item = new PlexServerContent
|
||||||
{
|
{
|
||||||
AddedAt = DateTime.Now,
|
AddedAt = DateTime.Now,
|
||||||
|
@ -358,7 +382,8 @@ namespace Ombi.Schedule.Jobs.Plex
|
||||||
Title = movie.title,
|
Title = movie.title,
|
||||||
Url = PlexHelper.GetPlexMediaUrl(servers.MachineIdentifier, movie.ratingKey, servers.ServerHostname),
|
Url = PlexHelper.GetPlexMediaUrl(servers.MachineIdentifier, movie.ratingKey, servers.ServerHostname),
|
||||||
Seasons = new List<PlexSeasonsContent>(),
|
Seasons = new List<PlexSeasonsContent>(),
|
||||||
Quality = movie.Media?.FirstOrDefault()?.videoResolution ?? string.Empty
|
Quality = selectedQuality,
|
||||||
|
Has4K = is4k,
|
||||||
};
|
};
|
||||||
if (providerIds.ImdbId.HasValue())
|
if (providerIds.ImdbId.HasValue())
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,11 @@ namespace Ombi.Store.Entities
|
||||||
public string TvDbId { get; set; }
|
public string TvDbId { get; set; }
|
||||||
public string TheMovieDbId { get; set; }
|
public string TheMovieDbId { get; set; }
|
||||||
public MediaType Type { get; set; }
|
public MediaType Type { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Only populated if it's not 4k
|
||||||
|
/// </summary>
|
||||||
public string Quality { get; set; }
|
public string Quality { get; set; }
|
||||||
|
public bool Has4K { get; set; }
|
||||||
public string Url { get; set; }
|
public string Url { get; set; }
|
||||||
|
|
||||||
public ICollection<IMediaServerEpisode> Episodes { get; set; }
|
public ICollection<IMediaServerEpisode> Episodes { get; set; }
|
||||||
|
|
536
src/Ombi.Store/Migrations/ExternalMySql/20220212210902_MediaServer4k.Designer.cs
generated
Normal file
536
src/Ombi.Store/Migrations/ExternalMySql/20220212210902_MediaServer4k.Designer.cs
generated
Normal file
|
@ -0,0 +1,536 @@
|
||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Ombi.Store.Context.MySql;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Ombi.Store.Migrations.ExternalMySql
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ExternalMySqlContext))]
|
||||||
|
[Migration("20220212210902_MediaServer4k")]
|
||||||
|
partial class MediaServer4k
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "6.0.0")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.CouchPotatoCache", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("TheMovieDbId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("CouchPotatoCache");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.EmbyContent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("AddedAt")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<string>("EmbyId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("varchar(255)");
|
||||||
|
|
||||||
|
b.Property<bool>("Has4K")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<string>("ImdbId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("Quality")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("TheMovieDbId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("TvDbId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<int>("Type")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Url")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("EmbyContent");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("AddedAt")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<string>("EmbyId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<int>("EpisodeNumber")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ImdbId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("ParentId")
|
||||||
|
.HasColumnType("varchar(255)");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<int>("SeasonNumber")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("TheMovieDbId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("TvDbId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ParentId");
|
||||||
|
|
||||||
|
b.ToTable("EmbyEpisode");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.JellyfinContent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("AddedAt")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<bool>("Has4K")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<string>("ImdbId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("JellyfinId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("varchar(255)");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("Quality")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("TheMovieDbId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("TvDbId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<int>("Type")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Url")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("JellyfinContent");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.JellyfinEpisode", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("AddedAt")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<int>("EpisodeNumber")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ImdbId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("JellyfinId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("ParentId")
|
||||||
|
.HasColumnType("varchar(255)");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<int>("SeasonNumber")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("TheMovieDbId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("TvDbId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ParentId");
|
||||||
|
|
||||||
|
b.ToTable("JellyfinEpisode");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.LidarrAlbumCache", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("AddedAt")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<int>("ArtistId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ForeignAlbumId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<bool>("Monitored")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<decimal>("PercentOfTracks")
|
||||||
|
.HasColumnType("decimal(65,30)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("ReleaseDate")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<int>("TrackCount")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("LidarrAlbumCache");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.LidarrArtistCache", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ArtistId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ArtistName")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("ForeignArtistId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<bool>("Monitored")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("LidarrArtistCache");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("EpisodeNumber")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("GrandparentKey")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Key")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ParentKey")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SeasonNumber")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("GrandparentKey");
|
||||||
|
|
||||||
|
b.ToTable("PlexEpisode");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ParentKey")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("PlexContentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int?>("PlexServerContentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SeasonKey")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SeasonNumber")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("PlexServerContentId");
|
||||||
|
|
||||||
|
b.ToTable("PlexSeasonsContent");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.PlexServerContent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("AddedAt")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<bool>("Has4K")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<string>("ImdbId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<int>("Key")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Quality")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("ReleaseYear")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<int?>("RequestId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("TheMovieDbId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("TvDbId")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<int>("Type")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Url")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("PlexServerContent");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.RadarrCache", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("Has4K")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<bool>("HasFile")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<bool>("HasRegular")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<int>("TheMovieDbId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("RadarrCache");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.SickRageCache", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("TvDbId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("SickRageCache");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.SickRageEpisodeCache", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("EpisodeNumber")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SeasonNumber")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("TvDbId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("SickRageEpisodeCache");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.SonarrCache", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("TheMovieDbId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("TvDbId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("SonarrCache");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.SonarrEpisodeCache", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("EpisodeNumber")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("HasFile")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<int>("MovieDbId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SeasonNumber")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("TvDbId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("SonarrEpisodeCache");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Ombi.Store.Entities.EmbyContent", "Series")
|
||||||
|
.WithMany("Episodes")
|
||||||
|
.HasForeignKey("ParentId")
|
||||||
|
.HasPrincipalKey("EmbyId");
|
||||||
|
|
||||||
|
b.Navigation("Series");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.JellyfinEpisode", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Ombi.Store.Entities.JellyfinContent", "Series")
|
||||||
|
.WithMany("Episodes")
|
||||||
|
.HasForeignKey("ParentId")
|
||||||
|
.HasPrincipalKey("JellyfinId");
|
||||||
|
|
||||||
|
b.Navigation("Series");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Ombi.Store.Entities.PlexServerContent", "Series")
|
||||||
|
.WithMany("Episodes")
|
||||||
|
.HasForeignKey("GrandparentKey")
|
||||||
|
.HasPrincipalKey("Key")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Series");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Ombi.Store.Entities.PlexServerContent", null)
|
||||||
|
.WithMany("Seasons")
|
||||||
|
.HasForeignKey("PlexServerContentId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.EmbyContent", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Episodes");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.JellyfinContent", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Episodes");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.PlexServerContent", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Episodes");
|
||||||
|
|
||||||
|
b.Navigation("Seasons");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Ombi.Store.Migrations.ExternalMySql
|
||||||
|
{
|
||||||
|
public partial class MediaServer4k : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "Has4K",
|
||||||
|
table: "PlexServerContent",
|
||||||
|
type: "tinyint(1)",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "Has4K",
|
||||||
|
table: "JellyfinContent",
|
||||||
|
type: "tinyint(1)",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "Has4K",
|
||||||
|
table: "EmbyContent",
|
||||||
|
type: "tinyint(1)",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Has4K",
|
||||||
|
table: "PlexServerContent");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Has4K",
|
||||||
|
table: "JellyfinContent");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Has4K",
|
||||||
|
table: "EmbyContent");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -46,6 +46,9 @@ namespace Ombi.Store.Migrations.ExternalMySql
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("varchar(255)");
|
.HasColumnType("varchar(255)");
|
||||||
|
|
||||||
|
b.Property<bool>("Has4K")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
b.Property<string>("ImdbId")
|
b.Property<string>("ImdbId")
|
||||||
.HasColumnType("longtext");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
@ -127,6 +130,9 @@ namespace Ombi.Store.Migrations.ExternalMySql
|
||||||
b.Property<DateTime>("AddedAt")
|
b.Property<DateTime>("AddedAt")
|
||||||
.HasColumnType("datetime(6)");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<bool>("Has4K")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
b.Property<string>("ImdbId")
|
b.Property<string>("ImdbId")
|
||||||
.HasColumnType("longtext");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
@ -329,6 +335,9 @@ namespace Ombi.Store.Migrations.ExternalMySql
|
||||||
b.Property<DateTime>("AddedAt")
|
b.Property<DateTime>("AddedAt")
|
||||||
.HasColumnType("datetime(6)");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<bool>("Has4K")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
b.Property<string>("ImdbId")
|
b.Property<string>("ImdbId")
|
||||||
.HasColumnType("longtext");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
|
534
src/Ombi.Store/Migrations/ExternalSqlite/20220212210807_MediaServer4k.Designer.cs
generated
Normal file
534
src/Ombi.Store/Migrations/ExternalSqlite/20220212210807_MediaServer4k.Designer.cs
generated
Normal file
|
@ -0,0 +1,534 @@
|
||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Ombi.Store.Context.Sqlite;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Ombi.Store.Migrations.ExternalSqlite
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ExternalSqliteContext))]
|
||||||
|
[Migration("20220212210807_MediaServer4k")]
|
||||||
|
partial class MediaServer4k
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder.HasAnnotation("ProductVersion", "6.0.0");
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.CouchPotatoCache", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("TheMovieDbId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("CouchPotatoCache");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.EmbyContent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("AddedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("EmbyId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("Has4K")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("ImdbId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Quality")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("TheMovieDbId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("TvDbId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("Type")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Url")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("EmbyContent");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("AddedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("EmbyId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("EpisodeNumber")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("ImdbId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ParentId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("SeasonNumber")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("TheMovieDbId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("TvDbId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ParentId");
|
||||||
|
|
||||||
|
b.ToTable("EmbyEpisode");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.JellyfinContent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("AddedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("Has4K")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("ImdbId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("JellyfinId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Quality")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("TheMovieDbId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("TvDbId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("Type")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Url")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("JellyfinContent");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.JellyfinEpisode", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("AddedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("EpisodeNumber")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("ImdbId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("JellyfinId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ParentId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("SeasonNumber")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("TheMovieDbId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("TvDbId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ParentId");
|
||||||
|
|
||||||
|
b.ToTable("JellyfinEpisode");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.LidarrAlbumCache", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("AddedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("ArtistId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("ForeignAlbumId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("Monitored")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<decimal>("PercentOfTracks")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("ReleaseDate")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("TrackCount")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("LidarrAlbumCache");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.LidarrArtistCache", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("ArtistId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("ArtistName")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ForeignArtistId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("Monitored")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("LidarrArtistCache");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("EpisodeNumber")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("GrandparentKey")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("Key")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("ParentKey")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("SeasonNumber")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("GrandparentKey");
|
||||||
|
|
||||||
|
b.ToTable("PlexEpisode");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("ParentKey")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("PlexContentId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("PlexServerContentId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("SeasonKey")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("SeasonNumber")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("PlexServerContentId");
|
||||||
|
|
||||||
|
b.ToTable("PlexSeasonsContent");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.PlexServerContent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("AddedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("Has4K")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("ImdbId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("Key")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Quality")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ReleaseYear")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("RequestId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("TheMovieDbId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("TvDbId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("Type")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Url")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("PlexServerContent");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.RadarrCache", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("Has4K")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("HasFile")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("HasRegular")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("TheMovieDbId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("RadarrCache");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.SickRageCache", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("TvDbId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("SickRageCache");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.SickRageEpisodeCache", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("EpisodeNumber")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("SeasonNumber")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("TvDbId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("SickRageEpisodeCache");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.SonarrCache", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("TheMovieDbId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("TvDbId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("SonarrCache");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.SonarrEpisodeCache", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("EpisodeNumber")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("HasFile")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("MovieDbId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("SeasonNumber")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("TvDbId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("SonarrEpisodeCache");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Ombi.Store.Entities.EmbyContent", "Series")
|
||||||
|
.WithMany("Episodes")
|
||||||
|
.HasForeignKey("ParentId")
|
||||||
|
.HasPrincipalKey("EmbyId");
|
||||||
|
|
||||||
|
b.Navigation("Series");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.JellyfinEpisode", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Ombi.Store.Entities.JellyfinContent", "Series")
|
||||||
|
.WithMany("Episodes")
|
||||||
|
.HasForeignKey("ParentId")
|
||||||
|
.HasPrincipalKey("JellyfinId");
|
||||||
|
|
||||||
|
b.Navigation("Series");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Ombi.Store.Entities.PlexServerContent", "Series")
|
||||||
|
.WithMany("Episodes")
|
||||||
|
.HasForeignKey("GrandparentKey")
|
||||||
|
.HasPrincipalKey("Key")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Series");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Ombi.Store.Entities.PlexServerContent", null)
|
||||||
|
.WithMany("Seasons")
|
||||||
|
.HasForeignKey("PlexServerContentId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.EmbyContent", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Episodes");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.JellyfinContent", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Episodes");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.PlexServerContent", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Episodes");
|
||||||
|
|
||||||
|
b.Navigation("Seasons");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Ombi.Store.Migrations.ExternalSqlite
|
||||||
|
{
|
||||||
|
public partial class MediaServer4k : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "Has4K",
|
||||||
|
table: "PlexServerContent",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "Has4K",
|
||||||
|
table: "JellyfinContent",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "Has4K",
|
||||||
|
table: "EmbyContent",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Has4K",
|
||||||
|
table: "PlexServerContent");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Has4K",
|
||||||
|
table: "JellyfinContent");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Has4K",
|
||||||
|
table: "EmbyContent");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -44,6 +44,9 @@ namespace Ombi.Store.Migrations.ExternalSqlite
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("Has4K")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<string>("ImdbId")
|
b.Property<string>("ImdbId")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
@ -125,6 +128,9 @@ namespace Ombi.Store.Migrations.ExternalSqlite
|
||||||
b.Property<DateTime>("AddedAt")
|
b.Property<DateTime>("AddedAt")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("Has4K")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<string>("ImdbId")
|
b.Property<string>("ImdbId")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
@ -327,6 +333,9 @@ namespace Ombi.Store.Migrations.ExternalSqlite
|
||||||
b.Property<DateTime>("AddedAt")
|
b.Property<DateTime>("AddedAt")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("Has4K")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<string>("ImdbId")
|
b.Property<string>("ImdbId")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
// ************************************************************************/
|
// ************************************************************************/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -37,7 +36,6 @@ namespace Ombi.Store.Repository
|
||||||
{
|
{
|
||||||
public class EmbyContentRepository : MediaServerContentRepository<EmbyContent>, IEmbyContentRepository
|
public class EmbyContentRepository : MediaServerContentRepository<EmbyContent>, IEmbyContentRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
public EmbyContentRepository(ExternalContext db):base(db)
|
public EmbyContentRepository(ExternalContext db):base(db)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -97,7 +95,13 @@ namespace Ombi.Store.Repository
|
||||||
{
|
{
|
||||||
Db.EmbyContent.Update((EmbyContent)existingContent);
|
Db.EmbyContent.Update((EmbyContent)existingContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Task UpdateRange(IEnumerable<IMediaServerContent> existingContent)
|
||||||
|
{
|
||||||
|
Db.EmbyContent.UpdateRange((EmbyContent)existingContent);
|
||||||
|
return InternalSaveChanges();
|
||||||
|
}
|
||||||
|
|
||||||
public override RecentlyAddedType RecentlyAddedType => RecentlyAddedType.Emby;
|
public override RecentlyAddedType RecentlyAddedType => RecentlyAddedType.Emby;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,6 +10,7 @@ namespace Ombi.Store.Repository
|
||||||
{
|
{
|
||||||
RecentlyAddedType RecentlyAddedType{ get; }
|
RecentlyAddedType RecentlyAddedType{ get; }
|
||||||
Task Update(IMediaServerContent existingContent);
|
Task Update(IMediaServerContent existingContent);
|
||||||
|
Task UpdateRange(IEnumerable<IMediaServerContent> existingContent);
|
||||||
IQueryable<IMediaServerEpisode> GetAllEpisodes();
|
IQueryable<IMediaServerEpisode> GetAllEpisodes();
|
||||||
Task<IMediaServerEpisode> Add(IMediaServerEpisode content);
|
Task<IMediaServerEpisode> Add(IMediaServerEpisode content);
|
||||||
Task AddRange(IEnumerable<IMediaServerEpisode> content);
|
Task AddRange(IEnumerable<IMediaServerEpisode> content);
|
||||||
|
|
|
@ -98,6 +98,12 @@ namespace Ombi.Store.Repository
|
||||||
Db.JellyfinContent.Update((JellyfinContent)existingContent);
|
Db.JellyfinContent.Update((JellyfinContent)existingContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Task UpdateRange(IEnumerable<IMediaServerContent> existingContent)
|
||||||
|
{
|
||||||
|
Db.JellyfinContent.UpdateRange((JellyfinContent)existingContent);
|
||||||
|
return InternalSaveChanges();
|
||||||
|
}
|
||||||
|
|
||||||
public override RecentlyAddedType RecentlyAddedType => RecentlyAddedType.Jellyfin;
|
public override RecentlyAddedType RecentlyAddedType => RecentlyAddedType.Jellyfin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,6 @@ namespace Ombi.Store.Repository
|
||||||
public abstract Task<IMediaServerEpisode> Add(IMediaServerEpisode content);
|
public abstract Task<IMediaServerEpisode> Add(IMediaServerEpisode content);
|
||||||
public abstract Task AddRange(IEnumerable<IMediaServerEpisode> content);
|
public abstract Task AddRange(IEnumerable<IMediaServerEpisode> content);
|
||||||
public abstract void UpdateWithoutSave(IMediaServerContent existingContent);
|
public abstract void UpdateWithoutSave(IMediaServerContent existingContent);
|
||||||
|
public abstract Task UpdateRange(IEnumerable<IMediaServerContent> existingContent);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -164,5 +164,10 @@ namespace Ombi.Store.Repository
|
||||||
await InternalSaveChanges();
|
await InternalSaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Task UpdateRange(IEnumerable<IMediaServerContent> existingContent)
|
||||||
|
{
|
||||||
|
Db.PlexServerContent.UpdateRange((PlexServerContent)existingContent);
|
||||||
|
return InternalSaveChanges();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue