%
' ModuleName: asxgen.asp
' System: PT Radio
' Description: Build and launch audio/video stream
' Usage: Centralized media streamer called with url variables
' Author:
'
'*MOD
' 24-Jun-2006 GG - Dynamically determine media type (audio - wma or video - wmv)
'
' Used to stream audio/video files
' called like this:
' http://www.ptm.org/av/asxgen.asp?folder=audio&stream=ptr0090.wma&title=The Title&banner=graphic path&link=offer link
'
' title defaults to the stream name if it's omitted
' banner defaults to /images/ptmCWRforWM.gif (defaultbanner constant)
' link defaults to home page (defaultlink constant)
const defaultbanner = "/images/ptmCWRforWM.gif"
const defaultlink = "/"
const webserver = "http://www.ptm.org"
const mediaserver = "mms://63.251.216.221/av/" 'WIN-Q1G6Q0GNJN4"'media.ptm.org/av/"
const mediafilepath = "C:/Inetpub/wwwroot/av/"
myfolder = request("folder")
mystream = request("stream")
mytitle = request("title")
mybanner = request("banner")
mylink = request("link")
if mytitle = "" then mytitle = mystream
if mybanner = "" then mybanner = defaultbanner
if mylink = "" then mylink = defaultlink
if badURLParm(myfolder) or badURLParm(mytitle) or badURLParm(mybanner) or badURLParm(mylink) then
response.redirect("http://www.ptm.org")
end if
' If stream contains no suffix, dynamically determine whether wmv or wma suffix (wmv is used if both present)
if not instr(1, mystream, ".")>0 then
dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
if fso.FileExists(mediafilepath & myfolder & "/" & mystream & ".wmv") then
mystream = mystream & ".wmv"
elseif fso.FileExists(mediafilepath & myfolder & "/" & mystream & ".wma") then
mystream = mystream & ".wma"
else
response.redirect("http://www.ptm.org")
end if
set fso = nothing
end if
response.Expires = -1
response.ContentType = "video/x-ms-asf"
response.AddHeader "Content-Disposition" , "inline; filename=""" & mystream & """"
response.Write _
"" &_
"" & mytitle & "" &_
"" &_
"" &_
"" &_
"" &_
"" &_
"" & mytitle & "" &_
"" &_
"" &_
"" &_
""
response.End
'Validate bad parm vals
function badURLParm(str)
badURLParm=(instr(lcase(str),"