plex-ruby 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +15 -0
- data/README.md +3 -2
- data/lib/plex-ruby/client.rb +7 -2
- data/lib/plex-ruby/version.rb +1 -1
- data/test/test_client.rb +8 -0
- metadata +12 -6
data/CHANGELOG.md
CHANGED
@@ -29,3 +29,18 @@
|
|
29
29
|
|
30
30
|
* Added a test suite that can be run with `rake`
|
31
31
|
* I feel this a production ready, will continue to add features
|
32
|
+
|
33
|
+
## 1.1.0
|
34
|
+
|
35
|
+
* Added `Plex::Section` category methods
|
36
|
+
* ie. `library.section(2).years # [{key: '2008', title: '2008'},...]`
|
37
|
+
* `library.section(1).by_first_letter('H') # [Plex::Movie, ...]`
|
38
|
+
* Read the docs for more info
|
39
|
+
|
40
|
+
## 1.1.1
|
41
|
+
|
42
|
+
* Fix code breaking bug in 1.1.0
|
43
|
+
|
44
|
+
## 1.2.0
|
45
|
+
|
46
|
+
* `Plex::Client#play_media` now can take an Object that `responds_to(:key)`
|
data/README.md
CHANGED
@@ -50,8 +50,9 @@ shows = section.all # Returns a list of shows/movies
|
|
50
50
|
bsg = shows.select { |s| s.title =~ /Battlestar/ }.first # Pick a great show
|
51
51
|
bsg.seasons # array of its seasons
|
52
52
|
episodes = bsg.seasons.last.episodes # Array the last seasons episodes
|
53
|
-
|
54
|
-
|
53
|
+
episode = episodes[4] # The fith episode in the season
|
54
|
+
puts "#{episode.title} - #{episode.summary}" # Looks good
|
55
|
+
client.play_media(episode) # Play it!
|
55
56
|
```
|
56
57
|
|
57
58
|
For a full list of commands check out the [documentation](http://rubydoc.info/github/ekosz/Plex-Ruby/master/frames).
|
data/lib/plex-ruby/client.rb
CHANGED
@@ -54,14 +54,19 @@ module Plex
|
|
54
54
|
|
55
55
|
# Plays a video that is in the library
|
56
56
|
#
|
57
|
-
# @param [String] the key of the video that we want to play.
|
58
|
-
# Episode#key) (see Movie#key)
|
57
|
+
# @param [String, Object] the key of the video that we want to play. Or an
|
58
|
+
# Object that responds to :key (see Episode#key) (see Movie#key)
|
59
59
|
# @param [String] no clue what this does, its the Plex Remote Command API though
|
60
60
|
# @param [String] no clue what this does, its the Plex Remote Command API though
|
61
61
|
# @param [String] no clue what this does, its the Plex Remote Command API though
|
62
62
|
# @return [True, nil] true if it worked, nil if something went wrong check
|
63
63
|
# the console for the error message
|
64
64
|
def play_media(key, user_agent = nil, http_cookies = nil, view_offset = nil)
|
65
|
+
|
66
|
+
if !key.is_a?(String) && key.respond_to?(:key)
|
67
|
+
key = key.key
|
68
|
+
end
|
69
|
+
|
65
70
|
url = player_url+'/application/playMedia?'
|
66
71
|
url += "path=#{CGI::escape(server.url+key)}"
|
67
72
|
url += "&key=#{CGI::escape(key)}"
|
data/lib/plex-ruby/version.rb
CHANGED
data/test/test_client.rb
CHANGED
@@ -39,6 +39,14 @@ describe Plex::Client do
|
|
39
39
|
)
|
40
40
|
end
|
41
41
|
|
42
|
+
it "should exsept an object that responds to :key for #play_media" do
|
43
|
+
object = Plex::Episode.new(FakeParent.new, '/libary/metadata/6')
|
44
|
+
assert @client.play_media(object)
|
45
|
+
FakeWeb.last_request.path.must_equal(
|
46
|
+
"/system/players/#{@client.name}/application/playMedia?path=#{CGI::escape(@client.url+object.key)}&key=#{CGI::escape(object.key)}"
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
42
50
|
it "should properly commnicate its #screenshot method" do
|
43
51
|
assert @client.screenshot(100, 100, 75)
|
44
52
|
FakeWeb.last_request.path.must_equal(
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: plex-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.
|
5
|
+
version: 1.2.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Eric Koslow
|
@@ -10,12 +10,11 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-12-
|
13
|
+
date: 2011-12-19 00:00:00 -05:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: minitest
|
18
|
-
prerelease: false
|
19
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
20
19
|
none: false
|
21
20
|
requirements:
|
@@ -23,10 +22,10 @@ dependencies:
|
|
23
22
|
- !ruby/object:Gem::Version
|
24
23
|
version: "0"
|
25
24
|
type: :development
|
25
|
+
prerelease: false
|
26
26
|
version_requirements: *id001
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
|
-
prerelease: false
|
30
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
31
30
|
none: false
|
32
31
|
requirements:
|
@@ -34,10 +33,10 @@ dependencies:
|
|
34
33
|
- !ruby/object:Gem::Version
|
35
34
|
version: "0"
|
36
35
|
type: :development
|
36
|
+
prerelease: false
|
37
37
|
version_requirements: *id002
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: fakeweb
|
40
|
-
prerelease: false
|
41
40
|
requirement: &id003 !ruby/object:Gem::Requirement
|
42
41
|
none: false
|
43
42
|
requirements:
|
@@ -45,10 +44,10 @@ dependencies:
|
|
45
44
|
- !ruby/object:Gem::Version
|
46
45
|
version: "0"
|
47
46
|
type: :development
|
47
|
+
prerelease: false
|
48
48
|
version_requirements: *id003
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: nokogiri
|
51
|
-
prerelease: false
|
52
51
|
requirement: &id004 !ruby/object:Gem::Requirement
|
53
52
|
none: false
|
54
53
|
requirements:
|
@@ -56,6 +55,7 @@ dependencies:
|
|
56
55
|
- !ruby/object:Gem::Version
|
57
56
|
version: "0"
|
58
57
|
type: :runtime
|
58
|
+
prerelease: false
|
59
59
|
version_requirements: *id004
|
60
60
|
description: Extracts the Plex API into easy to write ruby code
|
61
61
|
email:
|
@@ -119,12 +119,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
119
|
requirements:
|
120
120
|
- - ">="
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
+
hash: -4420716880571956707
|
123
|
+
segments:
|
124
|
+
- 0
|
122
125
|
version: "0"
|
123
126
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
127
|
none: false
|
125
128
|
requirements:
|
126
129
|
- - ">="
|
127
130
|
- !ruby/object:Gem::Version
|
131
|
+
hash: -4420716880571956707
|
132
|
+
segments:
|
133
|
+
- 0
|
128
134
|
version: "0"
|
129
135
|
requirements: []
|
130
136
|
|