Full Album & Two For Script

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

Moderators: Peke, Gurus

jaxjon
Posts: 102
Joined: Tue May 27, 2003 8:47 am
Location: Florida USA

Full Album & Two For Script

Post by jaxjon »

Here is my previous script updated with a new routine for generating 2 random songs from a randomly generated artist, commonly known as Two For Tuesday on radio stations here. Once again you need to install a song of no or little sound into the main tracklist and title it End. Here is my file to download http://home.comcast.net/~jaxjon/End.wma
Call the script Checker.vbs
Once you start either script then the checker will go into action and continue the same script indefinately unless you run across the unlikely event of an album with only 2 songs in PlayAlbum mode.

If there is any better way of accomplishing these tasks or other suggestions, please reply.

Code: Select all

Sub Checker
Set plr=SDB.Player
If (((plr.PlaylistCount) = (plr.CurrentSongIndex +1)) and (plr.PlaylistCount>3))Then
Call PlayAlbum
Else If (((plr.PlaylistCount) = (plr.CurrentSongIndex +1)) and (plr.PlaylistCount<=3)) Then
Call PlayArtist
End If
End If
End Sub


Sub PlayAlbum
Dim list, itm, i, a, b, c
' Set List
Set list = SDB.AllVisibleSonglist
If list.count=0 Then
res = SDB.MessageBox( "Select Tracks to be exported, please.", mtInformation, Array(mbOk))
Exit Sub
End If
Set plr=SDB.Player


plr.PlaylistClear

Dim Progress
Set Progress = SDB.Progress
Progress.Text = "Working..."

'Export to MM all songs
Progress.MaxValue = list.count

Randomize
i=0
i = Int(((list.count-1) * Rnd) + 1)
Set itm = list.Item(i)

a = itm.AlbumName

For b=0 to list.count-1
Set itm=list.item(b)

If itm.AlbumName = a Then

plr.PlaylistAddTrack(itm)

Progress.Value=b+1

If Progress.Terminate Then
Exit For

End If
End If

Next
For c=0 to list.count-1
Set itm=list.item(c)
If itm.Title="End" Then
plr.PlaylistAddTrack(itm)
End If
Next
plr.Play


End Sub 

Sub PlayArtist
Dim list, itm, i, a, b, c, d
' Set List
Set list = SDB.AllVisibleSonglist
If list.count=0 Then
res = SDB.MessageBox( "Select Tracks to be exported, please.", mtInformation, Array(mbOk))
Exit Sub
End If
Set plr=SDB.Player


plr.PlaylistClear

Dim Progress
Set Progress = SDB.Progress
Progress.Text = "Working..."

'Export to MM all songs
Progress.MaxValue = list.count

Randomize
i=0
i = Int(((list.count-1) * Rnd) + 1)
Set itm = list.Item(i)

a = itm.ArtistName

For b=0 to list.count-1
d=Int(((list.count-1) * Rnd) + 1)
Set itm=list.item(d)

If itm.ArtistName = a Then
If plr.PlaylistCount<2 Then
plr.PlaylistAddTrack(itm)

Progress.Value=b+1

If Progress.Terminate Then
Exit For

End If
End If
End If
Next
For c=0 to list.count-1
Set itm=list.item(c)
If itm.Title="End" Then
plr.PlaylistAddTrack(itm)
End If
Next
plr.Play


End Sub 

Code: Select all

[PlayAlbum] 
FileName=Checker.vbs 
ProcName=PlayAlbum 
Order=1 
DisplayName=Play Full Album 
Description=Plays Full Album 
Language=VBScript 
ScriptType=0 

[Checker] 
FileName=Checker.vbs 
ProcName=Checker 
Order=1 
DisplayName=Checker 
Description=Checker 
Language=VBScript 
ScriptType=2 

[PlayArtist] 
FileName=Checker.vbs 
ProcName=PlayArtist 
Order=2 
DisplayName=Play Artist 
Description=Plays Artist 
Language=VBScript 
ScriptType=0 
jaxjon
Posts: 102
Joined: Tue May 27, 2003 8:47 am
Location: Florida USA

Post by jaxjon »

Here is an update that has a check to make sure the second track is not the same as the first track in PlayArtist mode.

Code: Select all

Sub Checker
Set plr=SDB.Player
If (((plr.PlaylistCount) = (plr.CurrentSongIndex +1)) and (plr.PlaylistCount>3))Then
Call PlayAlbum
Else If (((plr.PlaylistCount) = (plr.CurrentSongIndex +1)) and (plr.PlaylistCount<=3)) Then
Call PlayArtist
End If
End If
End Sub


Sub PlayAlbum
Dim list, itm, i, a, b, c
' Set List
Set list = SDB.AllVisibleSonglist
If list.count=0 Then
res = SDB.MessageBox( "View Tracks to be played, please.", mtInformation, Array(mbOk))
Exit Sub
End If
Set plr=SDB.Player


plr.PlaylistClear

Dim Progress
Set Progress = SDB.Progress
Progress.Text = "Working..."

'Export to MM all songs
Progress.MaxValue = list.count

Randomize
i=0
i = Int(((list.count-1) * Rnd) + 1)
Set itm = list.Item(i)

a = itm.AlbumName

For b=0 to list.count-1
Set itm=list.item(b)

If itm.AlbumName = a Then

plr.PlaylistAddTrack(itm)

Progress.Value=b+1

If Progress.Terminate Then
Exit For

End If
End If

Next
For c=0 to list.count-1
Set itm=list.item(c)
If itm.Title="End" Then
plr.PlaylistAddTrack(itm)
End If
Next
plr.Play


End Sub 

Sub PlayArtist
Dim list, itm, i, a, b, c, d, firstTrack
' Set List
Set list = SDB.AllVisibleSonglist
If list.count=0 Then
res = SDB.MessageBox( "View Tracks to be played, please.", mtInformation, Array(mbOk))
Exit Sub
End If
Set plr=SDB.Player

plr.PlaylistClear

Dim Progress
Set Progress = SDB.Progress
Progress.Text = "Working..."

'Export to MM all songs
Progress.MaxValue = list.count

Randomize
i=0
i = Int(((list.count-1) * Rnd) + 1)
Set itm = list.Item(i)

a = itm.ArtistName

For b=0 to list.count-1
d=Int(((list.count-1) * Rnd) + 1)
Set itm=list.item(d)

If ((itm.Title <> firstTrack) and (itm.ArtistName = a) and (plr.PlaylistCount<2)) Then


plr.PlaylistAddTrack(itm)
firstTrack = itm.Title
Progress.Value=b+1

If Progress.Terminate Then
Exit For

End If

End If

Next
For c=0 to list.count-1
Set itm=list.item(c)
If itm.Title="End" Then
plr.PlaylistAddTrack(itm)
End If
Next
plr.Play


End Sub 
Last edited by jaxjon on Thu Jun 03, 2004 6:08 pm, edited 1 time in total.
jaxjon
Posts: 102
Joined: Tue May 27, 2003 8:47 am
Location: Florida USA

Post by jaxjon »

Revision to Checker routine to only go to new album when End is the last song ( now when not in playalbum mode the last song will play :D )

Code: Select all

Sub Checker
Set plr=SDB.Player
Set list=plr.CurrentSongList
Dim i, itm
For i=0 To list.count-1
Set itm=list.Item(i)
If ((itm.Title="End") and ((plr.PlaylistCount) = (plr.CurrentSongIndex +1)) and (plr.PlaylistCount>3))Then
Call PlayAlbum
Else If ((itm.Title="End") and ((plr.PlaylistCount) = (plr.CurrentSongIndex +1)) and (plr.PlaylistCount<=3)) Then
Call PlayArtist
End If
End If
Next
End Sub
[/code]
Guest

Re: Full Album & Two For Script

Post by Guest »

jaxjon wrote:Here is my previous script updated with a new routine for generating 2 random songs from a randomly generated artist, commonly known as Two For Tuesday on radio stations here. Once again you need to install a song of no or little sound into the main tracklist and title it End. Here is my file to download http://home.comcast.net/~jaxjon/End.wma
Call the script Checker.vbs
Once you start either script then the checker will go into action and continue the same script indefinately unless you run across the unlikely event of an album with only 2 songs in PlayAlbum mode.

If there is any better way of accomplishing these tasks or other suggestions, please reply.

Code: Select all

Sub Checker
Set plr=SDB.Player
If (((plr.PlaylistCount) = (plr.CurrentSongIndex +1)) and (plr.PlaylistCount>3))Then
Call PlayAlbum
Else If (((plr.PlaylistCount) = (plr.CurrentSongIndex +1)) and (plr.PlaylistCount<=3)) Then
Call PlayArtist
End If
End If
End Sub


Sub PlayAlbum
Dim list, itm, i, a, b, c
' Set List
Set list = SDB.AllVisibleSonglist
If list.count=0 Then
res = SDB.MessageBox( "Select Tracks to be exported, please.", mtInformation, Array(mbOk))
Exit Sub
End If
Set plr=SDB.Player


plr.PlaylistClear

Dim Progress
Set Progress = SDB.Progress
Progress.Text = "Working..."

'Export to MM all songs
Progress.MaxValue = list.count

Randomize
i=0
i = Int(((list.count-1) * Rnd) + 1)
Set itm = list.Item(i)

a = itm.AlbumName

For b=0 to list.count-1
Set itm=list.item(b)

If itm.AlbumName = a Then

plr.PlaylistAddTrack(itm)

Progress.Value=b+1

If Progress.Terminate Then
Exit For

End If
End If

Next
For c=0 to list.count-1
Set itm=list.item(c)
If itm.Title="End" Then
plr.PlaylistAddTrack(itm)
End If
Next
plr.Play


End Sub 

Sub PlayArtist
Dim list, itm, i, a, b, c, d
' Set List
Set list = SDB.AllVisibleSonglist
If list.count=0 Then
res = SDB.MessageBox( "Select Tracks to be exported, please.", mtInformation, Array(mbOk))
Exit Sub
End If
Set plr=SDB.Player


plr.PlaylistClear

Dim Progress
Set Progress = SDB.Progress
Progress.Text = "Working..."

'Export to MM all songs
Progress.MaxValue = list.count

Randomize
i=0
i = Int(((list.count-1) * Rnd) + 1)
Set itm = list.Item(i)

a = itm.ArtistName

For b=0 to list.count-1
d=Int(((list.count-1) * Rnd) + 1)
Set itm=list.item(d)

If itm.ArtistName = a Then
If plr.PlaylistCount<2 Then
plr.PlaylistAddTrack(itm)

Progress.Value=b+1

If Progress.Terminate Then
Exit For

End If
End If
End If
Next
For c=0 to list.count-1
Set itm=list.item(c)
If itm.Title="End" Then
plr.PlaylistAddTrack(itm)
End If
Next
plr.Play


End Sub 

Code: Select all

[PlayAlbum] 
FileName=Checker.vbs 
ProcName=PlayAlbum 
Order=1 
DisplayName=Play Full Album 
Description=Plays Full Album 
Language=VBScript 
ScriptType=0 

[Checker] 
FileName=Checker.vbs 
ProcName=Checker 
Order=1 
DisplayName=Checker 
Description=Checker 
Language=VBScript 
ScriptType=2 

[PlayArtist] 
FileName=Checker.vbs 
ProcName=PlayArtist 
Order=2 
DisplayName=Play Artist 
Description=Plays Artist 
Language=VBScript 
ScriptType=0 
Guest

Post by Guest »

:) very nice ~
john.smith
Posts: 1
Joined: Wed Jan 16, 2008 1:50 am
Contact:

Post by john.smith »

:) I have fixed my problem. lol
Post Reply