forked from linnoss/MediaApps2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
linnrecords.xsl
160 lines (148 loc) · 6.14 KB
/
linnrecords.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml" exclude-result-prefixes="xhtml" version="1.0">
<xsl:output method="xml" indent="yes"/>
<!-- ROOT -->
<xsl:template match="/plugin">
<plugin>
<name>Linn Records</name>
<enabled>true</enabled>
<period>10080</period>
<description>Podcasts from Linn Records</description>
<link>http://www.linnrecords.com/</link>
<artwork>http://www.linnrecords.com/img/label/Linn_logo_100x100.jpg</artwork>
<container>/home</container>
</plugin>
</xsl:template>
<!-- HOME -->
<!--
<xsl:template match="/container[text() = '/home']">
<container name="Linn Records">
<container>/podcasts</container>
<container type="html">/previews</container>
</container>
</xsl:template>
-->
<xsl:template match="/container[text() = '/home']">
<container name="Linn Records">
<xsl:for-each select="document('http://www.linnrecords.com/rss/podcasts.aspx')/rss/channel/item">
<item>
<metadatum tag="type">audio</metadatum>
<metadatum tag="a.type">podcast</metadatum>
<metadatum tag="a.title">
<xsl:value-of select="title"/>
</metadatum>
<metadatum tag="a.description">
<xsl:value-of select="description"/>
</metadatum>
<metadatum tag="a.uri">
<xsl:value-of select="enclosure/@url" />
</metadatum>
<metadatum tag="a.duration">
<xsl:value-of select="enclosure/@length"/>
</metadatum>
<metadatum tag="a.channels">2</metadatum>
<metadatum tag="a.codec">mp3</metadatum>
</item>
</xsl:for-each>
</container>
</xsl:template>
<!-- PODCASTS -->
<xsl:template match="/container[text() = '/podcasts']">
<container name="Podcasts">
<xsl:for-each select="document('http://www.linnrecords.com/rss/podcasts.aspx')/rss/channel/item">
<item>
<metadatum tag="type">audio</metadatum>
<metadatum tag="a.type">podcast</metadatum>
<metadatum tag="a.title">
<xsl:value-of select="title"/>
</metadatum>
<metadatum tag="a.description">
<xsl:value-of select="description"/>
</metadatum>
<metadatum tag="a.uri">
<xsl:value-of select="enclosure/@url" />
</metadatum>
<metadatum tag="a.duration">
<xsl:value-of select="enclosure/@length"/>
</metadatum>
<metadatum tag="a.channels">2</metadatum>
<metadatum tag="a.codec">mp3</metadatum>
</item>
</xsl:for-each>
</container>
</xsl:template>
<!-- PREVIEWS -->
<xsl:template match="/container[text() = '/previews']">
<container name="Previews">
<xsl:for-each select="document('http://www.linnrecords.com/catalogue.aspx?sort=artistname&order=asc')//xhtml:div[@class='recordings']">
<container type="html">
/album/<xsl:value-of select="xhtml:div[@class='recordingsinfo']/xhtml:div[@class='synopsis']/xhtml:a/@href"/>
</container>
</xsl:for-each>
</container>
</xsl:template>
<!-- ALBUM -->
<xsl:template match="/container[starts-with(text(),'/album/')]">
<xsl:variable name="page">http://www.linnrecords.com/<xsl:value-of select="substring-after(text(),'/album/')"/></xsl:variable>
<container>
<xsl:for-each select="document($page)//xhtml:html">
<xsl:variable name="artwork">
http://www.linnrecords.com/<xsl:value-of select="xhtml:body[1]//xhtml:div[@class='titleImage'][1]/xhtml:img/@src"/>
</xsl:variable>
<xsl:variable name="artist">
<xsl:value-of select="xhtml:body[1]//xhtml:div[@class='titleLeft'][1]/xhtml:h1/xhtml:a"/>
</xsl:variable>
<xsl:variable name="album">
<xsl:value-of select="xhtml:body[1]//xhtml:div[@class='titleLeft'][1]/xhtml:h2"/>
</xsl:variable>
<xsl:attribute name="name">
<xsl:value-of select="$album"/>
</xsl:attribute>
<xsl:attribute name="artwork">
<xsl:value-of select="$artwork"/>
</xsl:attribute>
<xsl:attribute name="description">
<xsl:value-of select="xhtml:body[1]//xhtml:div[@class='titleLeft'][1]/xhtml:div[@class='teaser']"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test="//xhtml:div[@id='collection-right']">
<xsl:for-each select="//xhtml:div[@class='collectionrecording']">
<container type="html">
/album/<xsl:value-of select="xhtml:div[@class='collectionrecordinginfo']/xhtml:h2/xhtml:a/@href"/>
</container>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="artist">
<xsl:value-of select="$artist"/>
</xsl:attribute>
<xsl:for-each select="//xhtml:table[@class='trackresults'][1]/xhtml:tr[position() > 1]">
<item>
<metadatum tag="type">audio</metadatum>
<metadatum tag="a.type">clip</metadatum>
<metadatum tag="a.title">
<xsl:value-of select=".//xhtml:div[@class='summary'][1]/xhtml:strong"/>
</metadatum>
<metadatum tag="a.artist">
<xsl:value-of select="$artist"/>
</metadatum>
<metadatum tag="a.album">
<xsl:value-of select="$album"/>
</metadatum>
<metadatum tag="a.uri">
<xsl:value-of select="xhtml:td[4]/xhtml:a/@href" />
</metadatum>
<metadatum tag="a.track">
<xsl:value-of select="position()" />
</metadatum>
<metadatum tag="a.channels">2</metadatum>
<metadatum tag="a.codec">mp3</metadatum>
<metadatum tag="a.bitrate">128000</metadatum>
</item>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</container>
</xsl:template>
</xsl:stylesheet>