modb stands for Manami Offline DataBase. Repositories prefixed with this acronym are used to create the manami-project/anime-offline-database.
This lib is the base for every specific meta data provider module. It contains the API for downloaders and converters, defines the anime model and provides basic functionality.
This lib contains the following features.
- An implementation of
MutableList
whose elements are always sorted by a predefinedComparator
- Interfaces for
MetaDataProviderConfig
,Downloader
,AnimeConverter
,PathConverter
.HttpClient
which define the standard API
- Default implementation for
PathConverter
. Takes anAnimeConverter
as delegate and can convert files and directories
- Leightweight interface for creating HTTP calls including helpers for creating headers and setting user agents
- Constants for the name of the property which can contain the path to a file providing possible user agents:
FIREFOX_DESKTOP_USER_AGENTS_FILE_PROPERTY_NAME
FIREFOX_MOBILE_USER_AGENT_PROPERTY_NAME
CHROME_DESKTOP_USER_AGENT_PROPERTY_NAME
CHROME_MOBILE_USER_AGENT_PROPERTY_NAME
- Constants for the file name in the classpath providing possible user agents:
FIREFOX_DESKTOP_USER_AGENT_RESOURCE_FILE
FIREFOX_MOBILE_USER_AGENT_RESOURCE_FILE
CHROME_DESKTOP_USER_AGENT_RESOURCE_FILE
CHROME_MOBILE_USER_AGENT_RESOURCE_FILE
- Implementation of
HttpClient
- A client for HTTP requests based on okhttp
- Offers retry behavior which can be individualized
- Delegate for SLF4J logger
companion object {
private val log by LoggerDelegate()
}
- Const
LOG_LEVEL_CONFIG_PROPERTY_NAME
for property name which lets you set the global log level
- For
Anime
and all underlying subtypes- Typealias for
Episodes
- Typealias for
Title
- Typealias for
Tag
- Enum
Anime.Type
- Enum
Anime.Status
- Type
AnimeSeason
- Typealias for
Year
- Type for
AnimeSeason.Season
- Typealias for
- Type
Duration
- Typealias for
Seconds
- Enum
TimeUnit
- Typealias for
- Typealias for
- Const
EMTPY
for emptyString
- Const
LOCK_FILE_SUFFIX
- Const
YEAR_OF_THE_FIRST_ANIME
for year of the first anime - Typealias for
RegularFile
as more specific version ofPath
- Typealias for
Directory
as more specific version ofPath
- Typealias for
FileSuffix
- Object class for serializing/deserializing objects to/from JSON
function | description |
---|---|
loadResource |
Conveniently load a file from src/main/resources |
resourceFileExists |
Checks if a file exists in src/main/resources |
random |
Pick a a random number from a given interval |
excludeFromTestContext |
Won't execute the code within during test execution |
Collection<T>.pickRandom() |
Picks a random element of a Collection |
Int.toAnimeId |
Converts an Int to an AnimeId |
List<T>.createShuffledList() |
Creates a new list from the given List and randomizes the order of elements |
List<T>.containsExactlyInTheSameOrder |
Checks if a list contains the same elements in the same order as another list |
OutputStream.write |
Writes a String to the OutputStream and also flushes the stream |
Path.changeSuffix |
Changes the file suffix |
Path.regularFileExists |
Checks if a given Path exists and is a file |
Path.directoryExists |
Checks if a given Path exists and is a directory |
Path.readFile |
Read the content of a file into a String |
Path.copyTo |
Copy file to file, directory to directory or a file into a directory |
Path.fileName |
Filename as String |
Path.fileSuffix |
Returns the file suffix as String |
String.writeToFile |
Write String to file and optionally write a lock file as indications for other processes that the file is being written |
String.remove |
Remove sequence from a String |
String.normalizeWhitespaces |
Replaces multiple consecutive whitespaces with a single one |