How to reclaim play count and rating (iTunes)?, Help getting stats after using MP3gain |
![]() ![]() |
How to reclaim play count and rating (iTunes)?, Help getting stats after using MP3gain |
Jun 8 2005, 19:34
Post
#1
|
|
|
Group: Members Posts: 1 Joined: 8-June 05 Member No.: 22603 |
I apologize if this question's been posted ad nauseum, but after being overwhelmed by the non-specific search results I figured I'd lob this request over the wall...
Is there any way to reclaim or maintain My Rating and play count totals from iTunes after using MP3gain? I've built playlists based on rating and play count and I'd like to keep them carefully maintained. My process for using this software and the iPod is: Clear "to be MP3gain'd" files from iTunes library Use MP3gain to desired db level Add folder containing "new" files to iTunes library Re-sync iPod Help me get those stars back when I import the files again! Thanks to all and any who reply... INFO iTunes 4.8 MP3gain Windows XP SP2 4G 20GB iPod |
|
|
|
Jun 8 2005, 21:56
Post
#2
|
|
![]() Group: Members Posts: 1075 Joined: 15-October 03 From: Memphis, TN Member No.: 9323 |
This is not a perfect solution, but it works for most cases.
Download this script I wrote: http://otto.homedns.org:8888/iTunes/SaveRatings.zip It's an HTA file, which is an HTML Application. If your virus scanner complains about it (many will gripe about HTA's using Javascript on general principle), I suggest disabling the virus scanner temporarily. It's perfectly safe, I wrote it myself. Start iTunes. Then double click the HTA to run it. Click "Save Ratings" to save the ratings (and play count and last played time) to a file which will be called "ratings.xml". It does take a while to run, and has no obvious feedback actually showing it running, so go make a sandwich while it processes. Once it's done, close it. Do whatever you need to do, then when you have all your stuff back in iTunes, run the program again and select "Restore Ratings" to restore all the data back to iTunes. This script keys off of the song name, artist name, and album name. So anything with identical info like that will get the ratings restored to it. That's how it works, basically. It runs some fairly simple Javascript if you want to edit it to be more suited to your particular needs. It's just a text file, really, very easy to modify. Anyway, enjoy. -------------------- http://ottodestruct.com
|
|
|
|
Jun 8 2005, 22:47
Post
#3
|
|
|
Group: Members Posts: 1356 Joined: 25-November 02 Member No.: 3873 |
you don't need to necessarily remove your mp3's from iTunes and add them later again. Usually iTunes notices it when a file has been changed and therefore will update it automatically next time you sync your iPod. It works great if you replace the file or if you alter the tag information - even if you keep the timestamp. You just have to play the file or take a look at the specs...
This might not work when you just change the volume of the mp3 since iTunes won't read APEv2 Tags anyway, but you could just uncheck the songs you've updated and sync your iPod. That way the files are removed from your iPod. After that, you tick the checkboxes again and sync your iPod a second time. The files are copied to your iPod and you have the updated files on your iPod without loosing any meta info... Easy as pie -------------------- --alt-presets are there for a reason! These other switches DO NOT work better than it, trust me on this.
LAME + Joint Stereo doesn't destroy 'Stereo' |
|
|
|
Jun 9 2005, 02:35
Post
#4
|
|
![]() Group: Members Posts: 1075 Joined: 15-October 03 From: Memphis, TN Member No.: 9323 |
Jojo: True, except iTunes won't redo it's volume scan for the SoundCheck information without removing and readding the files. Which is fine as long as you never turn on SoundCheck.
-------------------- http://ottodestruct.com
|
|
|
|
Jun 9 2005, 14:16
Post
#5
|
|
|
Group: Members Posts: 1356 Joined: 25-November 02 Member No.: 3873 |
QUOTE (Otto42 @ Jun 8 2005, 05:35 PM) Jojo: True, except iTunes won't redo it's volume scan for the SoundCheck information without removing and readding the files. Which is fine as long as you never turn on SoundCheck. seems logical, but you wouldn't want to use mp3Gain anymore if you already use SoundCheck - and the other way around. -------------------- --alt-presets are there for a reason! These other switches DO NOT work better than it, trust me on this.
LAME + Joint Stereo doesn't destroy 'Stereo' |
|
|
|
Jun 16 2005, 22:12
Post
#6
|
|
|
Group: Members Posts: 1356 Joined: 25-November 02 Member No.: 3873 |
@ Otto42
do you think you could add a feature that saves all playlists? It's especially the Smart Playlists and it's rules I'm looking for thanks -------------------- --alt-presets are there for a reason! These other switches DO NOT work better than it, trust me on this.
LAME + Joint Stereo doesn't destroy 'Stereo' |
|
|
|
Jun 16 2005, 22:43
Post
#7
|
|
![]() Group: Members Posts: 1075 Joined: 15-October 03 From: Memphis, TN Member No.: 9323 |
There's no need. You can save the playlists yourself in iTunes. Just export the playlists to an XML file and reimport them later. It'll keep the smart playlist rules too.
Okay, so it's a one-by-one solution, but it's there now in any case. -------------------- http://ottodestruct.com
|
|
|
|
Aug 1 2006, 05:14
Post
#8
|
|
|
Group: Members Posts: 1356 Joined: 25-November 02 Member No.: 3873 |
I just used your little script again. It still works great
Anyway, would it be possible to preserve the "song added" information as well? I have a bunch of smart playlists that depend upon that information. thanks -------------------- --alt-presets are there for a reason! These other switches DO NOT work better than it, trust me on this.
LAME + Joint Stereo doesn't destroy 'Stereo' |
|
|
|
Aug 1 2006, 10:12
Post
#9
|
|
|
Group: Members Posts: 117 Joined: 6-June 04 Member No.: 14513 |
If your files were soundchecked before mp3gaining them, you will not only have to remove them from the library and re-import them afterwards, but you will also have to remove the itunesnorm tag. Otherwise, itunes will re-import the old soundcheck values.
It also still makes sense to soundcheck the mp3gained files imo: if you mp3gain them it would be best to use album gain. By turning on soundcheck you can still use track gain for playback. (track gain: with soundcheck, album gain: without soundcheck) |
|
|
|
Aug 4 2006, 00:30
Post
#10
|
|
|
Group: Members Posts: 1356 Joined: 25-November 02 Member No.: 3873 |
I just used your little script again. It still works great Anyway, would it be possible to preserve the "song added" information as well? I have a bunch of smart playlists that depend upon that information. thanks ok, I've tried to modify Otto's script. I simply want to preserve the 'date added' property. I also removed the album criteria for a successful restore of a song. The data gets exported and all the data is there, but I'm getting an error on line 175, char 7, saying: "Wrong number of arguments or invalid property assignment". The line the code refers to is: QUOTE foundTrack.DateAdded = dateadded.getVarDate(); Here is the entire script: CODE <html> <head> <title>Save and Restore Ratings/Playcounts/Last Played</title> <?XML:NAMESPACE PREFIX = HTA /> <HTA:APPLICATION /> <script LANGUAGE="VBScript"> Function GetNothing() Set GetNothing = Nothing End Function </SCRIPT> <script type="text/JScript"> var jsNothing = GetNothing(); function saveXMLRatings(everything) { var iTunesApp = new ActiveXObject("iTunes.Application"); var mainLibrary = iTunesApp.LibraryPlaylist; var mainLibrarySource = iTunesApp.LibrarySource; var tracks = mainLibrary.Tracks; var numTracks = tracks.Count; var i; var dom = new ActiveXObject("Microsoft.XMLDOM"); // create the root element var root = dom.createElement("songs"); dom.appendChild(root); // Insert a newline + tab for readability root.appendChild(dom.createTextNode("\n\t")); // run through all the tracks for (i = 1; i <= numTracks; i++) { var currTrack = tracks.Item(i); var rating = currTrack.Rating; var playcount = currTrack.PlayedCount; var lastplayed = currTrack.PlayedDate; var dateadded = currTrack.DateAdded; var name = currTrack.Name; var artist = currTrack.Artist; //var album = currTrack.Album; // dont bother to save if the rating and playcount are both zero if (rating != 0 || playcount != 0 || everything == 1) { // create a new song element var songnode = dom.createElement("song"); root.appendChild(songnode); songnode.appendChild(dom.createTextNode("\n\t\t")); var artistnode = dom.createElement("artist"); artistnode.text = artist; songnode.appendChild(artistnode); songnode.appendChild(dom.createTextNode("\n\t\t")); // var albumnode = dom.createElement("album"); // albumnode.text = album; // songnode.appendChild(albumnode); // songnode.appendChild(dom.createTextNode("\n\t\t")); var namenode = dom.createElement("name"); namenode.text = name; songnode.appendChild(namenode); songnode.appendChild(dom.createTextNode("\n\t\t")); var ratingnode = dom.createElement("rating"); ratingnode.text = rating; songnode.appendChild(ratingnode); songnode.appendChild(dom.createTextNode("\n\t\t")); var datenode = dom.createElement("lastplayed"); datenode.text = lastplayed; songnode.appendChild(datenode); songnode.appendChild(dom.createTextNode("\n\t\t")); var addednode = dom.createElement("dateadded"); addednode.text = dateadded; songnode.appendChild(addednode); songnode.appendChild(dom.createTextNode("\n\t\t")); var countnode = dom.createElement("playcount"); countnode.text = playcount; songnode.appendChild(countnode); songnode.appendChild(dom.createTextNode("\n\t")); root.appendChild(dom.createTextNode("\n\t")); // var addednode = dom.createElement("dateadded"); // addednode.text = dateadded; // songnode.appendChild(addednode); // songnode.appendChild(dom.createTextNode("\n\t")); // root.appendChild(dom.createTextNode("\n\t")); } } document.write("Ratings/Playcount data saved.<br>"); // Add a newline. root.appendChild(dom.createTextNode("\n")); // Save the XML document to a file. dom.save("ratings2.xml"); root = null; dom = null; iTunesApp = jsNothing; } function restoreXMLRatings(everything) { var iTunesApp = new ActiveXObject("iTunes.Application"); var mainLibrary = iTunesApp.LibraryPlaylist; //var mainLibrarySource = iTunesApp.LibrarySource; var tracks = mainLibrary.Tracks; var ITPlaylistSearchFieldSongNames = 5; var dom = new ActiveXObject("Microsoft.XMLDOM") dom.async="false" dom.load("ratings2.xml") // go through the songs one by one var i, n_elems, j; var elems = dom.getElementsByTagName("song"); n_elems = elems.length; for (i = 0; i < n_elems; i++) { // elems.item(i) or elems[i] is the song node we want to look at var rating = elems.item(i).selectSingleNode("rating").text; var playcount = elems.item(i).selectSingleNode("playcount").text; var lastplayed = new Date(elems.item(i).selectSingleNode("lastplayed").text); var dateadded = new Date(elems.item(i).selectSingleNode("dateadded").text); var name = elems.item(i).selectSingleNode("name").text; var artist = elems.item(i).selectSingleNode("artist").text; //var album = elems.item(i).selectSingleNode("album").text; // search for the name of the song var foundTracks = mainLibrary.Search(name,ITPlaylistSearchFieldSongNames); var worked = 0; if (foundTracks) { for (j=1; j<=foundTracks.Count;j++) { // check the artist, album, name, and kind if (name == foundTracks.Item(j).Name && artist == foundTracks.Item(j).Artist //&& //album == foundTracks.Item(j).Album ) { var foundTrack = foundTracks.Item(j); //document.write("Found an exact match for " +name+ "<br>"); if (rating !=0 || everything == 1) { //document.write("Setting rating to "+rating +"<br>"); foundTrack.Rating = parseInt(rating); } if (playcount !=0 || everything == 1) { //document.write("Setting playcount to "+playcount +"<br>"); foundTrack.PlayedCount = parseInt(playcount); // also restore last played date in this case //document.write("Setting lastplayed<br>"); foundTrack.PlayedDate = lastplayed.getVarDate(); foundTrack.DateAdded = dateadded.getVarDate(); } worked=1; } } // end for } //if (worked==0) document.write("Could not find any match for "+name+", "+album+", "+artist+"<br>"); if (worked==0) document.write("Could not find any match for "+name+", "+artist+"<br>"); foundTracks=null; } dom = null; iTunesApp = jsNothing; } </script> </head> <body> <h4>Saving Ratings</h4> <p>Click the "Save Ratings" button below to save the Ratings/Playcount/LastPlayedDate data from iTunes into a file. This file will be called "ratings2.xml" and it will be saved in the same directory as you ran the HTA file from. This process may take a while.</p> <h4>Restoring Ratings</h4> <p>Click the "Restore Ratings" button to restore the Ratings/Playcount/LastPlayedDate from the "ratings2.xml" file to the iTunes library. This is not undo-able, so you may want to backup your iTunes library files first.</p> <h4>Saving/Restoring Everything</h4> <p>Does the same thing, except it saves and restores all song data, including zero ratings and such. Normally, zero ratings get ignored, so as not to overwrite good ratings with zero ratings. This has no such protection. It's also much, much slower. Be patient.</p> <h4>Note</h4> <ul> <li>It's recommended that you have iTunes running when you use this program. It's not required, as iTunes will start regardless, but it's a bit faster if it's already running.</li> </ul> <center> <table border=0> <!-- <tr> <td align=center><button onclick="saveXMLRatings(0)">Save Ratings</button></td> <td align=center><button onclick="restoreXMLRatings(0)">Restore Ratings</button></td> </tr> --> <tr> <td align=center><button onclick="saveXMLRatings(1)">Save Everything</button></td> <td align=center><button onclick="restoreXMLRatings(1)">Restore Everything</button></td> </tr> </table> </center> </body> </html> any help would be appreciated. thanks -------------------- --alt-presets are there for a reason! These other switches DO NOT work better than it, trust me on this.
LAME + Joint Stereo doesn't destroy 'Stereo' |
|
|
|
Dec 31 2006, 04:15
Post
#11
|
|
|
Group: Members Posts: 558 Joined: 10-July 03 From: Australia Member No.: 7693 |
Just added this feature to iTSfv, kudos to Otto42's design idea.
![]() iTSfv can do more things than that. Here is iTSfv adding Track Count, Disc Number and Disc Count: http://wmwiki.com/mcored/research/itsfv/it...-count-etc2.avi If you are a tag natzi like me, you will like it. You can download the latest from http://wmwiki.com/mcored/downloads/itsfv/?M=D |
|
|
|
Jan 5 2007, 13:40
Post
#12
|
|
|
Group: Members Posts: 1356 Joined: 25-November 02 Member No.: 3873 |
Just added this feature to iTSfv, kudos to Otto42's design idea. maybe you could check my previous post in this thread and see if it is possible to backup the 'date added' property as well -------------------- --alt-presets are there for a reason! These other switches DO NOT work better than it, trust me on this.
LAME + Joint Stereo doesn't destroy 'Stereo' |
|
|
|
Jan 9 2007, 23:43
Post
#13
|
|
|
Group: Members Posts: 558 Joined: 10-July 03 From: Australia Member No.: 7693 |
maybe you could check my previous post in this thread and see if it is possible to backup the 'date added' property as well It's possible to backup; the problem is restoring it. Like you said maybe hacking the XML file could be a workaround. IIRC the change has to be done to the .itl file as well as the .xml file. Otherwise iTunes reverts back to the old value by reading the .itl file. However, indeed an interesting challenge. |
|
|
|
Mar 4 2007, 15:20
Post
#14
|
|
|
Group: Members Posts: 2 Joined: 4-March 07 Member No.: 41173 |
Just added this feature to iTSfv, kudos to Otto42's design idea. maybe you could check my previous post in this thread and see if it is possible to backup the 'date added' property as well Or you can try iRating. This guy seems to get the thing complete Axel |
|
|
|
Mar 23 2007, 17:07
Post
#15
|
|
|
Group: Members Posts: 1 Joined: 23-March 07 Member No.: 41788 |
Is there any way to reclaim or maintain My Rating and play count totals from iTunes after using MP3gain? I've built playlists based on rating and play count and I'd like to keep them carefully maintained. My process for using this software and the iPod is: I found a way to get the ratings back . . . it's kind of a hack, but it works with little fuss -- 1. Sort your entire iTunes music library by rating, and then create a playlist for each number of stars you've given the song ("star 1," "star2," etc.). 2. Download a program that converts iTunes playlists to m3u files, like this one: http://www.ericdaugherty.com/dev/itunesexport 3. Export the star 1-5 playlists to m3u format. 4. Load the star 1-5 playlists into foobar and rate the songs according to what their playlist name is. iRating will take care of the other stuff you want too, but it only works on a limited number of files 100-200 before closing down. This post has been edited by iggyst00ge: Mar 23 2007, 17:09 |
|
|
|
Apr 10 2007, 00:37
Post
#16
|
|
|
Group: Members Posts: 558 Joined: 10-July 03 From: Australia Member No.: 7693 |
Later versions of iTSfv will store all the "not-stored-in-tracks" tags to an XML file to backup/restore. ![]() Is there any tag I am missing? http://wmwiki.com/downloads/itsfv/beta/?M=D I have tested this myself however if you are trying it please try it first in another XP user account to get confidence that it is working. Backing up should be must faster because it is not storing the data in the track thus not modifying the track everytime. This post has been edited by ~*McoreD*~: Apr 10 2007, 00:53 |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 22nd November 2009 - 00:42 |