Compare commits
1 Commits
66716a9bc9
...
v0.0.10-al
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ba270c9a0 |
@@ -1,5 +1,5 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<AssemblyVersion>0.0.0.10</AssemblyVersion>
|
<AssemblyVersion>0.0.0.9</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -17,10 +17,7 @@ public class MovieHelper(ILogger logger)
|
|||||||
|
|
||||||
public bool IsMovieStale(BaseItem movie)
|
public bool IsMovieStale(BaseItem movie)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(movie, "IsMovieStale process recieved a null movie. Logic failure. Exception thrown.");
|
_loggingHelper.LogDebugInformation("Start of scanning for movie: {Movie}", movie);
|
||||||
|
|
||||||
_loggingHelper.LogDebugInformation("-------------------------------------------------");
|
|
||||||
_loggingHelper.LogDebugInformation("Scanning movie: {Movie}", movie);
|
|
||||||
_loggingHelper.LogDebugInformation("-------------------------------------------------");
|
_loggingHelper.LogDebugInformation("-------------------------------------------------");
|
||||||
|
|
||||||
bool movieIsStale = false;
|
bool movieIsStale = false;
|
||||||
@@ -50,20 +47,13 @@ public class MovieHelper(ILogger logger)
|
|||||||
movieIsStale = true;
|
movieIsStale = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (createdOutsideCutoff)
|
||||||
if (createdOutsideCutoff && !hasUserData)
|
|
||||||
{
|
{
|
||||||
_loggingHelper.LogDebugInformation("Movie has no user data and was created outside of cutoff: {DateCreated}.", movie.DateCreated);
|
_loggingHelper.LogDebugInformation("Movie has no user data and was created outside of cutoff: {DateCreated}.", movie.DateCreated);
|
||||||
_loggingHelper.LogDebugInformation("Adding {Movie} to stale movies.", movie);
|
_loggingHelper.LogDebugInformation("Adding {Movie} to stale movies.", movie);
|
||||||
movieIsStale = true;
|
movieIsStale = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!createdOutsideCutoff && !hasUserData)
|
|
||||||
{
|
|
||||||
_loggingHelper.LogDebugInformation("Movie has no user data and was not created outside of cutoff: {DateCreated}.", movie.DateCreated);
|
|
||||||
_loggingHelper.LogDebugInformation("Movie is not stale.");
|
|
||||||
}
|
|
||||||
|
|
||||||
_loggingHelper.LogDebugInformation("-------------------------------------------------");
|
_loggingHelper.LogDebugInformation("-------------------------------------------------");
|
||||||
_loggingHelper.LogDebugInformation("End of scanning for movie: {Movie}", movie);
|
_loggingHelper.LogDebugInformation("End of scanning for movie: {Movie}", movie);
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,10 @@ public class SeriesHelper(ILogger logger)
|
|||||||
|
|
||||||
public bool IsSeasonDataStale(IReadOnlyList<BaseItem> episodes)
|
public bool IsSeasonDataStale(IReadOnlyList<BaseItem> episodes)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(episodes, "IsSeasonDataStale process recieved null episodes. Logic failure. Exception thrown.");
|
if(episodes == null)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(episodes);
|
||||||
|
}
|
||||||
|
|
||||||
bool seasonIsStale = false;
|
bool seasonIsStale = false;
|
||||||
|
|
||||||
|
|||||||
@@ -73,59 +73,46 @@ public sealed class StaleMediaTask : IScheduledTask
|
|||||||
|
|
||||||
List<BaseItem> allItems = [.. _libraryManager.GetItemsResult(query).Items];
|
List<BaseItem> allItems = [.. _libraryManager.GetItemsResult(query).Items];
|
||||||
|
|
||||||
_loggingHelper.LogInformation("Total items to scan: {ItemCount}", allItems.Count);
|
_loggingHelper.LogInformation("Total items: {ItemCount}", allItems.Count);
|
||||||
_loggingHelper.LogDebugInformation("Items found: {AllItems}", allItems);
|
_loggingHelper.LogInformation("Stale items found: {AllItems}", allItems);
|
||||||
|
|
||||||
List<BaseItem> series = [.. allItems.Where(item => item.GetBaseItemKind() == BaseItemKind.Series)];
|
List<BaseItem> series = [.. allItems.Where(item => item.GetBaseItemKind() == BaseItemKind.Series)];
|
||||||
List<BaseItem> movies = [.. allItems.Where(item => item.GetBaseItemKind() == BaseItemKind.Movie)];
|
List<BaseItem> movies = [.. allItems.Where(item => item.GetBaseItemKind() == BaseItemKind.Movie)];
|
||||||
|
|
||||||
_loggingHelper.LogDebugInformation("-------------------------------------------------");
|
_loggingHelper.LogInformation("-------------------------------------------------");
|
||||||
_loggingHelper.LogDebugInformation("Starting scan of series items.");
|
_loggingHelper.LogInformation("Starting scan of series items.");
|
||||||
|
_loggingHelper.LogInformation("-------------------------------------------------");
|
||||||
|
|
||||||
List<BaseItem> staleSeasons = [.. series.SelectMany(GetStaleSeasons)];
|
List<BaseItem> staleSeasons = [.. series.SelectMany(GetStaleSeasons)];
|
||||||
|
|
||||||
_loggingHelper.LogDebugInformation("-------------------------------------------------");
|
_loggingHelper.LogInformation("Starting scan of movies items.");
|
||||||
_loggingHelper.LogDebugInformation("End of scan for series items.");
|
_loggingHelper.LogInformation("-------------------------------------------------");
|
||||||
|
|
||||||
_loggingHelper.LogDebugInformation("-------------------------------------------------");
|
|
||||||
_loggingHelper.LogDebugInformation("Starting scan of movie items.");
|
|
||||||
|
|
||||||
List<BaseItem> staleMovies = [.. GetStaleMovies(movies)];
|
List<BaseItem> staleMovies = [.. GetStaleMovies(movies)];
|
||||||
|
|
||||||
_loggingHelper.LogDebugInformation("-------------------------------------------------");
|
_loggingHelper.LogInformation("-------------------------------------------------");
|
||||||
_loggingHelper.LogDebugInformation("End of scan for movie items.");
|
_loggingHelper.LogInformation("Stale Movies found: {StaleMovies}", staleMovies.Count);
|
||||||
|
|
||||||
|
if (staleMovies.Count > 0 && Configuration.DebugMode)
|
||||||
|
{
|
||||||
|
foreach (var movieInfo in staleMovies)
|
||||||
|
{
|
||||||
|
_loggingHelper.LogDebugInformation("Movie Info: ID: {Id} | Movie Name: {MovieName}", [movieInfo.Id, movieInfo.Name]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_loggingHelper.LogInformation("-------------------------------------------------");
|
_loggingHelper.LogInformation("-------------------------------------------------");
|
||||||
_loggingHelper.LogInformation("Stale seasons found: {StaleSeasons}", staleSeasons.Count);
|
_loggingHelper.LogInformation("Stale seasons found: {StaleSeasons}", staleSeasons.Count);
|
||||||
|
|
||||||
if (staleSeasons.Count > 0)
|
if (staleSeasons.Count > 0 && Configuration.DebugMode)
|
||||||
{
|
{
|
||||||
IEnumerable<SeriesInfo> staleSeriesInfo = FindSeriesInfo(staleSeasons);
|
IEnumerable<SeriesInfo> staleSeriesInfo = FindSeriesInfo(staleSeasons);
|
||||||
|
|
||||||
foreach (var seriesInfo in staleSeriesInfo)
|
foreach (var seriesInfo in staleSeriesInfo)
|
||||||
{
|
{
|
||||||
_loggingHelper.LogInformation("Series Info: ID: {Id} | Series Name: {SeriesName} | Stale Seasons: {Seasons}", [seriesInfo.Id, seriesInfo.SeriesName, string.Join(", ", seriesInfo.Seasons)]);
|
_loggingHelper.LogDebugInformation("Series Info: ID: {Id} | Series Name: {SeriesName} | Stale Seasons: {Seasons}", [seriesInfo.Id, seriesInfo.SeriesName, string.Join(", ", seriesInfo.Seasons)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
_loggingHelper.LogInformation("No stale seasons found!");
|
|
||||||
}
|
|
||||||
|
|
||||||
_loggingHelper.LogInformation("-------------------------------------------------");
|
|
||||||
_loggingHelper.LogInformation("Stale Movies found: {StaleMovies}", staleMovies.Count);
|
|
||||||
|
|
||||||
if (staleMovies.Count > 0)
|
|
||||||
{
|
|
||||||
foreach (var movieInfo in staleMovies)
|
|
||||||
{
|
|
||||||
_loggingHelper.LogInformation("Movie Info: ID: {Id} | Movie Name: {MovieName}", [movieInfo.Id, movieInfo.Name]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_loggingHelper.LogInformation("No stale movies found!");
|
|
||||||
}
|
|
||||||
|
|
||||||
_loggingHelper.LogInformation("-------------------------------------------------");
|
_loggingHelper.LogInformation("-------------------------------------------------");
|
||||||
_loggingHelper.LogInformation("Ending stale media scan...");
|
_loggingHelper.LogInformation("Ending stale media scan...");
|
||||||
@@ -138,15 +125,7 @@ public sealed class StaleMediaTask : IScheduledTask
|
|||||||
{
|
{
|
||||||
List<BaseItem> staleMovies = [];
|
List<BaseItem> staleMovies = [];
|
||||||
|
|
||||||
try
|
staleMovies.AddRange(movies.Where(_movieHelper.IsMovieStale));
|
||||||
{
|
|
||||||
staleMovies.AddRange(movies.Where(_movieHelper.IsMovieStale));
|
|
||||||
}
|
|
||||||
catch (ArgumentNullException ex)
|
|
||||||
{
|
|
||||||
_loggingHelper.LogInformation("Arguement Null Exception in GetStaleMovies!");
|
|
||||||
_loggingHelper.LogInformation(ex.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return staleMovies;
|
return staleMovies;
|
||||||
}
|
}
|
||||||
@@ -154,10 +133,10 @@ public sealed class StaleMediaTask : IScheduledTask
|
|||||||
|
|
||||||
private List<BaseItem> GetStaleSeasons(BaseItem item)
|
private List<BaseItem> GetStaleSeasons(BaseItem item)
|
||||||
{
|
{
|
||||||
_loggingHelper.LogDebugInformation("-------------------------------------------------");
|
|
||||||
_loggingHelper.LogDebugInformation("Debug data for series: {SeriesName}", item.Name);
|
_loggingHelper.LogDebugInformation("Debug data for series: {SeriesName}", item.Name);
|
||||||
_loggingHelper.LogDebugInformation("-------------------------------------------------");
|
_loggingHelper.LogDebugInformation("-------------------------------------------------");
|
||||||
|
|
||||||
|
// Gets each season in a show
|
||||||
var seasons = _libraryManager.GetItemList(new InternalItemsQuery
|
var seasons = _libraryManager.GetItemList(new InternalItemsQuery
|
||||||
{
|
{
|
||||||
ParentId = item.Id,
|
ParentId = item.Id,
|
||||||
@@ -174,17 +153,7 @@ public sealed class StaleMediaTask : IScheduledTask
|
|||||||
|
|
||||||
_loggingHelper.LogDebugInformation("Season debug information for {SeasonNumber}:", season);
|
_loggingHelper.LogDebugInformation("Season debug information for {SeasonNumber}:", season);
|
||||||
|
|
||||||
bool isSeasonDataStale = false;
|
bool isSeasonDataStale = _seriesHelper.IsSeasonDataStale(episodes);
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
isSeasonDataStale = _seriesHelper.IsSeasonDataStale(episodes);
|
|
||||||
}
|
|
||||||
catch (ArgumentNullException ex)
|
|
||||||
{
|
|
||||||
_loggingHelper.LogInformation("Arguement Null Exception in GetStaleSeasons!");
|
|
||||||
_loggingHelper.LogInformation(ex.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
_loggingHelper.LogDebugInformation("End of season debug information for {SeasonNumber}.", season);
|
_loggingHelper.LogDebugInformation("End of season debug information for {SeasonNumber}.", season);
|
||||||
|
|
||||||
@@ -194,6 +163,7 @@ public sealed class StaleMediaTask : IScheduledTask
|
|||||||
|
|
||||||
_loggingHelper.LogDebugInformation("-------------------------------------------------");
|
_loggingHelper.LogDebugInformation("-------------------------------------------------");
|
||||||
_loggingHelper.LogDebugInformation("End of scanning for series: {Series}", item);
|
_loggingHelper.LogDebugInformation("End of scanning for series: {Series}", item);
|
||||||
|
_loggingHelper.LogDebugInformation("-------------------------------------------------");
|
||||||
|
|
||||||
return staleSeasons;
|
return staleSeasons;
|
||||||
}
|
}
|
||||||
@@ -223,7 +193,6 @@ public sealed class StaleMediaTask : IScheduledTask
|
|||||||
IEnumerable<TaskTriggerInfo> IScheduledTask.GetDefaultTriggers()
|
IEnumerable<TaskTriggerInfo> IScheduledTask.GetDefaultTriggers()
|
||||||
{
|
{
|
||||||
// Run this task every 24 hours
|
// Run this task every 24 hours
|
||||||
// Unnecessary, and will be removed once front end page is ready.
|
|
||||||
yield return new TaskTriggerInfo
|
yield return new TaskTriggerInfo
|
||||||
{
|
{
|
||||||
Type = TaskTriggerInfoType.IntervalTrigger,
|
Type = TaskTriggerInfoType.IntervalTrigger,
|
||||||
|
|||||||
Reference in New Issue
Block a user