Good news everyone!
I did not find a way to have the behaviour I wanted when a track started playing...
BUT when looking in the forums I (finally) discovered that in MM3 you can now make scripts to control the behaviour of AutoDJ when adding a track (type 4).
So I made a script to add songs at random from a playlist, but when a song belongs to a group the whole group is added in order. It only works when using AutoDJ, but then again it's the only time I want this to work. If I'm adding tracks manually, I know what I'm doing, I don't want the player to add tracks by itself then ("I'm sorry Dave, I can't do that"). So for me it's a better way of doing this then before.
Basically here is what it does:
-If the last track of Now Playing is a grouped track, it gets the next tracks in the group. If there is one, it adds it.
-If not, it gets a track a random from the specified playlist (configured in the options of AutoDJ when you select to add tracks from "AutoDJ Tied songs groups"). If the random track is a grouped track, it adds the first of its group, otherwise it simply adds the random track.
As with the previous script, tracks must have a common tag starting with LT (it is described in the script). I took the time to put a drop-down list to select the source playlist in the Options window, but I didn't make the tag location configurable, it has to be in Custom3. You can modify it to your taste, or make it configurable if you wish. As a source playlist, I like to use an auto-playlist configured to contain tracks that haven't been played for 6 weeks, to avoid early repeats.
Here is the script, it's also simpler than the old one:
Code: Select all
'==========================================================================
'
' MediaMonkey Script
'
' NAME: DJTiedSongsGroups
' DESCRIPTION:
' Lets you use auto-dj while playing together groups of songs that should go together
' (groups of songs must previously be tagged as linked)
'
' AUTHOR: Tanguy Kervahut
' DATE : 11.10.2008
'
' INSTALL:
' - Copy script to MediaMonkey's "Scripts" folder
' - Add an script entry to file Scripts.ini (example shown below)
'
' USE:
' For songs you want in one group, change the Custom3 field for these songs to
' the same value, beginning with LT (this indicates a "linked track").
' E.g. for an album "Pink Floyd - Dark Side of the Moon" you can change the Custom3 field
' for all tracks to "LT Pink Floyd - Dark Side of the Moon". (without quotation marks).
' Bear in mind that shorter values for the Custom3 field are faster (so better "LT PF-DSOTM")
' Order of tracks in a tied group is indicated using the standard Track Number field.
'
' [DJTiedSongsGroups]
' FileName=DJTiedSongsGroups.vbs
' DisplayName=AutoDJ Tied songs groups
' Language=VBScript
' ScriptType=4
'##############################################################################################
Option Explicit
Public TagGroupPlaylist
Sub InitConfigSheet(Panel)
Dim Edt, Lists, i
Set Edt = SDB.UI.NewLabel(Panel)
Edt.Common.SetRect 1, 1, 75, 20
Edt.Caption = "Use playlist:"
Edt.Autosize = False
Edt.Alignment = 0
Set Edt = SDB.UI.NewDropDown(Panel)
Set Lists = SDB.PlaylistByTitle("").ChildPlaylists
for i = 0 to Lists.Count-1
Edt.AddItem(Lists.Item(i).Title)
next
Edt.Common.SetRect 86, 1, 200, 20
Edt.Common.ControlName = "TagGroupPlaylist"
Edt.Text = SDB.IniFile.StringValue("TagGroup", "DefaultPlaylist")
End Sub
Sub CloseConfigSheet(Panel, SaveConfig)
if Saveconfig then
SDB.IniFile.StringValue("TagGroup", "DefaultPlaylist") = Panel.Common.ChildControl("TagGroupPlaylist").Text
end if
End Sub
Function GenerateNewTrack
Dim LastSong, LastGroup, NextSong, NextFound
Set LastSong = SDB.Player.PlaylistItems(SDB.Player.PlaylistCount - 1)
NextFound = false
If Left(LastSong.Custom3, 2) = "LT" Then
Set LastGroup = SDB.Database.QuerySongs("Songs.Custom3='" & LastSong.Custom3 & "' ORDER BY abs(Songs.TrackNumber) ASC")
Do While Not LastGroup.EOF
if LastGroup.Item.TrackOrder > LastSong.TrackOrder then
Set NextSong = LastGroup.Item
NextFound = true
exit do
end if
LastGroup.Next
Loop
end if
If NextFound Then
Set GenerateNewTrack = NextSong
else
Dim CheckPlaylist, RandomTrack
TagGroupPlaylist = SDB.IniFile.StringValue("TagGroup", "DefaultPlaylist")
Set CheckPlaylist = SDB.PlaylistByTitle(TagGroupPlaylist).Tracks
RandomTrack = Int((Rnd() * CheckPlaylist.Count) + 1)
Set NextSong = CheckPlaylist.Item(RandomTrack)
If Left(NextSong.Custom3, 2) = "LT" Then
Set LastGroup = SDB.Database.QuerySongs("Songs.Custom3='" & NextSong.Custom3 & "' ORDER BY abs(Songs.TrackNumber) ASC")
Set GenerateNewTrack = LastGroup.Item
else
Set GenerateNewTrack = NextSong
end if
End If
End Function
Hope you'll enjoy this!
Rycher