Help for an easy script

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey for Windows 4.

Moderators: Gurus, Addon Administrators

Protostomien

Help for an easy script

Post by Protostomien »

Hi everyone,

As I don’t know how to code a script for media monkey, so I was wondering if someone can help me to code this (the script will be executed with a global short cut):
1) Rate the current playing song as 1 star
2) Jump to next song
3) Advance to 1min

I guess it's something very simple for somebody who knows how to code, but honestly, I don’t have free time to learn it (beside the code, how to build the file etc). So, if one of you can help me on that, thank you very much :o)

Have a nice day.
Scottes
Posts: 150
Joined: Sat Mar 21, 2009 6:51 am

Re: Help for an easy script

Post by Scottes »

You can do this, or come close, with Hotkeys. Though it will take 3 keypresses instead of 1 click.

Tools... Options... General... Hotkeys
(Bottom Right)
Edit Hotkey - Rating Now Playing file: Rate 1 Stars
Click inside the Hotkey box and press something, like Ctrl-Alt-NumPad 1
Click the Global box

Next setup something, like Ctrl-Alt-NumPad * - for Playback: Next File

And another key (Ctrl-Alt-Right Arrow maybe) for Playback: Skip 5 Seconds Forward
Sadly there's no Skip 1 Minute. Sigh. So you'll have to tap that key several times.

Suggestions: Also setup keys for 2 Stars, 3 Stars, etc.
And More keys for Rating down 1 star, up 1 star.

If you make these all Global, they'll work almost always regardless of what program you're running. I've found that a few programs, like Microsoft Word, trap some of them so they might not all work when you're in Word or Excel or one of those programs that trap the keys.

Now, go about your day, and use your computer as normal, with MediaMonkey playing in the background. Tap those keys as you notice the songs being good or great or terrible.


This is the process I've been using for years. I find it easier because I'm not spending time just concentrating on MM and the songs. I get to do everything I would normally do, but with the added benefit of rating new music with an occasional extra keypress.

I have to admit that I will often "miss" a song and fail to rate it. Thus I figure that it's neither great nor terrible, so I will usually go back to MM and re-listen to those tracks, skipping around on the playback bar rather than tapping the "forward 5 seconds" button.

But sometimes I rate them as 3 stars and then use an Autoplaylist set to all 3-star songs, and go about listening to those songs a second time while using my computer as normal. This is where the +1 and -1 rating keys come in handy, marking songs as slightly better or slightly worse.
Protostomien

Re: Help for an easy script

Post by Protostomien »

Thx for your answer Scottes,

I agree with you for most of the stuff (and yes, the issues with some of the global short-cuts and MS Office is so painful).
I also agree that it's possible to use multiple short-cuts, without script. But I feel sad do no get perfectly the function just because I don't use the good tool (ie a simple script). :roll:
In my case, I've got a large folder containing 50% rubbish sounds, 50% "nice" song. I don't want to have to think about the sequence of short-cuts, or even the notation. I just want that, when I pass a sound with the short-cut, I get a mark on the pass sound in order to get rid of it later with others tools.

Furthermore, I would like to see what look likes such a script, to know if in future I should try to learn how to do similar stuff (or if it's to complicated as it seems when I'm looking other script).

But again, thank you for your answer,

Protostomien
rivorson
Posts: 594
Joined: Thu Jul 25, 2013 4:17 am

Re: Help for an easy script

Post by rivorson »

This script took 15 minutes to write and should do what you need, but you'll need to install it manually. I wholly recommend learning scripting so that you can do things like this.

Create a new text file in Notepad or your favourite text editor. Copy and paste the code block below into it.

Code: Select all

Sub RateAndSkip()
	SDB.Player.CurrentSong.Rating = 20 'set current track's rating to 1 star
	SDB.Player.CurrentSongList.UpdateAll 'write the rating to the library and to the file depending on MM settings
	SDB.Player.Next 'skip to the next track
	
	If SDB.Player.CurrentSongLength < 90000 Then
		'if the new track is less than 90 seconds long then don't bother trying to skip to the one minute mark
		Exit Sub
	End If
	
	While SDB.Player.IsStartingPlayback 'wait for the player to successfully start playback by running this loop. Otherwise track seeking will have no effect.
		SDB.ProcessMessages 'allows MM to continue working while this script waits
	WEnd
	
	If SDB.Player.IsPlaying Then 'only seek to one minute if a track is actually playing
		SDB.Player.PlaybackTime = 60000 'skip to one minute into the track
	End If
End Sub
Save this as RateAndSkip.vbs in the following folder:
Windows 7 or later: C:\Users\[username]\AppData\Roaming\MediaMonkey\Scripts\
Windows XP: C:\Documents and Settings\[username]\Application Data\MediaMonkey\Scripts\


Now open the file called Scripts.ini in the same folder and add this block to the top:

Code: Select all

[RateAndSkip]
Filename=RateAndSkip.vbs
Procname=RateAndSkip
Order=99
DisplayName=RateAndSkip
Description=Rates the current track one star and skips to the next track.
Language=VBScript
ScriptType=0

The script will be available next time you open MM.

To assign a hotkey:
1. Go to Tools --> Options --> General --> Hotkeys
2. Select <New Hotkey...> at the top of the list.
3. Below the existing hotkey list, select the action 'General: Execute Script: RateAndSkip' from the drop down menu. It will be near the bottom of the drop down list.
4. Click on the text box below the drop down list and type the hotkey you would like to use. Also check the Global box.
5. Click Apply then OK.
Post Reply