diff options
| author | Shadowghost <Ghost_of_Stone@web.de> | 2025-01-22 18:20:57 +0100 |
|---|---|---|
| committer | Shadowghost <Ghost_of_Stone@web.de> | 2025-01-26 11:56:19 +0100 |
| commit | 6454a35ef831157fb10d8cbdf39017b2df2b8449 (patch) | |
| tree | 4800866dc86a6938f4fe1ca7f6117ee07515342b /Jellyfin.Server/Migrations/Routines/MoveTrickplayFiles.cs | |
| parent | b318f335991167102a5fa8d65030d200bbec898d (diff) | |
Extract trickplay files into own subdirectory
Diffstat (limited to 'Jellyfin.Server/Migrations/Routines/MoveTrickplayFiles.cs')
| -rw-r--r-- | Jellyfin.Server/Migrations/Routines/MoveTrickplayFiles.cs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/Jellyfin.Server/Migrations/Routines/MoveTrickplayFiles.cs b/Jellyfin.Server/Migrations/Routines/MoveTrickplayFiles.cs index c1a9e8894..f4ebac377 100644 --- a/Jellyfin.Server/Migrations/Routines/MoveTrickplayFiles.cs +++ b/Jellyfin.Server/Migrations/Routines/MoveTrickplayFiles.cs @@ -39,7 +39,7 @@ public class MoveTrickplayFiles : IMigrationRoutine } /// <inheritdoc /> - public Guid Id => new("4EF123D5-8EFF-4B0B-869D-3AED07A60E1B"); + public Guid Id => new("9540D44A-D8DC-11EF-9CBB-B77274F77C52"); /// <inheritdoc /> public string Name => "MoveTrickplayFiles"; @@ -89,6 +89,12 @@ public class MoveTrickplayFiles : IMigrationRoutine { _fileSystem.MoveDirectory(oldPath, newPath); } + + oldPath = GetNewOldTrickplayDirectory(item, trickplayInfo.TileWidth, trickplayInfo.TileHeight, trickplayInfo.Width, false); + if (_fileSystem.DirectoryExists(oldPath)) + { + _fileSystem.MoveDirectory(oldPath, newPath); + } } } while (previousCount == Limit); @@ -101,4 +107,20 @@ public class MoveTrickplayFiles : IMigrationRoutine return width.HasValue ? Path.Combine(path, width.Value.ToString(CultureInfo.InvariantCulture)) : path; } + + private string GetNewOldTrickplayDirectory(BaseItem item, int tileWidth, int tileHeight, int width, bool saveWithMedia = false) + { + var path = saveWithMedia + ? Path.Combine(item.ContainingFolderPath, Path.ChangeExtension(item.Path, ".trickplay")) + : Path.Combine(item.GetInternalMetadataPath(), "trickplay"); + + var subdirectory = string.Format( + CultureInfo.InvariantCulture, + "{0} - {1}x{2}", + width.ToString(CultureInfo.InvariantCulture), + tileWidth.ToString(CultureInfo.InvariantCulture), + tileHeight.ToString(CultureInfo.InvariantCulture)); + + return Path.Combine(path, subdirectory); + } } |
