Skip to content

Instantly share code, notes, and snippets.

@XeCycle
Created February 29, 2012 14:25
Show Gist options
  • Save XeCycle/1941196 to your computer and use it in GitHub Desktop.
Save XeCycle/1941196 to your computer and use it in GitHub Desktop.
SJTU Comic VLC TV playlist transformed for use with mplayer.
#!/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>&#xA;</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