AsuraScans: Prevent slug map break (#5254)
* prevent slugmap break * reset slug map
This commit is contained in:
parent
12528d72a5
commit
eef6f38cd7
|
@ -1,7 +1,7 @@
|
||||||
ext {
|
ext {
|
||||||
extName = 'Asura Scans'
|
extName = 'Asura Scans'
|
||||||
extClass = '.AsuraScans'
|
extClass = '.AsuraScans'
|
||||||
extVersionCode = 40
|
extVersionCode = 41
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -57,6 +57,9 @@ class AsuraScans : ParsedHttpSource(), ConfigurableSource {
|
||||||
if (contains("pref_permanent_manga_url_2_en")) {
|
if (contains("pref_permanent_manga_url_2_en")) {
|
||||||
edit().remove("pref_permanent_manga_url_2_en").apply()
|
edit().remove("pref_permanent_manga_url_2_en").apply()
|
||||||
}
|
}
|
||||||
|
if (contains("pref_slug_map")) {
|
||||||
|
edit().remove("pref_slug_map").apply()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,9 +195,11 @@ class AsuraScans : ParsedHttpSource(), ConfigurableSource {
|
||||||
override fun mangaDetailsParse(response: Response): SManga {
|
override fun mangaDetailsParse(response: Response): SManga {
|
||||||
if (preferences.dynamicUrl()) {
|
if (preferences.dynamicUrl()) {
|
||||||
val url = response.request.url.toString()
|
val url = response.request.url.toString()
|
||||||
val newSlug = url.substringAfter("/series/").substringBefore("/")
|
val newSlug = url.substringAfter("/series/", "").substringBefore("/")
|
||||||
val absSlug = newSlug.substringBeforeLast("-")
|
if (newSlug.isNotEmpty()) {
|
||||||
preferences.slugMap = preferences.slugMap.apply { put(absSlug, newSlug) }
|
val absSlug = newSlug.substringBeforeLast("-")
|
||||||
|
preferences.slugMap = preferences.slugMap.apply { put(absSlug, newSlug) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return super.mangaDetailsParse(response)
|
return super.mangaDetailsParse(response)
|
||||||
}
|
}
|
||||||
|
@ -225,9 +230,11 @@ class AsuraScans : ParsedHttpSource(), ConfigurableSource {
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
if (preferences.dynamicUrl()) {
|
if (preferences.dynamicUrl()) {
|
||||||
val url = response.request.url.toString()
|
val url = response.request.url.toString()
|
||||||
val newSlug = url.substringAfter("/series/").substringBefore("/")
|
val newSlug = url.substringAfter("/series/", "").substringBefore("/")
|
||||||
val absSlug = newSlug.substringBeforeLast("-")
|
if (newSlug.isNotEmpty()) {
|
||||||
preferences.slugMap = preferences.slugMap.apply { put(absSlug, newSlug) }
|
val absSlug = newSlug.substringBeforeLast("-")
|
||||||
|
preferences.slugMap = preferences.slugMap.apply { put(absSlug, newSlug) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return super.chapterListParse(response)
|
return super.chapterListParse(response)
|
||||||
}
|
}
|
||||||
|
@ -308,7 +315,7 @@ class AsuraScans : ParsedHttpSource(), ConfigurableSource {
|
||||||
private val CLEAN_DATE_REGEX = """(\d+)(st|nd|rd|th)""".toRegex()
|
private val CLEAN_DATE_REGEX = """(\d+)(st|nd|rd|th)""".toRegex()
|
||||||
private val OLD_FORMAT_MANGA_REGEX = """^/manga/(\d+-)?([^/]+)/?$""".toRegex()
|
private val OLD_FORMAT_MANGA_REGEX = """^/manga/(\d+-)?([^/]+)/?$""".toRegex()
|
||||||
private val OLD_FORMAT_CHAPTER_REGEX = """^/(\d+-)?[^/]*-chapter-\d+(-\d+)*/?$""".toRegex()
|
private val OLD_FORMAT_CHAPTER_REGEX = """^/(\d+-)?[^/]*-chapter-\d+(-\d+)*/?$""".toRegex()
|
||||||
private const val PREF_SLUG_MAP = "pref_slug_map"
|
private const val PREF_SLUG_MAP = "pref_slug_map_2"
|
||||||
private const val PREF_DYNAMIC_URL = "pref_dynamic_url"
|
private const val PREF_DYNAMIC_URL = "pref_dynamic_url"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue