mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Extract media attachment one by one if the filename appears to be a path (#11812)
This commit is contained in:
parent
bcf884ccfa
commit
45e8872cc0
@ -89,15 +89,28 @@ namespace MediaBrowser.MediaEncoding.Attachments
|
|||||||
string outputPath,
|
string outputPath,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
using (await _semaphoreLocks.LockAsync(outputPath, cancellationToken).ConfigureAwait(false))
|
var shouldExtractOneByOne = mediaSource.MediaAttachments.Any(a => a.FileName.Contains('/', StringComparison.OrdinalIgnoreCase) || a.FileName.Contains('\\', StringComparison.OrdinalIgnoreCase));
|
||||||
|
if (shouldExtractOneByOne)
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(outputPath))
|
var attachmentIndexes = mediaSource.MediaAttachments.Select(a => a.Index);
|
||||||
|
foreach (var i in attachmentIndexes)
|
||||||
{
|
{
|
||||||
await ExtractAllAttachmentsInternal(
|
var newName = Path.Join(outputPath, i.ToString(CultureInfo.InvariantCulture));
|
||||||
_mediaEncoder.GetInputArgument(inputFile, mediaSource),
|
await ExtractAttachment(inputFile, mediaSource, i, newName, cancellationToken).ConfigureAwait(false);
|
||||||
outputPath,
|
}
|
||||||
false,
|
}
|
||||||
cancellationToken).ConfigureAwait(false);
|
else
|
||||||
|
{
|
||||||
|
using (await _semaphoreLocks.LockAsync(outputPath, cancellationToken).ConfigureAwait(false))
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(outputPath))
|
||||||
|
{
|
||||||
|
await ExtractAllAttachmentsInternal(
|
||||||
|
_mediaEncoder.GetInputArgument(inputFile, mediaSource),
|
||||||
|
outputPath,
|
||||||
|
false,
|
||||||
|
cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user