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.1
to
1.4.0
+18
-3
CHANGELOG.md

@@ -25,3 +25,3 @@ ## 0.0.1.alpha

* Fix `gem install plex-ruby`, require `open-uri` as a runtime dependecy
* Fix `gem install plex-ruby`, require `open-uri` as a runtime dependency
wasn't a good idea

@@ -54,5 +54,5 @@

* Added singular season and episode methods
* Attribute methods are now dynamicly created in the initializer. This gets ride of
* Attribute methods are now dynamically 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.
the code every time the API changes.

@@ -64,1 +64,16 @@ ## 1.3.1

* Added tests
## 1.4.0
* Switched from Array#select().first to Array#detect for performance
* Plex::Season helper methods
* #first_episode
* #last_episode
* Plex::Show helper methods
* #first_season
* #last_season
* #special_season
* #first_episode
* #last_episode
* Updated Readme to use new helper methods
* Cleaned up docs by adding @private to internal public methods

@@ -123,2 +123,3 @@ module Plex

# @private
def url #:nodoc:

@@ -128,2 +129,3 @@ server.url

# @private
def inspect #:nodoc:

@@ -130,0 +132,0 @@ "#<Plex::Client: name=\"#{name}\" host=\"#{host}\" port=\"#{port}\">"

@@ -23,2 +23,3 @@ module Plex

# @private
def url #:nodoc:

@@ -28,2 +29,3 @@ season.url

# @private
def ==(other) #:nodoc:

@@ -37,2 +39,3 @@ if other.is_a? Plex::Episode

# @private
def inspect #:nodoc:

@@ -39,0 +42,0 @@ "#<Plex::Episode key=\"#{key}\" title=\"#{title}\" index=\"#{index}\" season=\"#{season.index}\" show=\"#{season.show.title}\">"

@@ -36,2 +36,3 @@ module Plex

# @private
def key #:nodoc:

@@ -41,2 +42,3 @@ "/library/sections"

# @private
def url #:nodoc:

@@ -46,2 +48,3 @@ server.url

# @private
def ==(other) #:nodoc:

@@ -55,2 +58,3 @@ if other.is_a? Library

# @private
def inspect #:nodoc:

@@ -57,0 +61,0 @@ "#<Plex::Libary: server=#{server.inspect}>"

+6
-4

@@ -13,6 +13,2 @@ module Plex

def url #:nodoc:
section.url
end
# Delegates all method calls to the video object that represents this

@@ -28,2 +24,8 @@ # movie, if that video object responds to the method.

# @private
def url #:nodoc:
section.url
end
# @private
def inspect #:nodoc:

@@ -30,0 +32,0 @@ "#<Plex::Movie: key=\"#{key}\" title=\"#{title}\">"

@@ -39,5 +39,20 @@ module Plex

def episode(number)
episodes.select { |epi| epi.index.to_i == number.to_i }.first
episodes.detect { |epi| epi.index.to_i == number.to_i }
end
# Selects the first episode of this season that is on the Plex Server
#
# @return [Episode] episode with the lowest index
def first_episode
episodes.inject { |a, b| a.index < b.index ? a : b }
end
# Selects the last episode of this season that is on the Plex Server
#
# @return [Episode] episode with the highest index
def last_episode
episodes.inject { |a, b| a.index > b.index ? a : b }
end
# @private
def url #:nodoc:

@@ -47,2 +62,3 @@ show.url

# @private
def ==(other) #:nodoc:

@@ -56,2 +72,3 @@ if other.is_a? Plex::Season

# @private
def inspect #:nodoc:

@@ -58,0 +75,0 @@ "#<Plex::Season: key=\"#{key}\" title=\"#{title}\" index=\"#{index}\" show=\"#{show.title}\">"

@@ -79,2 +79,3 @@ module Plex

# @private
def key #:nodoc:

@@ -84,2 +85,3 @@ "/library/sections/#{@key}"

# @private
def url #:nodoc:

@@ -89,2 +91,3 @@ library.url

# @private
def ==(other) #:nodoc:

@@ -98,2 +101,3 @@ if other.is_a? Plex::Section

# @private
def inspect #:nodoc:

@@ -100,0 +104,0 @@ "#<Plex::Section: key=\"#{key}\" type=\"#{type}\" title=\"#{title}\">"

@@ -30,2 +30,3 @@ module Plex

# @private
def url #:nodoc:

@@ -35,2 +36,3 @@ "http://#{host}:#{port}"

# @private
def inspect #:nodoc:

@@ -37,0 +39,0 @@ "#<Plex::Server: host=#{host} port=#{port}>"

@@ -39,5 +39,46 @@ module Plex

def season(number)
seasons.select { |sea| sea.index.to_i == number.to_i }.first
seasons.detect { |sea| sea.index.to_i == number.to_i }
end
# Helper method for selecting the special Season of this show
# Season 0 is where Plex stores episodes that are not part of a
# regular season. i.e. Christmas Specials
#
# @return [Season] season with index of 0
def special_season
season(0)
end
# Selects the first season of this show that is on the Plex Server
# Does not select season 0
#
# @return [Season] season with the lowest index (but not 0)
def first_season
seasons.inject { |a, b| a.index < b.index && a.index > 0 ? a : b }
end
# Selects the last season of this show that is on the Plex Server
#
# @return [Season] season with the highest index
def last_season
seasons.inject { |a, b| a.index > b.index ? a : b }
end
# Selects the first episode of this show that is on the Plex Server
#
# @return [Episode] episode with the lowest index of the season of the
# lowest index
def first_episode
first_season.first_episode
end
# Selects the last episode of this show that is on the Plex Server
#
# @return [Episode] episode with the highest index of the season of the
# highest index
def last_episode
last_season.last_episode
end
# @private
def url #:nodoc:

@@ -47,2 +88,3 @@ section.url

# @private
def ==(other) #:nodoc:

@@ -56,2 +98,3 @@ if other.is_a? Plex::Show

# @private
def inspect #:nodoc:

@@ -58,0 +101,0 @@ "#<Plex::Show: key=\"#{key}\" title=\"#{title}\">"

module Plex
VERSION = "1.3.1"
VERSION = "1.4.0"
end

@@ -29,3 +29,3 @@ # Plex-Ruby [![Build Status](https://secure.travis-ci.org/ekosz/Plex-Ruby.png)](https://secure.travis-ci.org/ekosz/Plex-Ruby)

Everything Stems from the Plex MediaServer. Create a server with the host and
Everything Stems from the Plex Media Server. Create a server with the host and
port number.

@@ -49,9 +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
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!
section = # Pick the section you want I.E. TV, Movies, Home Videos
shows = section.all # Returns a list of shows/movies
bsg = shows.detect { |s| s.title =~ /Battlestar/ } # Pick a great show
season = bsg.last_season # 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!
```

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