Enqueue Albums 1.3 - Updated 01/05/2010

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

Moderators: Peke, Gurus

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

Enqueue Albums 1.3 - Updated 01/05/2010

Post by trixmoto »

This script was requested here. It loops through the selected tracks, adding all the tracks in the album of each one to the end of the Now Playing list. An option appears in the context menu (tracklist and now playing) to trigger this script.

Code: Select all

'
' MediaMonkey Script
'
' NAME: EnqueueAlbums 1.3
'
' AUTHOR: trixmoto (http://trixmoto.net)
' DATE : 01/05/2010
'
' Thanks to Steegy for the SkinnedInputBox
'
' INSTALL: Copy to Scripts\Auto directory
'
' FIXES: Fixed tracks not being added in correct order 
'

Option Explicit

Dim Playlists : Playlists = False
Dim PlayNext : PlayNext = False

Sub onStartUp
  Dim itm : Set itm = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_NP,1,1)
  itm.Caption = "Enqueue Albums"
  itm.OnClickFunc = "ItmClick"
  itm.UseScript = Script.ScriptPath
  itm.IconIndex = 56
  Set SDB.Objects("EnqueueAlbumsMenu1") = itm
  Set itm = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_TrackList,1,1)
  itm.Caption = "Enqueue Albums"
  itm.OnClickFunc = "ItmClick"
  itm.UseScript = Script.ScriptPath
  itm.IconIndex = 56  
  Set SDB.Objects("EnqueueAlbumsMenu2") = itm
End Sub

Sub ItmClick(itm)
  Dim list : Set list = SDB.SelectedSongList.Albums
  If list.Count > 0 Then
    Dim p : Set p = Nothing
    If Playlists Then
      Dim n : n = SkinnedInputBox("Please enter unique playlist name:","EnqueueAlbums","","EnqueueAlbumsPosition")
      If Not (n = "") Then
        Set p = SDB.PlaylistByTitle("").CreateChildPlaylist(n)
      End If
    End If
    Dim i : i = 0    
    Dim k : k = SDB.Player.CurrentSongIndex
    For i = 0 To list.Count-1
      Dim j : j = 0
      Dim sql : sql = "AND Songs.IDAlbum="&list.Item(i).ID&" ORDER BY DiscNumber COLLATE NUMERICSTRING,TrackNumber COLLATE NUMERICSTRING"        
      Dim itr : Set itr = SDB.Database.QuerySongs(sql)
      While Not itr.EOF
        j = j+1
        Dim t : Set t = itr.Item
        Call SDB.Player.PlaylistAddTrack(t)
        If PlayNext Then
          Call SDB.Player.PlaylistMoveTrack(SDB.Player.PlaylistCount-1,k+((i+1)*j))
        End If
        If Not (p Is Nothing) Then
          Call p.AddTrack(t)                
        End If            
        itr.Next
      WEnd           
    Next   
  End If
End Sub

Function SkinnedInputBox(Text, Caption, Input, PositionName)
   Dim Form, Label, Edt, btnOk, btnCancel, modalResult 

   ' Create the window to be shown 
   Set Form = SDB.UI.NewForm 
   Form.Common.SetRect 100, 100, 360, 130 
   Form.BorderStyle  = 2   ' Resizable 
   Form.FormPosition = 4   ' Screen Center 
   Form.SavePositionName = PositionName 
   Form.Caption = Caption 
      
   ' Create a button that closes the window 
   Set Label = SDB.UI.NewLabel(Form) 
   Label.Caption = Text 
   Label.Common.Left = 5 
   Label.Common.Top = 10 
     
   Set Edt = SDB.UI.NewEdit(Form) 
   Edt.Common.Left = Label.Common.Left 
   Edt.Common.Top = Label.Common.Top + Label.Common.Height + 5 
   Edt.Common.Width = Form.Common.Width - 20 
   Edt.Common.ControlName = "Edit1" 
   Edt.Common.Anchors = 1+2+4 'Left+Top+Right 
   Edt.Text = Input 
       
   ' Create a button that closes the window 
   Set BtnOk = SDB.UI.NewButton(Form) 
   BtnOk.Caption = "&OK" 
   BtnOk.Common.Top = Edt.Common.Top + Edt.Common.Height + 10 
   BtnOk.Common.Hint = "OK" 
   BtnOk.Common.Anchors = 4   ' Right 
   BtnOk.UseScript = Script.ScriptPath 
   BtnOk.Default = True
   BtnOk.ModalResult = 1 
    
   Set BtnCancel = SDB.UI.NewButton(Form) 
   BtnCancel.Caption = "&Cancel" 
   BtnCancel.Common.Left = Form.Common.Width - BtnCancel.Common.Width - 15 
   BtnOK.Common.Left = BtnCancel.Common.Left - BtnOK.Common.Width - 10 
   BtnCancel.Common.Top = BtnOK.Common.Top 
   BtnCancel.Common.Hint = "Cancel" 
   BtnCancel.Common.Anchors = 4   ' Right 
   BtnCancel.UseScript = Script.ScriptPath 
   BtnCancel.Cancel = True
   BtnCancel.ModalResult = 2 
       
   If Form.showModal = 1 Then
     SkinnedInputBox = Edt.Text
   Else
     SkinnedInputBox = ""
   End If  
End Function
Last edited by trixmoto on Fri Jun 08, 2007 9:11 am, edited 2 times 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.
MarineBrat
Posts: 490
Joined: Tue Jun 14, 2005 12:12 am
Location: Loony left coast, USA.

Post by MarineBrat »

Seems to work nicely here on MM3A4.
powerpill-pacman
Posts: 154
Joined: Mon Feb 21, 2005 1:07 pm
Location: berlin, germany
Contact:

Post by powerpill-pacman »

Works like a charm, now MM seems pretty much complete to me. Thanks very much for just another great script.
Windows 7 Ultimate (64bit) - MediaMonkey 3.2.4.1304
My music on Soundcloud
some more on Last.fm
if you really like my music...
powerpill-pacman
Posts: 154
Joined: Mon Feb 21, 2005 1:07 pm
Location: berlin, germany
Contact:

Post by powerpill-pacman »

Just one litlle wish to add: Would it be possible to create a new playlist from the enqueued albums autmatically?
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

I was about to say no, but I think I might just have worked out how to do it...
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.
powerpill-pacman
Posts: 154
Joined: Mon Feb 21, 2005 1:07 pm
Location: berlin, germany
Contact:

Post by powerpill-pacman »

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

Post by trixmoto »

New version (1.1) is now available from my website (and code updated above). I have added the option to create playlists of the enqueued tracks.
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.
powerpill-pacman
Posts: 154
Joined: Mon Feb 21, 2005 1:07 pm
Location: berlin, germany
Contact:

Post by powerpill-pacman »

You're unbelievably fast. Thanks very much. But where can i find the playlist option?
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

You have to edit the script file (look for the star (*)) by setting the "Playlists" variable to "True".
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.
powerpill-pacman
Posts: 154
Joined: Mon Feb 21, 2005 1:07 pm
Location: berlin, germany
Contact:

Post by powerpill-pacman »

Thanks for the hint. I should've read the script (shame on me).
Juraitwaluzka
Posts: 5
Joined: Thu Jul 12, 2007 8:56 pm

Re: Enqueue Albums 1.1 [MM2+3]

Post by Juraitwaluzka »

Very useful script. I was wondering how hard it would be to make it enqueue in such a way that the album plays next instead of at the end of the playlist.

An example... I have some auto playlists that generate say 2 hours of different songs. While listening I decide I want to hear the rest of the album of whatever song is playing. Now I do an 'Enqueue Albums' then manually move the tracks into place. However, it would be nice if the tracks would be inserted so that I automatically hear them next, then when the album runs out the rest of the playlist goes ahead.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: Enqueue Albums 1.1 [MM2+3]

Post by trixmoto »

It should be possible to do this, yes. I'll add it to my list.
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.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: Enqueue Albums 1.2 - Updated 10/01/2010

Post by trixmoto »

New version (1.2) is now available to download from my website. Changes include...

- Removed old MM2 code to improve performance
- Added option to play next instead of play last
- Added update server to installation package
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.
florin
Posts: 24
Joined: Sat Sep 27, 2008 5:38 pm
Location: Romania
Contact:

Re: Enqueue Albums 1.2 - Updated 10/01/2010

Post by florin »

Can you add an Enqueue Track option? It's the one option I would really like in MM.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: Enqueue Albums 1.2 - Updated 10/01/2010

Post by trixmoto »

There are buttons on the toolbar for that, "Play Next" and "Play Last".
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.
Post Reply