Recently I went through the trauma of hard-drive failure, but fortunately when I realised something wasn't quite right, I backed up my files, including all of my music, to another hard-drive.
In iTunes, I exported the playlist as a .xml file, before proceeding to clear my library. Prior to the failure, all of the music & video files for iTunes were located either in E:/iTunes Files/iTunes Music/ or C:/Documents and Settings/Owner/My Documents/My Music/iTunes/iTunes Music/
Seeing E:/ went belly up, I decided to put everything (including the files in C:/) into F:/iTunes/
This is what I did, to transfer the files and update the play count
- Open the playlist backup file (In my case, Playlist.xml file) in Notepad++ (you can also use Notepad, Wordpad or any other text editor).
- Use the Find and Replace function to replace all instances of both E:/iTunes Files/iTunes Music/ and C:/Documents and Settings/Owner/My Documents/My Music/iTunes/iTunes Music/ and turn it into F:/iTunes/
- Save the playlist backup file under a different filename, I chose Playlist_new.xml
- In iTunes, remove everything. Delete all playlists and libraries, so it is essentially a blank canvas.
- Go to File -> Import in iTunes, and restore the new backup file (Playlist_new.xml)
HOW TO UPDATE THE PLAY COUNT
To update the play count, this was my procedure (unfortunately, I don't know how to update last played... which doesn't really matter anyway, as it will update whenever you next play the particular song).
- Open a new window of Notepad, and paste the following code:
Code: Select all
var iTunesApp = WScript.CreateObject("iTunes.Application"); var track = iTunesApp.CurrentTrack; track.PlayedCount = 100;
- Save this as update.js into My Documents.
Now, to update each songs play count:
- Open Playlist.xml in Notepad++ again. As you saved your changes to Playlist_new.xml, Playlist.xml should remain unchanged.
- Open iTunes, and go in to your Music library (the very first playlist under the word "Library" on the left of screen)
- Sort the songs by Artist (you can order it in any way you want, but I find Artist is the simplest)
- Play the very first song, by double clicking it.
- Go back to Playlist.xml, and using the Ctrl+F search function, search for the name of the song you are playing. Then look for this:
Code: Select all
<key>Play Count</key>
- To the right of that, you should see:
Whatever the number between the <integer> tags is, is the play count. In the case of that song, it was 43.
Code: Select all
<integer>43</integer>
- Go to your update.js file, which should still be open in Notepad.
- Change track.PlayedCount = 100; to track.PlayedCount = 43; ..... it is very important that the line ends with a semi-colon (;), so ONLY change the actual number, nothing else.
- Save the file by using Ctrl+S (this is quicker than File -> Save)
- Double click the update.js file in your My Documents folder (leave My Documents open in the background to make this process quicker)
- Go back to iTunes, and you will see the file has been updated. This might take 5 or so seconds to update, but I found it to be almost instant in most cases.
- Play song you wish to update play count of
- Search for that song name in your original .xml file, and note the number of plays it had
- Update the last line of update.js and save the file
- Double click update.js to run the file
- Once the play count has updated, double click to play the next song in the list, and repeat the process.