Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

plex-ruby

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

plex-ruby - rubygems Package Compare versions

Comparing version
1.3.0
to
1.3.1
+15
-0
CHANGELOG.md

@@ -47,1 +47,16 @@ ## 0.0.1.alpha

* `Plex::Client#play_media` now can take an Object that `responds_to(:key)`
## 1.3.0
* snake_case() -> underscore()
* Added Plex class method `camalize`
* Added singular season and episode methods
* Attribute methods are now dynamicly created in the initializer. This gets ride of
the lazy loading, but allows this gem to grow with Plex without having to update
the code everytime the API changes.
## 1.3.1
* Got rid of stdout garbage
* Fixed `Show#season` not working
* Added tests
+5
-1

@@ -123,6 +123,10 @@ module Plex

def url
def url #:nodoc:
server.url
end
def inspect #:nodoc:
"#<Plex::Client: name=\"#{name}\" host=\"#{host}\" port=\"#{port}\">"
end
private

@@ -129,0 +133,0 @@

+6
-2

@@ -23,7 +23,7 @@ module Plex

def url
def url #:nodoc:
season.url
end
def ==(other)
def ==(other) #:nodoc:
if other.is_a? Plex::Episode

@@ -36,2 +36,6 @@ key == other.key

def inspect #:nodoc:
"#<Plex::Episode key=\"#{key}\" title=\"#{title}\" index=\"#{index}\" season=\"#{season.index}\" show=\"#{season.show.title}\">"
end
private

@@ -38,0 +42,0 @@

@@ -36,11 +36,11 @@ module Plex

def key
def key #:nodoc:
"/library/sections"
end
def url
def url #:nodoc:
server.url
end
def ==(other)
def ==(other) #:nodoc:
if other.is_a? Library

@@ -53,2 +53,6 @@ server == other.server

def inspect #:nodoc:
"#<Plex::Libary: server=#{server.inspect}>"
end
private

@@ -55,0 +59,0 @@

@@ -13,3 +13,3 @@ module Plex

def url
def url #:nodoc:
section.url

@@ -28,2 +28,6 @@ end

def inspect #:nodoc:
"#<Plex::Movie: key=\"#{key}\" title=\"#{title}\">"
end
private

@@ -30,0 +34,0 @@

@@ -42,7 +42,7 @@ module Plex

def url
def url #:nodoc:
show.url
end
def ==(other)
def ==(other) #:nodoc:
if other.is_a? Plex::Season

@@ -55,2 +55,6 @@ key == other.key

def inspect #:nodoc:
"#<Plex::Season: key=\"#{key}\" title=\"#{title}\" index=\"#{index}\" show=\"#{show.title}\">"
end
private

@@ -75,3 +79,3 @@

def episodes_from_video(node)
node.search("Video").map { |m| Plex::Episode.new(self, m.attr('key')) }
node.search("Video").map { |m| plex_episode.new(self, m.attr('key')) }
end

@@ -83,3 +87,7 @@

def plex_episode
@plex_episode ||= Plex::Episode
end
end
end

@@ -79,11 +79,11 @@ module Plex

def key
def key #:nodoc:
"/library/sections/#{@key}"
end
def url
def url #:nodoc:
library.url
end
def ==(other)
def ==(other) #:nodoc:
if other.is_a? Plex::Section

@@ -96,2 +96,6 @@ key == other.key

def inspect #:nodoc:
"#<Plex::Section: key=\"#{key}\" type=\"#{type}\" title=\"#{title}\">"
end
private

@@ -98,0 +102,0 @@

@@ -30,6 +30,10 @@ module Plex

def url
def url #:nodoc:
"http://#{host}:#{port}"
end
def inspect #:nodoc:
"#<Plex::Server: host=#{host} port=#{port}>"
end
private

@@ -36,0 +40,0 @@

@@ -39,10 +39,10 @@ module Plex

def season(number)
seasons.select { |sea| sea.index.to_i == sea.to_i }.first
seasons.select { |sea| sea.index.to_i == number.to_i }.first
end
def url
def url #:nodoc:
section.url
end
def ==(other)
def ==(other) #:nodoc:
if other.is_a? Plex::Show

@@ -55,2 +55,6 @@ key == other.key

def inspect #:nodoc:
"#<Plex::Show: key=\"#{key}\" title=\"#{title}\">"
end
private

@@ -57,0 +61,0 @@

module Plex
VERSION = "1.3.0"
VERSION = "1.3.1"
end

@@ -12,4 +12,4 @@ # -*- encoding: utf-8 -*-

s.homepage = "https://github.com/ekosz/Plex-Ruby"
s.summary = %q{Plex APIs in easy ruby code}
s.description = %q{Extracts the Plex API into easy to write ruby code}
s.summary = %q{Plex Media Server APIs in easy ruby code}
s.description = %q{Extracts the Plex Media Server API into easy to write ruby code}

@@ -16,0 +16,0 @@ s.rubyforge_project = "plex-ruby"

+12
-13

@@ -1,4 +0,4 @@

# Plex-Ruby [![Build Status](https://secure.travis-ci.org/ekosz/Plex-Ruby.png)](https://secure.travis-ci.org/ekosz/Plex-Ruby.png)
# Plex-Ruby [![Build Status](https://secure.travis-ci.org/ekosz/Plex-Ruby.png)](https://secure.travis-ci.org/ekosz/Plex-Ruby)
A handy gem for working with Plex within Ruby. Tries to emulate and document
A handy gem for working with [Plex Media Player](http://plexapp.com) within Ruby. Tries to emulate and document
all of the Plex APIs using simple ruby code. I will try and keep it as

@@ -39,5 +39,5 @@ up-to-date as possible, but pull requests are always welcomed.

```ruby
clients = server.clients
client = # pick the media player you want
client.pause # That was easy
clients = server.clients # list of all connected clients
client = # pick the media player you want
client.pause # That was easy
````

@@ -49,10 +49,9 @@

sections = server.library.sections
section = # Pick the section you want I.E. TV, Movies, Home Videos
shows = section.all # Returns a list of shows/movies
bsg = shows.select { |s| s.title =~ /Battlestar/ }.first # Pick a great show
bsg.seasons # array of its seasons
episodes = bsg.seasons.last.episodes # Array the last seasons episodes
episode = episodes[4] # The fifth episode in the season
puts "#{episode.title} - #{episode.summary}" # Looks good
client.play_media(episode) # Play it!
section = # Pick the section you want I.E. TV, Movies, Home Videos
shows = section.all # Returns a list of shows/movies
bsg = shows.select { |s| s.title =~ /Battlestar/ }.first # Pick a great show
season = bsg.seasons.last # Pick the last season
episode = season.episode(5) # The fifth episode in the season
puts "#{episode.title} - #{episode.summary}" # Looks good
client.play_media(episode) # Play it!
```

@@ -59,0 +58,0 @@

require 'test_helper'
class TestEpisode < Plex::Episode
def initialize(parent, key)
@xml_doc = FakeNode.new({Video: FakeNode.new(FAKE_VIDEO_NODE_HASH)})
super(parent, key)
end
end
describe Plex::Episode do

@@ -4,0 +11,0 @@

@@ -186,2 +186,3 @@ require 'plex-ruby'

updated_at: '342214',
index: '1',
Media: FakeNode.new( FAKE_MEDIA_NODE_HASH ),

@@ -188,0 +189,0 @@ Genre: FakeNode.new( FAKE_GENRE_NODE_HASH ),

@@ -31,2 +31,10 @@ require 'test_helper'

it "should return a spesific show" do
@season.instance_variable_set(
"@children", FakeNode.new({Video: FakeNode.new(FAKE_VIDEO_NODE_HASH)})
)
@season.instance_variable_set( "@plex_episode", TestEpisode )
@season.episode(1).must_equal @season.episodes.first
end
it "should remember its parent (show)" do

@@ -33,0 +41,0 @@ @season.show.must_equal @show

@@ -33,2 +33,10 @@ require 'test_helper'

it "should return a spesific season" do
@show.instance_variable_set(
"@children", FakeNode.new(FAKE_SEASON_NODE_HASH)
)
@show.instance_variable_set( "@plex_season", TestSeason )
@show.season(1).must_equal @show.seasons.first
end
it "should remember its parent (section)" do

@@ -35,0 +43,0 @@ @show.section.must_equal @section