need some advice on the best code to use for this situation. Basically I'm writing a function that has to do the following:
opens a file for reading/writing from a path specified when calling the function
looks over all the data in the file(it's an m3u file, a winamp playlist file with just basically text info about songs) and matches certain songs with those listed in an array.
let me give an exmaple. The m3u file contains info for songs like this:
#EXTINF:100,Artist1- Title1
MP3s\artist1.mp3
#EXTINF:200,Artist2- Title2
MP3s\artist2.mp3
#EXTINF:150,Artist3- Title3
MP3s\artist3.mp3
that's 3 songs right there. Now I have an array of songs that gets passed trough the function as well. The array goes like this:
$deletesongs[0]= "artist1- title1";
$deletesongs[1]= "artist2- title2";
now what I need the function to do is to search all the entries in the m3u file that match the entries in the $deletesongs array and then delete both lines in the m3u file for each of the songs.
So the function should produce the following m3u file after it went through and deleted the 2 entries contained in the array:
#EXTINF:150,Artist3- Title3
MP3s\artist3.mp3
then the m3u file needs to be uploaded back to the server
hope this is not too confusing hehe, any ideas on this?