[Script] Clear and Queue [MM2+3] [2008.06.22]

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: [Script] Clear and Queue [MM2+3] [2008.06.22]

Re: [Script] Clear and Queue [MM2+3] [2008.06.22]

by Plotino » Tue Mar 28, 2017 6:27 am

I have the same problem, even with ClearNowPlayingButton extension

Image

Re: [Script] Clear and Queue [MM2+3] [2008.06.22]

by zephyr » Tue Nov 12, 2013 3:20 pm

Hi again, I had a look at the other script, and could see an 'install' function, adding entries to scripts.ini.

I added the following manually, enabling me to configure a hotkey via MM Options


[ClearAndQueue]
Filename=Auto\ClearAndQueue.vbs
Procname=ClearAndQueue
Order=51
DisplayName=Clear and Queue
Description=Clears now playing and enqueues selected
Language=VBScript
ScriptType=99

The existing functionality still works (via context>Clear and Queue), but when using the shortcut I've setup, I get an error:

Image
after this, the script stops working at all until MM is restarted...

Does anyone know how to successfully modify + enable hotkeys? ScriptType maybe?

Re: [Script] Clear and Queue [MM2+3] [2008.06.22]

by zephyr » Tue Nov 12, 2013 2:00 pm

Hi,

I'm trying to manage my context (and hopefully/eventually my shortcut keys) for Play options.

I wanted play last as my default, with the option to 'play now' / 'play next' available (in MM) via hotkeys.

I have a script (PlayAlbum I think) that adds entries to the hotkeys, enabling it to be configured like so

Image

Image

Can Clear and Queue be modified to enable this level of configuration (call via hotkey)?

Thanks!

Re: [Script] Clear and Queue [MM2+3] [2008.06.22]

by Guest » Sat Mar 21, 2009 9:43 pm

Thought I'd share a customization. This adds the current song list in random order (and does that quickly), and enables continuous playback. Someone could add switches to enable/disable these things. I'll do that myself if I ever find a need for disabling them.

Code: Select all

Sub ClearAndQueue(obj)

  Dim Selected
  
  Set Selected = SDB.CurrentSongList

  If Selected.Count > 0 Then
    Dim Randomized : Set Randomized = RandomizedSongList(Selected)
    SDB.Player.PlaylistClear
'     SDB.Player.PlaylistAddTrack(SDB.Player.CurrentSong)    
    SDB.Player.PlaylistAddTracks(Randomized)
    SDB.Player.isRepeat = True
    If SDB.Player.isPlaying = False Then SDB.Player.Play
  End If

End Sub

Function RandomizedSongList(f)
  Dim RndList : RndList = RandomList(f.Count)
  Dim t : Set t = SDB.NewSongList
  Dim i
  For i = 0 To f.Count - 1
	t.Add( f.Item( RndList(i) ) )
  Next
  Set RandomizedSongList = t
End Function

Function RandomList(size)
  Randomize
  ReDim list(size)
  Dim i
  For i = 0 To size - 1
    list(i) = i
  Next
  For i = 0 To size - 1
    Dim j : j = Int( (size - i + 1) * Rnd + i )
    Dim tmp : tmp = list(i)
    list(i) = list(j)
    list(j) = tmp
  Next
  RandomList = list
End Function

Re: [Script] Clear and Queue [MM2+3] [2008.06.22]

by MM3 monkey » Sun Jan 25, 2009 4:05 pm

Thanks, Nyn.

Re: [Script] Clear and Queue [MM2+3] [2008.06.22]

by nynaevelan » Sun Jan 25, 2009 2:13 pm

MM3 monkey wrote:
Also In Nyn's signature is a script "Copy 2 Playlist". A google of [[ site:mediamonkey.com/forum intitle:copy intitle:playlist ]] didn't find it. I wonder what it is?
MM3:

This is a little one that Raybeau made for me in order to copy the now playing song to a particular playlist. You can find it by scrolling in the Stations topic, I think it is on page 2 or 3. I also use Onenonymous's Right Click for Scripts script in order to add a toolbar icon for it onto the Now Playing Main window, which makes it more accessible. THis script is quite handy because it allows me to save songs that I eventually want to add to a particular playlist but at the time I am too busy to work on it.

There is also another one he created in the same forum, this one will copy the entire now playing list to a particular playlist, there is one that is manual and one that can be setup to run automatically at a certain time. I use the manual one because I was getting too many with the automated one.

Nyn

Re: [Script] Clear and Queue [MM2+3] [2008.06.22]

by onenonymous » Sun Jan 25, 2009 1:40 pm

I use the code below in my ClearNowPlayingButton.vbs script. It does slow down if there are lots of files in Now Playing- but it does do the trick to remove before and after the currently playing song without removing it. Just call ClearBeforeAfterNP(o) rather than SDB.Player.PlaylistClear.

Code: Select all

Sub ClearBeforeNP(o)
	dim iSongItem, i
	iSongItem = CInt(SDB.Player.CurrentSongIndex)
	For i = 0 To iSongItem - 1
		SDB.Player.PlaylistDelete(0)
	Next
End Sub

Sub ClearAfterNP(o)
	dim iSongItem, i
	iSongItem = CInt(SDB.Player.CurrentSongIndex) + 1
	For i = iSongItem to SDB.Player.PlaylistCount 
		SDB.Player.PlaylistDelete(iSongItem)
	Next
End Sub

Sub ClearBeforeAfterNP(o)
	Call ClearBeforeNP(o)
	Call ClearAfterNP(o)
End Sub

Re: [Script] Clear and Queue [MM2+3] [2008.06.22]

by MM3 monkey » Sat Jan 17, 2009 6:19 am

Thanks, Teknojnky. I'm just about to install it for the first time. Thanks, Nyn for putting it in your sig.

Also In Nyn's signature is a script "Copy 2 Playlist". A google of [[ site:mediamonkey.com/forum intitle:copy intitle:playlist ]] didn't find it. I wonder what it is?

Re: [Script] Clear and Queue [MM2+3] [2008.06.22]

by nynaevelan » Tue Jun 24, 2008 7:18 pm

I think I must have been using the 6/21 version because once I updated I now have the script in the menu. Thank you for your help and the script, I am really starting to enjoy the convenience of it. :P

Nyn

Re: [Script] Clear and Queue [MM2+3] [2008.06.22]

by Teknojnky » Tue Jun 24, 2008 6:50 pm

do you have the 6/21 or 6/22 version?

the version linked and posted above should have the tree menu added (wasn't in the initial)

Re: [Script] Clear and Queue [MM2+3] [2008.06.22]

by nynaevelan » Tue Jun 24, 2008 5:57 pm

It's not working for me, am I missing sometihing??

Image

Nyn

Re: [Script] Clear and Queue [MM2+3] [2008.06.22]

by Teknojnky » Tue Jun 24, 2008 5:45 pm

nynaevelan wrote:Tekno:

It's not a requirement, but is it possible for the script to be run when a playlist is selected without having to select all the tracks in the playlist?

Nyn
it should work (does for me) by simply right clicking the playlist in the tree, you don't need to have the individual files selected when using the tree context menu, all files will be added.

Re: [Script] Clear and Queue [MM2+3] [2008.06.22]

by nynaevelan » Tue Jun 24, 2008 4:43 pm

Tekno:

It's not a requirement, but is it possible for the script to be run when a playlist is selected without having to select all the tracks in the playlist?

Nyn

Re: [Script] Clear and Queue [MM2+3] [2008.06.21]

by nynaevelan » Mon Jun 23, 2008 12:02 pm

Teknojnky wrote: Also, you do know you can right click the player and go to properties to access the track properties that is playing? Perhaps not as easy as using the detail grids, but...
This method would be fine with me, as long as I still have the "easy" access to get to the file I am content. I know there are some that would suggest the keyboard shortcuts but I don't use them and it is difficult to remember what all the different options are, I have to write down the three that I do use. I am a right-clicking kind of girl. :wink:


Nyn

Re: [Script] Clear and Queue [MM2+3] [2008.06.21]

by Teknojnky » Mon Jun 23, 2008 11:50 am

@ squishy, I have added the tree menu's, I missed those the first time.

@ nyn, I tried the below but it did not work as expected so I had removed it from the initial release. What happens is that current song is essentially removed from the list and then added back which ends up causing it to play twice.

Code: Select all

  If Selected.Count > 0 Then
    SDB.Player.PlaylistClear
    SDB.Player.PlaylistAddTrack(SDB.Player.CurrentSong)
    SDB.Player.PlaylistAddTracks(Selected)
    If SDB.Player.isPlaying = False Then SDB.Player.Play
  End If
Now I suppose I could loop thru the entire now playing list and remove each track individually instead of using player.playlistclear, but I figured that it would be very in-efficient and slow (especially on large now playing lists) so I didnt bother with it.

Not to mention a bit more complex due to having to account for deleting an unknown number of songs before and after the current track without deleting the current track.

Also, you do know you can right click the player and go to properties to access the track properties that is playing? Perhaps not as easy as using the detail grids, but...

I don't think I will make it part of the script, but if you really wanted to loop thru, I would guess it could work something like the below pseudocode (untested of course)

x=0
do while playlistcount > 1
if x <> currentsongindex then playlistdelete(x)
x=x+1
loop

or something along those lines.

if someone wants to figure it out, test it and post it, others could use it if they desire.

edit: actually I don't think the above will work, because x would be increasing but the index# and count would be changing as songs were removed.

edit2: perhaps something like this instead
do while playlistcount > 1
if currentsongindex <> 0 then
playlistdelete(0)
else
playlistdelete(1)
end if
loop

that might work

Top