From a4d4376e857c21a2e21221a9b522e91c79740788 Mon Sep 17 00:00:00 2001 From: Minteck Date: Sun, 5 Mar 2023 09:42:52 +0100 Subject: Updated 2 files and added 3 files (automated) --- pages/api/plex-thumb.php | 11 ++++++ pages/api/plex.php | 90 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 pages/api/plex-thumb.php create mode 100644 pages/api/plex.php (limited to 'pages/api') diff --git a/pages/api/plex-thumb.php b/pages/api/plex-thumb.php new file mode 100644 index 0000000..4a20159 --- /dev/null +++ b/pages/api/plex-thumb.php @@ -0,0 +1,11 @@ + "Plex", + "avatar_url" => "https://support.plex.tv/wp-content/themes/plex/assets/img/favicons/plex-192.png", + "embeds" => [ + [ + "title" => formatTitle($payload["Metadata"]), + "type" => "rich", + "description" => formatSubtitle($payload["Metadata"]), + "color" => hexdec( "2b2d31" ), + "thumbnail" => [ + "url" => "https://ponies.equestria.horse/assets/cache/" . $id . ".jpg" + ], + "footer" => [ + "text" => $payload["Account"]["title"] . " ยท Playing from " . $payload["Player"]["title"], + "icon_url" => $payload["Account"]["thumb"] + ] + ] + ] + + ], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); +} + +if (isset($hookObject)) { + $ch = curl_init(); + + curl_setopt_array( $ch, [ + CURLOPT_URL => $app["webhook"]["plex"], + CURLOPT_POST => true, + CURLOPT_POSTFIELDS => $hookObject, + CURLOPT_HTTPHEADER => [ + "Content-Type: application/json" + ] + ]); + + $response = curl_exec( $ch ); + curl_close( $ch ); +} \ No newline at end of file -- cgit