Fix broken integration with Plex libraries

This commit is contained in:
Florian Dupret 2022-01-17 10:32:22 +01:00
commit 26177e5236
3 changed files with 41 additions and 4 deletions

View file

@ -182,7 +182,7 @@ namespace Ombi.Schedule.Jobs.Plex
foreach (var content in allContent.OrderByDescending(x => x.viewGroup)) foreach (var content in allContent.OrderByDescending(x => x.viewGroup))
{ {
Logger.LogDebug($"Got type '{content.viewGroup}' to process"); Logger.LogDebug($"Got type '{content.viewGroup}' to process");
if (content.viewGroup.Equals(MediaType.Episode.ToString(), StringComparison.InvariantCultureIgnoreCase)) if (content.viewGroup.Equals(PlexMediaType.Episode.ToString(), StringComparison.InvariantCultureIgnoreCase))
{ {
Logger.LogDebug("Found some episodes, this must be a recently added sync"); Logger.LogDebug("Found some episodes, this must be a recently added sync");
var count = 0; var count = 0;
@ -230,7 +230,7 @@ namespace Ombi.Schedule.Jobs.Plex
episodesProcessed.AddRange(episodesAdded.Select(x => x.Id)); episodesProcessed.AddRange(episodesAdded.Select(x => x.Id));
} }
} }
if (content.viewGroup.Equals(MediaType.Series.ToString(), StringComparison.InvariantCultureIgnoreCase)) if (content.viewGroup.Equals(PlexMediaType.Show.ToString(), StringComparison.InvariantCultureIgnoreCase))
{ {
// Process Shows // Process Shows
Logger.LogDebug("Processing TV Shows"); Logger.LogDebug("Processing TV Shows");
@ -260,7 +260,7 @@ namespace Ombi.Schedule.Jobs.Plex
await Repo.SaveChangesAsync(); await Repo.SaveChangesAsync();
} }
if (content.viewGroup.Equals(MediaType.Movie.ToString(), StringComparison.InvariantCultureIgnoreCase)) if (content.viewGroup.Equals(PlexMediaType.Movie.ToString(), StringComparison.InvariantCultureIgnoreCase))
{ {
await MovieLoop(servers, content, contentToAdd, contentProcessed); await MovieLoop(servers, content, contentToAdd, contentProcessed);
} }

View file

@ -83,7 +83,7 @@ namespace Ombi.Schedule.Jobs.Plex
var sections = await _api.GetLibrarySections(settings.PlexAuthToken, settings.FullUri); var sections = await _api.GetLibrarySections(settings.PlexAuthToken, settings.FullUri);
// Filter the libSections // Filter the libSections
var tvSections = sections.MediaContainer.Directory.Where(x => x.type.Equals(MediaType.Series.ToString(), StringComparison.CurrentCultureIgnoreCase)); var tvSections = sections.MediaContainer.Directory.Where(x => x.type.Equals(PlexMediaType.Show.ToString(), StringComparison.CurrentCultureIgnoreCase));
foreach (var section in tvSections) foreach (var section in tvSections)
{ {

View file

@ -0,0 +1,37 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2017 Jamie Rees
// File: PlexContentCacher.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 Ombi.Schedule.Jobs
{
public enum PlexMediaType
{
Movie = 0,
Show = 1,
Episode = 2,
}
}