Created
February 29, 2012 14:25
-
-
Save XeCycle/1941196 to your computer and use it in GitHub Desktop.
SJTU Comic VLC TV playlist transformed for use with mplayer.
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
#!/bin/bash | |
# Configurations | |
player=mplayer | |
playlisturl='http://comic.sjtu.edu.cn/vlc/pl_xspf.asp' | |
TMPDIR=$(mktemp -d) | |
cd $TMPDIR | |
cat > comic-vlc.xslt <<EOF | |
<?xml version="1.0" encoding="utf-8"?> | |
<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform"> | |
<output method="text"/> | |
<template match="/"> | |
<apply-templates select="//track"/> | |
</template> | |
<template match="track"> | |
<value-of select="./title"/><text> </text> | |
<value-of select="./location"/> | |
<text>
</text> | |
</template> | |
</stylesheet> | |
EOF | |
wget -O playlist.xml $playlisturl | |
choice=$(xsltproc comic-vlc.xslt playlist.xml | xargs \ | |
zenity --list --column=频道 --column=url --print-column=2 --hide-column=2) | |
rm -rf $TMPDIR | |
exec $player $choice |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment