mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-18 19:25:00 -04:00
Merge pull request #13406 from Shadowghost/extract-trickplay-master
Extract trickplay files into own subdirectory
This commit is contained in:
commit
6331de2e13
4 changed files with 46 additions and 46 deletions
|
@ -34,76 +34,46 @@ namespace Emby.Server.Implementations.AppBase
|
|||
DataPath = Directory.CreateDirectory(Path.Combine(ProgramDataPath, "data")).FullName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to the program data folder.
|
||||
/// </summary>
|
||||
/// <value>The program data path.</value>
|
||||
/// <inheritdoc/>
|
||||
public string ProgramDataPath { get; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string WebPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to the system folder.
|
||||
/// </summary>
|
||||
/// <value>The path to the system folder.</value>
|
||||
/// <inheritdoc/>
|
||||
public string ProgramSystemPath { get; } = AppContext.BaseDirectory;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the folder path to the data directory.
|
||||
/// </summary>
|
||||
/// <value>The data directory.</value>
|
||||
/// <inheritdoc/>
|
||||
public string DataPath { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string VirtualDataPath => "%AppDataPath%";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the image cache path.
|
||||
/// </summary>
|
||||
/// <value>The image cache path.</value>
|
||||
/// <inheritdoc/>
|
||||
public string ImageCachePath => Path.Combine(CachePath, "images");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to the plugin directory.
|
||||
/// </summary>
|
||||
/// <value>The plugins path.</value>
|
||||
/// <inheritdoc/>
|
||||
public string PluginsPath => Path.Combine(ProgramDataPath, "plugins");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to the plugin configurations directory.
|
||||
/// </summary>
|
||||
/// <value>The plugin configurations path.</value>
|
||||
/// <inheritdoc/>
|
||||
public string PluginConfigurationsPath => Path.Combine(PluginsPath, "configurations");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to the log directory.
|
||||
/// </summary>
|
||||
/// <value>The log directory path.</value>
|
||||
/// <inheritdoc/>
|
||||
public string LogDirectoryPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to the application configuration root directory.
|
||||
/// </summary>
|
||||
/// <value>The configuration directory path.</value>
|
||||
/// <inheritdoc/>
|
||||
public string ConfigurationDirectoryPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to the system configuration file.
|
||||
/// </summary>
|
||||
/// <value>The system configuration file path.</value>
|
||||
/// <inheritdoc/>
|
||||
public string SystemConfigurationFilePath => Path.Combine(ConfigurationDirectoryPath, "system.xml");
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the folder path to the cache directory.
|
||||
/// </summary>
|
||||
/// <value>The cache directory.</value>
|
||||
/// <inheritdoc/>
|
||||
public string CachePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the folder path to the temp directory within the cache folder.
|
||||
/// </summary>
|
||||
/// <value>The temp directory.</value>
|
||||
/// <inheritdoc/>
|
||||
public string TempDirectory => Path.Join(Path.GetTempPath(), "jellyfin");
|
||||
|
||||
/// <inheritdoc />
|
||||
public string TrickplayPath => Path.Combine(DataPath, "trickplay");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -610,9 +610,11 @@ public class TrickplayManager : ITrickplayManager
|
|||
/// <inheritdoc />
|
||||
public string GetTrickplayDirectory(BaseItem item, int tileWidth, int tileHeight, int width, bool saveWithMedia = false)
|
||||
{
|
||||
var basePath = _config.ApplicationPaths.TrickplayPath;
|
||||
var idString = item.Id.ToString("N", CultureInfo.InvariantCulture);
|
||||
var path = saveWithMedia
|
||||
? Path.Combine(item.ContainingFolderPath, Path.ChangeExtension(item.Path, ".trickplay"))
|
||||
: Path.Combine(item.GetInternalMetadataPath(), "trickplay");
|
||||
: Path.Combine(basePath, idString);
|
||||
|
||||
var subdirectory = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,5 +84,11 @@ namespace MediaBrowser.Common.Configuration
|
|||
/// </summary>
|
||||
/// <value>The magic string used for virtual path manipulation.</value>
|
||||
string VirtualDataPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path used for storing trickplay files.
|
||||
/// </summary>
|
||||
/// <value>The trickplay path.</value>
|
||||
string TrickplayPath { get; }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue