|
1 | 1 | import { APIModel } from '../APIModel';
|
2 | 2 | import { MediaTypeModel } from '../../models/MediaTypeModel';
|
3 |
| -// import { MovieModel } from '../../models/MovieModel'; |
4 | 3 | import MediaDbPlugin from '../../main';
|
5 | 4 | import { MangaModel } from '../../models/MangaModel';
|
6 | 5 | import { MediaType } from '../../utils/MediaType';
|
@@ -96,36 +95,36 @@ export class MALAPIManga extends APIModel {
|
96 | 95 | const result = data.data;
|
97 | 96 |
|
98 | 97 | const type = this.typeMappings.get(result.type?.toLowerCase());
|
99 |
| - const model = new MangaModel({ |
100 |
| - subType: type, |
101 |
| - title: result.title, |
102 |
| - synopsis: result.synopsis, |
103 |
| - englishTitle: result.title_english ?? result.title, |
104 |
| - alternateTitles: result.titles?.map((x: any) => x.title) ?? [], |
105 |
| - year: result.year ?? result.published?.prop?.from?.year ?? '', |
106 |
| - dataSource: this.apiName, |
107 |
| - url: result.url, |
108 |
| - id: result.mal_id, |
109 |
| - |
110 |
| - genres: result.genres?.map((x: any) => x.name) ?? [], |
111 |
| - authors: result.authors?.map((x: any) => x.name) ?? [], |
112 |
| - chapters: result.chapters, |
113 |
| - volumes: result.volumes, |
114 |
| - onlineRating: result.score ?? 0, |
115 |
| - image: result.images?.jpg?.image_url ?? '', |
116 |
| - |
117 |
| - released: true, |
118 |
| - publishedFrom: new Date(result.published?.from).toLocaleDateString() ?? 'unknown', |
119 |
| - publishedTo: new Date(result.published?.to).toLocaleDateString() ?? 'unknown', |
120 |
| - status: result.status, |
121 |
| - |
122 |
| - userData: { |
123 |
| - watched: false, |
124 |
| - lastWatched: '', |
125 |
| - personalRating: 0, |
126 |
| - }, |
127 |
| - } as MangaModel); |
128 |
| - |
129 |
| - return model; |
| 98 | + const model = new MangaModel({ |
| 99 | + subType: type, |
| 100 | + title: result.title, |
| 101 | + synopsis: result.synopsis, |
| 102 | + englishTitle: result.title_english ?? result.title, |
| 103 | + alternateTitles: result.titles?.map((x: any) => x.title) ?? [], |
| 104 | + year: result.year ?? result.published?.prop?.from?.year ?? '', |
| 105 | + dataSource: this.apiName, |
| 106 | + url: result.url, |
| 107 | + id: result.mal_id, |
| 108 | + |
| 109 | + genres: result.genres?.map((x: any) => x.name) ?? [], |
| 110 | + authors: result.authors?.map((x: any) => x.name) ?? [], |
| 111 | + chapters: result.chapters, |
| 112 | + volumes: result.volumes, |
| 113 | + onlineRating: result.score ?? 0, |
| 114 | + image: result.images?.jpg?.image_url ?? '', |
| 115 | + |
| 116 | + released: true, |
| 117 | + publishedFrom: new Date(result.published?.from).toLocaleDateString() ?? 'unknown', |
| 118 | + publishedTo: new Date(result.published?.to).toLocaleDateString() ?? 'unknown', |
| 119 | + status: result.status, |
| 120 | + |
| 121 | + userData: { |
| 122 | + watched: false, |
| 123 | + lastWatched: '', |
| 124 | + personalRating: 0, |
| 125 | + }, |
| 126 | + } as MangaModel); |
| 127 | + |
| 128 | + return model; |
130 | 129 | }
|
131 | 130 | }
|
0 commit comments