mirror of
https://github.com/LukeHagar/plex-api-oauth.git
synced 2025-12-11 04:20:51 +00:00
Cleanup for RFC
This commit is contained in:
@@ -4,8 +4,11 @@ import axios from "axios";
|
|||||||
import qs from "qs";
|
import qs from "qs";
|
||||||
// import InfiniteScroll from "react-infinite-scroller";
|
// import InfiniteScroll from "react-infinite-scroller";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
|
import { GeneratePlexClientInformation } from "..";
|
||||||
|
|
||||||
export async function PlexLogin(plexClientInformation) {
|
export async function PlexLogin(
|
||||||
|
plexClientInformation = GeneratePlexClientInformation()
|
||||||
|
) {
|
||||||
var plexOauth = new PlexOauth(plexClientInformation);
|
var plexOauth = new PlexOauth(plexClientInformation);
|
||||||
let data = await plexOauth.requestHostedLoginURL().catch((err) => {
|
let data = await plexOauth.requestHostedLoginURL().catch((err) => {
|
||||||
throw err;
|
throw err;
|
||||||
@@ -32,11 +35,17 @@ export async function PlexLogin(plexClientInformation) {
|
|||||||
} else {
|
} else {
|
||||||
console.log("Plex Authentication Failed");
|
console.log("Plex Authentication Failed");
|
||||||
}
|
}
|
||||||
return authToken;
|
return {
|
||||||
|
plexTVAuthToken: authToken,
|
||||||
|
plexClientInformation: plexClientInformation,
|
||||||
|
};
|
||||||
// An auth token will only be null if the user never signs into the hosted UI, or you stop checking for a new one before they can log in
|
// An auth token will only be null if the user never signs into the hosted UI, or you stop checking for a new one before they can log in
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function GetPlexUserData(plexClientInformation, plexTVAuthToken) {
|
export async function GetPlexUserData({
|
||||||
|
plexClientInformation,
|
||||||
|
plexTVAuthToken,
|
||||||
|
}) {
|
||||||
let response = await axios({
|
let response = await axios({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url:
|
url:
|
||||||
@@ -68,7 +77,10 @@ export async function GetPlexUserData(plexClientInformation, plexTVAuthToken) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function GetPlexDevices(plexClientInformation, plexAuthToken) {
|
export async function GetPlexDevices({
|
||||||
|
plexClientInformation,
|
||||||
|
plexTVAuthToken,
|
||||||
|
}) {
|
||||||
let serverArray = [];
|
let serverArray = [];
|
||||||
let response = await axios({
|
let response = await axios({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -89,7 +101,10 @@ export async function GetPlexDevices(plexClientInformation, plexAuthToken) {
|
|||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function GetPlexServers(plexClientInformation, plexTVAuthToken) {
|
export async function GetPlexServers({
|
||||||
|
plexClientInformation,
|
||||||
|
plexTVAuthToken,
|
||||||
|
}) {
|
||||||
let serverArray = [];
|
let serverArray = [];
|
||||||
let response = await axios({
|
let response = await axios({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -489,12 +504,7 @@ export async function GetPlexArtists(searchParams = {}, servers, libraries) {
|
|||||||
return artistLibraryContent;
|
return artistLibraryContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function GetPlexAlbums(
|
export async function GetPlexAlbums(searchParams = {}, servers, libraries) {
|
||||||
searchParams = {},
|
|
||||||
servers,
|
|
||||||
libraries,
|
|
||||||
cancelToken
|
|
||||||
) {
|
|
||||||
let albumLibraryContent = [];
|
let albumLibraryContent = [];
|
||||||
for (const server of servers) {
|
for (const server of servers) {
|
||||||
let connectionUri = server.relayConnection;
|
let connectionUri = server.relayConnection;
|
||||||
@@ -769,7 +779,7 @@ export function fnBrowserDetect() {
|
|||||||
return browserName;
|
return browserName;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function SavePlexSession(plexClientInformation, plexTVAuthToken) {
|
export function SavePlexSession({ plexClientInformation, plexTVAuthToken }) {
|
||||||
window.localStorage.setItem(
|
window.localStorage.setItem(
|
||||||
"plexSessionData",
|
"plexSessionData",
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
@@ -783,30 +793,13 @@ export function LoadPlexSession() {
|
|||||||
return JSON.parse(window.localStorage?.getItem("plexSessionData") || "{}");
|
return JSON.parse(window.localStorage?.getItem("plexSessionData") || "{}");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GeneratePlexClientInformation(forwardUrl = "") {
|
|
||||||
if (typeof navigator !== "undefined") {
|
|
||||||
let plexClientInformation = {
|
|
||||||
clientIdentifier: v4(),
|
|
||||||
product: fnBrowserDetect(),
|
|
||||||
device: navigator.userAgentData.platform,
|
|
||||||
version: navigator.userAgentData.brands[0].version,
|
|
||||||
forwardUrl: forwardUrl,
|
|
||||||
platform: "Plex-API-OAuth",
|
|
||||||
};
|
|
||||||
console.log("Client Information generated successfully");
|
|
||||||
return plexClientInformation;
|
|
||||||
} else {
|
|
||||||
throw "Unable to detect Client";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function CreatePlexClientInformation(
|
export function CreatePlexClientInformation(
|
||||||
clientIdentifier = v4(),
|
clientIdentifier = v4(),
|
||||||
product = "Plex-API-OAuth",
|
product = fnBrowserDetect(),
|
||||||
device = "Web-Client",
|
device = navigator.userAgentData.platform,
|
||||||
version = "1",
|
version = navigator.userAgentData.brands[0].version,
|
||||||
forwardUrl = "",
|
forwardUrl = "",
|
||||||
platform = "Web"
|
platform = "Plex-API-OAuth"
|
||||||
) {
|
) {
|
||||||
let plexClientInformation = {
|
let plexClientInformation = {
|
||||||
clientIdentifier: clientIdentifier,
|
clientIdentifier: clientIdentifier,
|
||||||
@@ -839,13 +832,6 @@ export function GetLibraryPages(
|
|||||||
setItems([]);
|
setItems([]);
|
||||||
}, [query, libraryType]);
|
}, [query, libraryType]);
|
||||||
|
|
||||||
const [cancelToken, setCancelToken] = useState();
|
|
||||||
|
|
||||||
function getCancelToken(event) {
|
|
||||||
setCancelToken(event);
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
setError(false);
|
setError(false);
|
||||||
@@ -863,60 +849,25 @@ export function GetLibraryPages(
|
|||||||
|
|
||||||
switch (libraryType) {
|
switch (libraryType) {
|
||||||
case "artists":
|
case "artists":
|
||||||
data = GetPlexArtists(
|
data = GetPlexArtists(searchParams, servers, libraries);
|
||||||
searchParams,
|
|
||||||
servers,
|
|
||||||
libraries,
|
|
||||||
this.getCancelToken.bind(this)
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case "albums":
|
case "albums":
|
||||||
data = GetPlexAlbums(
|
data = GetPlexAlbums(searchParams, servers, libraries);
|
||||||
searchParams,
|
|
||||||
servers,
|
|
||||||
libraries,
|
|
||||||
this.getCancelToken.bind(this)
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case "songs":
|
case "songs":
|
||||||
data = GetPlexSongs(
|
data = GetPlexSongs(searchParams, servers, libraries);
|
||||||
searchParams,
|
|
||||||
servers,
|
|
||||||
libraries,
|
|
||||||
this.getCancelToken.bind(this)
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case "shows":
|
case "shows":
|
||||||
data = GetPlexShows(
|
data = GetPlexShows(searchParams, servers, libraries);
|
||||||
searchParams,
|
|
||||||
servers,
|
|
||||||
libraries,
|
|
||||||
this.getCancelToken.bind(this)
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case "seasons":
|
case "seasons":
|
||||||
data = PlexSession.GetPlexSeasons(
|
data = GetPlexSeasons(searchParams, servers, libraries);
|
||||||
searchParams,
|
|
||||||
servers,
|
|
||||||
libraries,
|
|
||||||
this.getCancelToken.bind(this)
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case "episodes":
|
case "episodes":
|
||||||
data = GetPlexEpisodes(
|
data = GetPlexEpisodes(searchParams, servers, libraries);
|
||||||
searchParams,
|
|
||||||
servers,
|
|
||||||
libraries,
|
|
||||||
this.getCancelToken.bind(this)
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case "movies":
|
case "movies":
|
||||||
data = GetPlexMovies(
|
data = GetPlexMovies(searchParams, servers, libraries);
|
||||||
searchParams,
|
|
||||||
servers,
|
|
||||||
libraries,
|
|
||||||
this.getCancelToken.bind(this)
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -933,11 +884,6 @@ export function GetLibraryPages(
|
|||||||
setError(e);
|
setError(e);
|
||||||
});
|
});
|
||||||
} catch {}
|
} catch {}
|
||||||
return () => {
|
}, [query, pageNumber, libraryType]);
|
||||||
if (cancelToken) {
|
|
||||||
cancelToken();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}, [query, pageNumber]);
|
|
||||||
return { loading, error, items, hasMore };
|
return { loading, error, items, hasMore };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,190 +5,170 @@ import {
|
|||||||
PlexLogin,
|
PlexLogin,
|
||||||
GetPlexUserData,
|
GetPlexUserData,
|
||||||
} from "../src/index.js";
|
} from "../src/index.js";
|
||||||
import React, { useState } from "React";
|
import React from "React";
|
||||||
|
|
||||||
function UnitTests() {
|
describe("Unit Tests", function () {
|
||||||
const [plexClientInformation, setPlexClientInformation] = useState();
|
let emptyArray = [];
|
||||||
const [plexTVAuthToken, setPlexTVAuthToken] = useState();
|
it("Generate ClientId and Login", async function () {
|
||||||
const [plexTVUserData, setPlexUserData] = useState();
|
this.timeout(10000);
|
||||||
const [plexServers, setPlexServers] = useState();
|
let plexSession = await PlexLogin(plexClientInformation);
|
||||||
describe("Unit Tests", function () {
|
assert.notEqual(plexSession.plexTVAuthToken, null);
|
||||||
let emptyArray = [];
|
assert.notEqual(plexSession.plexTVAuthToken, undefined);
|
||||||
it("Generate ClientId", function () {
|
assert.notEqual(plexSession.plexClientInformation, null);
|
||||||
setPlexClientInformation(CreatePlexClientInformation());
|
assert.notEqual(plexSession.plexClientInformation, undefined);
|
||||||
assert.notEqual(plexClientInformation, null);
|
console.log("Client Info and Auth Token");
|
||||||
assert.notEqual(plexClientInformation, undefined);
|
console.log(plexSession);
|
||||||
console.log("Plex Session");
|
|
||||||
console.log(plexClientInformation);
|
|
||||||
});
|
|
||||||
it("Login", async function () {
|
|
||||||
this.timeout(10000);
|
|
||||||
setPlexClientInformation(await PlexLogin(plexClientInformation));
|
|
||||||
assert.notEqual(plexTVAuthToken, null);
|
|
||||||
assert.notEqual(plexTVAuthToken, undefined);
|
|
||||||
console.log("Auth Token");
|
|
||||||
console.log(plexTVAuthToken);
|
|
||||||
});
|
|
||||||
it("Get Plex User Data", async function () {
|
|
||||||
this.timeout(5000);
|
|
||||||
setPlexUserData(
|
|
||||||
await GetPlexUserData(plexClientInformation, plexTVAuthToken)
|
|
||||||
);
|
|
||||||
assert.notEqual(plexTVUserData, undefined);
|
|
||||||
assert.notEqual(plexTVUserData, null);
|
|
||||||
console.log("User Data");
|
|
||||||
console.log(plexTVUserData);
|
|
||||||
});
|
|
||||||
it("Get Plex Servers", async function () {
|
|
||||||
this.timeout(12000);
|
|
||||||
setPlexServers(
|
|
||||||
await PlexSession.GetPlexServers(
|
|
||||||
plexClientInformation,
|
|
||||||
plexTVAuthToken,
|
|
||||||
{
|
|
||||||
owned: true,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert.notEqual(plexServers, emptyArray);
|
|
||||||
assert.notEqual(plexServers, null);
|
|
||||||
assert.notEqual(plexServers, undefined);
|
|
||||||
console.log("Plex Servers");
|
|
||||||
console.log(plexServers);
|
|
||||||
});
|
|
||||||
// it("Get Plex Libraries", async function () {
|
|
||||||
// this.timeout(10000);
|
|
||||||
// let response = await PlexSession.GetPlexLibraries();
|
|
||||||
// assert.notEqual(PlexSession.plexLibraries, null);
|
|
||||||
// assert.notEqual(PlexSession.plexLibraries, undefined);
|
|
||||||
// assert.notEqual(PlexSession.plexLibraries, emptyArray);
|
|
||||||
// assert.notEqual(response, emptyArray);
|
|
||||||
// assert.notEqual(response, null);
|
|
||||||
// assert.notEqual(response, undefined);
|
|
||||||
// //console.log("Plex Libraries");
|
|
||||||
// //console.log(PlexSession.plexLibraries);
|
|
||||||
// });
|
|
||||||
// it("Get Plex Movie Libraries", async function () {
|
|
||||||
// this.timeout(20000);
|
|
||||||
// let response = await PlexSession.GetPlexMovieLibraries();
|
|
||||||
// assert.notEqual(response, emptyArray);
|
|
||||||
// assert.notEqual(response, null);
|
|
||||||
// assert.notEqual(response, undefined);
|
|
||||||
// // console.log("Plex Movie Libraries");
|
|
||||||
// // console.log(response);
|
|
||||||
// });
|
|
||||||
// it("Get Plex Music Libraries", async function () {
|
|
||||||
// this.timeout(10000);
|
|
||||||
// let response = await PlexSession.GetPlexMusicLibraries();
|
|
||||||
// assert.notEqual(response, emptyArray);
|
|
||||||
// assert.notEqual(response, null);
|
|
||||||
// assert.notEqual(response, undefined);
|
|
||||||
// // console.log("Plex Music Libraries");
|
|
||||||
// // console.log(response);
|
|
||||||
// });
|
|
||||||
// it("Get Plex TV Libraries", async function () {
|
|
||||||
// this.timeout(10000);
|
|
||||||
// let response = await PlexSession.GetPlexTVShowLibraries();
|
|
||||||
// assert.notEqual(response, emptyArray);
|
|
||||||
// assert.notEqual(response, null);
|
|
||||||
// assert.notEqual(response, undefined);
|
|
||||||
// // console.log("Plex TV Libraries");
|
|
||||||
// // console.log(response);
|
|
||||||
// });
|
|
||||||
// it("Get Plex Movies", async function () {
|
|
||||||
// this.timeout(10000);
|
|
||||||
// let response = await PlexSession.GetPlexMovies({
|
|
||||||
// "X-Plex-Container-Start": 0,
|
|
||||||
// "X-Plex-Container-Size": 2,
|
|
||||||
// });
|
|
||||||
// assert.notEqual(response, emptyArray);
|
|
||||||
// assert.notEqual(response, null);
|
|
||||||
// assert.notEqual(response, undefined);
|
|
||||||
// // console.log("Plex Movies");
|
|
||||||
// // console.log(response);
|
|
||||||
// });
|
|
||||||
// it("Get Plex Shows", async function () {
|
|
||||||
// this.timeout(10000);
|
|
||||||
// let response = await PlexSession.GetPlexShows({
|
|
||||||
// "X-Plex-Container-Start": 0,
|
|
||||||
// "X-Plex-Container-Size": 2,
|
|
||||||
// });
|
|
||||||
// assert.notEqual(response, emptyArray);
|
|
||||||
// assert.notEqual(response, null);
|
|
||||||
// assert.notEqual(response, undefined);
|
|
||||||
// // console.log("Plex Shows");
|
|
||||||
// // console.log(response);
|
|
||||||
// });
|
|
||||||
// it("Get Plex Seasons", async function () {
|
|
||||||
// this.timeout(10000);
|
|
||||||
// let response = await PlexSession.GetPlexSeasons({
|
|
||||||
// "X-Plex-Container-Start": 0,
|
|
||||||
// "X-Plex-Container-Size": 2,
|
|
||||||
// });
|
|
||||||
// assert.notEqual(response, emptyArray);
|
|
||||||
// assert.notEqual(response, null);
|
|
||||||
// assert.notEqual(response, undefined);
|
|
||||||
// // console.log("Plex Seasons");
|
|
||||||
// // console.log(response);
|
|
||||||
// });
|
|
||||||
// it("Get Plex Episodes", async function () {
|
|
||||||
// this.timeout(20000);
|
|
||||||
// let response = await PlexSession.GetPlexEpisodes({
|
|
||||||
// "X-Plex-Container-Start": 0,
|
|
||||||
// "X-Plex-Container-Size": 2,
|
|
||||||
// });
|
|
||||||
// assert.notEqual(response, emptyArray);
|
|
||||||
// assert.notEqual(response, null);
|
|
||||||
// assert.notEqual(response, undefined);
|
|
||||||
// // console.log("Plex Episodes");
|
|
||||||
// // console.log(response);
|
|
||||||
// });
|
|
||||||
// it("Get Plex Artists", async function () {
|
|
||||||
// this.timeout(10000);
|
|
||||||
// let response = await PlexSession.GetPlexArtists({
|
|
||||||
// "X-Plex-Container-Start": 0,
|
|
||||||
// "X-Plex-Container-Size": 2,
|
|
||||||
// });
|
|
||||||
// assert.notEqual(response, emptyArray);
|
|
||||||
// assert.notEqual(response, null);
|
|
||||||
// assert.notEqual(response, undefined);
|
|
||||||
// // console.log("Plex Artists");
|
|
||||||
// // console.log(response);
|
|
||||||
// });
|
|
||||||
// it("Get Plex Albums", async function () {
|
|
||||||
// this.timeout(10000);
|
|
||||||
// let response = await PlexSession.GetPlexAlbums({
|
|
||||||
// "X-Plex-Container-Start": 0,
|
|
||||||
// "X-Plex-Container-Size": 2,
|
|
||||||
// });
|
|
||||||
// assert.notEqual(response, emptyArray);
|
|
||||||
// assert.notEqual(response, null);
|
|
||||||
// assert.notEqual(response, undefined);
|
|
||||||
// // console.log("Plex Albums");
|
|
||||||
// // console.log(response);
|
|
||||||
// });
|
|
||||||
// it("Get Plex Songs", async function () {
|
|
||||||
// this.timeout(20000);
|
|
||||||
// let response = await PlexSession.GetPlexSongs({
|
|
||||||
// "X-Plex-Container-Start": 0,
|
|
||||||
// "X-Plex-Container-Size": 2,
|
|
||||||
// });
|
|
||||||
// assert.notEqual(response, emptyArray);
|
|
||||||
// assert.notEqual(response, null);
|
|
||||||
// assert.notEqual(response, undefined);
|
|
||||||
// // console.log("Plex Songs");
|
|
||||||
// // console.log(response);
|
|
||||||
// });
|
|
||||||
// it("Get Plex Songs Paged", async function () {
|
|
||||||
// this.timeout(20000);
|
|
||||||
// let response = GetLibraryPages(PlexSession, "songs");
|
|
||||||
// assert.notEqual(response, emptyArray);
|
|
||||||
// assert.notEqual(response, null);
|
|
||||||
// assert.notEqual(response, undefined);
|
|
||||||
// console.log("Plex Songs Paged");
|
|
||||||
// console.log(response);
|
|
||||||
// });
|
|
||||||
});
|
});
|
||||||
}
|
it("Get Plex User Data", async function () {
|
||||||
|
this.timeout(5000);
|
||||||
UnitTests();
|
let plexSession = await PlexLogin(plexClientInformation);
|
||||||
|
let plexTVUserData = await GetPlexUserData(plexSession);
|
||||||
|
assert.notEqual(plexTVUserData, undefined);
|
||||||
|
assert.notEqual(plexTVUserData, null);
|
||||||
|
console.log("User Data");
|
||||||
|
console.log(plexTVUserData);
|
||||||
|
});
|
||||||
|
it("Get Plex Servers", async function () {
|
||||||
|
this.timeout(12000);
|
||||||
|
let plexSession = await PlexLogin(plexClientInformation);
|
||||||
|
let plexTVUserData = await GetPlexUserData(plexSession);
|
||||||
|
let plexServers = await PlexSession.GetPlexServers(plexSession);
|
||||||
|
assert.notEqual(plexServers, emptyArray);
|
||||||
|
assert.notEqual(plexServers, null);
|
||||||
|
assert.notEqual(plexServers, undefined);
|
||||||
|
console.log("Plex Servers");
|
||||||
|
console.log(plexServers);
|
||||||
|
});
|
||||||
|
// it("Get Plex Libraries", async function () {
|
||||||
|
// this.timeout(10000);
|
||||||
|
// let response = await PlexSession.GetPlexLibraries();
|
||||||
|
// assert.notEqual(PlexSession.plexLibraries, null);
|
||||||
|
// assert.notEqual(PlexSession.plexLibraries, undefined);
|
||||||
|
// assert.notEqual(PlexSession.plexLibraries, emptyArray);
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// //console.log("Plex Libraries");
|
||||||
|
// //console.log(PlexSession.plexLibraries);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Movie Libraries", async function () {
|
||||||
|
// this.timeout(20000);
|
||||||
|
// let response = await PlexSession.GetPlexMovieLibraries();
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex Movie Libraries");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Music Libraries", async function () {
|
||||||
|
// this.timeout(10000);
|
||||||
|
// let response = await PlexSession.GetPlexMusicLibraries();
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex Music Libraries");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex TV Libraries", async function () {
|
||||||
|
// this.timeout(10000);
|
||||||
|
// let response = await PlexSession.GetPlexTVShowLibraries();
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex TV Libraries");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Movies", async function () {
|
||||||
|
// this.timeout(10000);
|
||||||
|
// let response = await PlexSession.GetPlexMovies({
|
||||||
|
// "X-Plex-Container-Start": 0,
|
||||||
|
// "X-Plex-Container-Size": 2,
|
||||||
|
// });
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex Movies");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Shows", async function () {
|
||||||
|
// this.timeout(10000);
|
||||||
|
// let response = await PlexSession.GetPlexShows({
|
||||||
|
// "X-Plex-Container-Start": 0,
|
||||||
|
// "X-Plex-Container-Size": 2,
|
||||||
|
// });
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex Shows");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Seasons", async function () {
|
||||||
|
// this.timeout(10000);
|
||||||
|
// let response = await PlexSession.GetPlexSeasons({
|
||||||
|
// "X-Plex-Container-Start": 0,
|
||||||
|
// "X-Plex-Container-Size": 2,
|
||||||
|
// });
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex Seasons");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Episodes", async function () {
|
||||||
|
// this.timeout(20000);
|
||||||
|
// let response = await PlexSession.GetPlexEpisodes({
|
||||||
|
// "X-Plex-Container-Start": 0,
|
||||||
|
// "X-Plex-Container-Size": 2,
|
||||||
|
// });
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex Episodes");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Artists", async function () {
|
||||||
|
// this.timeout(10000);
|
||||||
|
// let response = await PlexSession.GetPlexArtists({
|
||||||
|
// "X-Plex-Container-Start": 0,
|
||||||
|
// "X-Plex-Container-Size": 2,
|
||||||
|
// });
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex Artists");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Albums", async function () {
|
||||||
|
// this.timeout(10000);
|
||||||
|
// let response = await PlexSession.GetPlexAlbums({
|
||||||
|
// "X-Plex-Container-Start": 0,
|
||||||
|
// "X-Plex-Container-Size": 2,
|
||||||
|
// });
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex Albums");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Songs", async function () {
|
||||||
|
// this.timeout(20000);
|
||||||
|
// let response = await PlexSession.GetPlexSongs({
|
||||||
|
// "X-Plex-Container-Start": 0,
|
||||||
|
// "X-Plex-Container-Size": 2,
|
||||||
|
// });
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex Songs");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Songs Paged", async function () {
|
||||||
|
// this.timeout(20000);
|
||||||
|
// let response = GetLibraryPages(PlexSession, "songs");
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// console.log("Plex Songs Paged");
|
||||||
|
// console.log(response);
|
||||||
|
// });
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user