Automatically doing stuff on new track adds

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: Automatically doing stuff on new track adds

by DiddeLeeDoo » Mon Oct 30, 2006 12:23 am

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.

by trixmoto » Fri Oct 27, 2006 3:48 am

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:

by Teknojnky » Thu Oct 26, 2006 12:50 pm

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.

by trixmoto » Thu Oct 26, 2006 11:02 am

You can't trigger the volume analysis from a script, sorry.

Automatically doing stuff on new track adds

by Teknojnky » Thu Oct 26, 2006 10:38 am

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?

Top