From db2306cc91d60ae35f6187dc198df4d96de4b254 Mon Sep 17 00:00:00 2001 From: David Ludwig Date: Sat, 8 May 2021 15:01:29 +0000 Subject: [PATCH] Add interface method to Plex API to grab links for given movie items --- api/plex/src/IpcClient.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/api/plex/src/IpcClient.ts b/api/plex/src/IpcClient.ts index 8d3e11c..5c9a769 100644 --- a/api/plex/src/IpcClient.ts +++ b/api/plex/src/IpcClient.ts @@ -13,4 +13,15 @@ export class IpcClient extends IpcClientS * The path to the socket file */ protected readonly SOCKET_PATH = SOCKET_PATH; + + /** + * Fetch a Plex movie link given the TMDb ID if it exists + */ + public async movieLinks(tmdbIds: (number|string)[]) { + let results = await this.request("movie_links", tmdbIds); + if (results.error) { + throw new Error("Failed to fetch Plex movie link"); + } + return <{ [tmdbId: string]: string|null }>results.data; + } }