Skip to content

Commit 122f0c9

Browse files
committed
fix: cannot parse series.json
Closes: #961
1 parent 5e7194c commit 122f0c9

File tree

8 files changed

+58
-12
lines changed

8 files changed

+58
-12
lines changed

komga/src/main/kotlin/org/gotson/komga/infrastructure/metadata/mylar/dto/MylarMetadata.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ data class MylarMetadata(
1515
val name: String,
1616

1717
@field:JsonAlias("cid")
18-
val comicId: String,
18+
val comicid: String,
1919

2020
val year: Int,
2121

komga/src/test/kotlin/org/gotson/komga/infrastructure/metadata/mylar/MylarSeriesProviderTest.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class MylarSeriesProviderTest {
2929
publisher = "DC",
3030
imprint = "Vertigo",
3131
name = "Sandman",
32-
comicId = "12345",
32+
comicid = "12345",
3333
year = 1990,
3434
descriptionText = "Sandman comics",
3535
descriptionFormatted = "Sandman comics formatted",
@@ -69,7 +69,7 @@ class MylarSeriesProviderTest {
6969
publisher = "DC",
7070
imprint = "Vertigo",
7171
name = "Sandman",
72-
comicId = "12345",
72+
comicid = "12345",
7373
year = 1990,
7474
descriptionText = "Sandman comics",
7575
descriptionFormatted = null,
@@ -109,7 +109,7 @@ class MylarSeriesProviderTest {
109109
publisher = "DC",
110110
imprint = "Vertigo",
111111
name = "Sandman",
112-
comicId = "12345",
112+
comicid = "12345",
113113
year = 1990,
114114
descriptionText = "Sandman comics",
115115
descriptionFormatted = "Sandman comics formatted",
@@ -140,7 +140,7 @@ class MylarSeriesProviderTest {
140140
publisher = "DC",
141141
imprint = "Vertigo",
142142
name = "Sandman",
143-
comicId = "12345",
143+
comicid = "12345",
144144
year = 1990,
145145
descriptionText = "Sandman comics",
146146
descriptionFormatted = "Sandman comics formatted",
@@ -171,7 +171,7 @@ class MylarSeriesProviderTest {
171171
publisher = "DC",
172172
imprint = "Vertigo",
173173
name = "Sandman",
174-
comicId = "12345",
174+
comicid = "12345",
175175
year = 1990,
176176
descriptionText = "Sandman comics",
177177
descriptionFormatted = "Sandman comics formatted",

komga/src/test/kotlin/org/gotson/komga/infrastructure/metadata/mylar/dto/SeriesTest.kt

+27-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class SeriesTest(
3030
assertThat(publisher).isEqualTo("DC Comics")
3131
assertThat(imprint).isNull()
3232
assertThat(name).isEqualTo("American Vampire 1976")
33-
assertThat(comicId).isEqualTo("130865")
33+
assertThat(comicid).isEqualTo("130865")
3434
assertThat(year).isEqualTo(2020)
3535
assertThat(descriptionText).isEqualTo("Nine issue mini-series, the closing chapter of American Vampire")
3636
assertThat(descriptionFormatted).isEqualTo("Nine issue mini-series, the closing chapter of American Vampire")
@@ -55,7 +55,7 @@ class SeriesTest(
5555
assertThat(publisher).isEqualTo("IDW Publishing")
5656
assertThat(imprint).isNull()
5757
assertThat(name).isEqualTo("Usagi Yojimbo")
58-
assertThat(comicId).isEqualTo("119731")
58+
assertThat(comicid).isEqualTo("119731")
5959
assertThat(year).isEqualTo(2019)
6060
assertThat(descriptionText).isNull()
6161
assertThat(descriptionFormatted).isNull()
@@ -69,6 +69,31 @@ class SeriesTest(
6969
}
7070
}
7171

72+
@Test
73+
fun `given yet another valid json file when deserializing then properties are available`() {
74+
val file = ClassPathResource("mylar/series-gh961.json")
75+
val seriesJson = mapper.readValue<Series>(file.url)
76+
77+
assertThat(seriesJson.metadata).isNotNull
78+
with(seriesJson.metadata) {
79+
assertThat(type).isEqualTo("comicSeries")
80+
assertThat(publisher).isEqualTo("Kodansha Comics USA")
81+
assertThat(imprint).isNull()
82+
assertThat(name).isEqualTo("Vinland Saga")
83+
assertThat(comicid).isEqualTo("69157")
84+
assertThat(year).isEqualTo(2013)
85+
assertThat(descriptionText).isEqualTo("English translation of Vinland Saga (ヴィンランド・サガ).Vinland Saga is the first series from Kodansha Comics USA to be released in hardcovers, each collection collects and translates two volumes of the original Japanese manga")
86+
assertThat(descriptionFormatted).isEqualTo("English translation of Vinland Saga (ヴィンランド・サガ).Vinland Saga is the first series from Kodansha Comics USA to be released in hardcovers, each collection collects and translates two volumes of the original Japanese manga")
87+
assertThat(volume).isNull()
88+
assertThat(bookType).isEqualTo("Print")
89+
assertThat(ageRating).isNull()
90+
assertThat(comicImage).isEqualTo("https://comicvine.gamespot.com/a/uploads/scale_large/6/67663/3439178-01.jpg")
91+
assertThat(totalIssues).isEqualTo(12)
92+
assertThat(publicationRun).isEqualTo("November 2013 - December 2021")
93+
assertThat(status).isEqualTo(Status.Ended)
94+
}
95+
}
96+
7297
@Test
7398
fun `given invalid json file missing year when deserializing then it fails`() {
7499
val file = ClassPathResource("mylar/series-missing-year.json")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"version": "1.0.1",
3+
"metadata": {
4+
"type": "comicSeries",
5+
"publisher": "Kodansha Comics USA",
6+
"imprint": null,
7+
"name": "Vinland Saga",
8+
"comicid": 69157,
9+
"year": 2013,
10+
"description_text": "English translation of Vinland Saga (ヴィンランド・サガ).Vinland Saga is the first series from Kodansha Comics USA to be released in hardcovers, each collection collects and translates two volumes of the original Japanese manga",
11+
"description_formatted": "English translation of Vinland Saga (ヴィンランド・サガ).Vinland Saga is the first series from Kodansha Comics USA to be released in hardcovers, each collection collects and translates two volumes of the original Japanese manga",
12+
"volume": null,
13+
"booktype": "Print",
14+
"age_rating": null,
15+
"collects": null,
16+
"ComicImage": "https://comicvine.gamespot.com/a/uploads/scale_large/6/67663/3439178-01.jpg",
17+
"total_issues": 12,
18+
"publication_run": "November 2013 - December 2021",
19+
"status": "Ended"
20+
}
21+
}

komga/src/test/resources/mylar/series-missing-publisher.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "comicSeries",
55
"imprint": null,
66
"name": "Usagi Yojimbo",
7-
"cid": 119731,
7+
"comicid": 119731,
88
"year": 2019,
99
"description_text": null,
1010
"description_formatted": null,

komga/src/test/resources/mylar/series-missing-status.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"publisher": "IDW Publishing",
66
"imprint": null,
77
"name": "Usagi Yojimbo",
8-
"cid": 119731,
8+
"comicid": 119731,
99
"year": 2019,
1010
"description_text": null,
1111
"description_formatted": null,

komga/src/test/resources/mylar/series-missing-year.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"publisher": "IDW Publishing",
66
"imprint": null,
77
"name": "Usagi Yojimbo",
8-
"cid": 119731,
8+
"comicid": 119731,
99
"description_text": null,
1010
"description_formatted": null,
1111
"volume": 4,

komga/src/test/resources/mylar/series1.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"publisher": "IDW Publishing",
66
"imprint": null,
77
"name": "Usagi Yojimbo",
8-
"comicId": 119731,
8+
"comicid": 119731,
99
"year": 2019,
1010
"description_text": null,
1111
"description_formatted": null,

0 commit comments

Comments
 (0)