Print Page | Close Window

batch m3u’s.. i don’t know this stuff

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=5748
Printed Date: 30 March 2026 at 11:40pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: batch m3u’s.. i don’t know this stuff
Posted By: mapnapkin
Subject: batch m3u’s.. i don’t know this stuff
Date Posted: 14 September 2003 at 6:18pm

I've built a lot of band website and they all stream mp3s..
i am tired of writing m3u's.

now i'm building a site that will have 100's of streaming mp3 samples, that will constantly have more added.
so i need a script that will write an new m3u text file for every mp3 file in a selected directory then put the new m3u file into a different selected directory.
I was going to try perl but perl programmers don't want to help

this is what i have so far.. it's unfinished and i'm unsure how to continue
------------------------------

<%
dim fsoObj, filename, objtextFile, baseurl, songname, startdirectory, enddirectory
baseurl = Request.Form("baseurl")
startdirectory = Request.Form("startdirectory")
enddirectory = Request.Form("enddirectory")
%>

<% do until EOF in startdirectory %><!-- not sure about this line -->
<!-- still need to get songname with out the ".mp3" -->
<%
FileName = Server.MapPath( songname & ".m3u")
set fsoObj = Server.CreateObject("Scripting.FileSystemObject")
set objtextFile = fsoObj.OpenTextFile(FileName, 8)
objTextFile.WriteLine ( baseurl & songname & ".mp3")
%>

<% loop %>

<%
objTextFile.Close
set objTextFile = nothing
set fsoObj = nothing
%>

----------------------------------
any help/thoughts would be appreciated

 




Replies:
Posted By: mapnapkin
Date Posted: 16 September 2003 at 1:28am

if any one cares... heres the finsihed script
------------------------------------------
<%
Dim baseurl,startdirectory,enddirectory,fs,fo,fe,tfile,x,songnam e
startdirectory = Request.Form("rootdir")&"\"&Request.Form("startdirec tory")&"\"
enddirectory = Request.Form("rootdir")&"\"&Request.Form("enddirecto ry")&"\"
baseurl = Request.Form("baseurl")&"/"

Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set fo=fs.GetFolder(startdirectory)
Set fe=fs.GetFolder(enddirectory)
%>
<% for each x in fo.files %>
<%
songname = fs.GetBaseName(startdirectory&x.Name)
Set tfile=fe.CreateTextFile(songname&".m3u",true)
tfile.WriteLine(baseurl&songname&".mp3")
%>
<% next %>
<%
tfile.Close
set tfile=nothing
set fo=nothing
set fs=nothing
%>
--------------------------------------
and the form
--------------------------------------
<form name="create" method="post" action="">
    <%
    Set fs=Server.CreateObject("Scripting.FileSystemObject")
    Set fo=fs.GetFolder(Server.MapPath("\BatchM3u\"))
    %>
    <input name="rootdir" type="text" size="50" value="<%Response.Write(fo.ParentFolder)%>">
    Root Directory
    <%
    set fo=nothing
    set fs=nothing
    %>
  <p>
    <input name="startdirectory" type="text" size="50">
    Folder of mp3's </p>
  <p>
    <input name="enddirectory" type="text" size="50">
    Folder for m3u's</p>
  <p>
    <input name="baseurl" type="text" size="50">
    Base URL to mp3's folder
  <p>
    <input name="Submit" type="submit" value=":::::::::: GO ::::::::::">
</form>
---------------------------------------

for creating an m3u for every mp3 in a folder




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net