Skip to content

Commit

Permalink
fix: attempt to upgrade trickplay files
Browse files Browse the repository at this point in the history
Attempt to "upgrade" the trickplay files in the underlying library if we have a newer version in the VFS compared to what is in the underlying library.
  • Loading branch information
revam committed Nov 10, 2024
1 parent ed9ca66 commit dc96e7d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Shokofin/Resolvers/VirtualFileSystemService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,18 @@ public LinkGenerationResult GenerateSymbolicLinks(string sourceLocation, string[
File.Delete(symbolicTrickplay);
}
else {
if (Directory.GetCreationTime(symbolicTrickplay) > Directory.GetCreationTime(trickplayLocation)) {
Logger.LogTrace("Replacing trickplay for target {Link} → {LinkTarget}", symbolicTrickplay, trickplayLocation);
try {
Directory.Delete(trickplayLocation, recursive: true);
Directory.CreateDirectory(trickplayLocation);
CopyDirectory(symbolicDirectory, trickplayLocation);
}
catch (Exception ex) {
if (!preview)
Logger.LogError(ex, "Failed to replace trickplay for target {Link} → {LinkTarget}", symbolicTrickplay, trickplayLocation);
}
}
Directory.Delete(symbolicTrickplay, recursive: true);
}
Directory.CreateSymbolicLink(symbolicTrickplay, trickplayLocation);
Expand Down

0 comments on commit dc96e7d

Please sign in to comment.