Skip to content

Latest commit

 

History

History
225 lines (138 loc) · 8.44 KB

README.md

File metadata and controls

225 lines (138 loc) · 8.44 KB

Media

(media)

Overview

API Calls interacting with Plex Media Server Media

Available Operations

mark_played

This will mark the provided media key as Played.

Example Usage

require 'plex_ruby_sdk'


s = ::PlexRubySDK::PlexAPI.new
s.config_security(
  ::PlexRubySDK::Shared::Security.new(
    access_token: "<YOUR_API_KEY_HERE>",
  )
)

    
res = s.media.mark_played(key=59398.0)

if res.status_code == 200
  # handle response
end

Parameters

Parameter Type Required Description Example
key ::Float ✔️ The media key to mark as played 59398

Response

T.nilable(::PlexRubySDK::Operations::MarkPlayedResponse)

mark_unplayed

This will mark the provided media key as Unplayed.

Example Usage

require 'plex_ruby_sdk'


s = ::PlexRubySDK::PlexAPI.new
s.config_security(
  ::PlexRubySDK::Shared::Security.new(
    access_token: "<YOUR_API_KEY_HERE>",
  )
)

    
res = s.media.mark_unplayed(key=59398.0)

if res.status_code == 200
  # handle response
end

Parameters

Parameter Type Required Description Example
key ::Float ✔️ The media key to mark as Unplayed 59398

Response

T.nilable(::PlexRubySDK::Operations::MarkUnplayedResponse)

update_play_progress

This API command can be used to update the play progress of a media item.

Example Usage

require 'plex_ruby_sdk'


s = ::PlexRubySDK::PlexAPI.new
s.config_security(
  ::PlexRubySDK::Shared::Security.new(
    access_token: "<YOUR_API_KEY_HERE>",
  )
)

    
res = s.media.update_play_progress(key="<key>", time=90000.0, state="played")

if res.status_code == 200
  # handle response
end

Parameters

Parameter Type Required Description Example
key ::String ✔️ the media key
time ::Float ✔️ The time, in milliseconds, used to set the media playback progress. 90000
state ::String ✔️ The playback state of the media item. played

Response

T.nilable(::PlexRubySDK::Operations::UpdatePlayProgressResponse)

get_banner_image

Gets the banner image of the media item

Example Usage

require 'plex_ruby_sdk'


s = ::PlexRubySDK::PlexAPI.new
s.config_security(
  ::PlexRubySDK::Shared::Security.new(
    access_token: "<YOUR_API_KEY_HERE>",
  )
)


req = ::PlexRubySDK::Operations::GetBannerImageRequest.new(
  rating_key: 9518,
  width: 396,
  height: 396,
  min_size: 1,
  upscale: 1,
  x_plex_token: "CV5xoxjTpFKUzBTShsaf",
)
    
res = s.media.get_banner_image(req)

if ! res.bytes.nil?
  # handle response
end

Parameters

Parameter Type Required Description
request ::PlexRubySDK::Operations::GetBannerImageRequest ✔️ The request object to use for the request.

Response

T.nilable(::PlexRubySDK::Operations::GetBannerImageResponse)

get_thumb_image

Gets the thumbnail image of the media item

Example Usage

require 'plex_ruby_sdk'


s = ::PlexRubySDK::PlexAPI.new
s.config_security(
  ::PlexRubySDK::Shared::Security.new(
    access_token: "<YOUR_API_KEY_HERE>",
  )
)


req = ::PlexRubySDK::Operations::GetThumbImageRequest.new(
  rating_key: 9518,
  width: 396,
  height: 396,
  min_size: 1,
  upscale: 1,
  x_plex_token: "CV5xoxjTpFKUzBTShsaf",
)
    
res = s.media.get_thumb_image(req)

if ! res.bytes.nil?
  # handle response
end

Parameters

Parameter Type Required Description
request ::PlexRubySDK::Operations::GetThumbImageRequest ✔️ The request object to use for the request.

Response

T.nilable(::PlexRubySDK::Operations::GetThumbImageResponse)