@sequencemedia/music-library-parser 1.0.11 → 1.0.19
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequencemedia/music-library-parser",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "Parse Apple Music Library XML to JSON, JS, ES, or M3U",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"music",
|
|
@@ -47,17 +47,17 @@
|
|
|
47
47
|
"rimraf": "^3.0.2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@babel/cli": "^7.16.
|
|
51
|
-
"@babel/core": "^7.16.
|
|
50
|
+
"@babel/cli": "^7.16.7",
|
|
51
|
+
"@babel/core": "^7.16.7",
|
|
52
52
|
"@babel/eslint-parser": "^7.16.5",
|
|
53
|
-
"@babel/plugin-proposal-export-default-from": "^7.16.
|
|
54
|
-
"@babel/plugin-proposal-export-namespace-from": "^7.16.
|
|
55
|
-
"@babel/preset-env": "^7.16.
|
|
56
|
-
"@sequencemedia/hooks": "^1.0.
|
|
57
|
-
"core-js": "^3.20.
|
|
53
|
+
"@babel/plugin-proposal-export-default-from": "^7.16.7",
|
|
54
|
+
"@babel/plugin-proposal-export-namespace-from": "^7.16.7",
|
|
55
|
+
"@babel/preset-env": "^7.16.7",
|
|
56
|
+
"@sequencemedia/hooks": "^1.0.8",
|
|
57
|
+
"core-js": "^3.20.2",
|
|
58
58
|
"eslint": "7.32.0",
|
|
59
59
|
"eslint-config-standard": "^16.0.3",
|
|
60
|
-
"eslint-plugin-import": "^2.25.
|
|
60
|
+
"eslint-plugin-import": "^2.25.4",
|
|
61
61
|
"eslint-plugin-node": "^11.1.0",
|
|
62
62
|
"eslint-plugin-promise": "5.2.0",
|
|
63
63
|
"gulp": "^4.0.2",
|
package/src/js/library/index.mjs
CHANGED
package/src/xsl/to-json.xsl
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<xsl:stylesheet version="2.0"
|
|
3
3
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
4
|
-
|
|
4
|
+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
5
|
+
xmlns:j="http://www.w3.org/2013/XSLT/xml-to-json"
|
|
6
|
+
exclude-result-prefixes="xsl xs j">
|
|
5
7
|
<xsl:output encoding="UTF-8" method="text" omit-xml-declaration="yes" indent="no" />
|
|
6
8
|
<xsl:template match="integer">
|
|
7
9
|
<xsl:value-of select="text()" />
|
|
@@ -13,7 +15,7 @@
|
|
|
13
15
|
|
|
14
16
|
<xsl:template match="string">
|
|
15
17
|
<xsl:text>"</xsl:text>
|
|
16
|
-
<xsl:value-of select="
|
|
18
|
+
<xsl:value-of select="j:escape(.)" />
|
|
17
19
|
<xsl:text>"</xsl:text>
|
|
18
20
|
</xsl:template>
|
|
19
21
|
|
|
@@ -64,4 +66,44 @@
|
|
|
64
66
|
<xsl:text>,</xsl:text>
|
|
65
67
|
</xsl:if>
|
|
66
68
|
</xsl:template>
|
|
69
|
+
|
|
70
|
+
<!-- Escape special characters -->
|
|
71
|
+
<xsl:function name="j:escape" as="xs:string" visibility="final">
|
|
72
|
+
<xsl:param name="s" as="xs:string" />
|
|
73
|
+
<xsl:value-of>
|
|
74
|
+
<xsl:for-each select="string-to-codepoints($s)">
|
|
75
|
+
<xsl:choose>
|
|
76
|
+
<xsl:when test=". gt 65535">
|
|
77
|
+
<xsl:value-of select="concat('\u', j:to-hex((. - 65536) idiv 1024 + 55296))" />
|
|
78
|
+
<xsl:value-of select="concat('\u', j:to-hex((. - 65536) mod 1024 + 56320))" />
|
|
79
|
+
</xsl:when>
|
|
80
|
+
<xsl:when test=". = 34">\"</xsl:when>
|
|
81
|
+
<xsl:when test=". = 92">\\</xsl:when>
|
|
82
|
+
<xsl:when test=". = 08">\b</xsl:when>
|
|
83
|
+
<xsl:when test=". = 09">\t</xsl:when>
|
|
84
|
+
<xsl:when test=". = 10">\n</xsl:when>
|
|
85
|
+
<xsl:when test=". = 12">\f</xsl:when>
|
|
86
|
+
<xsl:when test=". = 13">\r</xsl:when>
|
|
87
|
+
<xsl:when test=". lt 32 or (. ge 127 and . le 160)">
|
|
88
|
+
<xsl:value-of select="concat('\u', j:to-hex(.))" />
|
|
89
|
+
</xsl:when>
|
|
90
|
+
<xsl:otherwise>
|
|
91
|
+
<xsl:value-of select="codepoints-to-string(.)" />
|
|
92
|
+
</xsl:otherwise>
|
|
93
|
+
</xsl:choose>
|
|
94
|
+
</xsl:for-each>
|
|
95
|
+
</xsl:value-of>
|
|
96
|
+
</xsl:function>
|
|
97
|
+
|
|
98
|
+
<!-- Convert a UTF16 codepoint to a string of hex characters -->
|
|
99
|
+
<xsl:function name="j:to-hex" as="xs:string" visibility="final">
|
|
100
|
+
<xsl:param name="i" as="xs:integer" />
|
|
101
|
+
<xsl:variable name="h" select="'0123456789abcdef'" />
|
|
102
|
+
<xsl:value-of>
|
|
103
|
+
<xsl:value-of select="substring($h, $i idiv 4096 + 1, 1)" />
|
|
104
|
+
<xsl:value-of select="substring($h, $i idiv 256 mod 16 + 1, 1)" />
|
|
105
|
+
<xsl:value-of select="substring($h, $i idiv 16 mod 16 + 1, 1)" />
|
|
106
|
+
<xsl:value-of select="substring($h, $i mod 16 + 1, 1)" />
|
|
107
|
+
</xsl:value-of>
|
|
108
|
+
</xsl:function>
|
|
67
109
|
</xsl:stylesheet>
|