playlist_creator 0.1.0 → 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: 21509af0edffb525f0104f0f5f31975286bc61f37ec47db9482e67e68bd0c027
4
- data.tar.gz: b54970e4159d8e1d248c0403c6ccafa9042e9ce38ee971b6bcfaab34f94db082
3
+ metadata.gz: 96c02c8d2f0272a187b90cd63fd4d961b99fbda25a886b06ff415406406343e1
4
+ data.tar.gz: f351c303be139b6769d8fec613e22d3b614324ee639516c3e8fe67595b687a23
5
5
  SHA512:
6
- metadata.gz: 5b00999cfabd641dd15bfde5d30a6005749cda797964a4768eea13cf9609985d4c38cb6f7fda5d8ee81f44cda596d59af33283989a2f5d0d3e70b8188048f0ee
7
- data.tar.gz: 604f2d8b70939f2a822b85e5d776be85fc372988fc4cc349cc757de2878ca3808753a08f87ab38314c8897dfe99756ef7540634c3c17d39e1806cd86a543faf0
6
+ metadata.gz: f73e8585fa2349850e9225e61ec3c4046ee66dccfdbaa4a7256056173d003b15d963b8a1d52041117cd706d2f65370b8547143ee1324c8f36936b17fc3e8924e
7
+ data.tar.gz: b28b1b17511c42b544ad41ee0703a0e7646a2bffcb4ecd5c311c3b87426041a23af0610c7b8dbb616323e7d430b2487d826c1678b4ef68a43f1a290e3a20eb9d
checksums.yaml.gz.sig CHANGED
Binary file
@@ -8,14 +8,14 @@ require 'nokogiri'
8
8
 
9
9
  XSLT_DX = <<XSLT
10
10
  <?xml version='1.0' encoding='UTF-8'?>
11
- <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
11
+ <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0' xmlns='http://xspf.org/ns/0/'>
12
12
  <xsl:output method='xml' indent='yes' omit-xml-declaration='no' encoding='utf-8'/>
13
13
  <xsl:template match='tracklist'>
14
- <playlist version="1" xmlns="http://xspf.org/ns/0/">
15
- <tracklist>
14
+ <playlist version="1">
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,21 +38,49 @@ 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
 
55
+ def add(titlex='', locationx='', title: titlex,
56
+ location: locationx, album: '')
57
+ @dx.create({title: title, location: location, album: album})
58
+ end
59
+
60
+ def delete(id)
61
+ @dx.delete id
62
+ end
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
+
72
+ def to_xml()
73
+ @dx.to_xml pretty: true
74
+ end
75
+
49
76
  def to_xspf()
50
77
  doc = Nokogiri::XML(@dx.to_xml(pretty: true))
51
78
  xslt = Nokogiri::XSLT(XSLT_DX)
52
79
  xslt.transform(doc).to_xml
53
80
  end
54
81
 
82
+ def update(id, title: nil, location: nil, album: nil)
83
+ @dx.update(id, {title: title, location: location, album: album})
84
+ end
85
+
55
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.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  3gBiTtMBjF7+0wQ7XsAV0M2s+rul6mpyQTDBWbwOArnLmDWVtWcEr0G+4AAloRh2
36
36
  U1ZWR/R6TfQXs+jFXG4fV8wX
37
37
  -----END CERTIFICATE-----
38
- date: 2021-11-27 00:00:00.000000000 Z
38
+ date: 2021-11-28 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: dynarex
metadata.gz.sig CHANGED
Binary file