upnp_content_explorer 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/README.md +88 -0
- data/lib/upnp_content_explorer/item.rb +4 -0
- data/lib/upnp_content_explorer/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 70b8cb6774af6666726032cb2ab87783f2b5c656
|
|
4
|
+
data.tar.gz: d036b630bbd5e416a5067a6a54573e146734924d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5fd717a10acee244d770c45c7291019feb61a30738e55ed2033ae2f113bba29a77c65f2be736893635fcb16b4090384629f6d7d582584596518c2b4db64d45f4
|
|
7
|
+
data.tar.gz: 7b7ea40f94d190e3cce26fe15c3b3a3707d7a83f7508cbd738925b4afd4e400983a5ff329da5f492427f515082878b98099c22eee342a18f7e61a19956de35ef
|
data/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# upnp_content_explorer
|
|
2
|
+
A convenience wrapper around an [easy_upnp](https://github.com/sidoh/easy_upnp) service to access content.
|
|
3
|
+
|
|
4
|
+
## Installing
|
|
5
|
+
|
|
6
|
+
`upnp_content_explorer` is available on [Rubygems](https://rubygems.org). You can install it with:
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
$ gem install upnp_content_explorer
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
You can also add it to your Gemfile:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
gem 'upnp_content_explorer'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## What's this for?
|
|
19
|
+
|
|
20
|
+
This gem makes it easy to explore and navigate content provided by a UPnP media server implementing the `urn:schemas-upnp-org:service:ContentDirectory:1` service. At the moment, it relies on [`easy_upnp`](https://github.com/sidoh/easy_upnp) to interface with the UPnP server.
|
|
21
|
+
|
|
22
|
+
## Example usage
|
|
23
|
+
|
|
24
|
+
Given an `easy_upnp` server identified by `service`, you can construct a content explorer as follows:
|
|
25
|
+
|
|
26
|
+
```ruby
|
|
27
|
+
require 'upnp_content_explorer'
|
|
28
|
+
|
|
29
|
+
explorer = UpnpContentExplorer::Explorer.new(service)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
You can then do the following:
|
|
33
|
+
|
|
34
|
+
### Get the contents of a directory
|
|
35
|
+
|
|
36
|
+
```ruby
|
|
37
|
+
node = explorer.node_at('/Movies')
|
|
38
|
+
|
|
39
|
+
node.children.map(&:title)
|
|
40
|
+
# => ["Comedy", "Horror", "Suspense"]
|
|
41
|
+
|
|
42
|
+
node.items.map(&:title)
|
|
43
|
+
# => ["Inside Out (2015).mkv"]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### List the children of a directory
|
|
47
|
+
```ruby
|
|
48
|
+
children = explorer.children_of('/Movies')
|
|
49
|
+
|
|
50
|
+
children.map(&:title)
|
|
51
|
+
# => ["Comedy", "Horror", "Suspense"]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### List the files inside of a directory
|
|
55
|
+
```ruby
|
|
56
|
+
items = explorer.items_of('/Movies')
|
|
57
|
+
|
|
58
|
+
items.map(&:title)
|
|
59
|
+
# => ["Inside Out (2015).mkv"]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Recursively scrape all content of a directory
|
|
63
|
+
```ruby
|
|
64
|
+
movies = explorer.scrape('/Movies')
|
|
65
|
+
|
|
66
|
+
items.map(&:title)
|
|
67
|
+
# => ["Inside Out (2015).mkv", "Exorcist, The (1973).mkv", "Seven (1995).mkv", "Airplane (1980).mkv"]
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Extracting metadata
|
|
71
|
+
|
|
72
|
+
To extract DIDL Lite metadata for an item, you should generally call `Browse` with the `BrowseFlag` parameter equal to `'BrowseMetadata'`, passing the `ObjectID` of the item in question. For example:
|
|
73
|
+
|
|
74
|
+
```ruby
|
|
75
|
+
# Choose a random movie
|
|
76
|
+
movie = explorer.scrape('/Movies').sample
|
|
77
|
+
|
|
78
|
+
movie.title
|
|
79
|
+
# => "Airplane (1980).mkv"
|
|
80
|
+
|
|
81
|
+
# Get movie metadata
|
|
82
|
+
movie_metadata = service.Browse(
|
|
83
|
+
ObjectID: movie.id,
|
|
84
|
+
BrowseFlag: 'BrowseMetadata',
|
|
85
|
+
Filter: '*'
|
|
86
|
+
)[:Result]
|
|
87
|
+
# => ... (Raw DIDL Lite metadata) ...
|
|
88
|
+
```
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: upnp_content_explorer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Christopher Mullins
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-09-
|
|
11
|
+
date: 2015-09-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nori
|
|
@@ -90,6 +90,7 @@ files:
|
|
|
90
90
|
- .gitignore
|
|
91
91
|
- Gemfile
|
|
92
92
|
- LICENSE.txt
|
|
93
|
+
- README.md
|
|
93
94
|
- Rakefile
|
|
94
95
|
- lib/upnp_content_explorer.rb
|
|
95
96
|
- lib/upnp_content_explorer/explorer.rb
|