public async Task <XRay> CreateXRayAsync( string dataLocation, string db, string guid, string asin, string tld, bool includeTopics, ISecondarySource dataSource, IProgressBar progress, CancellationToken token = default) { var xray = new XRay(dataLocation, db, guid, asin, dataSource) { Terms = (await dataSource.GetTermsAsync(dataLocation, asin, tld, includeTopics, progress, token)).ToList() }; if (dataSource.SupportsNotableClips) { _logger.Log("Downloading notable clips..."); xray.NotableClips = (await dataSource.GetNotableClipsAsync(dataLocation, null, progress, token))?.ToList(); } if (xray.Terms.Count == 0) { _logger.Log("Warning: No terms found on " + dataSource.Name + "."); } return(xray); }
public async Task <XRay> CreateXRayAsync( string dataLocation, string db, string guid, string asin, string tld, bool includeTopics, ISecondarySource dataSource, IProgressBar progress, CancellationToken token = default) { if (dataLocation == "" && !(dataSource is SecondarySourceRoentgen) || guid == "" || asin == "") { throw new ArgumentException("Error initializing X-Ray, one of the required parameters was blank."); } dataLocation = dataSource.SanitizeDataLocation(dataLocation); var terms = (await dataSource.GetTermsAsync(dataLocation, asin, tld, includeTopics, progress, token)).ToList(); var xray = new XRay { DatabaseName = string.IsNullOrEmpty(db) ? null : db, Guid = Functions.ConvertGuid(guid), Asin = asin, DataUrl = dataLocation, Terms = terms }; if (dataSource.SupportsNotableClips) { _logger.Log("Downloading notable clips..."); xray.NotableClips = (await dataSource.GetNotableClipsAsync(dataLocation, null, progress, token))?.ToList(); } if (xray.Terms.Count == 0) { _logger.Log($"Warning: No terms found on {dataSource.Name}."); } return(xray); }