Compare commits
5 Commits
v0.0.9-alp
...
d78d1069b1
| Author | SHA1 | Date | |
|---|---|---|---|
| d78d1069b1 | |||
| f7c463aba4 | |||
| 77f2873180 | |||
| b2da7beb00 | |||
| 9696826406 |
@@ -1,5 +1,5 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<AssemblyVersion>0.0.0.8</AssemblyVersion>
|
<AssemblyVersion>0.0.0.9</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -63,12 +63,12 @@ public class LoggingHelper
|
|||||||
_logger.LogInformation("-------------------------------------------------");
|
_logger.LogInformation("-------------------------------------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PrintStaleItemsInformation(IReadOnlyCollection<BaseItem> staleItems)
|
public void PrintItemsInformation(IReadOnlyCollection<BaseItem> items)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(staleItems);
|
ArgumentNullException.ThrowIfNull(items);
|
||||||
|
|
||||||
_logger.LogInformation("Total stale items: {ItemCount}", staleItems.Count);
|
_logger.LogInformation("Total items: {ItemCount}", items.Count);
|
||||||
_logger.LogInformation("Stale items found: {AllItems}", staleItems);
|
_logger.LogInformation("Stale items found: {AllItems}", items);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PrintStaleMoviesInformation(IReadOnlyCollection<BaseItem> staleMovies)
|
public void PrintStaleMoviesInformation(IReadOnlyCollection<BaseItem> staleMovies)
|
||||||
@@ -149,13 +149,11 @@ public class LoggingHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PrintDebugNoUserDataAndOutsideCutoffEpisodeInfo(IReadOnlyCollection<BaseItem> episodes)
|
public void PrintDebugEpisodeCreationInfo(IReadOnlyCollection<BaseItem> episodes)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(episodes);
|
ArgumentNullException.ThrowIfNull(episodes);
|
||||||
|
|
||||||
if(Configuration.DebugMode){
|
if(Configuration.DebugMode){
|
||||||
_logger.LogInformation("No user data, and creation date is outside of media cutoff, Season is stale.");
|
|
||||||
|
|
||||||
_logger.LogInformation("-------------------------------------------------");
|
_logger.LogInformation("-------------------------------------------------");
|
||||||
_logger.LogInformation("Episode creation dates:");
|
_logger.LogInformation("Episode creation dates:");
|
||||||
_logger.LogInformation("-------------------------------------------------");
|
_logger.LogInformation("-------------------------------------------------");
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public sealed class StaleMediaTask : IScheduledTask
|
|||||||
|
|
||||||
List<BaseItem> allItems = [.. _libraryManager.GetItemsResult(query).Items];
|
List<BaseItem> allItems = [.. _libraryManager.GetItemsResult(query).Items];
|
||||||
|
|
||||||
_loggingHelper.PrintStaleItemsInformation(allItems);
|
_loggingHelper.PrintItemsInformation(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)];
|
||||||
@@ -121,24 +121,16 @@ public sealed class StaleMediaTask : IScheduledTask
|
|||||||
Recursive = false
|
Recursive = false
|
||||||
});
|
});
|
||||||
|
|
||||||
bool seasonCreatedOutsideCutoff = episodes.All(episode => episode.DateCreated < DateTime.Now.AddDays(-Configuration.StaleMediaCutoff));
|
|
||||||
|
|
||||||
_loggingHelper.PrintDebugSeasonInfo();
|
_loggingHelper.PrintDebugSeasonInfo();
|
||||||
|
|
||||||
if (seasonCreatedOutsideCutoff)
|
|
||||||
{
|
|
||||||
_loggingHelper.PrintDebugSeasonCreatedOutsideCutoff();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool seasonHasUserData = episodes.Any(episode => episode.UserData.Count > 0);
|
bool seasonHasUserData = episodes.Any(episode => episode.UserData.Count > 0);
|
||||||
bool seasonIsStale = (seasonHasUserData && _seriesHelper.IsSeasonUserDataStale(episodes)) || seasonCreatedOutsideCutoff;
|
bool seasonIsStale = seasonHasUserData && _seriesHelper.IsSeasonUserDataStale(episodes);
|
||||||
bool noUserDataAndOutsideCutoff = !seasonHasUserData && seasonCreatedOutsideCutoff;
|
|
||||||
|
|
||||||
if (seasonIsStale)
|
if (seasonIsStale)
|
||||||
{
|
{
|
||||||
if (noUserDataAndOutsideCutoff)
|
if (!seasonHasUserData)
|
||||||
{
|
{
|
||||||
_loggingHelper.PrintDebugNoUserDataAndOutsideCutoffEpisodeInfo(episodes);
|
_loggingHelper.PrintDebugEpisodeCreationInfo(episodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
staleEpisodes.AddRange(episodes);
|
staleEpisodes.AddRange(episodes);
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
The idea behind this plugin is to have an easy way to run a task to find all movies and shows in your media collection that users haven't viewed in a number of cutoff days.
|
The idea behind this plugin is to have an easy way to run a task to find all movies and shows in your media collection that users haven't viewed in a number of cutoff days.
|
||||||
|
|
||||||
At the time of writing, the plugin is only capable of logging movies and shows that are stale (Unwatched for 90 days) by running a scheduled task. You will need to view your logs to know the number of stale files.
|
At the time of writing, the plugin is only capable of logging movies and shows that are stale (Unwatched for a user set number of days) by running a scheduled task. You will need to view your logs to know the number of stale files and the names of said files.
|
||||||
|
|
||||||
Planned features:
|
Planned features:
|
||||||
- Better logging to show more than just the count.
|
- Better logging to show more than just the count. ✅
|
||||||
- A page that shows what media is currently flagged for removal. And a button to confirm removal.
|
- A page that shows what media is currently flagged for removal. And a button to confirm removal.
|
||||||
- Integration with sonarr and radarr apis to delete your media.
|
- Integration with sonarr and radarr apis to delete your media.
|
||||||
- Whitelist for shows to ignore. (Seasonal shows)
|
- Whitelist for shows to ignore. (Seasonal shows)
|
||||||
|
|||||||
Reference in New Issue
Block a user