playlist 0.1.1 → 0.1.2
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 +1 -0
- data/lib/playlist/format.rb +1 -0
- data/lib/playlist/format/dira.rb +57 -0
- data/lib/playlist/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70f73534ba89b3e792e0ab18761584ba04ba6d3b
|
4
|
+
data.tar.gz: 192a4fbe4b8e9995b426608824207bd339c3bf54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 027c61567a8142920be50a97bc2cb5112971474a47a0f5fd2c9abe1c6655557f7205e2cbc67ef86fe71e8330ae6f5699ee737852e72bed7446a3d8120f33fbd3
|
7
|
+
data.tar.gz: 6b298e207b4b7345bfa6de7a26b6caf53a559be7e7dc39ee9545a06fa00c76eb28dd505f1ecf9c1228066b87f8810f737fc91984006b5c5fb7e3f3a7c15403b8
|
data/README.md
CHANGED
data/lib/playlist/format.rb
CHANGED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
unless Nokogiri::XML::Node.respond_to?(:content_at)
|
4
|
+
require 'playlist/ext/content_at.rb'
|
5
|
+
end
|
6
|
+
|
7
|
+
# Module to parse Scisys dira XML genealogy files
|
8
|
+
module Playlist::Format::Dira
|
9
|
+
class << self
|
10
|
+
# Parse a Dira XML document into a new Playlist object
|
11
|
+
# @param input [String, IO] the source of the Dira XML
|
12
|
+
# @return [Playlist] a new Playlist object
|
13
|
+
def parse(input)
|
14
|
+
Playlist.new do |playlist|
|
15
|
+
doc = Nokogiri::XML(input)
|
16
|
+
playlist.title = doc.content_at(
|
17
|
+
'//TAKE/GENERIC/GENE_MULTIMEDIA_TITLE'
|
18
|
+
) || doc.content_at(
|
19
|
+
'//TAKE/GENERIC/GENE_TITLE'
|
20
|
+
)
|
21
|
+
doc.xpath('//TAKE/GENEALOGY/GENEALOGY_ITEM').each do |item|
|
22
|
+
playlist.tracks << parse_genealogy_item(item)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
protected
|
28
|
+
|
29
|
+
# Parse a single Genealogy Item from a Dira XML document
|
30
|
+
def parse_genealogy_item(doc)
|
31
|
+
Playlist::Track.new do |track|
|
32
|
+
track.title = doc.content_at('./CLIP/CLIP_INFO/GENE_TITLE')
|
33
|
+
track.album = doc.content_at('./CLIP/CLIP_INFO/GENE_ALBUM')
|
34
|
+
track.track_number = doc.content_at('./CLIP/CLIP_INFO/GENE_TRACK')
|
35
|
+
track.side = doc.content_at('./CLIP/CLIP_INFO/GENE_SIDE')
|
36
|
+
track.record_label = doc.content_at('./CLIP/CLIP_INFO/GENE_LABEL')
|
37
|
+
track.publisher = doc.content_at('./CLIP/CLIP_INFO/GENE_PUBLISHER')
|
38
|
+
if (duration = doc.content_at('./GENY_CLIP_LENGTH'))
|
39
|
+
track.duration = duration.to_f / 1000
|
40
|
+
end
|
41
|
+
doc.xpath('./CLIP/CLIP_PERSONS/PERSON').each do |person|
|
42
|
+
track.contributors << parse_person(person)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Parse a single Person from a dira XML document
|
48
|
+
def parse_person(doc)
|
49
|
+
Playlist::Contributor.new do |c|
|
50
|
+
c.name = doc.content_at('PERSON_NAME')
|
51
|
+
if doc.content_at('PMAP_FUNC') =~ /^PERSON_FUNC\$(.+)\#(.*)$/
|
52
|
+
c.role = Regexp.last_match(1).downcase.to_sym
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/playlist/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playlist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicholas Humfrey
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- lib/playlist/contributor.rb
|
141
141
|
- lib/playlist/ext/content_at.rb
|
142
142
|
- lib/playlist/format.rb
|
143
|
+
- lib/playlist/format/dira.rb
|
143
144
|
- lib/playlist/format/m3u.rb
|
144
145
|
- lib/playlist/format/simple_text.rb
|
145
146
|
- lib/playlist/format/xspf.rb
|