Enqueue Albums 1.3 - Updated 01/05/2010

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

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

Enqueue Albums 1.3 - Updated 01/05/2010

Post by trixmoto » Tue Jun 05, 2007 10:32 am

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

MarineBrat
Posts: 489
Joined: Tue Jun 14, 2005 12:12 am
Location: Loony left coast, USA.

Post by MarineBrat » Tue Jun 05, 2007 11:26 am

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 » Wed Jun 06, 2007 1:21 am

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 » Fri Jun 08, 2007 7:03 am

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: Barton, UK
Contact:

Post by trixmoto » Fri Jun 08, 2007 8:11 am

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

powerpill-pacman
Posts: 154
Joined: Mon Feb 21, 2005 1:07 pm
Location: berlin, germany
Contact:

Post by powerpill-pacman » Fri Jun 08, 2007 8:55 am

Sounds good! :P

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

Post by trixmoto » Fri Jun 08, 2007 9:12 am

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

powerpill-pacman
Posts: 154
Joined: Mon Feb 21, 2005 1:07 pm
Location: berlin, germany
Contact:

Post by powerpill-pacman » Fri Jun 08, 2007 9:32 am

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: Barton, UK
Contact:

Post by trixmoto » Fri Jun 08, 2007 5:19 pm

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

powerpill-pacman
Posts: 154
Joined: Mon Feb 21, 2005 1:07 pm
Location: berlin, germany
Contact:

Post by powerpill-pacman » Sat Jun 09, 2007 12:41 pm

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 » Mon Jun 29, 2009 1:04 am

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: Barton, UK
Contact:

Re: Enqueue Albums 1.1 [MM2+3]

Post by trixmoto » Mon Jun 29, 2009 3:42 am

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

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

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

Post by trixmoto » Sun Jan 10, 2010 1:57 pm

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

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 » Thu Jan 14, 2010 1:11 pm

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: Barton, UK
Contact:

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

Post by trixmoto » Thu Jan 14, 2010 1:38 pm

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

Post Reply