For some reason, my i-tunes media folder has a second copy of many of the music files, but the entries in the i-tunes library link to the wrong copies.
For instance, the folder has "Purple Haze.mp3" and also "Purple Haze 1.mp3". The i-tunes library entry is "Purple Haze" but instead of it pointing to "Purple Haze.mp3" it points to "Purple Haze 1.mp3".
All these unwanted files have the " 1" added.
I want to be able to redirect each library entry so that it points to the right file. If I do this manually, one by one, it will take forever as there are thousands of these incorrect duplicates.
How can I change the target files for multiple entries? I need a tool that (1) searches for all library entries that point to a target file containing " 1.mp" in the name and (2) deletes the " 1" in the library entry.
Any help/<acronym title='Other than "Don't use i-tunes, cos it's crap'>suggestions gratefully received
this is a itunes problem, mp3tag can't help you here
Yes, this is an iTunes problem.
Now then: you could filter all the files with the "1" in mp3tag and delete them (or move them to another place so that you have a backup).
Then let iTunes reread the folder(s) to add the other files. Now you have two entries: one pointing to the new file, the other to the one with the "1" in it.
Then let a java script run over the library to delete the orphans. (These should be the entries with the "1" in the file name).
The result would be a clean library.
naturally, you loose all ratings for the orphaned entries.
Ohrenkino
Forgive my newbie ignorance, but how do I "let a java script run over the library to delete the orphans"?
No problem. Only shows that sooner or later we all face the same problems. ![]()
Copy the code of the following box into the notepad, save the file as suggested "removeDeadTracks.js" or something of your liking.
Open iTunes.
Then start the script in a command window (cmd.exe).
Depending on the size of your library this may take some time, even hours.
You will see the progress in iTunes as the number of stored tracks in the library decreases.
The script will really only remove those entries in the library that point to a filename that is not there any more.
/*
File: RemoveDeadTracks.js
Version: 1.0
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc.
("Apple") in consideration of your agreement to the following terms, and your
use, installation, modification or redistribution of this Apple software
constitutes acceptance of these terms. If you do not agree with these terms,
please do not use, install, modify or redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and subject
to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs
copyrights in this original Apple software (the "Apple Software"), to use,
reproduce, modify and redistribute the Apple Software, with or without
modifications, in source and/or binary forms; provided that if you redistribute
the Apple Software in its entirety and without modifications, you must retain
this notice and the following text and disclaimers in all such redistributions of
the Apple Software. Neither the name, trademarks, service marks or logos of
Apple Computer, Inc. may be used to endorse or promote products derived from the
Apple Software without specific prior written permission from Apple. Except as
expressly stated in this notice, no other rights or licenses, express or implied,
are granted by Apple herein, including but not limited to any patent rights that
may be infringed by your derivative works or by other works in which the Apple
Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
(INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Copyright © 2004 Apple Computer, Inc., All Rights Reserved
*/
var ITTrackKindFile = 1;
var iTunesApp = WScript.CreateObject("iTunes.Application");
var deletedTracks = 0;
var mainLibrary = iTunesApp.LibraryPlaylist;
var tracks = mainLibrary.Tracks;
var numTracks = tracks.Count;
var i;
while (numTracks != 0)
{
var currTrack = tracks.Item(numTracks);
WScript.Echo("Noch " + numTracks);
// is this a file track?
if (currTrack.Kind == ITTrackKindFile)
{
// yes, does it have an empty location?
if (currTrack.Location == "")
{
// yes, delete it
currTrack.Delete();
deletedTracks++;
WScript.Echo("Removed " + deletedTracks);
}
}
numTracks--;
}
if (deletedTracks > 0)
{
if (deletedTracks == 1)
{
WScript.Echo("Removed 1 dead track.");
}
else
{
WScript.Echo("Removed " + deletedTracks + " dead tracks.");
}
}
else
{
WScript.Echo("No dead tracks were found.");
}
Enjoy.
ohrenkino
I fear you still do not realise just how ignorant I am.
I have cut and paste your code into a txt document and saved it as a javascript file.
Does it matter where I save the file to?
Now what do I do with it? How do I "start the script in a command window (cmd.exe)"?
Many thanks for your patience and assistance.
Yes, a script is mainly a text file.
But if you save it with the extension js then the java script interpreter (if installed) will run it.
No, it does not matter where you save it as long as you open iTunes before you start the script. Actually, the script will terminate if you do not have iTunes open or close it during script execution.
On my computer the right-click context menu for the js-file has the options "open" and "open in command shell". Select the latter.
(alternatively, you can open a command shell by executing cmd.exe. But then you have to navigate to the path where you saved the js-file)
When I right click the js-file in windows explorer, the options are to "Open", "Edit" and "Open with Command Prompt".
When I choose "Open with Command Prompt", a command window quickly opens and shuts (too quick for me to see what's in it) and nothing else happens.
When I Run cmd.exe what do I type to run the js-file? If I just enter the file's name and hit enter, I get a "Windows Script Host" error message "Can't find script engine "JScript" for script " C:\Users\dogmatooth\RemoveDeadTracks.js"
I am running Windows 7 Ultimate, 64 bit
I've got a different language version so this was just my crude attempt to translate it. Now I'll try to remember.
I am not quite sure what about this js-error. Could it be necessary to activate "active scripting" in the Internet Explorer?
What he could try is rename the script to Removedeadtrack.vbs and start from the Command Prompt with "wscript Removedeadtrack.vbs" and see what happens.
Another solution could be, look at this website : http://www.winhelponline.com/articles/230/...g-js-files.html
Edit: 16:04: Spelling