Skip to content

Commit

Permalink
fix: Improved logging when media is not removable through *arr (#1177)
Browse files Browse the repository at this point in the history
* fix: Improved logging when media is not removable through *arr

* chore: Moved error logs to warnings
  • Loading branch information
jorenn92 authored Jul 18, 2024
1 parent c79dc9b commit 074c7c3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
6 changes: 3 additions & 3 deletions server/src/modules/api/plex-api/plex-api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class PlexApiService {
);
}
} catch (err) {
this.logger.error(
this.logger.warn(
`Couldn't connect to Plex.. Please check your settings`,
);
this.logger.debug(err);
Expand Down Expand Up @@ -448,7 +448,7 @@ export class PlexApiService {
uri: `/library/metadata/${plexId}`,
});
} catch (e) {
this.logger.log('Something went wrong while removing media from Plex.', {
this.logger.warn('Something went wrong while removing media from Plex.', {
label: 'Plex API',
errorMessage: e.message,
plexId,
Expand Down Expand Up @@ -905,7 +905,7 @@ export class PlexApiService {
this.machineId = response.machineIdentifier;
return response.machineIdentifier;
} else {
this.logger.error("Couldn't reach Plex");
this.logger.warn("Couldn't reach Plex");
return null;
}
} catch (err) {
Expand Down
16 changes: 12 additions & 4 deletions server/src/modules/collections/collection-worker.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ export class CollectionWorkerService extends TaskBase {
if (collection.arrAction !== ServarrAction.UNMONITOR) {
this.plexApi.deleteMediaFromDisk(plexData.ratingKey);
this.infoLogger(
`Couldn't find correct tvdb id. No Sonarr action was taken for show: https://www.themoviedb.org/tv/${media.tmdbId}. But media item was removed from Plex`,
`Couldn't find correct tvdb id. No Sonarr action was taken for show: https://www.themoviedb.org/tv/${media.tmdbId}. But media item was removed through Plex`,
);
} else {
this.infoLogger(
Expand Down Expand Up @@ -467,10 +467,18 @@ export class CollectionWorkerService extends TaskBase {
if (
!(plexLibrary.type === 'movie'
? this.settings.radarrConfigured()
: this.settings.sonarrConfigured()) &&
collection.arrAction !== ServarrAction.UNMONITOR
: this.settings.sonarrConfigured())
)
await this.plexApi.deleteMediaFromDisk(media.plexId);
if (collection.arrAction !== ServarrAction.UNMONITOR) {
await this.plexApi.deleteMediaFromDisk(media.plexId.toString());
this.infoLogger(
`Couldn't utilize *arr to find and remove the media with id ${media.plexId}, so media was removed from the filesystem through Plex. No unmonitor action was taken.`,
);
} else {
this.infoLogger(
`*arr unmonitor action isn't possible, since *arr is not available. Didn't unmonitor media with id ${media.plexId}.}`,
);
}
}
}

Expand Down

0 comments on commit 074c7c3

Please sign in to comment.