playlist_creator 0.1.3 → 0.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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/playlist_creator.rb +25 -6
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96c02c8d2f0272a187b90cd63fd4d961b99fbda25a886b06ff415406406343e1
|
4
|
+
data.tar.gz: f351c303be139b6769d8fec613e22d3b614324ee639516c3e8fe67595b687a23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f73e8585fa2349850e9225e61ec3c4046ee66dccfdbaa4a7256056173d003b15d963b8a1d52041117cd706d2f65370b8547143ee1324c8f36936b17fc3e8924e
|
7
|
+
data.tar.gz: b28b1b17511c42b544ad41ee0703a0e7646a2bffcb4ecd5c311c3b87426041a23af0610c7b8dbb616323e7d430b2487d826c1678b4ef68a43f1a290e3a20eb9d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/playlist_creator.rb
CHANGED
@@ -12,10 +12,10 @@ XSLT_DX = <<XSLT
|
|
12
12
|
<xsl:output method='xml' indent='yes' omit-xml-declaration='no' encoding='utf-8'/>
|
13
13
|
<xsl:template match='tracklist'>
|
14
14
|
<playlist version="1">
|
15
|
-
<
|
15
|
+
<trackList>
|
16
16
|
<xsl:apply-templates select='summary'/>
|
17
17
|
<xsl:apply-templates select='records/track'/>
|
18
|
-
</
|
18
|
+
</trackList>
|
19
19
|
</playlist>
|
20
20
|
</xsl:template>
|
21
21
|
<xsl:template match='tracklist/summary'/>
|
@@ -24,6 +24,9 @@ XSLT_DX = <<XSLT
|
|
24
24
|
<title>
|
25
25
|
<xsl:value-of select='title'/>
|
26
26
|
</title>
|
27
|
+
<album>
|
28
|
+
<xsl:value-of select='album'/>
|
29
|
+
</album>
|
27
30
|
<location>
|
28
31
|
<xsl:value-of select='location'/>
|
29
32
|
</location>
|
@@ -35,25 +38,37 @@ XSLT
|
|
35
38
|
|
36
39
|
class PlaylistCreator
|
37
40
|
|
38
|
-
def initialize(obj)
|
41
|
+
def initialize(obj=nil)
|
39
42
|
|
40
43
|
@dx = if obj.is_a? String then
|
41
|
-
header = "<?dynarex schema='tracklist/track(title,
|
44
|
+
header = "<?dynarex schema='tracklist/track(location, title, " +
|
45
|
+
"album)'?>\n--+\n"
|
42
46
|
Dynarex.new(header + obj)
|
43
47
|
elsif obj.is_a? Dynarex
|
44
48
|
obj
|
49
|
+
else
|
50
|
+
Dynarex.new('tracklist/track(location, title, album)')
|
45
51
|
end
|
46
52
|
|
47
53
|
end
|
48
54
|
|
49
|
-
def add(
|
50
|
-
|
55
|
+
def add(titlex='', locationx='', title: titlex,
|
56
|
+
location: locationx, album: '')
|
57
|
+
@dx.create({title: title, location: location, album: album})
|
51
58
|
end
|
52
59
|
|
53
60
|
def delete(id)
|
54
61
|
@dx.delete id
|
55
62
|
end
|
56
63
|
|
64
|
+
def find_by_title(title)
|
65
|
+
@dx.all.select {|x| x.title[/#{title}/i]}
|
66
|
+
end
|
67
|
+
|
68
|
+
def to_dx()
|
69
|
+
@dx.clone
|
70
|
+
end
|
71
|
+
|
57
72
|
def to_xml()
|
58
73
|
@dx.to_xml pretty: true
|
59
74
|
end
|
@@ -64,4 +79,8 @@ class PlaylistCreator
|
|
64
79
|
xslt.transform(doc).to_xml
|
65
80
|
end
|
66
81
|
|
82
|
+
def update(id, title: nil, location: nil, album: nil)
|
83
|
+
@dx.update(id, {title: title, location: location, album: album})
|
84
|
+
end
|
85
|
+
|
67
86
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|