mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-15 02:33:33 +01:00
Merge pull request #13406 from Shadowghost/extract-trickplay-master
Extract trickplay files into own subdirectory
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user