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

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

Post by trixmoto »

I am of course working on improving the speed of my BrowseByArt script. However, it does take time to create a webpage based on a large database. I find it is quick if you use the child nodes as this only displays a small subsection of my library.

Any ideas for improving the speed will be gratefully recieved! :)
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.
oldskool73
Posts: 38
Joined: Sat May 27, 2006 3:50 pm
Contact:

Post by oldskool73 »

How about a sortable DatGrid UI control, the same as is used in the Main & Now Playing windows? Ideally with the ability to embed images in the cells...?

Oooh, and if it's possible, the ability to do something like this? :)
DaledeSilva
Posts: 906
Joined: Sun May 28, 2006 4:22 am
Location: Australia
Contact:

Post by DaledeSilva »

I would love to be able to 'create' auto-playlists from scripts. I think the best way toward this is to have auto-playlists also work via a single line equation.

please see this thread where I posted it initially:
http://www.mediamonkey.com/forum/viewto ... 8813#48813

Dale.
Product Designer & Indie Developer.
Building at the intersection of motion, art, and code.
Find me on twitter and all the other ones here.
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

You can write a script that directly creates a new auto-playlist in the database (without using special SDB methods). I think MM should see it when you refresh the playlist node (I'm not sure though).
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

SDBTools.AlbumByName is not really as useful as I would find AlbumById. I often find that I have the album Id, but have to use Query Songs to get a song with that album id and then use that song to get the SDBAlbum object. This is a rather long process! :)
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.
DaledeSilva
Posts: 906
Joined: Sun May 28, 2006 4:22 am
Location: Australia
Contact:

Post by DaledeSilva »

Steegy, what command should I be looking for?

all I could find in the database was a property that would let me identify a playlist as auto or normal...but nothing to create an autoplaylist.

thanks,
Dale.
Product Designer & Indie Developer.
Building at the intersection of motion, art, and code.
Find me on twitter and all the other ones here.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

In the Playlists table:

isAutoPlaylist should be 1
QueryData should contain the criteria.

If you set a few up first when you look at the database you'll get an idea of how the criteria should be saved.
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.
DaledeSilva
Posts: 906
Joined: Sun May 28, 2006 4:22 am
Location: Australia
Contact:

Post by DaledeSilva »

thanks.. I'l give that a go
Product Designer & Indie Developer.
Building at the intersection of motion, art, and code.
Find me on twitter and all the other ones here.
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

I don't know if this is a bug or not, but it certainly relates to scripting behaviour:
Some external ActiveX controls can't be positioned when their container is (still) invisible.

Case:
- For my LibraryPanes (auto)script, I use 3 external ActiveX listviews. The currently posted script (in the scripts forum) works well in 95% of all cases: when MM (and the script) has started up, the controls are placed as mentioned in the code (e.g. lvArtists.Common.Top).
- I want to use a newer version of the external listviews, but the problem is that these aren't correctly positioned when the script starts, even though the rest of the code (e.g. lvArtists.Common.Top) stays the same. Assigning the Common.XXXXX (XXXXX = Top or Left) values doesn't seem to have any effect. I can only position the controls after the OnStartup subroutine has completed (and MM and the panel are completely visible).
I'm not sure if the problem is only with the Top and Left properties. But these are certainly the most noticable things.

So this is my conclusion:
Some ActiveX external controls can't be correctly positioned while their container isn't visible yet.
- A manual script allows correct positioning: after the panel/form has been made visible
- An autoscript allows correct positioning: after the complete application is visible (and so also the panel/form)
(If these conditions are met, the controls can be positioned while they're Visible=False, so that's not the problem)

(I can send code of the "new" LibraryPanes version, but it's quite long code and I should probably cut it down a bit, t make it easily readable.)
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

In future, will the SDBSongData.UpdateDB method trigger the OnTrackProperties event?
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.
abrazor
Posts: 263
Joined: Sat Jan 08, 2005 10:13 pm
Location: Japan
Contact:

virtual sync device

Post by abrazor »

I would like a virtual device (basically a folder on the PC) which will appear in the pull down sync device menu to which I can sync automatically playlists of my choice. For background please see my comments in the main scripts forum.
Image
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

Something that's really missing for the SpinEdit control is an "OnChanged" event. Can this be added please?

Also an Editable (boolean) for the Edit control would be very useful.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Billlllllly

Post by Billlllllly »

I think it would be great to extract an Artist List -- one artist per line -- for use on websites and such.
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Post by MoDementia »

1. ReverseParseText Please

All this from BrowsebyArt e.g.

Code: Select all

Function gettrack(itm,pos,mode)
  Dim track : track = CStr(itm.TrackOrder)
  Do While Len(track)<2
    track = "0"&track
  Loop
  Dim title : title = SDB.toAscii(itm.Title)
  Dim artist : artist = SDB.toAscii(itm.ArtistName)
  Dim album : album = SDB.toAscii(itm.AlbumName)
  Dim albumartist : albumartist = SDB.toAscii(itm.AlbumArtistName)
  Dim genre : genre = SDB.toAscii(itm.Genre)
  Dim theyear : theyear = itm.Year
  Dim bitrate : bitrate = Int(itm.Bitrate/1000)&"kbps"
  Dim bpm : bpm = itm.BPM
  Dim composer : composer = SDB.toAscii(itm.Author)
  Dim cust1 : cust1 = SDB.toAscii(itm.Custom1)
  Dim cust2 : cust2 = SDB.toAscii(itm.Custom2)
  Dim cust3 : cust3 = SDB.toAscii(itm.Custom3)
  Dim path : path = itm.Path
  Dim length : length = gettime(itm.SongLength/1000)
  Dim rating : rating = itm.Rating
  Dim stars : stars = getstars2(itm.ID,"t",rating)
  If rating < 0 Then 
    rating = 0
  Else
    rating = rating / 20
    If Not rating = Int(rating) Then
      rating = FormatNumber(rating,1)
    End If
  End If
  
  TrackMask = SDB.IniFile.StringValue("BrowseByArt","TrackMask")
  gettrack = TrackMask
  gettrack = Replace(gettrack,"<Track#>",track)
  gettrack = Replace(gettrack,"<Artist>",artist)
  gettrack = Replace(gettrack,"<Title>",title)
  gettrack = Replace(gettrack,"<Album>",album)
  gettrack = Replace(gettrack,"<Album Artist>",albumartist)
  gettrack = Replace(gettrack,"<Genre>",genre)
  gettrack = Replace(gettrack,"<Year>",theyear)
  gettrack = Replace(gettrack,"<Bitrate>",bitrate)
  gettrack = Replace(gettrack,"<BPM>",bpm)
  gettrack = Replace(gettrack,"<Composer>",composer)
  gettrack = Replace(gettrack,"<Custom 1>",cust1)
  gettrack = Replace(gettrack,"<Custom 2>",cust2)
  gettrack = Replace(gettrack,"<Custom 3>",cust3)
  gettrack = Replace(gettrack,"<Filename>",path)
  gettrack = Replace(gettrack,"<Length>",length)
  gettrack = Replace(gettrack,"<Rating>",rating)
  gettrack = Replace(gettrack,"<Stars>",stars)
Replaced by

Code: Select all

ReverseParseText(gettrack, UFText2Mask(TrackMask))
Yes I know the masks don't have all the fields (and I don't want to inflate the list) but there are enough to make decent webpage listings/titles etc

2. WebControl = default browser

3. Send commands to MM plugins
With the abiltiy to embed plugins in dockable panels some control over them via scripts would be great.

I don't know what the correct syntax might be but this is my example

Code: Select all

OnPlay LaunchSongTitleAnimation

Function LaunchSongTitleAnimation
   WScript.Shell.SendKeys(T) to Plugin_vis.milk  
Function End
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Post by MoDementia »

Forgot

3a. IsRunningScript("AutoRateSongs.vbs") and IsRunningPlugin("vis.milk")
Some scripts interfere with others in certain tasks so you need to know if they are active or not to code alternatives e.g. for pausing them etc
[Edit]
and/or ActiveScripts(arrActiveScripts)
results in
arrActiveScripts(0) = "AutoRateSongs.vbs"
arrActiveScripts(1) = "BrowseByArt.vbs"
etc for all active scripts
[/Edit]

So the above example would look like this

Code: Select all

OnPlay LaunchSongTitleAnimation

Function LaunchSongTitleAnimation
 If IsRunningPlugin("vis.milk") Then
   WScript.Shell.SendKeys("T") to Plugin_vis.milk 
 End If
Function End
Post Reply