Ran prettier

This commit is contained in:
ltctceplrm 2025-12-09 21:16:53 +01:00
parent bd2b84bbce
commit 35ea3cbb22
2 changed files with 28 additions and 21 deletions

View file

@ -69,7 +69,7 @@ export class TMDBSeasonAPI extends APIModel {
id: result.id.toString(), id: result.id.toString(),
seasonTitle: result.name ?? result.original_name ?? '', seasonTitle: result.name ?? result.original_name ?? '',
seasonNumber: totalSeasons, seasonNumber: totalSeasons,
}) }),
); );
} }
@ -105,7 +105,7 @@ export class TMDBSeasonAPI extends APIModel {
id: `${tvId}/season/${seasonNumber}`, id: `${tvId}/season/${seasonNumber}`,
seasonTitle: season.name ?? titleText, seasonTitle: season.name ?? titleText,
seasonNumber: seasonNumber, seasonNumber: seasonNumber,
}) }),
); );
} }
} }

View file

@ -250,13 +250,18 @@ export default class MediaDbPlugin extends Plugin {
} }
// Pass the original series title from the search result // Pass the original series title from the search result
const seriesName = selectResults[0]?.englishTitle || selectResults[0]?.title || ''; const seriesName = selectResults[0]?.englishTitle || selectResults[0]?.title || '';
const modal = new MediaDbSeasonSelectModal(this, allSeasons.map(s => ({ const modal = new MediaDbSeasonSelectModal(
season_number: s.seasonNumber, this,
name: s.seasonTitle || s.title, allSeasons.map(s => ({
episode_count: s.episodes || 0, season_number: s.seasonNumber,
air_date: s.year, name: s.seasonTitle || s.title,
poster_path: s.image, episode_count: s.episodes || 0,
})), true, seriesName); air_date: s.year,
poster_path: s.image,
})),
true,
seriesName,
);
const selectedSeasons: any[] = await new Promise(resolve => { const selectedSeasons: any[] = await new Promise(resolve => {
modal.setSubmitCallback(resolve); modal.setSubmitCallback(resolve);
modal.open(); modal.open();
@ -265,19 +270,21 @@ export default class MediaDbPlugin extends Plugin {
return; return;
} }
// Fetch full metadata for each selected seasond and create the note // Fetch full metadata for each selected seasond and create the note
await Promise.all(selectedSeasons.map(async season => { await Promise.all(
const orig = allSeasons.find(s => s.seasonNumber === season.season_number); selectedSeasons.map(async season => {
if (orig) { const orig = allSeasons.find(s => s.seasonNumber === season.season_number);
// Fetch full metadata using getById if (orig) {
const TMDBSeasonAPI = this.apiManager.getApiByName('TMDBSeasonAPI') as import('./api/apis/TMDBSeasonAPI').TMDBSeasonAPI; // Fetch full metadata using getById
if (TMDBSeasonAPI) { const TMDBSeasonAPI = this.apiManager.getApiByName('TMDBSeasonAPI') as import('./api/apis/TMDBSeasonAPI').TMDBSeasonAPI;
const fullMeta = await TMDBSeasonAPI.getById(orig.id); if (TMDBSeasonAPI) {
await this.createMediaDbNotes([fullMeta]); const fullMeta = await TMDBSeasonAPI.getById(orig.id);
} else { await this.createMediaDbNotes([fullMeta]);
await this.createMediaDbNotes([orig]); } else {
await this.createMediaDbNotes([orig]);
}
} }
} }),
})); );
return; return;
} }