Play songs by hotkey based on Genre, Playlist, Mood, Tempo..

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Steegy

Play songs by hotkey based on Genre, Playlist, Mood, Tempo..

Post by Steegy » Fri Nov 04, 2005 9:39 am

Hello

Here's a simple script (the first vbs that I made) that adds hotkeys to MediaMonkey so you can let it play songs based on Genre, Playlist, Mood, ... very easily.

You can download it from http://home.tiscali.be/ruben.castelein/ ... s_v1.0.vbs

Just put it in the MediaMonkey\Scripts\Auto folder and (re)start MM.

Code: Select all

'========================================================================== 
' 
' MediaMonkey Script 
' 
' NAME: Play Hotkeys v1.0 
' DESCRIPTION:
'  Predefines shortcuts to start playing songs of a specific Genre, from a
'  specific Playlist, or with specific Song Information (Tempo, Mood, Quality, ...)
' 
' AUTHOR: Steegy aka RC
' DATE  : 19.10.2005 
' 
' NOTE: Idea taken from Pekes "Predefined Genre Script v1.0" 
' 
' INSTALL: 
' - If wanted, change defaults in the "Variable Configuration" section of this file
' - Copy script to MM directory scripts\auto 
' 
' USE: 
' - Press key CTRL 0 ...5 (default) to start playing the wanted genre/playlist/...
' 
'========================================================================== 
'========================================================================== 
' Variable Definition (Do Not Change) 
'========================================================================== 

Dim EGenre
Dim Counter

'========================================================================== 
' Variable Configuration (EDIT HERE IF YOU WANT)
'========================================================================== 

'The code has some "sharp edges" (it's messy sometimes, especcially variable names), I'm sorry for that.

Sub AddItemsToMenu

'Change genres According to your needs
'(The number is the IconIndex value)
' Playlist    17 <= OK		==> Playlists
' "Notes"     14 <= OK		==> Song Information (Tempo, Mood, Quality, ...)
' Genre       58 <= OK		==> Genres
' Artist      60
' Rating star 64
'(The Y/N means Yes or No and sets the use of Shift, Crtl, Alt in the HotKey)

  AddItemToMenu("58|NYN|Trance")
  AddItemToMenu("58|NYN|Dance")
  AddItemToMenu("58|NYN|Rock")
  AddItemToMenu("58|NYN|Pop")
  AddItemToMenu("58|NYN|Disco")
  AddItemToMenu("14|NYN|Party")
  AddItemToMenu("14|NYN|Rustig en Traag")
  AddItemToMenu("17|NYN|Zachte Trance")

End Sub

'========================================================================== 
' MediaMonkey On Start Procedure 
'========================================================================== 

Sub OnStartup 
  
Counter = 0

  SDB.UI.AddMenuItemSep SDB.UI.Menu_Edit,0,0

  Set EGenre = SDB.UI.addMenuItemSub(SDB.UI.Menu_Edit,0,0) 
  EGenre.caption = "Play Hotkeys" 
  EGenre.IconIndex = 58 
  EGenre.useScript = Script.ScriptPath 
  
  AddItemsToMenu

End Sub 


Sub AddItemToMenu(Str_Item)
  Counter = Counter + 1

  Dim GenreA 
  Set GenreA = SDB.UI.AddMenuItem(EGenre,0,0) 
  GenreA.Caption = Right(Str_Item,Len(Str_Item)-7)
  GenreA.OnClickFunc = "PlayCategory" 
  GenreA.UseScript = Script.ScriptPath 
  GenreA.IconIndex = Left(Str_Item,2)
  GenreA.ShortCut = ShortCut(Str_Item)&Counter

End Sub


Function ShortCut(Caption)

  ShortCut = "" 
  If Mid(Caption,4,1)="Y" Then 
     ShortCut = ShortCut&"Shift+" 
  End if 
  If Mid(Caption,5,1)="Y" Then 
     ShortCut = ShortCut&"Ctrl+" 
  End if 
  If Mid(Caption,6,1)="Y" Then 
     ShortCut = ShortCut&"Alt+" 
  End if 

End Function



Sub PlayCategory(Item) 
  SDB.Player.PlaylistClear

  Select Case Item.IconIndex
    Case 58:
      PlayGenre(Item.Caption)
    Case 14:
      PlayInfoInt(Item.Caption)
    Case 17:
      PlayPlaylist(Item.Caption)
    Case Else:
      SDB.MessageBox "PlayHotkeys: The specified playlist doesn't exist!", mtError, Array(mbOk)
  End Select

  SDB.Player.Next
  SDB.Player.Play
End Sub


'========================================================================== 
' Adding the specified category to the Now Playing playlist 
'========================================================================== 


Sub PlayInfoInt(Name)

   Dim MyInfoNumber
   Set MyInfoNumber = SDB.Database.OpenSQL("SELECT Lists.ID FROM Lists WHERE TextData = '" & Name & "'")
   If Not MyInfoNumber.EOF Then
     Dim MySongNumber
     Set MySongNumber = SDB.Database.OpenSQL("SELECT AddSongInfoInt.IDSong FROM AddSongInfoInt WHERE AddSongInfoInt.IntData = " & MyInfoNumber.StringByIndex(0))
     While Not MySongNumber.EOF
       SDB.Player.PlaylistAddTrack(SDB.Database.QuerySongs("AND Songs.ID = " & MySongNumber.StringByIndex(0)).Item)
       MySongNumber.Next
     WEnd
   Else
     SDB.MessageBox "PlayHotkeys: The specified song information doesn't exist!", mtError, Array(mbOk)
   End If

End Sub


Sub PlayPlaylist(Playlist)

   Dim MyPlaylist
   Set MyPlaylist = SDB.PlaylistByTitle(Playlist)
   If Not MyPlaylist.Title = "" Then
     SDB.Player.PlaylistAddTracks(MyPlaylist.Tracks)
   Else
     SDB.MessageBox "PlayHotkeys: The specified playlist doesn't exist!", mtError, Array(mbOk)
   End If

End Sub


Sub PlayGenre(Genre) 

  Dim MyGenreNumber
  Set MyGenreNumber = SDB.Database.OpenSQL("SELECT Genres.IDGenre FROM Genres WHERE Genres.GenreName = '" & Genre & "'")

  If Not MyGenreNumber.EOF Then
    MyGenreNumber = MyGenreNumber.StringByIndex(0)
  
    Dim MyTrack
    Set MyTrack = SDB.Database.QuerySongs("AND Songs.Genre = " & MyGenreNumber)
    While Not MyTrack.EOF
      SDB.Player.PlaylistAddTrack(MyTrack.Item)
      MyTrack.Next
    WEnd
  Else
    SDB.MessageBox "PlayHotkeys: The specified genre doesn't exist!", mtError, Array(mbOk)
  End If

End Sub 
Cheers
Steegy (aka RC)

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

Post by trixmoto » Mon Nov 07, 2005 9:28 am

Nice script, thanks! :)
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.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE

sasapuksic
Posts: 106
Joined: Tue Jan 03, 2006 11:43 am
Location: Maribor, Slovenia
Contact:

Post by sasapuksic » Sat Jul 15, 2006 8:37 am

Just what I was looking for ...

Works like magic with autoplaylists, AtiRemote Wonder II and RWkeyfactory Plugin!! MM is everything I ever wanted!! Thanks guys!!

:D

salamat
Posts: 23
Joined: Sun Aug 20, 2006 3:32 am
Location: Philippines

Post by salamat » Thu Sep 21, 2006 12:48 am

Great script! But how can I change the genre to the one I use to play, like Jazz, progrock a.s.o.?

Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium
Contact:

Post by Steegy » Thu Sep 21, 2006 5:08 am

Hello

To change the genre Trance to Jazz, change

Code: Select all

AddItemToMenu("58|NYN|Trance")
to

Code: Select all

AddItemToMenu("58|NYN|Jazz")
These entries are "genres" because the number is 58 (genre).

I definately chould make this script easier to configure.

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).

tableguy
Posts: 109
Joined: Thu Jun 30, 2005 3:15 pm

Nice script..

Post by tableguy » Wed Jan 03, 2007 9:49 pm

any way to add more HotKeys and Styles (sub-grene)?



Thankx

nioflaz

Re: Play songs by hotkey based on Genre, Playlist, Mood, Tempo..

Post by nioflaz » Mon May 31, 2010 4:12 pm

Can someone explain this more to me as it might be exactly what i'm looking for. Basically for my A2 project I want to make a stereo that plays songs of a certain genre after selecting that genre on a control panel I'll make so you don't have to use the iPod after plugging it in. Will this program do exactly that? And, if you can suggest, how could I use this like would I download it to something? Thanks

BerniPi
Posts: 34
Joined: Sun Oct 29, 2006 7:30 pm
Location: Sulz VORARLBERG
Contact:

Re: Play songs by hotkey based on Genre, Playlist, Mood, Tem

Post by BerniPi » Sat Nov 26, 2011 4:28 am

Hi,

does this script work with MM3 or MM4? I would like to start Playlists with Hotkeys. The Script generates the menu and i can start a Playlist with the menu, but the hotkey Ctrl+0 doesn't work. Are there other scripts with this functionality or is it integrated in MM4?

Thanks,
Berni
Image

Post Reply