Skip to content

Commit 284f864

Browse files
committed
feat: 调整mikan时区
1 parent a624e46 commit 284f864

File tree

1 file changed

+7
-6
lines changed
  • plugins/common-plugin/src/main/kotlin/io/github/shoaky/sourcedownloader/common/anime

1 file changed

+7
-6
lines changed

plugins/common-plugin/src/main/kotlin/io/github/shoaky/sourcedownloader/common/anime/MikanSource.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ class MikanSource(
3232
if (cleanPointer) {
3333
pointer.cleanMonthly()
3434
}
35+
val mikananiZoneId = ZoneId.of("Asia/Shanghai")
3536
val sourceItems = rssReader.read(url)
3637
.map {
37-
fromRssItem(it)
38+
fromRssItem(it, mikananiZoneId)
3839
}
3940
.toList()
4041

@@ -44,8 +45,9 @@ class MikanSource(
4445
}.toList()
4546
}
4647

48+
val systemZoneId = ZoneId.systemDefault()
4749
val latestItems = sourceItems
48-
.filter { it.datetime.isAfter(pointer.latest.atZone(MIKANANI_ZONE_ID)) }
50+
.filter { it.datetime.isAfter(pointer.latest.atZone(systemZoneId)) }
4951
.sortedBy { it.datetime }
5052

5153
// 解决新番更新和添加顺序不一致的问题
@@ -67,7 +69,7 @@ class MikanSource(
6769
val subGroupId = fansubQuery["subgroupid"] ?: error("subgroupid is null")
6870
var fansubItems = rssReader.read(fansubRss)
6971
.map {
70-
fromRssItem(it)
72+
fromRssItem(it, mikananiZoneId)
7173
}
7274
.toList()
7375
.sortedBy { it.datetime }
@@ -97,14 +99,13 @@ class MikanSource(
9799
private companion object {
98100

99101
private val log = LoggerFactory.getLogger(MikanSource::class.java)
100-
private val MIKANANI_ZONE_ID = ZoneId.of("Asia/Shanghai")
101102

102-
private fun fromRssItem(rssItem: Item): SourceItem {
103+
private fun fromRssItem(rssItem: Item, zoneId: ZoneId): SourceItem {
103104
val enclosure = rssItem.enclosure.get()
104105
return SourceItem(
105106
rssItem.title.get(),
106107
URI(rssItem.link.get()),
107-
parseTime(rssItem.pubDate.get()),
108+
parseTime(rssItem.pubDate.get()).atZone(zoneId),
108109
enclosure.type,
109110
URI(enclosure.url)
110111
)

0 commit comments

Comments
 (0)