Scripting Functionality Thread (NO Script Requests Here!)

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

Fellow scripters/coders/...: Do you feel the need for a wishlist for enhanced scripting functionality?

You may select 1 option

 
 
View results

twinbee
Posts: 180
Joined: Tue May 13, 2008 2:36 am
Location: England
Contact:

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by twinbee »

To return to this point...
No, SDB.MainTracksWindow.AddTracksFromQuery() is the fastest way to add tracks to the main window, as long as you don't have slow SQL's.
I have about 5000 songs in my database so far. As before, I need to add tracks by ID to the TracksWindow. Using AddTracksFromQuery() is around 10 times slower than a way I have found which is rather kludgy (so I would prefer replaced) but is lightning quick - this is basically what happens:

When Mediamonkey boots up, I copy each SongData object for all tracks to an Objects array thusly:

Code: Select all

Set it = SDB.Database.QuerySongs("id > 0")
Do While Not it.EOF
	SDB.Objects(it.Item.ID) = it.Item    ' Copy the SongData object to each Object in the array
	it.Next
Loop
I then use later: mytrackswindow.AddTrack( SDB.Objects( id(n)) ) - where "id" is an array containing thousands of ID numbers. Doing it this way is much faster than AddTracksFromQuery() alone. Even if I use ID IN(" & MyString & ")" (which I think you mentioned a while back), my above kludgy method is almost twice as fast (and also, using ID IN.... won't keep the order of the thousands of ID numbers (separated by commas) in MyString - though perhaps there's a way around that?).

This is why my reasoning for allowing the AddTrackById method for SDBTracksWindow would be a great boon. Thousands of ID numbers could be added directly without having to scan the database for each and every ID as with AddTracksFromQuery(). Am I overlooking something?
MegaDJ v2 - Lightning fast and easy to use search to replace the standard AutoPlaylist. Features include random jukebox style playlists, along with syncing, weighting options, and logic complete querying.
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by ZvezdanD »

Bex wrote:I agree that we should have a proper Clear method
I tried to replace SDB.MainTracksWindow.RemoveSelectedTracks in my scripts with:

Code: Select all

        SDB.MainTree.CurrentNode.NodeType = 12
        SDB.MainTracksWindow.Refresh
because it is much faster, but unfortunately after adding new tracks with SDB.MainTracksWindow.AddTrack I could not get tracks sorted as before. I tried to restore NodeType, SortCriteria and SortGroup of that node but neither of that helped. Do you have some suggestion for this or should I stay with my solution?

By the way, have you tried your suggestion with a new possibility of MM 3.1 to display all tracks in the tracklist even when you select Library node?
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
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by Bex »

No I haven't tested it yet. Perhaps SDB.MainTree.CurrentNode.NodeType = 11, which is the location, works better in MM3.1?
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by trixmoto »

Anybody else with there was an OnDelete event? For the script I'm currently working on I am creating a table to extend the Songs table and when a song is deleted I'd really like to be able to delete my own record as well. I can of course tidy these up later on, but I'd like to add some other functionality as well that would need to happen as the track is being deleted.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by MoDementia »

I use a trigger for this type of thing, I think sync the sync has one
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by trixmoto »

Thanks, I'll take a look. :)

EDIT: Whilst this does seem to allow me to clean up my own database table, it does not allow me to add the other functionality I require (like showing a popup window to the user). Looks like I'm still gonna need an event unless I'm mistaken?
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by MoDementia »

You're right, but a popup to do what? there is no undelete :(
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by trixmoto »

Well if the event had a parameter to cancel the delete that would be cool, but not actually something that I need. The script I'm working on communicates with an online repository so when you delete a track in the repository from MM I want to give the user the option to also delete it from the repository automatically.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by MoDementia »

Yep an event wold be needed in this case.
As a work around you could add to the trigger to up date another table with the deletions, but it would be another click to read that table and confirm deletions.
Might not be too bad, ie instead of a popup every deletion just review the list after a deleting session.
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by ZvezdanD »

I really need OnAfterTracksMove event.
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
flashk
Posts: 188
Joined: Sun Dec 11, 2005 5:04 pm

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by flashk »

I would really like a OnTrackListModified event that behaves similarly to the OnNowPlayingModified event, except for the main tracks window. The problem with OnTrackListFilled is that it doesn't handle tracks being removed, reordered, or resorted.
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by ZvezdanD »

I agree with the previous. Also, I need OnPlaylistModified (static as well as auto-playlists).
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
Nanya
Posts: 21
Joined: Wed Oct 03, 2012 8:04 pm

Re: Scripting Functionality Thread (NO Script Requests Here!

Post by Nanya »

T'would be nice to have the ability to click on a spot on an SDBUITrackBar to change its value, (perhaps there already is, but it's just undocumented).

Having the ability to return to a previous view after a refresh would also be nice, i.e., selected tracks, visible tracks, etc..

And what about controls to modify TrackBrowser selections?

(Amateur here, perhaps I've just missed all these features. :D )
Post Reply