Shuffle & next track - what's the story?

Any ideas about how to improve MediaMonkey for Windows 4? Let us know!

Moderator: Gurus

jkforde
Posts: 33
Joined: Tue Mar 11, 2008 7:02 pm
Location: Galway, Ireland

Shuffle & next track - what's the story?

Post by jkforde »

hi, any way to get MM to play a track via 'play next' even when shuffle is on. i know about the randomise list workaround etc - just want to choose a track to play next but still maintain a shuffle for the rest of the tracks...and any way to get 'play next' in the now playing list content menu??
nohitter151
Posts: 23640
Joined: Wed Aug 09, 2006 10:20 am
Location: NJ, USA
Contact:

Re: Shuffle & next track - what's the story?

Post by nohitter151 »

I guess you already know the story that its not possible and that's why you posted to the wishlist.
MediaMonkey user since 2006
Need help? Got a suggestion? Can't find something?

Please no PMs in reply to a post. Just reply in the thread.
raybeau528
Posts: 401
Joined: Thu Sep 27, 2007 4:19 pm
Location: Connecticut

Re: Shuffle & next track - what's the story?

Post by raybeau528 »

@jkforde - I think this little script might do what you're looking for. Extract and copy to scripts\auto\playnext.vbs.
Let me know if it works for you and if so I'll make an install package for it.

To use, right click on a track in the track list window and select Play Next! It will place the selected track after the current playing track in now playing. If shuffle is on it will temporarily turn it off. When the next track (the one you clicked on to play next) starts playing it will turn shuffle back on.

Edit: Addressed the second part of your request to set the Next track in the now playing window (assuming I understood correctly). When you select a track in the Now Playing window and right-click on Play Next!, that track will be played next regardless if Shuffle is on or off. If it's on, it will turn it off temporarily and turn it back on when the next track starts playing.

Edit: Update addresses a couple issues with shuffle state changes.


Ray

Code: Select all

    '
    ' MediaMonkey Script
    '
    ' NAME:  PlayNext
    '
    '
    ' [PlayNext]
    ' FileName=PlayNext.vbs
    ' ProcName=PlayNext
    ' Order=210
    ' DisplayName=Play Next!
    ' Description=Play Next 
    ' Language=VBScript
    ' ScriptType=0
    '
    '

Option Explicit

Sub OnStartup   'Create PlayNext Menu Item

    Dim itm1

    Set itm1 = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_TrackList,0,0)
    itm1.Caption = "Play Next!"
    itm1.UseScript = Script.ScriptPath
    itm1.IconIndex = 18
    itm1.Visible = True
	Script.RegisterEvent itm1, "OnClick","Event_TrackListPlayNext"
  
    Set itm1 = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_NP,0,0)
    itm1.Caption = "Play Next!"
    itm1.UseScript = Script.ScriptPath
    itm1.IconIndex = 18
    itm1.Visible = True
	Script.RegisterEvent itm1, "OnClick","Event_NowPlayingPlayNext"
	
	SDB.IniFile.BoolValue("PlayNext","ShuffleState") = SDB.Player.isShuffle
	'Script.RegisterEvent SDB, "OnShuffleClicked", "Event_ShuffleClicked"
	
End Sub 'OnStartup

Sub Event_TrackListPlayNext( arg )

	Dim i
	Script.UnRegisterEvents SDB
	Script.RegisterEvent SDB, "OnShuffleClicked", "Event_ShuffleClicked"
	
	If SDB.Player.isShuffle Then
		SDB.IniFile.BoolValue("PlayNext","ShuffleState") = True
		SDB.IniFile.BoolValue("PlayNext","ShuffleClicked") = True
		SDB.Player.isShuffle = False
	End If
	
	Dim otrack : Set oTrack = SDB.CurrentSongList.Item(0)
	Dim oPlayerTracks : Set oPlayerTracks = SDB.Player.CurrentSongList
	Dim oRemainderTracks : Set oRemainderTracks = SDB.NewSongList
	
	SDB.IniFile.IntValue("PlayNext","NextTrack") = SDB.Player.CurrentSongIndex +1
	For i = SDB.Player.CurrentSongIndex +1 to oPlayerTracks.Count-1
		oRemainderTracks.Add ( oPlayerTracks.Item(i) )
		SDB.Player.PlayListDelete(SDB.Player.CurrentSongIndex +1)
	Next
	
	SDB.Player.PlayListAddTrack( oTrack )
	SDB.Player.PlayListAddTracks( oRemainderTracks )

	Script.RegisterEvent SDB, "OnPlayBackEnd","Event_OnPlayBackEnd"

End Sub

Sub Event_NowPlayingPlayNext( arg )

	Dim i
	Script.UnRegisterEvents SDB
	Script.RegisterEvent SDB, "OnShuffleClicked", "Event_ShuffleClicked"
	
	If SDB.Player.isShuffle Then
		SDB.IniFile.BoolValue("PlayNext","ShuffleState") = True
		SDB.IniFile.BoolValue("PlayNext","ShuffleClicked") = True
		SDB.Player.isShuffle = False
	End If
	
	Dim otrack : Set oTrack = SDB.CurrentSongList.Item(0)
	Dim oPlayerTracks : Set oPlayerTracks = SDB.Player.CurrentSongList

	For i = 0 to oPlayerTracks.Count -1
		If oPlayerTracks.Item(i).ID = oTrack.ID Then
			Exit For
		End IF
	Next
	SDB.IniFile.IntValue("PlayNext","NextTrack") = i
	Script.RegisterEvent SDB, "OnPlayBackEnd","Event_OnPlayBackEnd"

End Sub

Sub Event_OnPlayBackEnd()

	Script.UnRegisterEvents SDB
	Script.RegisterEvent SDB, "OnShuffleClicked", "Event_ShuffleClicked"
	
	SDB.Player.STop
	Script.RegisterEvent SDB, "OnPlay","Event_Play"
	SDB.Player.Play

End Sub

Sub Event_Play()

	Script.UnRegisterEvents SDB
	Script.RegisterEvent SDB, "OnShuffleClicked", "Event_ShuffleClicked"
	
	SDB.Player.CurrentSongIndex = SDB.IniFile.IntValue("PlayNext","NextTrack")
	SDB.IniFile.BoolValue("PlayNext","ShuffleClicked") = True
	SDB.Player.isShuffle = SDB.IniFile.BoolValue("PlayNext","ShuffleState")
	
End Sub

Sub Event_ShuffleClicked()

	If Not SDB.IniFile.BoolValue("PlayNext","ShuffleClicked") Then
		SDB.IniFile.BoolValue("PlayNext","ShuffleState") = SDB.Player.isShuffle ' User clicked
	Else
		SDB.IniFile.BoolValue("PlayNext","ShuffleClicked") = False ' Expected
	End If
	
End Sub
raybeau528
Posts: 401
Joined: Thu Sep 27, 2007 4:19 pm
Location: Connecticut

Re: Shuffle & next track - what's the story?

Post by raybeau528 »

A supported installation package is available here: http://www.mediamonkey.com/forum/viewto ... =2&t=38616
jkforde
Posts: 33
Joined: Tue Mar 11, 2008 7:02 pm
Location: Galway, Ireland

Re: Shuffle & next track - what's the story?

Post by jkforde »

thanks Ray for the script. I've tried it using MM 3.0.7.1191: shuffle on, continuous on

in the Now Playing track list window it does not appear in the track context menu on right-click

in the Library window it does appear in the track context menu, does skip to the next track but does not turn shuffle back on after running (the selected next track does play)
nohitter151
Posts: 23640
Joined: Wed Aug 09, 2006 10:20 am
Location: NJ, USA
Contact:

Re: Shuffle & next track - what's the story?

Post by nohitter151 »

jkforde wrote:thanks Ray for the script. I've tried it using MM 3.0.7.1191: shuffle on, continuous on

in the Now Playing track list window it does not appear in the track context menu on right-click

in the Library window it does appear in the track context menu, does skip to the next track but does not turn shuffle back on after running (the selected next track does play)
From Ray's first post in the script thread:
Note that V3.1 (currently in beta) is required as it uses OnShuffleClicked and OnPlayBackEnd events which were introduced in 3.1.
MediaMonkey user since 2006
Need help? Got a suggestion? Can't find something?

Please no PMs in reply to a post. Just reply in the thread.
jkforde
Posts: 33
Joined: Tue Mar 11, 2008 7:02 pm
Location: Galway, Ireland

Re: Shuffle & next track - what's the story?

Post by jkforde »

@nohitter, thanks, missed that little detail. will try with 3.1beta :roll:
jkforde
Posts: 33
Joined: Tue Mar 11, 2008 7:02 pm
Location: Galway, Ireland

Re: Shuffle & next track - what's the story?

Post by jkforde »

followup: i installed 3.1.0_1232 beta and still have the same issues as I outlined above...
nohitter151
Posts: 23640
Joined: Wed Aug 09, 2006 10:20 am
Location: NJ, USA
Contact:

Re: Shuffle & next track - what's the story?

Post by nohitter151 »

jkforde wrote:followup: i installed 3.1.0_1232 beta and still have the same issues as I outlined above...
1. Might be best to post that info at the script's official thread: http://www.mediamonkey.com/forum/viewto ... =2&t=38616
2. Why did you install 1232? (1236 is the latest available build)
MediaMonkey user since 2006
Need help? Got a suggestion? Can't find something?

Please no PMs in reply to a post. Just reply in the thread.
jkforde
Posts: 33
Joined: Tue Mar 11, 2008 7:02 pm
Location: Galway, Ireland

Re: Shuffle & next track - what's the story?

Post by jkforde »

ok, got the 1236 version... now the PlayNext! option does appears in the NowPlaying context menu so that's fine but the shuffle doesn't turn back on after choosing a track... so will post this remaining issue to the thread you suggested

update: OK, now working with MM 3.1.0_1236! ... thanks very much Ray for this! together with DreadM's NoirBlue skin (esp. the MiniPlayer skin) my MM is perfect... thanks nohitter for staying with me!
Post Reply