MainTracksWindow.Refresh and ExecSQL not work allways [#5763

Beta Testing for Windows Products and plugins

Moderator: Gurus

ZvezdanD
Posts: 3264
Joined: Thu Jun 08, 2006 7:40 pm

MainTracksWindow.Refresh and ExecSQL not work allways [#5763

Post by ZvezdanD »

The next code works fine only after the fist execution:

Code: Select all

    SDB.Database.ExecSQL "UPDATE Songs SET SongPath = '" & sNewPath _
            & "' WHERE SongPath = '" & sSongPath & "'"
    'SDB.ProcessMessages
    SDB.MainTracksWindow.Refresh
After the next execution the Path content is not updated in the main tracklist until I switch to some another node and return back to the previous node.

I tried also unsuccessfully:

Code: Select all

    SDB.Database.ExecSQL "UPDATE Songs SET SongPath = '" & sNewPath _
            & "' WHERE SongPath = '" & sSongPath & "'"
    'SDB.MainTracksWindow.Refresh
    Set oCurNode = SDB.MainTree.CurrentNode
    Set SDB.MainTree.CurrentNode = SDB.MainTree.Node_Location
    'SDB.ProcessMessages
    Set SDB.MainTree.CurrentNode = oCurNode
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
PetrCBR
Posts: 1775
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech
Contact:

Re: MainTracksWindow.Refresh and ExecSQL not work allways

Post by PetrCBR »

Zvezdan,

can you send me complete script ?
How to make a debuglog - step 4b: viewtopic.php?f=30&t=86643
ZvezdanD
Posts: 3264
Joined: Thu Jun 08, 2006 7:40 pm

Re: MainTracksWindow.Refresh and ExecSQL not work allways

Post by ZvezdanD »

Yes, of course. I will have one script ready for tests very soon.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
PetrCBR
Posts: 1775
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech
Contact:

Re: MainTracksWindow.Refresh and ExecSQL not work allways

Post by PetrCBR »

Ok, send it to me then (petr att mediamonkey dott com).
How to make a debuglog - step 4b: viewtopic.php?f=30&t=86643
ZvezdanD
Posts: 3264
Joined: Thu Jun 08, 2006 7:40 pm

Re: MainTracksWindow.Refresh and ExecSQL not work allways

Post by ZvezdanD »

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.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
PetrCBR
Posts: 1775
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech
Contact:

Re: MainTracksWindow.Refresh and ExecSQL not work allways

Post by PetrCBR »

Zvezdan,

i've tried that based on your description and can't reproduce.
Also when i'll remove redirection, assign redirection, remove redirection again and then when trying assign redirection again, it pops up dialog that it can't be assigned so i can't repeat steps 6-9 as you've mentioned.
How to make a debuglog - step 4b: viewtopic.php?f=30&t=86643
ZvezdanD
Posts: 3264
Joined: Thu Jun 08, 2006 7:40 pm

Re: MainTracksWindow.Refresh and ExecSQL not work allways

Post by ZvezdanD »

OK, sorry for complicating with comment lines. I sent you a modified script with commented lines which I have as a workaround to resolve mentioned bug. With it you could see that the Path is sometimes not updated in the tracklist (after two or three tryouts).

Mentioned dialog box saying that the track cannot be assigned should not appear if everything is fine. Did you checked if the Path is changed as it should? I repeat just to be sure - after you choose Remove Redirection from the Track the Path should have .mp3 extension (or whatever audio format you have), and after you choose Assign Redirections to the .asx Files the Path should have .asx extension. If the Path is not changed after some of those two commands, then it is a sign of the mentioned bug.

By the way, I wrongly said before that you should find two tracks which have same Album name and Title. In fact, you should have two tracks which have same Artist and Title, but different Album name.

Please let me know if you still cannot reproduce a problem.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
PetrCBR
Posts: 1775
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech
Contact:

Re: MainTracksWindow.Refresh and ExecSQL not work allways

Post by PetrCBR »

Will be fixed in next build (#5763).
How to make a debuglog - step 4b: viewtopic.php?f=30&t=86643
ZvezdanD
Posts: 3264
Joined: Thu Jun 08, 2006 7:40 pm

Re: MainTracksWindow.Refresh and ExecSQL not work allways

Post by ZvezdanD »

Works fine in 1255. Thanks!
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
Post Reply