OK, the script is finished. Instead to write some test example, you could try my new
Track Redirection script. Well, I just found my own way how to resolve the mentioned problem. I need to say it is very dirty and hard to find and here is a general conclusion. If I have some ExecSQL method sometimes tracklist is not updated until I change current node, but the worst situation is when neither changing of node is resolving a problem. I found that I could resolve such problems if I put next lines after ExecSQL:
Code: Select all
Set oSongIter = SDB.Database.QuerySongs("ID = " & oSongData.ID)
If Not oSongIter.EOF Then
Set oSongData = oSongIter.Item
sHack = oSongData.Publisher
SDB.ProcessMessages
End If
It is most interesting fact (and most hard to find) that you cannot use any field instead of the Publisher (the line sHack = oSongData.Publisher). I tried almost all SongData fields and only next fields refresh database and tracklist correctly: "Comment", "Lyrics", "Copyright", "Encoder", "ISRC", "Original Lyricist", "Publisher".
If you comment the mentioned lines in my code or if you replace Publisher line with e.g. sHack = oSongData.Title (or any other field which I have not mentioned), than you will get tracklist which is not always refreshing. Now, I need to explain what you should do to get such situation. First, as I said you should comment those lines in the AssingRedirection function (2192-2200) and similar lines in the RemoveRedirection function (2033-2041). To continue the test you need two tracks already stored in the Library which have same Album name and the Title. This script is messing with the library and audio files, so you should test it with some backup.
1. find one of those two tracks and select it in the tracklist;
2. right-click on it and choose
Track Redirection / Create .asx File(s) and Update the Library;
3. in the new Track Redirection dialog box you should select Artist, Album and Title of the second file (most probably it would be already selected);
4. after you click on the OK button that second track would be replaced with the .asx file in the library;
5. find that second track in the tracklist if it is not already there, e.g. click on its album in the tree;
6. check the Path column of the tracklist if the file have .asx extension;
7. right-click on same file and choose Track Redirection / Remove Redirection from the Track;
8. check the Path column of the tracklist if the file have old extension (.mp3 or whatever);
9. right-cilck on same file and choose Track Redirection / Assign Redirection to the Track(s);
10. check the Path column of the tracklist if the file have .asx extension ...
You could repeat steps 6-9 as many times as it is necessary, but most probably after the second step you would notice that extension is not changed. Just to repeat if it was not obvious - you first need to put comments on mentioned lines in my script to get incorrect behavior. If you try same steps with unmodified script you would get correct display.