|
|
@ -66,23 +66,15 @@ namespace MediaBrowser.MediaEncoding.Attachments
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var mediaSources = await _mediaSourceManager.GetPlayackMediaSources(item, null, true, false, cancellationToken).ConfigureAwait(false);
|
|
|
|
var mediaSources = await _mediaSourceManager.GetPlayackMediaSources(item, null, true, false, cancellationToken).ConfigureAwait(false);
|
|
|
|
MediaSourceInfo mediaSource;
|
|
|
|
var mediaSource = mediaSources
|
|
|
|
MediaAttachment mediaAttachment;
|
|
|
|
.FirstOrDefault(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase));
|
|
|
|
try
|
|
|
|
if (mediaSource == null)
|
|
|
|
{
|
|
|
|
|
|
|
|
mediaSource = mediaSources
|
|
|
|
|
|
|
|
.First(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex) when (ex is ArgumentNullException || ex is InvalidOperationException)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw new ResourceNotFoundException($"MediaSource {mediaSourceId} not found");
|
|
|
|
throw new ResourceNotFoundException($"MediaSource {mediaSourceId} not found");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
try
|
|
|
|
var mediaAttachment = mediaSource.MediaAttachments
|
|
|
|
{
|
|
|
|
.FirstOrDefault(i => i.Index == attachmentStreamIndex);
|
|
|
|
mediaAttachment = mediaSource.MediaAttachments
|
|
|
|
if (mediaAttachment == null)
|
|
|
|
.First(i => i.Index == attachmentStreamIndex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex) when (ex is ArgumentNullException || ex is InvalidOperationException)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw new ResourceNotFoundException($"MediaSource {mediaSourceId} has no attachment with stream index {attachmentStreamIndex}");
|
|
|
|
throw new ResourceNotFoundException($"MediaSource {mediaSourceId} has no attachment with stream index {attachmentStreamIndex}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|