mirror of
https://github.com/sct/overseerr.git
synced 2025-09-27 12:39:46 +02:00
fix(logs): improve logging when adding to sonarr/radarr
This commit is contained in:
@@ -78,7 +78,7 @@ class RadarrAPI {
|
|||||||
|
|
||||||
public addMovie = async (options: RadarrMovieOptions): Promise<void> => {
|
public addMovie = async (options: RadarrMovieOptions): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
await this.axios.post<RadarrMovie>(`/movie`, {
|
const response = await this.axios.post<RadarrMovie>(`/movie`, {
|
||||||
title: options.title,
|
title: options.title,
|
||||||
qualityProfileId: options.qualityProfileId,
|
qualityProfileId: options.qualityProfileId,
|
||||||
profileId: options.profileId,
|
profileId: options.profileId,
|
||||||
@@ -92,6 +92,19 @@ class RadarrAPI {
|
|||||||
searchForMovie: options.searchNow,
|
searchForMovie: options.searchNow,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (response.data.id) {
|
||||||
|
logger.info('Radarr accepted request', { label: 'Radarr' });
|
||||||
|
logger.debug('Radarr add details', {
|
||||||
|
label: 'Radarr',
|
||||||
|
movie: response.data,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
logger.error('Failed to add movie to Radarr', {
|
||||||
|
label: 'Radarr',
|
||||||
|
options,
|
||||||
|
});
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error(
|
logger.error(
|
||||||
'Failed to add movie to Radarr. This might happen if the movie already exists, in which case you can safely ignore this error.',
|
'Failed to add movie to Radarr. This might happen if the movie already exists, in which case you can safely ignore this error.',
|
||||||
|
@@ -126,7 +126,7 @@ class SonarrAPI {
|
|||||||
|
|
||||||
series.addOptions = {
|
series.addOptions = {
|
||||||
ignoreEpisodesWithFiles: true,
|
ignoreEpisodesWithFiles: true,
|
||||||
searchForMissingEpisodes: true,
|
searchForMissingEpisodes: options.searchNow,
|
||||||
};
|
};
|
||||||
|
|
||||||
const newSeriesResponse = await this.axios.put<SonarrSeries>(
|
const newSeriesResponse = await this.axios.put<SonarrSeries>(
|
||||||
@@ -134,6 +134,21 @@ class SonarrAPI {
|
|||||||
series
|
series
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (newSeriesResponse.data.id) {
|
||||||
|
logger.info('Sonarr accepted request. Updated existing series', {
|
||||||
|
label: 'Sonarr',
|
||||||
|
});
|
||||||
|
logger.debug('Sonarr add details', {
|
||||||
|
label: 'Sonarr',
|
||||||
|
movie: newSeriesResponse.data,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
logger.error('Failed to add movie to Sonarr', {
|
||||||
|
label: 'Sonarr',
|
||||||
|
options,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return newSeriesResponse.data;
|
return newSeriesResponse.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,6 +177,19 @@ class SonarrAPI {
|
|||||||
} as Partial<SonarrSeries>
|
} as Partial<SonarrSeries>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (createdSeriesResponse.data.id) {
|
||||||
|
logger.info('Sonarr accepted request', { label: 'Sonarr' });
|
||||||
|
logger.debug('Sonarr add details', {
|
||||||
|
label: 'Sonarr',
|
||||||
|
movie: createdSeriesResponse.data,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
logger.error('Failed to add movie to Sonarr', {
|
||||||
|
label: 'Sonarr',
|
||||||
|
options,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return createdSeriesResponse.data;
|
return createdSeriesResponse.data;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error('Something went wrong adding a series to Sonarr', {
|
logger.error('Something went wrong adding a series to Sonarr', {
|
||||||
|
Reference in New Issue
Block a user