Added download folder name change

This commit is contained in:
tom5079
2020-09-02 12:58:31 +09:00
parent f70eccb1da
commit fc6bc7965c
6 changed files with 32 additions and 2 deletions

View File

@@ -91,13 +91,14 @@ fun OkHttpClient.Builder.proxyInfo(proxyInfo: ProxyInfo) = this.apply {
val formatMap = mapOf<String, GalleryBlock.() -> (String)>(
"-id-" to { id.toString() },
"-title-" to { title },
"-artist-" to { artists.joinToString() }
// TODO
)
/**
* Formats download folder name with given Metadata
*/
fun GalleryBlock.formatDownloadFolder(): String =
Preferences["download_folder_format", "-id-"].let {
Preferences["download_folder_name", "-id-"].let {
formatMap.entries.fold(it) { str, (k, v) ->
str.replace(k, v.invoke(this), true)
}