Skip to content

Latest commit

 

History

History
154 lines (123 loc) · 7.85 KB

README.md

File metadata and controls

154 lines (123 loc) · 7.85 KB

Video

(Video)

Overview

API Calls that perform operations with Plex Media Server Videos

Available Operations

GetTimeline

Get the timeline for a media item

Example Usage

package main

import(
	"github.com/LukeHagar/plexgo"
	"context"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    s := plexgo.New(
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
        plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"),
        plexgo.WithClientName("Plex for Roku"),
        plexgo.WithClientVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithDeviceNickname("Roku 3"),
    )

    ctx := context.Background()
    res, err := s.Video.GetTimeline(ctx, operations.GetTimelineRequest{
        RatingKey: 23409,
        Key: "/library/metadata/23409",
        State: operations.StatePlaying,
        HasMDE: 1,
        Time: 2000,
        Duration: 10000,
        Context: "home:hub.continueWatching",
        PlayQueueItemID: 1,
        PlayBackTime: 2000,
        Row: 1,
    })
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.GetTimelineRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.GetTimelineResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.GetTimelineBadRequest 400 application/json
sdkerrors.GetTimelineUnauthorized 401 application/json
sdkerrors.SDKError 4XX, 5XX */*

StartUniversalTranscode

Begin a Universal Transcode Session

Example Usage

package main

import(
	"github.com/LukeHagar/plexgo"
	"context"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    s := plexgo.New(
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
        plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"),
        plexgo.WithClientName("Plex for Roku"),
        plexgo.WithClientVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithDeviceNickname("Roku 3"),
    )

    ctx := context.Background()
    res, err := s.Video.StartUniversalTranscode(ctx, operations.StartUniversalTranscodeRequest{
        HasMDE: 1,
        Path: "/library/metadata/23409",
        MediaIndex: 0,
        PartIndex: 0,
        Protocol: "hls",
        FastSeek: plexgo.Float64(0),
        DirectPlay: plexgo.Float64(0),
        DirectStream: plexgo.Float64(0),
        SubtitleSize: plexgo.Float64(100),
        Subtites: plexgo.String("burn"),
        AudioBoost: plexgo.Float64(100),
        Location: plexgo.String("lan"),
        MediaBufferSize: plexgo.Float64(102400),
        Session: plexgo.String("zvcage8b7rkioqcm8f4uns4c"),
        AddDebugOverlay: plexgo.Float64(0),
        AutoAdjustQuality: plexgo.Float64(0),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.StartUniversalTranscodeRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.StartUniversalTranscodeResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.StartUniversalTranscodeBadRequest 400 application/json
sdkerrors.StartUniversalTranscodeUnauthorized 401 application/json
sdkerrors.SDKError 4XX, 5XX */*