MainTracksWindow.Refresh and ExecSQL not work allways [#5763

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: MainTracksWindow.Refresh and ExecSQL not work allways [#5763

Re: MainTracksWindow.Refresh and ExecSQL not work allways

by ZvezdanD » Thu Jun 11, 2009 6:17 pm

Works fine in 1255. Thanks!

Re: MainTracksWindow.Refresh and ExecSQL not work allways

by PetrCBR » Wed Jun 10, 2009 11:53 am

Will be fixed in next build (#5763).

Re: MainTracksWindow.Refresh and ExecSQL not work allways

by ZvezdanD » Wed Jun 10, 2009 10:19 am

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.

Re: MainTracksWindow.Refresh and ExecSQL not work allways

by PetrCBR » Wed Jun 10, 2009 8:15 am

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.

Re: MainTracksWindow.Refresh and ExecSQL not work allways

by ZvezdanD » Tue May 05, 2009 6:28 pm

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.

Re: MainTracksWindow.Refresh and ExecSQL not work allways

by PetrCBR » Sun May 03, 2009 1:45 pm

Ok, send it to me then (petr att mediamonkey dott com).

Re: MainTracksWindow.Refresh and ExecSQL not work allways

by ZvezdanD » Thu Apr 30, 2009 1:08 am

Yes, of course. I will have one script ready for tests very soon.

Re: MainTracksWindow.Refresh and ExecSQL not work allways

by PetrCBR » Wed Apr 29, 2009 9:05 am

Zvezdan,

can you send me complete script ?

MainTracksWindow.Refresh and ExecSQL not work allways [#5763

by ZvezdanD » Tue Apr 28, 2009 11:19 am

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

Top