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
| <?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Convert kdenlive guide markers into MKV chapters.
this works with kdenlive 17.07.70.
Earlier versions were different.
-->
<xsl:output indent="yes"/>
<xsl:template match="/">
<Chapters>
<EditionEntry>
<xsl:for-each select="mlt/playlist/property[substring(@name, 0, 16) = 'kdenlive:guide.']">
<!-- we need to sort manually, they can appear in any order -->
<xsl:sort data-type="number" select="substring-before(concat(translate(substring(@name, 16),'.',''),','),',')"/>
<xsl:variable name="timeorig" select="substring(@name, 16)"/>
<!-- remove sub-seconds "2.652,56" -->
<xsl:variable name="time"
select="substring-before(
concat(
translate(
substring(@name, 16),
'.',
''
),
','
),
','
)"/>
<xsl:variable name="seconds" select="$time mod 60" />
<xsl:variable name="minutes" select="floor($time div 60) mod 60" />
<xsl:variable name="hours" select="floor(($time div 60) div 60)" />
<!-- hh:mm:ss.msec -->
<xsl:variable name="timecode">
<xsl:value-of select="format-number($hours, '00')"/>
<xsl:text>:</xsl:text>
<xsl:value-of select="format-number($minutes, '00')"/>
<xsl:text>:</xsl:text>
<xsl:value-of select="format-number($seconds, '00.000')"/>
</xsl:variable>
<ChapterAtom>
<ChapterDisplay>
<ChapterString>
<xsl:if test=".!='Hilfslinie'">
<xsl:value-of select="."/>
</xsl:if>
</ChapterString>
<ChapterLanguage>ger</ChapterLanguage>
</ChapterDisplay>
<ChapterFlagHidden>
<xsl:choose>
<xsl:when test=".='Hilfslinie'">1</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</ChapterFlagHidden>
<ChapterFlagEnabled>1</ChapterFlagEnabled>
<ChapterTimeStart>
<xsl:value-of select="$timecode"/>
</ChapterTimeStart>
</ChapterAtom>
</xsl:for-each>
</EditionEntry>
</Chapters>
</xsl:template>
</xsl:stylesheet>
|