Skip to content

Commit

Permalink
mis tagging bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
manybothans committed May 27, 2023
1 parent b4b7fb0 commit 09a1e41
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plex-requester-collections",
"version": "1.1.5",
"version": "1.2.0",
"description": "Node app to automatically create Plex Collections for content requested by users in Overseerr.",
"main": "dist/index.js",
"scripts": {
Expand Down
29 changes: 27 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,31 @@ const app = async function () {
}
// We found a request
else {
// Remove not requested tag in case it was added before.
await PlexAPI.removeLabelFromItem(
sectionId,
sectionTypeCode,
mediaId,
TAG_NOT_REQUESTED
);

// Handle Radarr/Sonarr if applicable.
if (radarrSonarrItem && sectionType === "movie") {
// Remove not requested tag in case it was added before.
radarrSonarrItem = await RadarrAPI.removeTagFromMediaItem(
radarrSonarrItem.id,
TAG_NOT_REQUESTED,
<RadarrMediaDetails>radarrSonarrItem
);
} else if (radarrSonarrItem && sectionType === "show") {
// Remove not requested tag in case it was added before.
radarrSonarrItem = await SonarrAPI.removeTagFromMediaItem(
radarrSonarrItem.id,
TAG_NOT_REQUESTED,
<SonarrSeriesDetails>radarrSonarrItem
);
}

// Init some values we're going to need.
plexUsername = request?.requestedBy?.plexUsername;
const displayName = request?.requestedBy?.displayName;
Expand All @@ -172,14 +197,14 @@ const app = async function () {
// Tag the media item with requester username.
radarrSonarrItem = await RadarrAPI.addTagToMediaItem(
radarrSonarrItem.id,
TAG_NOT_REQUESTED,
requesterTagValue,
<RadarrMediaDetails>radarrSonarrItem
);
} else if (radarrSonarrItem && sectionType === "show") {
// Tag the media item with requester username.
radarrSonarrItem = await SonarrAPI.addTagToMediaItem(
radarrSonarrItem.id,
TAG_NOT_REQUESTED,
requesterTagValue,
<SonarrSeriesDetails>radarrSonarrItem
);
}
Expand Down

0 comments on commit 09a1e41

Please sign in to comment.