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

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Dreadlau
Posts: 1967
Joined: Sun Nov 25, 2007 6:49 am

Post by Dreadlau » Thu Feb 28, 2008 2:51 pm

Thanks Das Monkey. :D I've installed it.

But I wonder how to use it. Do I have to write something in the customfield to tie songs toghether?

das Monkey
Posts: 70
Joined: Tue Feb 12, 2008 7:11 pm

Post by das Monkey » Thu Feb 28, 2008 3:11 pm

No problem. Pick one of the custom fields in the config screen (I use Custom 5). Then select the songs you want to always be played together and make that custom field value the same text string (with the leading characters "LT_").

For example, on Dark Side of the Moon, I want "Breathe" to always follow "Speak to Me". So, I select both files, go to properties, select the proper custom field, and type in "LT_DarkSide_Breathe". It doesn't really matter what you put after the "LT_", just so long as it's unique to the tracks you want to link together. I tend to use an abbreviated "LT_Album_Song" convention. Then turn on shuffle and select the first file in your list. The second file should play right after it. To test that you have it working, you can check the "disable crossfade" option and then turn on global crossfading. Click on the Play menu, and you'll see a checkmark next to "Crossfade" in the list. Now play the first track in your list, and while it's playing, click on the Play menu again. The checkmark should be gone, because it's disabled crossfading in anticipation of the next linked track. When your final linked track starts playing, check the Play menu again. Crossfading should be turned back on, because it's done with this batch of linked tracks.

das

Dreadlau
Posts: 1967
Joined: Sun Nov 25, 2007 6:49 am

Post by Dreadlau » Thu Feb 28, 2008 4:24 pm

Wow I so love this script.:o

Thanks a lot Steegy, bex and Das. And congrats Das for your crossfading option. It works like you discribe it.

And the best thing is that it works also with auto-Dj. :D

Just one last question: How does the script knows in wich order to play the tracks? Does it relate on the Track Numbers?

Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium
Contact:

Post by Steegy » Thu Feb 28, 2008 4:26 pm

Dreadlau wrote:Just one last question: How does the script knows in wich order to play the tracks? Does it relate on the Track Numbers?
Yes. Tracks within one group are played in order by track number.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).

Dreadlau
Posts: 1967
Joined: Sun Nov 25, 2007 6:49 am

Post by Dreadlau » Thu Feb 28, 2008 4:41 pm

Strange It worked so well the first time.

But after restarting Mediamonkey ( Had to kill it in the task manager )

it doesn't work anymore. What have i done wrong?
:-?

das Monkey
Posts: 70
Joined: Tue Feb 12, 2008 7:11 pm

Post by das Monkey » Thu Feb 28, 2008 4:55 pm

Why did you have to kill MM in the task manager?

It seems unlikely that this script could do anything that would cause MM to lock up. There's only one loop, and unless you've done something crazy, it should have very limited results.

Have you checked to see that your settings were retained after killing MM in the task manager? Maybe something didn't get saved?

das

Dreadlau
Posts: 1967
Joined: Sun Nov 25, 2007 6:49 am

Post by Dreadlau » Thu Feb 28, 2008 5:04 pm

Seems I spoke to quick. The linked songed didn't appear on the nowplayling list in auto-dj mode. But only when playing the songs who have tied songs. So I assumed it was not working.

Still it seems that crossfading is not always disabled when playing the first tied song. Sometimes it works, sometimes not.

I know that this script is probably not the cause of the lockup.

I dubelled checked the settings.

Just to be sure. When the script sees the second song of a sequence of a 2 tied songs. Does it put the first song before it?

Cause now it doesn't but I think it did before I restarted MM( Though I'm not sure of this cause I only played with it for 5 min)

Dreadlau
Posts: 1967
Joined: Sun Nov 25, 2007 6:49 am

Post by Dreadlau » Thu Feb 28, 2008 5:11 pm

Ok I think I know what was the problem for the crossfading. Seems you have to let the songs finish on their own and not use te previous/next track button. Right?

das Monkey
Posts: 70
Joined: Tue Feb 12, 2008 7:11 pm

Post by das Monkey » Thu Feb 28, 2008 5:11 pm

It should only disable crossfading between the linked tracks. It should still crossfade into the first track and out of the last track (if you have global crossfading turned on).

If you randomly stumble onto the second track in a list of two, it will just play it like normal. If you've linked 5 tracks together, and you hit the 3rd one, it will play 3-5 in order. It doesn't back-link them.

das

das Monkey
Posts: 70
Joined: Tue Feb 12, 2008 7:11 pm

Post by das Monkey » Thu Feb 28, 2008 5:13 pm

Dreadlau wrote:Ok I think I know what was the problem for the crossfading. Seems you have to let the songs finish on their own and not use te previous/next track button. Right?
Yeah, crossfading won't do anything if you're hitting previous and next.

das

Dreadlau
Posts: 1967
Joined: Sun Nov 25, 2007 6:49 am

Post by Dreadlau » Thu Feb 28, 2008 5:27 pm

Ok I see.

For the crossfading what I meant Is that:

If I have global crossfading and auto-dj enabled in the player menu,
and my playlist is: 1)random song 1
2)Speak to me
3)Breathe
4)random song 2

I have to let random song 1 finish and Speak to me begin in order to let the script disable the crossfading and auto-dj option.
If I use next track button to go from random song 1 to speak to me. crossfading and auto-dj option will not be disabled in the player menu.

Dreadlau
Posts: 1967
Joined: Sun Nov 25, 2007 6:49 am

Post by Dreadlau » Thu Feb 28, 2008 5:47 pm

Ok Ignore what I just said. Seems to works even when using the prev/nextbutton. :oops:

Thanks for your replys. Have a good night

Guest

Re: TiedSongsGroups: lets you make tied groups of songs

Post by Guest » Thu Jun 19, 2008 10:19 pm

Hello,

I haven't been here for an while and just recently saw a message from Just JP pointing to this thread (thanks Just JP!).

This is just what I wanted to handle groups of songs. I've modified it a bit to put the whole group and not just the following songs from the group. I've modified Steegy's script to do what I want, using some of das Monkey's modifications (thank you both!). So here is my version, mind you it might still require improvements, but it seems to be running well. Also, I'm still using MM2, so it might needs adjustments for MM3:

Code: Select all

'==========================================================================
'
' MediaMonkey Script
'
' NAME: TiedSongsGroups v1.0
' DESCRIPTION:
'  Lets you make groups of songs, so when one song of the group is played,
'   the next songs in the group are also played (in order).
'
' AUTHOR: Steegy aka RC (Ruben Castelein)
' DATE  : 28.02.2006
' UPDATE: 28.02.2006
'
'  16/06/2008: Modified by Rycher to put all the tracks from the same group (not just those after).
'
' INSTALL:
' - Copy script to MediaMonkey's "Scripts" folder
' - Add an script entry to file Scripts.ini (example shown below)
'
'    [TiedSongsGroups]
'    FileName=TiedSongsGroups.vbs
'    ProcName=OnSongStartsPlaying
'    Order=1
'    DisplayName=TiedSongsGroups
'    Description=TiedSongsGroups
'    Language=VBScript
'    ScriptType=2
'
' USE:
' For songs you want in one group, change the Custom3 field for these songs to
'  the same value, beginning with TG (this indicates a "tied group").
' E.g. for an album "Pink Floyd - Dark Side of the Moon" you can change the Custom3 field
'  for all tracks to "TG Pink Floyd - Dark Side of the Moon". (without quotation marks).
' Bear in mind that shorter values for the Custom3 field are faster (so better "TG PF-DSOTM")
' Order of tracks in a tied group is indicated using the standard Track Number field.
'
'==========================================================================
'>> ForumURL: http://www.mediamonkey.com/forum/viewtopic.php?t=8464
'>> ScriptName: TiedSongsGroups
'>> VersionNumber: 1.0
'>> Author: Steegy aka RC (Ruben Castelein)
'>>>>EndOfProperties


'##############################################################################################


Sub OnSongStartsPlaying

  If Left(SDB.Player.CurrentSong.Custom3, 2) = "LT" Then

    If Not SDB.IniFile.StringValue("Player", "saved_hasBeenSaved") = "True" Then
      SDB.IniFile.StringValue("Player", "saved_hasBeenSaved") = "True"
      SavePlayerStates
    End If

    If SDB.Player.CurrentSongIndex = SDB.Player.PlaylistCount - 1 Then
    'Last song in playlist
      PlayerStatesAsContinuous
      AddOtherTiedSongs
    Else
      If (SDB.Player.CurrentSongIndex = 0) Then
	  ' First song in playlist
        PlayerStatesAsContinuous
	  Else
         If (SDB.Player.PlaylistItems(SDB.Player.CurrentSongIndex - 1).Custom3 <> SDB.Player.CurrentSong.Custom3 OR SDB.Player.PlaylistItems(SDB.Player.CurrentSongIndex - 1).TrackOrder <> SDB.Player.CurrentSong.TrackOrder-1) AND (SDB.Player.PlaylistItems(SDB.Player.CurrentSongIndex + 1).Custom3 <> SDB.Player.CurrentSong.Custom3 OR SDB.Player.PlaylistItems(SDB.Player.CurrentSongIndex + 1).TrackOrder <> SDB.Player.CurrentSong.TrackOrder+1) Then
         'Non-tied song before and after
            AddOtherTiedSongs
         Else
         'Tied song 
            PlayerStatesAsContinuous
		End If
      End If

    End If

  Else

    If SDB.IniFile.StringValue("Player", "saved_hasBeenSaved") = "True" Then
      SDB.IniFile.StringValue("Player", "saved_hasBeenSaved") = "False"
      RestoreSavedPlayerStates
    End If

  End If

End Sub


Sub AddOtherTiedSongs

  Dim IndexForAdding, OriginalOrder
  IndexForAdding = SDB.Player.CurrentSongIndex
  OriginalOrder = SDB.Player.CurrentSong.TrackOrder
  
    Dim MySongs
' For MM2
    Set MySongs = SDB.Database.QuerySongs("AND Songs.Custom3='" & DoubleUpSingleQuotes(SDB.Player.CurrentSong.Custom3) & "' ORDER BY Songs.SongOrder ASC")
' For MM3	
'	Set MySongs = SDB.Database.QuerySongs("Songs.Custom3='" & DoubleUpSingleQuotes(SDB.Player.CurrentSong.Custom3) & "' ORDER BY Songs.TrackNumber ASC")

    If MySongs.EOF Then
      RestoreSavedPlayerStates
      Exit Sub
    End If

    SDB.Player.Previous
	
    Do While Not MySongs.EOF
	  if MySongs.Item.TrackOrder < OriginalOrder then
         SDB.Player.PlaylistAddTrack MySongs.Item
         SDB.Player.PlaylistMoveTrack SDB.Player.PlaylistCount - 1, IndexForAdding
         IndexForAdding = IndexForAdding + 1
	  end if

	  if MySongs.Item.TrackOrder > OriginalOrder then
         IndexForAdding = IndexForAdding + 1
         SDB.Player.PlaylistAddTrack MySongs.Item
         SDB.Player.PlaylistMoveTrack SDB.Player.PlaylistCount - 1, IndexForAdding
	  end if
	  
      MySongs.Next
    Loop
	
	SDB.Player.Next

End Sub


Sub RestoreSavedPlayerStates

  SDB.Player.isAutoDJ = StringToBool(SDB.IniFile.StringValue("Player", "saved_isAutoDJ"))
  SDB.Player.isShuffle = StringToBool(SDB.IniFile.StringValue("Player", "saved_isShuffle"))
  SDB.Player.isRepeat = StringToBool(SDB.IniFile.StringValue("Player", "saved_isRepeat"))

SDB.IniFile.StringValue("Player", "saved_hasBeenSaved") = "False"

End Sub


Sub PlayerStatesAsContinuous

  SDB.Player.isAutoDJ = False
  SDB.Player.isShuffle = False
  SDB.Player.isRepeat = False

End Sub


Sub SavePlayerStates

  SDB.IniFile.StringValue("Player", "saved_isAutoDJ") = SDB.Player.isAutoDJ
  SDB.IniFile.StringValue("Player", "saved_isShuffle") = SDB.Player.isShuffle
  SDB.IniFile.StringValue("Player", "saved_isRepeat") = SDB.Player.isRepeat

End Sub


Function StringToBool(InpuString)

  If InpuString = "True" Then
    StringToBool = True
  Else
    StringToBool = False
  End If

End Function


' Doubles single quotes so SQL doesn't have problems with it anymore
Function DoubleUpSingleQuotes(strInput)
    DoubleUpSingleQuotes = Replace(strInput, "'", "''")
End Function
And although it's not a very complicated script, here is something to assign the common tag in Custom3 field for selected tracks:

Code: Select all

'=============================================================================================
'
' MediaMonkey Script
'
' NAME: Link selected tracks - put link value in Custom 3
'
' AUTHOR: Rycher
' DATE : 16/06/2008
'
' INSTALL: Copy to Scripts directory and add the following to Scripts.ini
'          Don't forget to remove comments (') and set the order appropriately
'
' [LinkTracksInCustom3]
' FileName=LinkTracksInCustom3.vbs
' ProcName=LinkTracksInCustom3
' Order=10
' DisplayName=&Link selected tracks
' Description=Link selected tracks - put link value in Custom 3
' Language=VBScript
' ScriptType=0
'
'=============================================================================================
' A simple script that set the Custom3 field of all selected tracks with a common tag

Sub LinkTracksInCustom3
  ' Get list of selected tracks from MediaMonkey
  Dim list : Set list = SDB.CurrentSongList
  If list.Count = 0 Then
    Call SDB.MessageBox("No tracks are selected.",mtInformation,Array(mbOk))
    Exit Sub
  End If

  ' Define variables
  Dim i, Tag

  Tag = "LT_"+list.Item(0).AlbumName+"_"+list.Item(0).Title

  ' Process all selected tracks
  For i=0 To list.count-1
    list.Item(i).Custom3 = Tag
  Next

  ' Write all back to DB and update tags
  list.UpdateAll
End Sub
Again, this is for MM2, you might want to make adapt it for MM3 (and for different Custom fields).

What I would like now it to assing a shortcut to a script, it this possible in MM2? in MM3? It would make tagging groups a breeze...

Rycher

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK
Contact:

Re: TiedSongsGroups: lets you make tied groups of songs

Post by trixmoto » Fri Jun 20, 2008 8:28 am

In the "Scripts.ini" file under the "[LinkTracksInCustom3]" section add a line like...

Shortcut=Ctrl+Shift+T

...then restart MM and try it out! :)
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE

rycher
Posts: 129
Joined: Mon Sep 11, 2006 8:24 pm

Re: TiedSongsGroups: lets you make tied groups of songs

Post by rycher » Sat Jun 21, 2008 10:09 am

trixmoto wrote:In the "Scripts.ini" file under the "[LinkTracksInCustom3]" section add a line like...

Shortcut=Ctrl+Shift+T

...then restart MM and try it out! :)
Excellent! Thanks a lot!

Rycher

Post Reply