public async Task <ItemUpdateType> ProbeVideo <T>(T item, MetadataRefreshOptions options, CancellationToken cancellationToken) where T : Video { var isoMount = await MountIsoIfNeeded(item, cancellationToken).ConfigureAwait(false); BlurayDiscInfo blurayDiscInfo = null; try { if (item.VideoType == VideoType.BluRay || (item.IsoType.HasValue && item.IsoType == IsoType.BluRay)) { var inputPath = isoMount != null ? isoMount.MountedPath : item.Path; blurayDiscInfo = GetBDInfo(inputPath); } OnPreFetch(item, isoMount, blurayDiscInfo); // If we didn't find any satisfying the min length, just take them all if (item.VideoType == VideoType.Dvd || (item.IsoType.HasValue && item.IsoType == IsoType.Dvd)) { if (item.PlayableStreamFileNames.Count == 0) { _logger.Error("No playable vobs found in dvd structure, skipping ffprobe."); return(ItemUpdateType.MetadataImport); } } if (item.VideoType == VideoType.BluRay || (item.IsoType.HasValue && item.IsoType == IsoType.BluRay)) { if (item.PlayableStreamFileNames.Count == 0) { _logger.Error("No playable vobs found in bluray structure, skipping ffprobe."); return(ItemUpdateType.MetadataImport); } } var result = await GetMediaInfo(item, isoMount, cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); FFProbeHelpers.NormalizeFFProbeResult(result); cancellationToken.ThrowIfCancellationRequested(); await Fetch(item, cancellationToken, result, isoMount, blurayDiscInfo, options).ConfigureAwait(false); } finally { if (isoMount != null) { isoMount.Dispose(); } } return(ItemUpdateType.MetadataImport); }
public async Task <ItemUpdateType> Probe <T>(T item, CancellationToken cancellationToken) where T : Audio { var result = await GetMediaInfo(item, cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); FFProbeHelpers.NormalizeFFProbeResult(result); cancellationToken.ThrowIfCancellationRequested(); await Fetch(item, cancellationToken, result).ConfigureAwait(false); return(ItemUpdateType.MetadataImport); }
public async Task <ItemUpdateType> Probe <T>(T item, CancellationToken cancellationToken) where T : Audio { if (item.IsArchive) { var ext = Path.GetExtension(item.Path) ?? string.Empty; item.Container = ext.TrimStart('.'); return(ItemUpdateType.MetadataImport); } var result = await GetMediaInfo(item, cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); FFProbeHelpers.NormalizeFFProbeResult(result); cancellationToken.ThrowIfCancellationRequested(); await Fetch(item, cancellationToken, result).ConfigureAwait(false); return(ItemUpdateType.MetadataImport); }