KevinyzeR

is procuring hooligan activities

 
  • Increase font size
  • Default font size
  • Decrease font size
Home Rants Random Rants Winamp M3U Duplicate Movie Files

Winamp M3U Duplicate Movie Files

This should solve this problem
http://forums.winamp.com/showthread.php?postid=2171183

/*
KevinyzeR
Removes dulplicate files found in playlists
Situation:
file.avi is both on C:\movies\movie1\file.avi and D:\public\movies\movie1\file.avi

instructions:
1) Edit location and nonduplocation below
2) save this as removeduplicate.js
3) crack knucles
4) location, nonduplocation, and removeduplicate.js must be in the same directory
5) open command line go to the directory where removeduplicate.js
6) type, without the qoutation marks, "wscript removeduplicate.js" then hit enter
7) a new m3u file should appear where you declared the value in "nonduplocation"
*/

var location ="videos.m3u"; //your exported m3u containing duplicate files
var nonduplocation ="non-dup-videos.m3u"; //new playlist containing no duplicates

var fso = new ActiveXObject("Scripting.FileSystemObject");
var m3ufile = fso.OpenTextFile(location, 1);
var line = m3ufile.ReadLine();
var playlist_items=new Array;
var final_playlist_items=new Array;
var line1="";
var line2="";
while(!m3ufile.AtEndOfStream){
	line1=String(m3ufile.ReadLine());
	line2=String(m3ufile.ReadLine());
	if(String(line1).indexOf("#EXTINF")!=-1){
		playlist_items.push([line1,line2]);
	}
}
m3ufile.Close()

var directory_and_filename="";
var temp_array;
var filename_no_ext="";
var filename="";
var prefix="";
var directory_name="";
for(var i=0;i < playlist_items.length-1;i++){
	line1=playlist_items[i][0];
	line2=playlist_items[i][1];
	if(line2=="REMOVETHISISDUPLICATE"){	
	}else{
	temp_array=String(line2).split("\\");
	directory_and_filename=temp_array[temp_array.length-2]+"\\"+temp_array[temp_array.length-1];
	directory_name=temp_array[temp_array.length-2];
	filename=temp_array[temp_array.length-1];
	temp_array=String(temp_array[temp_array.length-1]).split(".");
	filename_no_ext=String(filename).replace("."+String(temp_array[temp_array.length-1]),"");
	temp_array=String(line1).split(",");
	prefix=String(temp_array[0]);
	//WScript.Echo(directory_and_filename);
	//break;
	for(var j=i+1;j < playlist_items.length-1;j++){
		if(String(playlist_items[j][1]).indexOf(directory_and_filename)!=-1){
			playlist_items[j][1]="REMOVETHISISDUPLICATE";
			//WScript.Echo(directory_and_filename);
		}
		
	}

		//rename the entry to filename
		playlist_items[i][0]=prefix +","+ filename_no_ext;
		
		//rename the entry to directory_name
		//playlist_items[i][0]=prefix +","+ directory_name;
	}
}

for(var i=0;i < playlist_items.length;i++){
	line1=playlist_items[i][0];
	line2=playlist_items[i][1];
	if(line2!="REMOVETHISISDUPLICATE"){
		final_playlist_items.push([line1,line2]);
	}
}

var a = fso.CreateTextFile(nonduplocation, true);
a.WriteLine("#EXTM3U");
for(var i=0;i < final_playlist_items.length;i++){
	a.WriteLine(final_playlist_items[i][0]);
	a.WriteLine(final_playlist_items[i][1]);
}
a.Close();
Last Updated ( Saturday, 26 December 2009 06:46 )  

Search