mirror of
https://github.com/seerr-team/seerr.git
synced 2026-06-15 11:59:11 -04:00
refactor(api): remove getEpisodesBySeriesId method and update availabilitySync to use getEpisodes
Signed-off-by: 0xsysr3ll <0xsysr3ll@pm.me>
This commit is contained in:
@@ -451,20 +451,6 @@ class SonarrAPI extends ServarrBase<{
|
||||
}
|
||||
};
|
||||
|
||||
public async getEpisodesBySeriesId(
|
||||
seriesId: number
|
||||
): Promise<EpisodeResult[]> {
|
||||
try {
|
||||
const response = await this.axios.get<EpisodeResult[]>(`/episode`, {
|
||||
params: { seriesId },
|
||||
});
|
||||
return response.data;
|
||||
} catch (e) {
|
||||
throw new Error(
|
||||
`[Sonarr] Failed to retrieve episodes for series: ${e.message}`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default SonarrAPI;
|
||||
|
||||
@@ -784,7 +784,7 @@ class AvailabilitySync {
|
||||
sonarr.statistics.episodeFileCount > 0
|
||||
) {
|
||||
try {
|
||||
const episodes = await sonarrAPI.getEpisodesBySeriesId(serviceId);
|
||||
const episodes = await sonarrAPI.getEpisodes(serviceId);
|
||||
this.sonarrEpisodesCache[`${server.id}-${serviceId}`] = episodes;
|
||||
} catch (err) {
|
||||
logger.error('Failed to fetch episodes for caching', {
|
||||
|
||||
Reference in New Issue
Block a user