| | | 1 | | using System; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using System.IO; |
| | | 4 | | using System.Linq; |
| | | 5 | | using System.Threading; |
| | | 6 | | using System.Threading.Tasks; |
| | | 7 | | using Emby.Naming.Common; |
| | | 8 | | using Emby.Naming.ExternalFiles; |
| | | 9 | | using MediaBrowser.Controller.Entities; |
| | | 10 | | using MediaBrowser.Controller.Entities.Audio; |
| | | 11 | | using MediaBrowser.Controller.MediaEncoding; |
| | | 12 | | using MediaBrowser.Controller.Providers; |
| | | 13 | | using MediaBrowser.Model.Dlna; |
| | | 14 | | using MediaBrowser.Model.Dto; |
| | | 15 | | using MediaBrowser.Model.Entities; |
| | | 16 | | using MediaBrowser.Model.Globalization; |
| | | 17 | | using MediaBrowser.Model.IO; |
| | | 18 | | using MediaBrowser.Model.MediaInfo; |
| | | 19 | | using Microsoft.Extensions.Logging; |
| | | 20 | | |
| | | 21 | | namespace MediaBrowser.Providers.MediaInfo |
| | | 22 | | { |
| | | 23 | | /// <summary> |
| | | 24 | | /// Resolves external files for <see cref="Video"/>. |
| | | 25 | | /// </summary> |
| | | 26 | | public abstract class MediaInfoResolver |
| | | 27 | | { |
| | | 28 | | /// <summary> |
| | | 29 | | /// The <see cref="ExternalPathParser"/> instance. |
| | | 30 | | /// </summary> |
| | | 31 | | private readonly ExternalPathParser _externalPathParser; |
| | | 32 | | |
| | | 33 | | /// <summary> |
| | | 34 | | /// The <see cref="IMediaEncoder"/> instance. |
| | | 35 | | /// </summary> |
| | | 36 | | private readonly IMediaEncoder _mediaEncoder; |
| | | 37 | | |
| | | 38 | | private readonly ILogger _logger; |
| | | 39 | | private readonly IFileSystem _fileSystem; |
| | | 40 | | |
| | | 41 | | /// <summary> |
| | | 42 | | /// The <see cref="NamingOptions"/> instance. |
| | | 43 | | /// </summary> |
| | | 44 | | private readonly NamingOptions _namingOptions; |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// The <see cref="DlnaProfileType"/> of the files this resolver should resolve. |
| | | 48 | | /// </summary> |
| | | 49 | | private readonly DlnaProfileType _type; |
| | | 50 | | |
| | | 51 | | /// <summary> |
| | | 52 | | /// Initializes a new instance of the <see cref="MediaInfoResolver"/> class. |
| | | 53 | | /// </summary> |
| | | 54 | | /// <param name="logger">The logger.</param> |
| | | 55 | | /// <param name="localizationManager">The localization manager.</param> |
| | | 56 | | /// <param name="mediaEncoder">The media encoder.</param> |
| | | 57 | | /// <param name="fileSystem">The file system.</param> |
| | | 58 | | /// <param name="namingOptions">The <see cref="NamingOptions"/> object containing FileExtensions, MediaDefaultFl |
| | | 59 | | /// <param name="type">The <see cref="DlnaProfileType"/> of the parsed file.</param> |
| | | 60 | | protected MediaInfoResolver( |
| | | 61 | | ILogger logger, |
| | | 62 | | ILocalizationManager localizationManager, |
| | | 63 | | IMediaEncoder mediaEncoder, |
| | | 64 | | IFileSystem fileSystem, |
| | | 65 | | NamingOptions namingOptions, |
| | | 66 | | DlnaProfileType type) |
| | | 67 | | { |
| | 195 | 68 | | _logger = logger; |
| | 195 | 69 | | _mediaEncoder = mediaEncoder; |
| | 195 | 70 | | _fileSystem = fileSystem; |
| | 195 | 71 | | _namingOptions = namingOptions; |
| | 195 | 72 | | _type = type; |
| | 195 | 73 | | _externalPathParser = new ExternalPathParser(namingOptions, localizationManager, _type); |
| | 195 | 74 | | } |
| | | 75 | | |
| | | 76 | | /// <summary> |
| | | 77 | | /// Retrieves the external streams for the provided video. |
| | | 78 | | /// </summary> |
| | | 79 | | /// <param name="video">The <see cref="Video"/> object to search external streams for.</param> |
| | | 80 | | /// <param name="startIndex">The stream index to start adding external streams at.</param> |
| | | 81 | | /// <param name="directoryService">The directory service to search for files.</param> |
| | | 82 | | /// <param name="clearCache">True if the directory service cache should be cleared before searching.</param> |
| | | 83 | | /// <param name="cancellationToken">The cancellation token.</param> |
| | | 84 | | /// <returns>The external streams located.</returns> |
| | | 85 | | public async Task<IReadOnlyList<MediaStream>> GetExternalStreamsAsync( |
| | | 86 | | Video video, |
| | | 87 | | int startIndex, |
| | | 88 | | IDirectoryService directoryService, |
| | | 89 | | bool clearCache, |
| | | 90 | | CancellationToken cancellationToken) |
| | | 91 | | { |
| | 19 | 92 | | if (!video.IsFileProtocol) |
| | | 93 | | { |
| | 1 | 94 | | return Array.Empty<MediaStream>(); |
| | | 95 | | } |
| | | 96 | | |
| | 18 | 97 | | var pathInfos = GetExternalFiles(video, directoryService, clearCache); |
| | | 98 | | |
| | 18 | 99 | | if (!pathInfos.Any()) |
| | | 100 | | { |
| | 5 | 101 | | return Array.Empty<MediaStream>(); |
| | | 102 | | } |
| | | 103 | | |
| | 13 | 104 | | var mediaStreams = new List<MediaStream>(); |
| | | 105 | | |
| | 56 | 106 | | foreach (var pathInfo in pathInfos) |
| | | 107 | | { |
| | 15 | 108 | | if (!pathInfo.Path.AsSpan().EndsWith(".strm", StringComparison.OrdinalIgnoreCase)) |
| | | 109 | | { |
| | | 110 | | try |
| | | 111 | | { |
| | 15 | 112 | | var mediaInfo = await GetMediaInfo(pathInfo.Path, _type, cancellationToken).ConfigureAwait(false |
| | | 113 | | |
| | 15 | 114 | | if (mediaInfo.MediaStreams.Count == 1) |
| | | 115 | | { |
| | 11 | 116 | | MediaStream mediaStream = mediaInfo.MediaStreams[0]; |
| | | 117 | | |
| | 11 | 118 | | if ((mediaStream.Type == MediaStreamType.Audio && _type == DlnaProfileType.Audio) |
| | 11 | 119 | | || (mediaStream.Type == MediaStreamType.Subtitle && _type == DlnaProfileType.Subtitle)) |
| | | 120 | | { |
| | 11 | 121 | | mediaStream.Index = startIndex++; |
| | 11 | 122 | | mediaStream.IsDefault = pathInfo.IsDefault; |
| | 11 | 123 | | mediaStream.IsForced = pathInfo.IsForced || mediaStream.IsForced; |
| | 11 | 124 | | mediaStream.IsHearingImpaired = pathInfo.IsHearingImpaired || mediaStream.IsHearingImpai |
| | | 125 | | |
| | 11 | 126 | | mediaStreams.Add(MergeMetadata(mediaStream, pathInfo)); |
| | | 127 | | } |
| | | 128 | | } |
| | | 129 | | else |
| | | 130 | | { |
| | 24 | 131 | | foreach (MediaStream mediaStream in mediaInfo.MediaStreams) |
| | | 132 | | { |
| | 8 | 133 | | if ((mediaStream.Type == MediaStreamType.Audio && _type == DlnaProfileType.Audio) |
| | 8 | 134 | | || (mediaStream.Type == MediaStreamType.Subtitle && _type == DlnaProfileType.Subtitl |
| | | 135 | | { |
| | 8 | 136 | | mediaStream.Index = startIndex++; |
| | | 137 | | |
| | 8 | 138 | | mediaStreams.Add(MergeMetadata(mediaStream, pathInfo)); |
| | | 139 | | } |
| | | 140 | | } |
| | | 141 | | } |
| | 15 | 142 | | } |
| | 0 | 143 | | catch (Exception ex) |
| | | 144 | | { |
| | 0 | 145 | | _logger.LogError(ex, "Error getting external streams from {Path}", pathInfo.Path); |
| | | 146 | | |
| | 0 | 147 | | continue; |
| | | 148 | | } |
| | | 149 | | } |
| | 15 | 150 | | } |
| | | 151 | | |
| | 13 | 152 | | return mediaStreams; |
| | 19 | 153 | | } |
| | | 154 | | |
| | | 155 | | /// <summary> |
| | | 156 | | /// Retrieves the external streams for the provided audio. |
| | | 157 | | /// </summary> |
| | | 158 | | /// <param name="audio">The <see cref="Audio"/> object to search external streams for.</param> |
| | | 159 | | /// <param name="startIndex">The stream index to start adding external streams at.</param> |
| | | 160 | | /// <param name="directoryService">The directory service to search for files.</param> |
| | | 161 | | /// <param name="clearCache">True if the directory service cache should be cleared before searching.</param> |
| | | 162 | | /// <returns>The external streams located.</returns> |
| | | 163 | | public IReadOnlyList<MediaStream> GetExternalStreams( |
| | | 164 | | Audio audio, |
| | | 165 | | int startIndex, |
| | | 166 | | IDirectoryService directoryService, |
| | | 167 | | bool clearCache) |
| | | 168 | | { |
| | 0 | 169 | | if (!audio.IsFileProtocol) |
| | | 170 | | { |
| | 0 | 171 | | return Array.Empty<MediaStream>(); |
| | | 172 | | } |
| | | 173 | | |
| | 0 | 174 | | var pathInfos = GetExternalFiles(audio, directoryService, clearCache); |
| | | 175 | | |
| | 0 | 176 | | if (pathInfos.Count == 0) |
| | | 177 | | { |
| | 0 | 178 | | return Array.Empty<MediaStream>(); |
| | | 179 | | } |
| | | 180 | | |
| | 0 | 181 | | var mediaStreams = new MediaStream[pathInfos.Count]; |
| | | 182 | | |
| | 0 | 183 | | for (var i = 0; i < pathInfos.Count; i++) |
| | | 184 | | { |
| | 0 | 185 | | mediaStreams[i] = new MediaStream |
| | 0 | 186 | | { |
| | 0 | 187 | | Type = MediaStreamType.Lyric, |
| | 0 | 188 | | Path = pathInfos[i].Path, |
| | 0 | 189 | | Language = pathInfos[i].Language, |
| | 0 | 190 | | Index = startIndex++ |
| | 0 | 191 | | }; |
| | | 192 | | } |
| | | 193 | | |
| | 0 | 194 | | return mediaStreams; |
| | | 195 | | } |
| | | 196 | | |
| | | 197 | | /// <summary> |
| | | 198 | | /// Returns the external file infos for the given video. |
| | | 199 | | /// </summary> |
| | | 200 | | /// <param name="video">The <see cref="Video"/> object to search external files for.</param> |
| | | 201 | | /// <param name="directoryService">The directory service to search for files.</param> |
| | | 202 | | /// <param name="clearCache">True if the directory service cache should be cleared before searching.</param> |
| | | 203 | | /// <returns>The external file paths located.</returns> |
| | | 204 | | public IReadOnlyList<ExternalPathParserResult> GetExternalFiles( |
| | | 205 | | Video video, |
| | | 206 | | IDirectoryService directoryService, |
| | | 207 | | bool clearCache) |
| | | 208 | | { |
| | 48 | 209 | | if (!video.IsFileProtocol) |
| | | 210 | | { |
| | 1 | 211 | | return Array.Empty<ExternalPathParserResult>(); |
| | | 212 | | } |
| | | 213 | | |
| | | 214 | | // Check if video folder exists |
| | 47 | 215 | | string folder = video.ContainingFolderPath; |
| | 47 | 216 | | if (!_fileSystem.DirectoryExists(folder)) |
| | | 217 | | { |
| | 12 | 218 | | return Array.Empty<ExternalPathParserResult>(); |
| | | 219 | | } |
| | | 220 | | |
| | 35 | 221 | | var files = directoryService.GetFilePaths(folder, clearCache).ToList(); |
| | 35 | 222 | | files.Remove(video.Path); |
| | 35 | 223 | | var internalMetadataPath = video.GetInternalMetadataPath(); |
| | 35 | 224 | | if (_fileSystem.DirectoryExists(internalMetadataPath)) |
| | | 225 | | { |
| | 34 | 226 | | files.AddRange(directoryService.GetFilePaths(internalMetadataPath, clearCache)); |
| | | 227 | | } |
| | | 228 | | |
| | 35 | 229 | | if (files.Count == 0) |
| | | 230 | | { |
| | 1 | 231 | | return Array.Empty<ExternalPathParserResult>(); |
| | | 232 | | } |
| | | 233 | | |
| | | 234 | | // VobSub .sub payloads only carry per-track language metadata when read via |
| | | 235 | | // their paired .idx file, so probe the .idx instead and skip the .sub. Pairing |
| | | 236 | | // requires the same directory (ffprobe can't resolve a split pair) and an |
| | | 237 | | // ordinal comparison (ffprobe matches the .sub by exact case on case-sensitive |
| | | 238 | | // filesystems, so a looser match could suppress a .sub with no working .idx). |
| | | 239 | | // An .idx file with no paired .sub cannot be probed at all, so it is left out |
| | | 240 | | // entirely rather than surfaced (which would otherwise fail every probe and, |
| | | 241 | | // since the .idx would keep "existing" from Jellyfin's point of view, prevent |
| | | 242 | | // stale subtitle stream metadata from ever being cleared once the .sub is gone). |
| | 34 | 243 | | HashSet<string>? pairedVobSubKeys = _type == DlnaProfileType.Subtitle |
| | 34 | 244 | | ? GetPairedVobSubKeys(files) |
| | 34 | 245 | | : null; |
| | | 246 | | |
| | 34 | 247 | | var externalPathInfos = new List<ExternalPathParserResult>(); |
| | 34 | 248 | | ReadOnlySpan<char> prefix = video.FileNameWithoutExtension; |
| | 148 | 249 | | foreach (var file in files) |
| | | 250 | | { |
| | 40 | 251 | | if (IsSuppressedVobSubFile(file, pairedVobSubKeys)) |
| | | 252 | | { |
| | | 253 | | continue; |
| | | 254 | | } |
| | | 255 | | |
| | 35 | 256 | | var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file.AsSpan()); |
| | 35 | 257 | | if (fileNameWithoutExtension.Length >= prefix.Length |
| | 35 | 258 | | && prefix.Equals(fileNameWithoutExtension[..prefix.Length], StringComparison.OrdinalIgnoreCase) |
| | 35 | 259 | | && (fileNameWithoutExtension.Length == prefix.Length || _namingOptions.MediaFlagDelimiters.Contains( |
| | | 260 | | { |
| | 32 | 261 | | var externalPathInfo = _externalPathParser.ParseFile(file, fileNameWithoutExtension[prefix.Length..] |
| | | 262 | | |
| | 32 | 263 | | if (externalPathInfo is not null) |
| | | 264 | | { |
| | 25 | 265 | | externalPathInfos.Add(externalPathInfo); |
| | | 266 | | } |
| | | 267 | | } |
| | | 268 | | } |
| | | 269 | | |
| | 34 | 270 | | return externalPathInfos; |
| | | 271 | | } |
| | | 272 | | |
| | | 273 | | /// <summary> |
| | | 274 | | /// Returns the external file infos for the given audio. |
| | | 275 | | /// </summary> |
| | | 276 | | /// <param name="audio">The <see cref="Audio"/> object to search external files for.</param> |
| | | 277 | | /// <param name="directoryService">The directory service to search for files.</param> |
| | | 278 | | /// <param name="clearCache">True if the directory service cache should be cleared before searching.</param> |
| | | 279 | | /// <returns>The external file paths located.</returns> |
| | | 280 | | public IReadOnlyList<ExternalPathParserResult> GetExternalFiles( |
| | | 281 | | Audio audio, |
| | | 282 | | IDirectoryService directoryService, |
| | | 283 | | bool clearCache) |
| | | 284 | | { |
| | 0 | 285 | | if (!audio.IsFileProtocol) |
| | | 286 | | { |
| | 0 | 287 | | return Array.Empty<ExternalPathParserResult>(); |
| | | 288 | | } |
| | | 289 | | |
| | 0 | 290 | | string folder = audio.ContainingFolderPath; |
| | 0 | 291 | | var files = directoryService.GetFilePaths(folder, clearCache).ToList(); |
| | 0 | 292 | | files.Remove(audio.Path); |
| | 0 | 293 | | var internalMetadataPath = audio.GetInternalMetadataPath(); |
| | 0 | 294 | | if (_fileSystem.DirectoryExists(internalMetadataPath)) |
| | | 295 | | { |
| | 0 | 296 | | files.AddRange(directoryService.GetFilePaths(internalMetadataPath, clearCache)); |
| | | 297 | | } |
| | | 298 | | |
| | 0 | 299 | | if (files.Count == 0) |
| | | 300 | | { |
| | 0 | 301 | | return Array.Empty<ExternalPathParserResult>(); |
| | | 302 | | } |
| | | 303 | | |
| | 0 | 304 | | var externalPathInfos = new List<ExternalPathParserResult>(); |
| | 0 | 305 | | ReadOnlySpan<char> prefix = audio.FileNameWithoutExtension; |
| | 0 | 306 | | foreach (var file in files) |
| | | 307 | | { |
| | 0 | 308 | | var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file.AsSpan()); |
| | 0 | 309 | | if (fileNameWithoutExtension.Length >= prefix.Length |
| | 0 | 310 | | && prefix.Equals(fileNameWithoutExtension[..prefix.Length], StringComparison.OrdinalIgnoreCase) |
| | 0 | 311 | | && (fileNameWithoutExtension.Length == prefix.Length || _namingOptions.MediaFlagDelimiters.Contains( |
| | | 312 | | { |
| | 0 | 313 | | var externalPathInfo = _externalPathParser.ParseFile(file, fileNameWithoutExtension[prefix.Length..] |
| | | 314 | | |
| | 0 | 315 | | if (externalPathInfo is not null) |
| | | 316 | | { |
| | 0 | 317 | | externalPathInfos.Add(externalPathInfo); |
| | | 318 | | } |
| | | 319 | | } |
| | | 320 | | } |
| | | 321 | | |
| | 0 | 322 | | return externalPathInfos; |
| | | 323 | | } |
| | | 324 | | |
| | | 325 | | /// <summary> |
| | | 326 | | /// Determines whether a candidate file is part of a VobSub .idx/.sub pair that |
| | | 327 | | /// should be resolved to only its .idx file, or an .idx file with no paired .sub |
| | | 328 | | /// that cannot be probed at all. |
| | | 329 | | /// </summary> |
| | | 330 | | /// <param name="file">The full path to the candidate file.</param> |
| | | 331 | | /// <param name="pairedVobSubKeys">The set of pairing keys with both an .idx and .sub present, or null if not ap |
| | | 332 | | /// <returns><c>true</c> if the file should be suppressed; otherwise, <c>false</c>.</returns> |
| | | 333 | | private static bool IsSuppressedVobSubFile(string file, HashSet<string>? pairedVobSubKeys) |
| | | 334 | | { |
| | 40 | 335 | | if (pairedVobSubKeys is null) |
| | | 336 | | { |
| | 4 | 337 | | return false; |
| | | 338 | | } |
| | | 339 | | |
| | 36 | 340 | | var extension = Path.GetExtension(file.AsSpan()); |
| | 36 | 341 | | if (extension.Equals(".sub", StringComparison.OrdinalIgnoreCase)) |
| | | 342 | | { |
| | | 343 | | // A paired .idx exists; probe it instead of the .sub payload. |
| | 5 | 344 | | return pairedVobSubKeys.Contains(GetVobSubPairingKey(file)); |
| | | 345 | | } |
| | | 346 | | |
| | 31 | 347 | | if (extension.Equals(".idx", StringComparison.OrdinalIgnoreCase)) |
| | | 348 | | { |
| | | 349 | | // Without its .sub payload, the .idx cannot be probed for any data. |
| | 5 | 350 | | return !pairedVobSubKeys.Contains(GetVobSubPairingKey(file)); |
| | | 351 | | } |
| | | 352 | | |
| | 26 | 353 | | return false; |
| | | 354 | | } |
| | | 355 | | |
| | | 356 | | /// <summary> |
| | | 357 | | /// Builds the set of directory+basename keys that have both an .idx and a .sub |
| | | 358 | | /// file present, in a single pass over the candidate files. |
| | | 359 | | /// </summary> |
| | | 360 | | /// <param name="files">The candidate files to search.</param> |
| | | 361 | | /// <returns>The set of pairing keys with both an .idx and .sub present.</returns> |
| | | 362 | | private static HashSet<string> GetPairedVobSubKeys(IEnumerable<string> files) |
| | | 363 | | { |
| | 30 | 364 | | var idxKeys = new HashSet<string>(StringComparer.Ordinal); |
| | 30 | 365 | | var subKeys = new HashSet<string>(StringComparer.Ordinal); |
| | 132 | 366 | | foreach (var file in files) |
| | | 367 | | { |
| | 36 | 368 | | var extension = Path.GetExtension(file.AsSpan()); |
| | 36 | 369 | | if (extension.Equals(".idx", StringComparison.OrdinalIgnoreCase)) |
| | | 370 | | { |
| | 5 | 371 | | idxKeys.Add(GetVobSubPairingKey(file)); |
| | | 372 | | } |
| | 31 | 373 | | else if (extension.Equals(".sub", StringComparison.OrdinalIgnoreCase)) |
| | | 374 | | { |
| | 5 | 375 | | subKeys.Add(GetVobSubPairingKey(file)); |
| | | 376 | | } |
| | | 377 | | } |
| | | 378 | | |
| | 30 | 379 | | idxKeys.IntersectWith(subKeys); |
| | 30 | 380 | | return idxKeys; |
| | | 381 | | } |
| | | 382 | | |
| | | 383 | | /// <summary> |
| | | 384 | | /// Builds a directory+basename key used to pair a VobSub .idx file with its .sub |
| | | 385 | | /// payload only when both live in the same directory. |
| | | 386 | | /// </summary> |
| | | 387 | | /// <param name="file">The full path to the file.</param> |
| | | 388 | | /// <returns>A key combining the containing directory and file name without extension.</returns> |
| | | 389 | | private static string GetVobSubPairingKey(string file) |
| | | 390 | | { |
| | 20 | 391 | | var directory = Path.GetDirectoryName(file) ?? string.Empty; |
| | 20 | 392 | | var baseName = Path.GetFileNameWithoutExtension(file); |
| | 20 | 393 | | return Path.Combine(directory, baseName); |
| | | 394 | | } |
| | | 395 | | |
| | | 396 | | /// <summary> |
| | | 397 | | /// Returns the media info of the given file. |
| | | 398 | | /// </summary> |
| | | 399 | | /// <param name="path">The path to the file.</param> |
| | | 400 | | /// <param name="type">The <see cref="DlnaProfileType"/>.</param> |
| | | 401 | | /// <param name="cancellationToken">The cancellation token to cancel operation.</param> |
| | | 402 | | /// <returns>The media info for the given file.</returns> |
| | | 403 | | private Task<Model.MediaInfo.MediaInfo> GetMediaInfo(string path, DlnaProfileType type, CancellationToken cancel |
| | | 404 | | { |
| | 15 | 405 | | cancellationToken.ThrowIfCancellationRequested(); |
| | | 406 | | |
| | 15 | 407 | | return _mediaEncoder.GetMediaInfo( |
| | 15 | 408 | | new MediaInfoRequest |
| | 15 | 409 | | { |
| | 15 | 410 | | MediaType = type, |
| | 15 | 411 | | MediaSource = new MediaSourceInfo |
| | 15 | 412 | | { |
| | 15 | 413 | | Path = path, |
| | 15 | 414 | | Protocol = MediaProtocol.File |
| | 15 | 415 | | } |
| | 15 | 416 | | }, |
| | 15 | 417 | | cancellationToken); |
| | | 418 | | } |
| | | 419 | | |
| | | 420 | | /// <summary> |
| | | 421 | | /// Merges path metadata into stream metadata. |
| | | 422 | | /// </summary> |
| | | 423 | | /// <param name="mediaStream">The <see cref="MediaStream"/> object.</param> |
| | | 424 | | /// <param name="pathInfo">The <see cref="ExternalPathParserResult"/> object.</param> |
| | | 425 | | /// <returns>The modified mediaStream.</returns> |
| | | 426 | | private MediaStream MergeMetadata(MediaStream mediaStream, ExternalPathParserResult pathInfo) |
| | | 427 | | { |
| | 19 | 428 | | mediaStream.Path = pathInfo.Path; |
| | 19 | 429 | | mediaStream.IsExternal = true; |
| | 19 | 430 | | mediaStream.Title = string.IsNullOrEmpty(mediaStream.Title) ? (string.IsNullOrEmpty(pathInfo.Title) ? null : |
| | 19 | 431 | | mediaStream.Language = string.IsNullOrEmpty(mediaStream.Language) ? (string.IsNullOrEmpty(pathInfo.Language) |
| | | 432 | | |
| | 19 | 433 | | return mediaStream; |
| | | 434 | | } |
| | | 435 | | } |
| | | 436 | | } |