LinkedTracks v1.1.1 [MM2+3+4] (TSFKA TiedSongsGroups)

Post a reply

Visual Confirmation

To prevent automated access and spam, you are required to confirm that you are human. Please place a check mark next to all images of monkeys or apes. If you cannot see any images, please contact the Board Administrator.

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: LinkedTracks v1.1.1 [MM2+3+4] (TSFKA TiedSongsGroups)

Re: LinkedTracks v1.1.1 [MM2+3+4] (TSFKA TiedSongsGroups)

Post by EinsteinX » Sat May 11, 2013 6:55 am

rrfpacker wrote:
I spent last night and today trying the latest code on page 4 and Einstein's code on page 5......


Hold on there! I'm nowhere near smart enough to create a code like this. I'm barely able of modifying a script.
All I intended to do on page 5 was summarise at the (then) end of the discussing thread, the script that was working for me. As it says in the script that I summarise it was created by Tanguy Kervahut and all credit goes to him.

Having said that, I am pleased to report that last week I finally upgraded from MM 3.2.1.1297 to MM 4.0.7.1511, then this morning I installed the DJTiedSongsGroups as described in my previous post and it is working exactly as I was and am used to.

So from a very happy MM user,

Cheers, Eins

Re: LinkedTracks v1.1.1 [MM2+3+4] (TSFKA TiedSongsGroups)

Post by dtsig » Wed Feb 13, 2013 1:30 pm

Any thoughts on this?

Re: LinkedTracks v1.1.1 [MM2+3+4] (TSFKA TiedSongsGroups)

Post by dtsig » Sun Feb 10, 2013 1:26 pm

I am having a "problem" with the LinkedTracks process and hoping I am just not understanding how it should work.

Setup: Win7 current Patched, MM Beta 1623 and the current LinkedTracks

1) removed all tracks from 'Now Playing'
2) In the basic Music section, went to 'Abbey Road' and selected tracks 7-17, right clicked and selected 'link selected tracks'.
3) Selected and then Drag&Dropped the 'Abbey Road' tracks to 'Now Playing'
4) Player is in Shuffle mode
5) dclicked track 3 (Maxwell's Silver Hammer).
6) After track 3 completed it went to Track 1. To this point Cool
7) After track 1 played track 12 highlighted ... but track 7 played. again pretty cool to this point
8 ) after track 17 played it then jumped to track 11. ??? This i don't understand. IF it goes to track 11 ... shouldn't it play track 7.

Sure i am just doing / understanding something wrong.

Re: Linked Tracks not playing "previous" tracks

Post by nohitter151 » Sun May 20, 2012 9:08 am

Sounds like you are posting about an addon, you should not post it to bug reports but to the actual addon thread in the addons help section.

Linked Tracks not playing "previous" tracks

Post by corbin » Sat May 19, 2012 8:15 pm

When set to shuffle mode, 'linked tracks' works fine as far as completing a set of linked tracks it jumps to. However, if it shuffles to the middle tracks in a linked set, it does not play from the first track of the set; it plays from wherever it landed to the end of the linked set instead.

I have the setting "also add previous linked tracks (and start playing from the 1st)' set to true in my Options, yet it doesn't seem to be working. I have tried switching it on and off with no change.

Am I doing something wrong or is this a bug?

Any help is greatly appreciated.

Thanks,
Corbin

Re: LinkedTracks v1.1.1 [MM2+3+4] (TSFKA TiedSongsGroups)

Post by rrfpacker » Sat Mar 03, 2012 1:46 pm

Sorry but I am confused.
I would like to use this LinkedTracks script with MM4.
Many of the posts talked about another script namely DJTiedSongsGroups script and the tweaks that are required for it to work with MM4.

Please reassure me that this LinkedTracks script works with MM4.
I downloaded the link from the first post. I hope that right.
Installation Package: LinkedTracks111.mmip
Thanks,


I spent last night and today trying the latest code on page 4 and Einstein's code on page 5. Good news is that they both work in MM4, however, not smoothly. I put 10 songs in the now playing list and then picked Golden Slumbers from Abbey Road Medley to play next, which should start at You Never Give Me Your Money. When the current now playing song ended Golden Slumbers started for about five seconds and then You Never Give Me Your Money started and all the other songs before Golden Slumbers were added. So, it works, you just get a five second delay. Not the smoothest of operations and I don't know how to fix it. I didn't use it in MM3 so I don't have a comparison. Maybe because I'm manually manipulating the now playing list it doesn't work, but you would think it would.

Re: LinkedTracks v1.1.1 [MM2+3+4] (TSFKA TiedSongsGroups)

Post by MusicBringer » Fri Mar 02, 2012 10:28 am

Sorry but I am confused.
I would like to use this LinkedTracks script with MM4.
Many of the posts talked about another script namely DJTiedSongsGroups script and the tweaks that are required for it to work with MM4.

Please reassure me that this LinkedTracks script works with MM4.
I downloaded the link from the first post. I hope that right.
Installation Package: LinkedTracks111.mmip
Thanks,

Re: LinkedTracks v1.1.1 [MM2+3+4] (TSFKA TiedSongsGroups)

Post by rycher » Tue Dec 06, 2011 12:35 pm

daztrue wrote:
rycher wrote:Here is an update of the DJTiedSongsGroups script.

Is this used instead of LinkedTracks or in conjunction with it? And does it make tracks play in a specific order just like LinkedTracks?


This was posted a while back in this thread. I haven't been following the thread for a while, I'm not sure how it evolved and what LinkedTracks does compared to it. You would have to sift through the thread to see want happened.

This is intended to either have albums selected randomly but played in order by auto-dj, or when not in album mode to have all tracks tagged along the randomly selected track play together in the right order. The tracks belonging together must be tagged beforehand (another script exists for this). The tag is stored in Custom 3 field. When an untagged track is selected it is added normaly like the standard auto-dj.

Re: LinkedTracks v1.1.1 [MM2+3+4] (TSFKA TiedSongsGroups)

Post by daztrue » Tue Dec 06, 2011 6:25 am

rycher wrote:Here is an update of the DJTiedSongsGroups script.

Is this used instead of LinkedTracks or in conjunction with it? And does it make tracks play in a specific order just like LinkedTracks?

Re: LinkedTracks v1.1.1 [MM2+3+4] (TSFKA TiedSongsGroups)

Post by rycher » Mon Dec 05, 2011 6:41 pm

Here is an update of the DJTiedSongsGroups script.

For a party I wanted to have some smooth music earlier in the evening, and switch to a rockier/dancier mood during the evening. But not have to go on the computer to change the source.

I've modified the script, now in the config window there is a field to specify a second source playlist, and a date time field (enter the date in format: 2011-11-23 18:10). The first playlist is used before the specified date/time, and after that time it switches to the second playlist (if one is specified).

NOTE: with MM4, there is a error that pops-up whenever multiple tracks are added at once (with the option By album or tagged tracks). Everything seems to work fine, but you get a pop-up message that you have to close. I've started a thread about that problem, no news yet on that.

Here is the updated script:
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
'
' Modified: 29.10.2008
'    -Added "By album" option
'    -Change the mechanism, it now adds a whole group (or album) at once. So it can add more tracks than the maximum specified for auto-dj when
'      a group has more tracks than the maximum.
'
' Modified: 24.02.2009
'    -"By album" option now gives the same weight to all albums (before an album with more tracks had more chances to play)
'    -For multi-disc albums, ask if whole album should play or only selected disc.
'
' Modified: 17.03.2009
'    - Fix a small bug when tracks don't have track order
'
' Modified: 05.12.2011
'    - Added a second source playlist, and a date/time field after which the second playlist should be used.
'    - Date should be in format: 2011-11-23 18:10
'
' 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 DJTSG_LastSong, DJTSG_LastCall, DJTSG_NbAdded, Fso, LogF

Sub InitConfigSheet(Panel)
  Dim Edt, Lists, i

  Set Edt = SDB.UI.NewLabel(Panel)
  Edt.Common.SetRect 1, 5, 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 76, 1, 200, 20
  Edt.Common.ControlName = "TagGroupPlaylist"
  Edt.Text = SDB.IniFile.StringValue("TagGroup", "DefaultPlaylist")

  Set Edt = SDB.UI.NewCheckBox(Panel)
  Edt.Common.SetRect 285, 2, 75, 20
  Edt.Common.ControlName = "ByAlbum"
  Edt.Caption = "By Album"
  Edt.Checked = SDB.IniFile.BoolValue("TagGroup", "ByAlbum")


  Set Edt = SDB.UI.NewLabel(Panel)
  Edt.Common.SetRect 1, 26, 75, 20
  Edt.Caption = "2nd playlist:"
  Edt.Autosize = False
  Edt.Alignment = 0

  Set Edt = SDB.UI.NewDropDown(Panel)
  for i = 0 to Lists.Count-1
     Edt.AddItem(Lists.Item(i).Title)
  next
  Edt.Common.SetRect 76, 22, 200, 20
  Edt.Common.ControlName = "TagGroupPlaylist2"
  Edt.Text = SDB.IniFile.StringValue("TagGroup", "DefaultPlaylist2")

  Set Edt = SDB.UI.NewEdit(Panel)
  Edt.Common.SetRect 285, 22, 125, 20
  Edt.Common.ControlName = "List2Time"
  Edt.Text = SDB.IniFile.StringValue("TagGroup", "List2Time")
End Sub


Sub CloseConfigSheet(Panel, SaveConfig)
  if Saveconfig then
     SDB.IniFile.StringValue("TagGroup", "DefaultPlaylist") = Panel.Common.ChildControl("TagGroupPlaylist").Text
     SDB.IniFile.StringValue("TagGroup", "DefaultPlaylist2") = Panel.Common.ChildControl("TagGroupPlaylist2").Text
     SDB.IniFile.StringValue("TagGroup", "List2Time") = Panel.Common.ChildControl("List2Time").Text
     SDB.IniFile.BoolValue("TagGroup", "ByAlbum") = Panel.Common.ChildControl("ByAlbum").Checked
  end if
End Sub

Function GenerateNewTrack
  Dim ByAlbum, TagGroupPlaylist, CheckPlaylist, i, RandomTrack, NextSong, NextGroup, DiscNo

' answer = SDB.MessageBox("Start of GenerateNewTrack", mtConfirmation, Array(mbYes,mbNo))

  if isEmpty(DJTSG_LastSong) then
    ' Randomize on first run
    Randomize
    DJTSG_NbAdded = 0
    DJTSG_LastCall = DateAdd("n",-1,Now)
  end if

  ' The following is to avoid adding multiple groups when more than one track needs
  ' to be added. Because MM can call this function multiple times at once when more
  ' than one is required to reach the minimum to maintain. When this happens, the
  ' playlist isn't updated until all calls are finished. So from an empty playlist,
  ' it could add 5 albums (if by album and number to maintain is 5).
  if DateDiff("s",DJTSG_LastCall,Now) < 5 then
    DJTSG_NbAdded = DJTSG_NbAdded - 1
    if DJTSG_NbAdded > 0 then
      exit Function
    end if
  else
    DJTSG_NbAdded = 0
  end if

  logme( "Inside GenerateNewTrack")

  Dim answer
  ByAlbum = SDB.IniFile.BoolValue("TagGroup", "ByAlbum")
  if (Len(SDB.IniFile.StringValue("TagGroup", "DefaultPlaylist2")) > 0) AND (Now > CDate(SDB.IniFile.StringValue("TagGroup", "List2Time"))) then
     TagGroupPlaylist = SDB.IniFile.StringValue("TagGroup", "DefaultPlaylist2")
  else
     TagGroupPlaylist = SDB.IniFile.StringValue("TagGroup", "DefaultPlaylist")
  end if
  Set CheckPlaylist = SDB.PlaylistByTitle(TagGroupPlaylist).Tracks
  if (CheckPlaylist.Count = 0) then
    ' To avoid multiple pop-up, see previous comment
    DJTSG_NbAdded = 99
    answer = SDB.MessageBox( "AutoDJ playlist is empty", mtError, Array(mbOk))
    exit Function
  end if

  i = 0
  if ByAlbum then
     dim CheckAlbumList, NextAlbum, RandomAlbum, AlbumTrackList
     Set CheckAlbumList = CheckPlaylist.Albums
     ' When ByAlbum, select an album at random from the AutoDJ playlist
     ' and not a track, otherwise albums with more tracks get picked more often
     Do
       RandomAlbum = Int(Rnd() * CheckAlbumlist.Count)
       Set NextAlbum = CheckAlbumlist.Item(RandomAlbum)
       Set AlbumTrackList = NextAlbum.Tracks
      Do
          RandomTrack = Int(Rnd() * AlbumTrackList.Count)
          Set NextSong = AlbumTrackList.Item(RandomTrack)
      Loop while (NOT IsInSongList(NextSong, CheckPlaylist)) ' Loop to skip discs already played from multi-disc albums
       i = i + 1
     Loop while (IsInSongList(NextSong, SDB.Player.CurrentPlaylist) Or SameGroup(NextSong, DJTSG_LastSong, ByAlbum)) AND i < CheckPlaylist.Count
  else
     Do
       RandomTrack = Int(Rnd() * CheckPlaylist.Count)
       Set NextSong = CheckPlaylist.Item(RandomTrack)
       i = i + 1
     Loop while (IsInSongList(NextSong, SDB.Player.CurrentPlaylist) Or SameGroup(NextSong, DJTSG_LastSong, ByAlbum)) AND i < CheckPlaylist.Count
  end if

  ' If you don't want to be asked what to play when it's a multi-disc album, simply replace the block below by: DiscNo = 0
  if (NextSong.TrackOrderStr <> "") then
     DiscNo = Fix(NextSong.TrackOrderStr / 100)
  else
     DiscNo = 0
  end if
  if (ByAlbum AND DiscNo > 0) then
    ' Ask to play full album or disc only
    answer = SDB.MessageBox( NextSong.AlbumArtistName & Chr(13) & NextSong.AlbumName & Chr(13) & Chr(13) & "Add full album? (No = Disc " & DiscNo & " only)", mtConfirmation, Array(mbYes,mbNo))
    if answer = mrYes then
      DiscNo = 0
    end if
  end if

  logme( "Track selected : " & NextSong.AlbumArtistName & " - " & NextSong.AlbumName & " - " & NextSong.Title )

  If ByAlbum OR Left(NextSong.Custom3, 2) = "LT" Then
    if ByAlbum then
      Set NextGroup = SDB.Database.QuerySongs("Songs.IDAlbum='" & NextSong.Album.Id & "' ORDER BY abs(Songs.TrackNumber) ASC")
    else
      Set NextGroup = SDB.Database.QuerySongs("Songs.Custom3='" & NextSong.Custom3 & "' ORDER BY abs(Songs.TrackNumber) ASC")
    end if
    ' Insert directly whole group at end of Now Playing - return nothing
    Set DJTSG_LastSong = NextGroup.Item
    Do While Not NextGroup.EOF
      dim NextNo
      Set NextSong = NextGroup.Item
      if NextSong.TrackOrderStr <> "" then
         NextNo = Fix(NextSong.TrackOrderStr / 100)
      else
         NextNo = 0
      end if

      NextGroup.Next

      if (NOT ByAlbum OR DiscNo = 0 OR NextNo = DiscNo ) then
        DJTSG_NbAdded = DJTSG_NbAdded + 1
        Call SDB.Player.PlaylistAddTrack( NextSong )
      end if
    Loop
  else
    ' Return track found
    DJTSG_NbAdded = DJTSG_NbAdded + 1
    Set GenerateNewTrack = NextSong
    Set DJTSG_LastSong = NextSong
  end if

  DJTSG_LastCall = Now

' answer = SDB.MessageBox("End of GenerateNewTrack", mtConfirmation, Array(mbYes,mbNo))

End Function


Function IsInSongList( Song, List )
  Dim i

  IsInSongList = False
  if not isEmpty(Song) AND List.Count > 0 then
  for i = 0 to List.Count -1
    if List.Item(i).SongId = Song.SongId then
      IsInSongList = True
      exit for
    end if
  next
  end if
End Function


Function SameGroup( Song1, Song2, ByAlbum )
  if isEmpty(Song1) or isEmpty(Song2) then
    SameGroup = False
  else
    if ByAlbum then
      SameGroup = Song1.Album.Id = Song2.Album.Id
    else
      SameGroup = Song1.SongId = Song2.SongId OR (Left(Song1.Custom3, 2) = "LT" AND Song1.Custom3 = Song2.Custom3)
    end if
  end if
End Function


Sub logme(msg)
' usage: logme( "text" & VarName )
' Don't forget to define LogF and Fso as Public
'  If DebugSt Then
    If IsEmpty(LogF) Then
      Set Fso = CreateObject("Scripting.FileSystemObject")
      Set LogF = Fso.OpenTextFile(Script.ScriptPath&".log",8,True)
    End If
    LogF.WriteLine Now() & ": " & msg
'  End If
End Sub

Re: LinkedTracks v1.1.1 [MM2+3+4] (TSFKA TiedSongsGroups)

Post by daztrue » Mon Nov 14, 2011 12:04 pm

FAO Steegy (although all comments welcome!):

I recently noticed that whenever I opened MM(3) shuffle would be on, and would turn on just as I exited. It wasn't happening in other Windows/MM accounts/libraries with the same setup. I even installed the debug version of MM on another PC and created the same setup, and found that the issue no longer occurred - until I installed LinkedTracks.

I checked one of my other accounts, which previously was fine, although now had tracks in it using LinkedTracks, thus the same scenario now occurs in that account/library.

As a reminder: my DB are on my NAS, and as of recently, so now are my INI files.

Any ideas why this is happening, whether you can sort it, and whether this function (one way or another) will feature in MM4?

Re: LinkedTracks v1.1.1 [MM2+3+4] (TSFKA TiedSongsGroups)

Post by daztrue » Wed Jul 06, 2011 1:34 pm

Hi again!

Just had a thought. Wouldn't the script conflict with certain Playlists/AutoPlaylists? Obviously it would depend on the settings. I just wondered what would happen, how severe it may be etc. For example, a playlist set to only play R&B, and a selection of tracks using the script, predominately rock, but with one or more listed as R&B.

Re: LinkedTracks v1.1 [MM2+3+4] (TSFKA TiedSongsGroups)

Post by Steegy » Sun Jun 12, 2011 6:06 am

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.

Re: LinkedTracks v1.1 [MM2+3+4] (TSFKA TiedSongsGroups)

Post by rycher » Wed Jun 08, 2011 10:47 am

Ok, forget what I said, I must be more tired than I thought... It's been running by itself in MM3 for so long that I forgot how it was configured in the options.
I forgot that I had to select my script in "Add files from", I thought that it would automatically be setup because of the script :oops:

Seems to be working ok. Now back to your regularly scheduled program...

Re: LinkedTracks v1.1 [MM2+3+4] (TSFKA TiedSongsGroups)

Post by rycher » Wed Jun 08, 2011 10:10 am

I haven't had a lot of time for this recently, but I want to have a closer look at all this and make it work in MM4. Once I have a running version, I'll make a MM installation package for it (remind me if I forget :wink: ).

Top