@@ -19,7 +19,12 @@ export class MALAPIManga extends APIModel {
1919 this . types = [ MediaType . Manga ] ;
2020 this . typeMappings = new Map < string , string > ( ) ;
2121 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' ) ;
2226 this . typeMappings . set ( 'light novel' , 'lnovel' ) ;
27+ this . typeMappings . set ( 'novel' , 'novel' ) ;
2328 }
2429
2530 async searchByTitle ( title : string ) : Promise < MediaTypeModel [ ] > {
@@ -40,7 +45,6 @@ export class MALAPIManga extends APIModel {
4045
4146 for ( const result of data . data ) {
4247 const type = this . typeMappings . get ( result . type ?. toLowerCase ( ) ) ;
43- if ( type === undefined ) {
4448 ret . push (
4549 new MangaModel ( {
4650 subType : type ,
@@ -71,41 +75,7 @@ export class MALAPIManga extends APIModel {
7175 personalRating : 0 ,
7276 } ,
7377 } 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+ )
10979 }
11080
11181 return ret ;
@@ -126,7 +96,6 @@ export class MALAPIManga extends APIModel {
12696 const result = data . data ;
12797
12898 const type = this . typeMappings . get ( result . type ?. toLowerCase ( ) ) ;
129- if ( type === undefined ) {
13099 const model = new MangaModel ( {
131100 subType : type ,
132101 title : result . title ,
@@ -158,42 +127,5 @@ export class MALAPIManga extends APIModel {
158127 } as MangaModel ) ;
159128
160129 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 ;
198130 }
199131}
0 commit comments