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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d50bd338e207991602b472ce02e789d5b57f4f9627e294108773b40636781f2
4
- data.tar.gz: a2b27c4027528e60e9fc816902e9711334ba70d30ba551b91fae4919970e7481
3
+ metadata.gz: 96c02c8d2f0272a187b90cd63fd4d961b99fbda25a886b06ff415406406343e1
4
+ data.tar.gz: f351c303be139b6769d8fec613e22d3b614324ee639516c3e8fe67595b687a23
5
5
  SHA512:
6
- metadata.gz: 3f5fe57ea97a5c15d09a157166cdd999c365b979152f2ff5a277171e859244ef85d5305694fb8c09e6b22a61375e888ef31c18ecd4775cc310017d3800651209
7
- data.tar.gz: e75c960a564c04f7b8f36082f39d21a7947c5b7af41d2a15823a6d729fdea1a3f486a1b505dfdd406ac07bed23847d1cc400a6918cb567a6da80a251c601d24f
6
+ metadata.gz: f73e8585fa2349850e9225e61ec3c4046ee66dccfdbaa4a7256056173d003b15d963b8a1d52041117cd706d2f65370b8547143ee1324c8f36936b17fc3e8924e
7
+ data.tar.gz: b28b1b17511c42b544ad41ee0703a0e7646a2bffcb4ecd5c311c3b87426041a23af0610c7b8dbb616323e7d430b2487d826c1678b4ef68a43f1a290e3a20eb9d
checksums.yaml.gz.sig CHANGED
Binary file
@@ -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
- <tracklist>
15
+ <trackList>
16
16
  <xsl:apply-templates select='summary'/>
17
17
  <xsl:apply-templates select='records/track'/>
18
- </tracklist>
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, location)'?>\n--+\n"
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(title: '', location: '')
50
- @dx.create({title: title, location: location})
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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playlist_creator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file