@@ -19,7 +19,12 @@ export class MALAPIManga extends APIModel {
19
19
this . types = [ MediaType . Manga ] ;
20
20
this . typeMappings = new Map < string , string > ( ) ;
21
21
this . typeMappings . set ( 'manga' , 'manga' ) ;
22
+ this . typeMappings . set ( 'manhwa' , 'manhwa' ) ;
23
+ this . typeMappings . set ( 'doujinshi' , 'doujin' ) ;
24
+ this . typeMappings . set ( 'one-shot' , 'oneshot' ) ;
25
+ this . typeMappings . set ( 'manhua' , 'manhua' ) ;
22
26
this . typeMappings . set ( 'light novel' , 'lnovel' ) ;
27
+ this . typeMappings . set ( 'novel' , 'novel' ) ;
23
28
}
24
29
25
30
async searchByTitle ( title : string ) : Promise < MediaTypeModel [ ] > {
@@ -40,7 +45,6 @@ export class MALAPIManga extends APIModel {
40
45
41
46
for ( const result of data . data ) {
42
47
const type = this . typeMappings . get ( result . type ?. toLowerCase ( ) ) ;
43
- if ( type === undefined ) {
44
48
ret . push (
45
49
new MangaModel ( {
46
50
subType : type ,
@@ -71,41 +75,7 @@ export class MALAPIManga extends APIModel {
71
75
personalRating : 0 ,
72
76
} ,
73
77
} as MangaModel )
74
- ) ;
75
- }
76
- if ( type === 'manga' || type === "lnovel" ) {
77
- ret . push (
78
- new MangaModel ( {
79
- subType : type ,
80
- title : result . title ,
81
- synopsis : result . synopsis ,
82
- englishTitle : result . title_english ?? result . title ,
83
- alternateTitles : result . titles ?. map ( ( x : any ) => x . title ) ?? [ ] ,
84
- year : result . year ?? result . published ?. prop ?. from ?. year ?? '' ,
85
- dataSource : this . apiName ,
86
- url : result . url ,
87
- id : result . mal_id ,
88
-
89
- genres : result . genres ?. map ( ( x : any ) => x . name ) ?? [ ] ,
90
- authors : result . authors ?. map ( ( x : any ) => x . name ) ?? [ ] ,
91
- chapters : result . chapters ,
92
- volumes : result . volumes ,
93
- onlineRating : result . score ?? 0 ,
94
- image : result . images ?. jpg ?. image_url ?? '' ,
95
-
96
- released : true ,
97
- publishedFrom : new Date ( result . published ?. from ) . toLocaleDateString ( ) ?? 'unknown' ,
98
- publishedTo : new Date ( result . published ?. to ) . toLocaleDateString ( ) ?? 'unknown' ,
99
- status : result . status ,
100
-
101
- userData : {
102
- watched : false ,
103
- lastWatched : '' ,
104
- personalRating : 0 ,
105
- } ,
106
- } as MangaModel )
107
- ) ;
108
- }
78
+ )
109
79
}
110
80
111
81
return ret ;
@@ -126,7 +96,6 @@ export class MALAPIManga extends APIModel {
126
96
const result = data . data ;
127
97
128
98
const type = this . typeMappings . get ( result . type ?. toLowerCase ( ) ) ;
129
- if ( type === undefined ) {
130
99
const model = new MangaModel ( {
131
100
subType : type ,
132
101
title : result . title ,
@@ -158,42 +127,5 @@ export class MALAPIManga extends APIModel {
158
127
} as MangaModel ) ;
159
128
160
129
return model ;
161
- }
162
-
163
- if ( type === 'manga' || type === 'lnovel' ) {
164
- const model = new MangaModel ( {
165
- subType : type ,
166
- title : result . title ,
167
- synopsis : result . synopsis ,
168
- englishTitle : result . title_english ?? result . title ,
169
- alternateTitles : result . titles ?. map ( ( x : any ) => x . title ) ?? [ ] ,
170
- year : result . year ?? result . published ?. prop ?. from ?. year ?? '' ,
171
- dataSource : this . apiName ,
172
- url : result . url ,
173
- id : result . mal_id ,
174
-
175
- genres : result . genres ?. map ( ( x : any ) => x . name ) ?? [ ] ,
176
- authors : result . authors ?. map ( ( x : any ) => x . name ) ?? [ ] ,
177
- chapters : result . chapters ,
178
- volumes : result . volumes ,
179
- onlineRating : result . score ?? 0 ,
180
- image : result . images ?. jpg ?. image_url ?? '' ,
181
-
182
- released : true ,
183
- publishedFrom : new Date ( result . published ?. from ) . toLocaleDateString ( ) ?? 'unknown' ,
184
- publishedTo : new Date ( result . published ?. to ) . toLocaleDateString ( ) ?? 'unknown' ,
185
- status : result . status ,
186
-
187
- userData : {
188
- watched : false ,
189
- lastWatched : '' ,
190
- personalRating : 0 ,
191
- } ,
192
- } as MangaModel ) ;
193
-
194
- return model ;
195
- }
196
-
197
- return ;
198
130
}
199
131
}
0 commit comments