Merge pull request #7802 from jellyfin/external

This commit is contained in:
Cody Robibero 2022-05-29 08:49:36 -06:00 committed by GitHub
commit 9954cbd550
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 14 deletions

View File

@ -106,19 +106,28 @@ namespace MediaBrowser.Providers.MediaInfo
if (mediaInfo.MediaStreams.Count == 1)
{
MediaStream mediaStream = mediaInfo.MediaStreams[0];
mediaStream.Index = startIndex++;
mediaStream.IsDefault = pathInfo.IsDefault || mediaStream.IsDefault;
mediaStream.IsForced = pathInfo.IsForced || mediaStream.IsForced;
mediaStreams.Add(MergeMetadata(mediaStream, pathInfo));
if ((mediaStream.Type == MediaStreamType.Audio && _type == DlnaProfileType.Audio)
|| (mediaStream.Type == MediaStreamType.Subtitle && _type == DlnaProfileType.Subtitle))
{
mediaStream.Index = startIndex++;
mediaStream.IsDefault = pathInfo.IsDefault || mediaStream.IsDefault;
mediaStream.IsForced = pathInfo.IsForced || mediaStream.IsForced;
mediaStreams.Add(MergeMetadata(mediaStream, pathInfo));
}
}
else
{
foreach (MediaStream mediaStream in mediaInfo.MediaStreams)
{
mediaStream.Index = startIndex++;
if ((mediaStream.Type == MediaStreamType.Audio && _type == DlnaProfileType.Audio)
|| (mediaStream.Type == MediaStreamType.Subtitle && _type == DlnaProfileType.Subtitle))
{
mediaStream.Index = startIndex++;
mediaStreams.Add(MergeMetadata(mediaStream, pathInfo));
mediaStreams.Add(MergeMetadata(mediaStream, pathInfo));
}
}
}
}
@ -222,13 +231,6 @@ namespace MediaBrowser.Providers.MediaInfo
mediaStream.Title = string.IsNullOrEmpty(mediaStream.Title) ? (string.IsNullOrEmpty(pathInfo.Title) ? null : pathInfo.Title) : mediaStream.Title;
mediaStream.Language = string.IsNullOrEmpty(mediaStream.Language) ? (string.IsNullOrEmpty(pathInfo.Language) ? null : pathInfo.Language) : mediaStream.Language;
mediaStream.Type = _type switch
{
DlnaProfileType.Audio => MediaStreamType.Audio,
DlnaProfileType.Subtitle => MediaStreamType.Subtitle,
_ => mediaStream.Type
};
return mediaStream;
}
}

View File

@ -43,6 +43,9 @@ public class AudioResolverTests
MediaStreams = new List<MediaStream>
{
new()
{
Type = MediaStreamType.Audio
}
}
}));

View File

@ -359,7 +359,10 @@ public class MediaInfoResolverTests
var mediaStreams = new List<MediaStream>();
for (int i = 0; i < streamCount; i++)
{
mediaStreams.Add(new());
mediaStreams.Add(new()
{
Type = MediaStreamType.Subtitle
});
}
return mediaStreams;

View File

@ -43,6 +43,9 @@ public class SubtitleResolverTests
MediaStreams = new List<MediaStream>
{
new()
{
Type = MediaStreamType.Subtitle
}
}
}));