Update of "Example script"

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: 499f67fd8d8c9785603e0d4b058b2b38bd289a5e
Page Name:Example script
Date: 2014-04-17 19:55:29
Original User: schelte
Parent: 8938fcf13b3c84d32f848a75d82d3c4eaff858d5 (diff)
Content

This example script will stream all mp3 files in the current directory to a local icecast server.


package require shout

proc stream {fd1 fd2} { puts -nonewline $fd2 [read $fd1 4096] if {[eof $fd1]} { close $fd1 nextsong $fd2 } }

proc nextsong {shout} { global playlist if {[llength $playlist] > 0} { set playlist [lassign $playlist file] set fd [open $file rb] fileevent $shout writable [list stream $fd $shout] fconfigure $shout -song [file rootname [file tail $file]] } else { exit } }

set fd [shout -user tcl -mount /tclradio -format mp3 \ -genre rock -name "Tcl Radio" 127.0.0.1 8000 hackme] fconfigure $fd -buffering none

set playlist [glob -nocomplain *.mp3]

nextsong $fd

vwait forever