Verified Owner
Top Description Fields Constructors Methods
org.jabref.gui.importer

public Class BookCoverFetcher

extends Object
Class Inheritance
Imports
java.io.IOException, java.net.MalformedURLException, java.nio.file.Files, .InvalidPathException, .Path, java.nio.file.attribute.FileTime, java.time.Duration, .Instant, java.util.Optional, java.util.regex.Matcher, .Pattern, org.jabref.gui.externalfiletype.CustomExternalFileType, .ExternalFileType, .ExternalFileTypes, .StandardExternalFileType, org.jabref.gui.frame.ExternalApplicationsPreferences, org.jabref.gui.icon.IconTheme, org.jabref.logic.importer.FetcherClientException, .FetcherException, .FetcherServerException, org.jabref.logic.net.URLDownload, org.jabref.logic.util.Directories, org.jabref.logic.util.io.FileUtil, org.jabref.model.entry.BibEntry, org.jabref.model.entry.identifier.ISBN, org.slf4j.Logger, .LoggerFactory

Provides functions for downloading and retrieving book covers for entries.

Field Summary

Modifier and TypeField and Description
private final ExternalApplicationsPreferences
private static final Integer
private static final String
private static final String
private static final Logger
private static final CustomExternalFileType
private static final String
private static final Pattern

Constructor Summary

AccessConstructor and Description
public
BookCoverFetcher(ExternalApplicationsPreferences externalApplicationsPreferences)

Method Summary

Modifier and TypeMethod and Description
private void
deleteNotAvailableFileIfExists(final String name, final Path directory)

private void
downloadCoverForISBN(ISBN isbn, Path directory)

private void
downloadCoverImage(String url, final String name, final Path directory)

public void
private Optional<Path>
findExistingImage(final String name, final Path directory)

private void
flagAsNotAvailable(final String name, final Path directory)

public Optional<Path>
private static String
private static Optional<Path>
resolveNameWithType(Path directory, String name, ExternalFileType fileType)

private Optional<Duration>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

externalApplicationsPreferencesback to summary
private final ExternalApplicationsPreferences externalApplicationsPreferences
IMAGE_DOWNLOAD_COOLDOWN_HOURSback to summary
private static final Integer IMAGE_DOWNLOAD_COOLDOWN_HOURS
IMAGE_FALLBACK_SUFFIXback to summary
private static final String IMAGE_FALLBACK_SUFFIX
IMAGE_FALLBACK_URLback to summary
private static final String IMAGE_FALLBACK_URL
LOGGERback to summary
private static final Logger LOGGER
NOT_AVAILABLE_FILE_TYPEback to summary
private static final CustomExternalFileType NOT_AVAILABLE_FILE_TYPE
URL_FETCHER_URLback to summary
private static final String URL_FETCHER_URL
URL_JSON_PATTERNback to summary
private static final Pattern URL_JSON_PATTERN

Constructor Detail

BookCoverFetcherback to summary
public BookCoverFetcher(ExternalApplicationsPreferences externalApplicationsPreferences)

Method Detail

deleteNotAvailableFileIfExistsback to summary
private void deleteNotAvailableFileIfExists(final String name, final Path directory)
downloadCoverForISBNback to summary
private void downloadCoverForISBN(ISBN isbn, Path directory)
downloadCoverImageback to summary
private void downloadCoverImage(String url, final String name, final Path directory)
downloadCoversForEntryback to summary
public void downloadCoversForEntry(BibEntry entry)
findExistingImageback to summary
private Optional<Path> findExistingImage(final String name, final Path directory)
flagAsNotAvailableback to summary
private void flagAsNotAvailable(final String name, final Path directory)
getDownloadedCoverForEntryback to summary
public Optional<Path> getDownloadedCoverForEntry(BibEntry entry)
getImageUrlback to summary
private static String getImageUrl(ISBN isbn)
resolveNameWithTypeback to summary
private static Optional<Path> resolveNameWithType(Path directory, String name, ExternalFileType fileType)
timeSincePreviousAttemptback to summary
private Optional<Duration> timeSincePreviousAttempt(String name, Path directory)