mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-06 12:37:46 +00:00
80 lines
2.2 KiB
TypeScript
80 lines
2.2 KiB
TypeScript
/*
|
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
*/
|
|
|
|
import dotenv from "dotenv";
|
|
dotenv.config();
|
|
/**
|
|
* Example usage of the @lukehagar/plexjs SDK
|
|
*
|
|
* To run this example from the examples directory:
|
|
* npm run build && npx tsx transcoderStartTranscodeSession.example.ts
|
|
*/
|
|
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import {
|
|
Extension,
|
|
StartTranscodeSessionLocation,
|
|
StartTranscodeSessionProtocol,
|
|
} from "@lukehagar/plexjs/models/operations";
|
|
import {
|
|
Accepts,
|
|
AdvancedSubtitles,
|
|
BoolInt,
|
|
TranscodeType,
|
|
} from "@lukehagar/plexjs/models/shared";
|
|
|
|
const plexAPI = new PlexAPI({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function main() {
|
|
const result = await plexAPI.transcoder.startTranscodeSession({
|
|
transcodeType: TranscodeType.Music,
|
|
extension: Extension.Mpd,
|
|
advancedSubtitles: AdvancedSubtitles.Burn,
|
|
audioBoost: 50,
|
|
audioChannelCount: 5,
|
|
autoAdjustQuality: BoolInt.True,
|
|
autoAdjustSubtitle: BoolInt.True,
|
|
directPlay: BoolInt.True,
|
|
directStream: BoolInt.True,
|
|
directStreamAudio: BoolInt.True,
|
|
disableResolutionRotation: BoolInt.True,
|
|
hasMDE: BoolInt.True,
|
|
location: StartTranscodeSessionLocation.Wan,
|
|
mediaBufferSize: 102400,
|
|
mediaIndex: 0,
|
|
musicBitrate: 5000,
|
|
offset: 90.5,
|
|
partIndex: 0,
|
|
path: "/library/metadata/151671",
|
|
peakBitrate: 12000,
|
|
photoResolution: "1080x1080",
|
|
protocol: StartTranscodeSessionProtocol.Dash,
|
|
secondsPerSegment: 5,
|
|
subtitleSize: 50,
|
|
videoBitrate: 12000,
|
|
videoQuality: 50,
|
|
videoResolution: "1080x1080",
|
|
xPlexClientProfileExtra:
|
|
"add-limitation(scope=videoCodec&scopeName=*&type=upperBound&name=video.frameRate&value=60&replace=true)+append-transcode-target-codec(type=videoProfile&context=streaming&videoCodec=h264%2Chevc&audioCodec=aac&protocol=dash)",
|
|
xPlexClientProfileName: "generic",
|
|
});
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
main().catch(console.error);
|