Skip to content

Commit

Permalink
feat: automagically move trickplay files
Browse files Browse the repository at this point in the history
Automagically move trickplay files between the VFS and the underlying library/libraries.
  • Loading branch information
revam committed Oct 29, 2024
1 parent 152963a commit bba9d7e
Show file tree
Hide file tree
Showing 3 changed files with 257 additions and 26 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"shounen",
"signalr",
"tmdb",
"trickplay",
"tvshow",
"tvshows",
"viewshow",
Expand Down
33 changes: 26 additions & 7 deletions Shokofin/Resolvers/Models/LinkGenerationResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ public class LinkGenerationResult
public ConcurrentBag<string> RemovedPaths { get; init; } = [];

public int Total =>
TotalVideos + TotalSubtitles;
TotalVideos + TotalSubtitles + TotalTrickplayDirectories;

public int Created =>
CreatedVideos + CreatedSubtitles;
CreatedVideos + CreatedSubtitles + CreatedTrickplayDirectories;

public int Fixed =>
FixedVideos + FixedSubtitles;
FixedVideos + FixedSubtitles + FixedTrickplayDirectories;

public int Skipped =>
SkippedVideos + SkippedSubtitles;
SkippedVideos + SkippedSubtitles + SkippedTrickplayDirectories;

public int Removed =>
RemovedVideos + RemovedSubtitles + RemovedNfos;
RemovedVideos + RemovedSubtitles + RemovedNfos + RemovedTrickplayDirectories;

public int TotalVideos =>
CreatedVideos + FixedVideos + SkippedVideos;
Expand All @@ -50,25 +50,40 @@ public class LinkGenerationResult

public int RemovedSubtitles { get; set; }

public int TotalTrickplayDirectories =>
CreatedTrickplayDirectories + FixedTrickplayDirectories + SkippedTrickplayDirectories;

public int CreatedTrickplayDirectories { get; set; }

public int FixedTrickplayDirectories { get; set; }

public int SkippedTrickplayDirectories { get; set; }

public int RemovedTrickplayDirectories { get; set; }

public int RemovedNfos { get; set; }

public void Print(ILogger logger, string path)
{
var timeSpent = DateTime.Now - CreatedAt;
logger.LogInformation(
"Created {CreatedTotal} ({CreatedMedia},{CreatedSubtitles}), fixed {FixedTotal} ({FixedMedia},{FixedSubtitles}), skipped {SkippedTotal} ({SkippedMedia},{SkippedSubtitles}), and removed {RemovedTotal} ({RemovedMedia},{RemovedSubtitles},{RemovedNFO}) entries in folder at {Path} in {TimeSpan} (Total={Total})",
"Created {CreatedTotal} ({CreatedMedia},{CreatedSubtitles},{CreatedTrickplay}), fixed {FixedTotal} ({FixedMedia},{FixedSubtitles},{FixedTrickplay}), skipped {SkippedTotal} ({SkippedMedia},{SkippedSubtitles},{SkippedTrickplay}), and removed {RemovedTotal} ({RemovedMedia},{RemovedSubtitles},{RemovedTrickplay},{RemovedNFO}) entries in folder at {Path} in {TimeSpan} (Total={Total})",
Created,
CreatedVideos,
CreatedSubtitles,
CreatedTrickplayDirectories,
Fixed,
FixedVideos,
FixedSubtitles,
FixedTrickplayDirectories,
Skipped,
SkippedVideos,
SkippedSubtitles,
SkippedTrickplayDirectories,
Removed,
RemovedVideos,
RemovedSubtitles,
RemovedTrickplayDirectories,
RemovedNfos,
path,
timeSpent,
Expand All @@ -81,7 +96,7 @@ public void Print(ILogger logger, string path)
// Re-use the same instance so the parallel execution will share the same bag.
var paths = a.Paths;
foreach (var path in b.Paths)
a.Paths.Add(path);
paths.Add(path);

var removedPaths = a.RemovedPaths;
foreach (var path in b.RemovedPaths)
Expand All @@ -100,6 +115,10 @@ public void Print(ILogger logger, string path)
FixedSubtitles = a.FixedSubtitles + b.FixedSubtitles,
SkippedSubtitles = a.SkippedSubtitles + b.SkippedSubtitles,
RemovedSubtitles = a.RemovedSubtitles + b.RemovedSubtitles,
CreatedTrickplayDirectories = a.CreatedTrickplayDirectories + b.CreatedTrickplayDirectories,
FixedTrickplayDirectories = a.FixedTrickplayDirectories + b.FixedTrickplayDirectories,
SkippedTrickplayDirectories = a.SkippedTrickplayDirectories + b.SkippedTrickplayDirectories,
RemovedTrickplayDirectories = a.RemovedTrickplayDirectories + b.RemovedTrickplayDirectories,
RemovedNfos = a.RemovedNfos + b.RemovedNfos,
};
}
Expand Down
Loading

0 comments on commit bba9d7e

Please sign in to comment.