File: blip-api.xsl

package info (click to toggle)
kmplayer 1%3A0.11.3d-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,504 kB
  • ctags: 8,651
  • sloc: cpp: 34,402; xml: 6,455; ansic: 3,085; sh: 32; makefile: 9
file content (100 lines) | stat: -rw-r--r-- 3,627 bytes parent folder | download | duplicates (6)
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
<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:str="http://exslt.org/strings">

  <xsl:template match="/">
    <playlist>
      <xsl:for-each select="response/payload/asset">
        <xsl:variable name="item_title">
          <xsl:value-of select="normalize-space(title)"/>
        </xsl:variable>
        <group title="{$item_title}">
          <item title="{$item_title}">
            <smil>
              <head>
                <layout>
                  <root-layout width="400" height="300" background-color="#F5F5DC"/>
                  <region id="title" left="10" top="10" height="18" right="10"/>
                  <region id="notice" left="180" top="40" bottom="190" right="10" background-color="#101023"/>
                  <region id="desc" left="10" top="120" bottom="10" right="10" fit="scroll"/>
                </layout>
              </head>
              <body>
                <par dur="indefinite">
                  <smilText region="title" textFontWeight="bold" textColor="#101023" textFontSize="11" textAlign="center">
                    <xsl:value-of select="$item_title"/>
                  </smilText>
                  <smilText region="notice" textColor="#F5F5DC">
                    <p textFontWeight="bold" textAlign="center" textFontSize="10">
Notice for links to Blip TV
                    </p>
                    <div textFontSize="9" textFontStyle="italic" textAlign="right">
These links are best viewed when saved first.
                    </div>
                  </smilText>
                  <xsl:variable name="text">
                    <xsl:value-of select="description"/>
                  </xsl:variable>
                  <xsl:variable name="text64">
                    <xsl:value-of select="str:encode-uri($text,true())"/>
                  </xsl:variable>
                  <text region="desc" src="data:text/html,{$text64}" fontPtSize="11" mediaBackgroundOpacity="0" fontFace="serif"/>
                </par>
              </body>
            </smil>
          </item>
          <xsl:apply-templates select="mediaList"/>
        </group>
      </xsl:for-each>
    </playlist>
  </xsl:template>

  <xsl:template match="node()">
  </xsl:template>

  <xsl:template match="mediaList">
    <xsl:apply-templates select="media"/>
  </xsl:template>

  <xsl:template match="media">
    <xsl:variable name="bytes">
      <xsl:value-of select="size"/>
    </xsl:variable>
    <xsl:variable name="size_txt">
      <xsl:choose>
        <xsl:when test="number($bytes) > 1048576">
          <xsl:value-of select="concat(' (',round($bytes div 1048576),' Mb)')"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="concat(' (',round($bytes div 1024), ' kb)')"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:apply-templates select="link">
      <xsl:with-param name="filesize">
        <xsl:value-of select="$size_txt"/>
      </xsl:with-param>
    </xsl:apply-templates>
  </xsl:template>

  <xsl:template match="link">
    <xsl:param name="filesize"/>
    <xsl:variable name="item_type">
      <xsl:choose>
        <xsl:when test="@type">
          <xsl:value-of select="normalize-space(@type)"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="@href"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="item_title">
      <xsl:value-of select="concat($item_type,$filesize)"/>
    </xsl:variable>
    <item title="{$item_title}" url="{@href}"/>
  </xsl:template>

</xsl:stylesheet>