Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - batch m3u’s.. i don’t know this stuff
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

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

 Post Reply Post Reply
Author
mapnapkin View Drop Down
Newbie
Newbie


Joined: 28 January 2003
Location: United States
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote mapnapkin Quote  Post ReplyReply Direct Link To This Post Topic: batch m3u’s.. i don’t know this stuff
    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

 

Back to Top
mapnapkin View Drop Down
Newbie
Newbie


Joined: 28 January 2003
Location: United States
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote mapnapkin Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.