public static InternetArchiveFile GetMiddleAssociatedThumbnailFile( InternetArchiveItem iaItem, InternetArchiveFile iaFile) { var associatedThumbnailFiles = GetAssociatedThumbnailFiles(iaItem, iaFile) .ToArray(); var centerIndex = (int)Math.Floor(associatedThumbnailFiles.Length / 2d); return(associatedThumbnailFiles[centerIndex]); }
public static string GetPrimaryAssociatedThumbnailFileUrl( InternetArchiveFile iaFile) { var fileNameWithoutExtension = iaFile.FileName.RemoveFileExtension(); var groupIndex = iaFile.OwnerArchiveItem.Identifier.Replace("emj-archive-", ""); var expectedThumbnailName = $"{groupIndex}.{fileNameWithoutExtension}.thumbs.primary.jpg"; var expectedThumbnailUrlUnEncoded = $"https://archive.org/download/emj-archive-thumbs-primary/{expectedThumbnailName}"; var expectedThumbnailUrl = expectedThumbnailUrlUnEncoded.UrlEncode(); return(expectedThumbnailUrl); }
public static IEnumerable <InternetArchiveFile> GetAssociatedThumbnailFiles( InternetArchiveItem iaItem, InternetArchiveFile iaFile) { var thumbnailFiles = ArchiveFileInterpreter.ScrapeArchiveThumbnailFiles(iaItem); foreach (var thumbnailFile in thumbnailFiles) { var thumbnailFileName = thumbnailFile.Title.RemoveFileExtension(); var videoFileName = iaFile.Title.RemoveFileExtension(); if (thumbnailFileName.StartsWith(videoFileName)) { yield return(thumbnailFile); } } }