Last active
April 15, 2017 07:21
-
-
Save velnias75/95d58bade5a435b562e13b0c95cbca6c to your computer and use it in GitHub Desktop.
XSLT-template to output a VLC playlist suitable to convert to MP4 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<stylesheet version="1.0" | |
xmlns="http://www.w3.org/1999/XSL/Transform" | |
xmlns:strings="http://exslt.org/strings" | |
xmlns:xspf="http://xspf.org/ns/0/"> | |
<output method="text" encoding="utf-8"/> | |
<variable name="apos">'</variable> | |
<param name="outdir" select="'/data1/var/tmp'"/> | |
<param name="pre" select="'avconv -ec guess_mvs -i '"/> | |
<param name="mid1" select="' -preset veryslow -tune film -acodec libfdk_aac -metadata title='"/> | |
<param name="mid2" select="' -metadata:s:a language=ger -threads auto -f mp4 -y '"/> | |
<param name="post" select="'

'"/> | |
<template match="/"> | |
<text>
</text> | |
<apply-templates select="xspf:playlist/xspf:trackList/xspf:track"/> | |
</template> | |
<template match="xspf:track"> | |
<apply-templates select="xspf:location"/> | |
</template> | |
<template match="*"> | |
<param name="input" select="normalize-space(strings:replace(strings:decode-uri(.), 'file://', ''))"/> | |
<param name="output" select="concat($outdir, '/', strings:split(strings:replace(strings:replace(strings:replace(strings:replace(strings:replace(strings:replace(strings:replace(strings:replace(strings:replace($input, ':', ' -'), '?', ''), 'ß', 'ss'), 'ä', 'ae'), 'ö', 'oe'), 'ü', 'ue'), '. ', 'te '), ',', ''), '&', 'and'), '/')[last()])"/> | |
<param name="title" select="strings:replace(strings:split($input, '/')[last()], '.mpg', '')"/> | |
<value-of select="concat($pre, $apos, $input, $apos, $mid1, $apos, $title, $apos, $mid2, $apos, strings:replace($output, '.mpg', '.mp4'), $apos, $post)"/> | |
</template> | |
</stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment