Possible improvements as discussed with daztrue over PM:daztrue wrote:The first time one of the 'generated' tracks was selected it played from that point onwards. It was probably a gremlin in the works as it didn't happen again - although I'll let you know if I detect any pattern or further occurances.
Yes, for now the script works like that. It just looks if the 1 track before and the 1 track after are OK (previous and next track in the set, or medley in your case) and then starts playback of the selected song without starting from the beginning (which happens only if linked tracks before had to be added because the 1 track before was not correct).
Like you suggest, better would be that the script stores the 'link' (blank for non-linked songs) of each track that starts playback, and compare with the 'link' of the next song that starts playback. When a song starts playing that has a different 'link', it should jump to the first song of the set: the script would 'run up' in the now playing list until it reaches the first song in the set and start playing, or if the set is incomplete it should add the necessary songs in front and start playing the first song (the last one added). By checking the 'link' of the previous song, it's still possible to manually skip playback to an other song in the set, once the set has started playing.
daztrue wrote:It'll be no surprise to you that when I randomised the list and a medley track was selected, the rest of the medley was added to the list again. I realise it would be far more complicated to remove the generated tracks when selecting randomise, although it's food for thought!
Probably the most logical approach in such a case would be an addition to the above. If a song starts playing with another 'link' than the previous played song, look if all previous and next linked tracks are present in the correct order in the now playing list. If not, (or this can also be done straight away, always) remove all the tracks in the now playing list that have that 'link', and re-add them in the correct order. Depends on how fast MM can do this of course.
daztrue wrote:The one other thing that would require more in-depth programming - again, food for thought - would be the benefit of the script not causing MM to lose memory of which tracks have been played in the list. Basically, what I observed (before repeatedly playing the list) was a shuffle play, of which the included medley track was the second to last to be selected, which, of course, generated the rest of the medley, which played accordingly, BUT afterwards I was expecting the one unplayed track in the Now Playing list to then play. But of course, as I explained before, the track after the medley then played, after which, tracks continued to be picked at random that had already played. Am I right in saying that without the script, a shuffled Now Playing list wouldn't have repeated already played tracks, thus memorising them until the list has finished?
Hmm, I'm not sure, but I think MM should work like you say. I'll try with and without the script and if the script changes the behaviour I'll think about a fix. I think MediaMonkey uses it's playback memory now for the shuffle mode...(which is great to avoid hearing the same 'random' song every time). If necessary we can add/remove tracks from MM's playback memory (in its database) automatically I guess. Just care should be taken that the playback statistics/history change as little as possible, as other scripts (Auto-DJ) probably heavilly rely on this.
Also to do: add icon IconIndex = 16 to context menu item + move the item 1 section up + add to context menu of Tree and NP.