Automatically doing stuff on new track adds

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

Moderators: Peke, Gurus

Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Automatically doing stuff on new track adds

Post by Teknojnky »

Using trixmoto's example:

Code: Select all

Sub onStartup 
  Script.RegisterEvent SDB, "OnTrackAdded", "AddPodcast" 
End Sub 

Sub AddPodcast(track) 
  If UCase(track.Genre) = "PODCAST" Then 
    track.ArtistName = track.Genre 
    track.AlbumArtistName = track.Genre 
    track.UpdateArtist 
    track.UpdateAlbum 
    track.UpdateDB 
  End If 
End Sub

I'd like to perform the following things automatically if not already set..

- volume analysis
- set rating to 2.5 stars
- clear genre or set to a user specified genre (ie _NewFiles_)

Now setting the rating doesn't seem too difficult, however I'm sure how (or if its possible) to programatically run volume analysis.

Further, when adding multiple tracks, I don't want to have a bunch of separate threads running one for each track added, having them queued together in the same manner as selecting an album and running the analysis normally sequentially in a single thread.

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

Post by trixmoto »

You can't trigger the volume analysis from a script, sorry.
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.
Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Post by Teknojnky »

Ok well I thought I knew how to do this, but it doesn't seem to be working..

Code: Select all

Sub onStartup 
  Script.RegisterEvent SDB, "OnTrackAdded", "TrackAddExec" 
End Sub 

Sub TrackAddExec(track) 

  If track.Rating < 0 Then
    track.Rating = 2.5
  End If

  If track.Genre = "" Then
    track.Genre = "_NewFiles_"
  End If

  track.UpdateDB

End Sub
I am using an existing file, using copy/paste the file (so it makes 'copy of test file.mp3') within a watched folder.

MM detects the new file but the code above doesnt seem to do anything.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

The rating is the value between 0 and 100 so 2.5 is 0 stars! Try setting the rating to 50 (which is 2.5 stars).

This code looks like it should be working to me, as long as the script is in your auto folder and you've restarted MM.

:oops: TYPO CORRECTED! :oops:
Last edited by trixmoto on Mon Oct 30, 2006 6:35 am, edited 1 time in total.
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.
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

Guess you've figured out that 2.5 star is actually 50

Currently I run Volume Analyzing automatically by using mp3gain, that also add Album Analyzing. This however, requires replay gain enabled in_plug-ins, which is something that I'm OK with.
Image
Post Reply