-   Programming (
-   -   PHP Remove Line From Shoutcast Playlist File. Sed? (

windisch 03-21-2007 09:25 PM

PHP Remove Line From Shoutcast Playlist File. Sed?
I have a shoutcast server, and I'm trying to add a piece to my web interface. What I'm looking at doing is removing a line from the playlist. The code works on a test playlist. But when I try it on the real playlist, it fails, because the file is being read by the shoutcast server.

PHP Code:

$song=$song 1;
$filename "/home/draco/shoutcast/transcode/MythMusic.alw"// File which holds all data
$rowToDelete $song// This is line need to be deleted

$arrFp file$filename ); // Open the data file as an array
$numLines count$arrFp ); // Count the elements in the array

$fp fopen$filename"w" ); // Open the file for writing
for($i=0$i<$numLines$i++) // Overwrite the content except the line to be deleted
$i != ($rowToDelete-1) )
fclose$fp ); // Close the file

I have a bash script (designed with the help of good people from this forum) that can use sed and remove a line from the same file when in use, so I'm assuming that I can do something similar with PHP.

Anyone have a suggestion?


windisch 03-24-2007 12:23 PM

Just checking in. Anyone have a suggestion? Or is what I'm trying to do impossible? Can I call a bash script that calls sed to remove the line? Any help would be appreciated.

windisch 03-26-2007 09:52 PM


All times are GMT -5. The time now is 03:23 AM.