Cortinas V1-12
-
raybeau528
- Posts: 401
- Joined: Thu Sep 27, 2007 4:19 pm
- Location: Connecticut
Re: Cortinas V1-4
Nyn does more with playlists than anyone I know so she could have some good ideas for you !
You might also want to look at my Stations script to see if that could help. You could leave all the playlists as they are and use Stations to 'organize' more important or frequently used ones. Just another thought.
Ray
You might also want to look at my Stations script to see if that could help. You could leave all the playlists as they are and use Stations to 'organize' more important or frequently used ones. Just another thought.
Ray
-
Correohs
Re: Cortinas V1-4
Ray
Thanks for asking Nyn, about it and thanks both of you.
I'll give it a try to your Stations script.
Murray
Thanks for asking Nyn, about it and thanks both of you.
I'll give it a try to your Stations script.
Murray
-
raybeau528
- Posts: 401
- Joined: Thu Sep 27, 2007 4:19 pm
- Location: Connecticut
Re: Cortinas V1-5
V1-5 is available which adds ability to select Cortina start time.
Ray
Ray
-
correohs
Re: Cortinas V1-5
Ray:
Invalid File. This error has been forwarded to MediaFire's development team.
Can you try to upload it again?
Thanks
Invalid File. This error has been forwarded to MediaFire's development team.
Can you try to upload it again?
Thanks
-
raybeau528
- Posts: 401
- Joined: Thu Sep 27, 2007 4:19 pm
- Location: Connecticut
Re: Cortinas V1-5
Murray, I'm not sure what the problem is...I was able to download from Mediafire just fine. I tested it. Here's the code. Just copy it to Cortinas.vbs in the mediamonkey\scripts\auto folder (overwrite existing file).
Ray
Ray
Code: Select all
Option Explicit
' MediaMonkey Script
' NAME: Cortinas - Insert Cortinas between song sets
' [eCortinas]
' FileName=Cortinas.vbs
' ProcName=Cortina
' Order=220
' DisplayName=Cortinas
' Description=Insert Cortinas between song sets
' Language=VBScript
' ScriptType=0 Auto Script
' Cortinas.VBS is copied to scripts\auto
' Use Tools/Options/Cortinas to set options:
' - check to randomize the song selection
' - check to randomize the cortinas list
' - set the number of songs per set
' ' set the number of cortinas per song set
' ' specify the playlist that contains the Cortinas
'
' Right-click a selection in the maintracks window and select Cortinas
' The song sets and cortinas will be copied to the Now Playing window
'
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' Init Variables etc. when script is invoked
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
dim ini : set ini = new rbini
If Not ( Ini.ValueExists( "Cortinas", "RandomizeSelection", "" ) ) Then
Ini.BoolValue( "Cortinas", "RandomizeSelection", "" ) = False
End If
If Not ( Ini.ValueExists( "Cortinas", "RandomizeCortinas", "" ) ) Then
Ini.BoolValue( "Cortinas", "RandomizeCortinas", "" ) = False
End If
If Not ( Ini.ValueExists( "Cortinas", "CortinasPlaylistName", "" ) ) Then
Ini.StringValue( "Cortinas", "CortinasPlaylistName", "" ) = "Cortinas"
End If
If Not ( Ini.ValueExists( "Cortinas", "SongsPerSet", "" ) ) Then
Ini.IntValue( "Cortinas", "SongsPerSet", "" ) = 3
End If
If Not ( Ini.ValueExists( "Cortinas", "CortinasPerSet", "" ) ) Then
Ini.IntValue( "Cortinas", "CortinasPerSet", "" ) = 3
End If
If Not ( Ini.ValueExists( "Cortinas", "CortinasTimer", "" ) ) Then
Ini.IntValue( "Cortinas", "CortinasTimer", "" ) = 30
End If
If Not ( Ini.ValueExists( "Cortinas", "CortinasStartTime", "" ) ) Then
Ini.IntValue( "Cortinas", "CortinasStartTime", "" ) = 0
End If
Const iFadeOut = 0
Const iFadeIn = 1
Dim iFadeDirection
Dim iFadeOutCount
Dim iFadeInCount
Dim Volume
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' OnStartup - When MediaMonkey starts
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Sub OnStartup
Dim Menu1 : Set Menu1 = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_Tracklist,0,0)
Menu1.Caption = "Cortina"
Menu1.UseScript = Script.ScriptPath
Menu1.IconIndex = 18
Menu1.Visible = True
SDB.Objects("Menu1") = Menu1
Script.RegisterEvent Menu1, "OnClick", "Cortina"
Dim Menu2 : Set Menu2 = SDB.UI.AddMenuItem(SDB.UI.Menu_Play,0,0)
Menu2.Caption = "Cortinas"
Menu2.UseScript = Script.ScriptPath
Menu2.Visible = True
Menu2.Checked = True
SDB.Objects("Menu2") = Menu2
Script.RegisterEvent Menu2, "OnClick", "Event_StartStopCortina"
Dim Menu3 : Set Menu3 = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_Tree,0,0)
Menu3.Caption = "Cortinas"
Menu3.UseScript = Script.ScriptPath
Menu3.Visible = True
SDB.Objects("Menu3") = Menu3
Script.RegisterEvent Menu3, "OnClick", "Cortina"
Dim Sheet : Sheet = SDB.UI.AddOptionSheet("Cortinas",Script.ScriptPath,"InitSheet","SaveSheet",-3)
' Amount of time to play a Cortina
Dim CortinasTimer : Set CortinasTimer = SDB.CreateTimer ( 1000 * Ini.IntValue( "Cortinas", "CortinasTimer", "" ) )
CortinasTimer.Enabled = False
SDB.Objects("CortinasTimer") = CortinasTimer
Script.RegisterEvent CortinasTimer, "OnTimer", "Event_PlayNext"
' Time interval between volume change down
Dim FadeOut_Timer : Set FadeOut_Timer = SDB.CreateTimer ( 1000 * .25)
FadeOut_Timer.Enabled = False
SDB.Objects("FadeOut_Timer") = FadeOut_Timer
Script.RegisterEvent FadeOut_Timer, "OnTimer", "Event_FadeOut"
'Time interval between volume change up
Dim FadeIn_Timer : Set FadeIn_Timer = SDB.CreateTimer ( 1000 * .25)
FadeIn_Timer.Enabled = False
SDB.Objects("FadeIn_Timer") = FadeIn_Timer
Script.RegisterEvent FadeIn_Timer, "OnTimer", "Event_FadeIn"
' Time interval between Cortina finishes fade-out and next track starts
Dim Gap_Timer : Set Gap_Timer = SDB.CreateTimer ( 1000 * 3)
Gap_Timer.Enabled = False
SDB.Objects("Gap_Timer") = Gap_Timer
Script.RegisterEvent Gap_Timer, "OnTimer", "Event_Gap"
Script.RegisterEvent SDB, "OnPlay", "Event_OnPlay"
End Sub
Sub Event_StartStopCortina(arg)
If SDB.Objects("Menu2").Checked Then
SDB.Objects("Menu2").Checked = False
Script.UnRegisterEvents SDB
SDB.Objects("Menu1").Visible=False
SDB.Objects("Menu3").Visible=False
Else
SDB.Objects("Menu2").Checked = True
SDB.Objects("Menu1").Visible=True
SDB.Objects("Menu3").Visible=True
Script.RegisterEvent SDB, "OnPlay", "Event_Play"
End If
End Sub
Sub Cortina(arg)
Dim i,j,n,m,o,a,b
Dim clist : Set cList = SDB.CurrentSongList
Dim CortinasPlayListName : CortinasPlayListName = _
Ini.StringValue( "Cortinas", "CortinasPlaylistName", "" )
Dim SongsPerSet : SongsPerSet = Ini.IntValue( "Cortinas", "SongsPerSet", "" )
Dim RandomizeSelection : RandomizeSelection = Ini.BoolValue( "Cortinas", "RandomizeSelection", "" )
Dim CortinasPerSet : CortinasPerSet = Ini.IntValue( "Cortinas", "CortinasPerSet", "" )
Dim RandomizeCortinas : RandomizeCortinas = Ini.BoolValue( "Cortinas", "RandomizeCortinas", "" )
Dim pList : Set pList = sdb.playlistbytitle( CortinasPlayListName )
If pList.Title <> CortinasPlayListName Then
MsgBox("Cortinas PlayList: " & CortinasPlayListName & " Does Not Exist" )
Exit Sub
End If
If pList.Tracks.Count = 0 Then
MsgBox("The Cortinas PlayList is Empty")
Exit Sub
End If
If cList.Count = 0 Then
MsgBox("No Tracks Selected")
Exit Sub
End If
SDB.PLAYER.PlayListClear
redim a(cList.count-1)
redim b(pList.tracks.count-1)
' Create an array of sequential integers
for i=0 to Ubound(a)
a(i)=i
Next
for i=0 to Ubound(b)
b(i)=i
Next
' Randomize the array of integers
If RandomizeSelection Then
a = arandom(a)
End If
If RandomizeCortinas Then
b = arandom(b)
End If
n=0
For i = 0 to clist.count -1 step SongsPerSet
For j = i to i+SongsPerSet-1
If j < clist.count Then
sdb.player.playlistaddtrack(clist.item(a(j)) )
End If
Next
For m = 1 to CortinasPerSet
If n > Plist.Tracks.count - 1 Then
n=0
If RandomizeCortinas Then
b = arandom(b)
End If
End If
SDB.Player.PlayListAddTrack(Plist.tracks.Item(b(n)))
N=n+1
Next
Next
End Sub
Sub Event_OnPlay()
' Enter here at start of every track to check if Cortina track
Dim iTID, iPID
Dim sCortinasPlaylist, oCortinasPlaylist
If Ini.IntValue( "Cortinas", "CortinasTimer", "" ) = 0 Then
Exit Sub
End If
SDB.Objects("CortinasTimer").Interval = 1000 * Ini.IntValue( "Cortinas", "CortinasTimer", "" )
sCortinasPlaylist = Ini.StringValue( "Cortinas", "CortinasPlaylistName", "" )
Set oCortinasPlayList = SDB.PlayListByTitle( sCortinasPlaylist )
iPID = oCortinasPlaylist.ID
iTID = SDB.Player.CurrentSong.ID
If Not ExistsTrackInPlayList( iTID, iPID ) Then
SDB.Objects("CortinasTimer").Enabled=False
Exit Sub
End If
If Ini.IntValue( "Cortinas", "CortinasStartTime", "" ) > 0 Then
Volume=sdb.player.volume
Sdb.Player.Volume= 0
sdb.player.playbacktime = 1000 * Ini.IntValue( "Cortinas", "CortinasStartTime", "" )
iFadeInCount = 10
SDB.Objects("FadeIn_Timer").Enabled = True
Else
SDB.Objects("CortinasTimer").Enabled=True
End If
End Sub
Sub Event_PlayNext(arg)
' Enter here when the Cortinas timer expired
' Fade out the Cortina
' Start the gap timer then play next track
SDB.Objects("CortinasTimer").Enabled=False
iFadeOutCount = 10
Volume = SDB.Player.Volume
SDB.Objects("FadeOut_Timer").Enabled=True
End Sub
Sub Event_FadeIn( arg )
If iFadeInCount > 0 Then
SDB.Player.Volume = SDB.Player.Volume + Volume/10
iFadeInCount = iFadeInCount - 1
Else
SDB.Player.Volume = Volume
SDB.Objects("FadeIn_Timer").Enabled=False
SDB.Objects("CortinasTimer").Enabled=True
End If
End Sub
Sub Event_FadeOut ( arg )
If iFadeOutCount > 0 Then
SDB.Player.Volume = SDB.Player.Volume - Volume/10
iFadeOutCount = iFadeOutCount -1
Else
SDB.Objects("FadeOut_Timer").Enabled = False
SDB.Player.stop
SDB.Player.Volume = Volume
SDB.Objects("Gap_Timer").Enabled = True
End If
End Sub
Sub Event_Gap( arg )
SDB.Objects("Gap_Timer").Enabled = False
SDB.Player.Next
SDB.Player.Play
End Sub
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' Option Sheets
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Sub InitSheet(Sheet)
dim ini : set ini = new rbini
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Form created by mmForms - raybeau528
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim Form1 : Set Form1 = SDB.UI.NewGroupBox(Sheet)
Form1.Common.ControlName = ""
Form1.Common.SetRect 0,0,475,150
Form1.Common.Visible = True
Form1.Caption = "Options for Cortinas"
Dim CheckBox1 : Set CheckBox1 = SDB.UI.NewCheckBox(Form1)
CheckBox1.Common.ControlName = "CheckBox1"
CheckBox1.Common.SetRect 10,20,150,21
CheckBox1.Common.Hint = "Randomize Selection"
CheckBox1.Common.Visible = True
CheckBox1.Caption = "Randomize Selection"
CheckBox1.Checked = False
Dim CheckBox2 : Set CheckBox2 = SDB.UI.NewCheckBox(Form1)
CheckBox2.Common.ControlName = "CheckBox2"
CheckBox2.Common.SetRect 200,20,150,21
CheckBox2.Common.Hint = ""
CheckBox2.Common.Visible = True
CheckBox2.Caption = "Randomize Cortinas"
CheckBox2.Checked = False
Dim SpinEdit1 : Set SpinEdit1 = SDB.UI.NewSpinEdit(Form1)
SpinEdit1.Common.ControlName = "SpinEdit1"
SpinEdit1.Common.SetRect 10,50,40,21
SpinEdit1.MinValue = 1
SpinEdit1.MaxValue = 10
SpinEdit1.Value = 3
SpinEdit1.Common.Hint = ""
SpinEdit1.Common.Visible = True
Dim Label2 : Set Label2 = SDB.UI.NewLabel(Form1)
Label2.Common.ControlName = "Label2"
Label2.Common.SetRect 70,50,130,21
Label2.Common.Hint = ""
Label2.Common.Visible = True
Label2.Caption = "Songs per Set"
Dim SpinEdit2 : Set SpinEdit2 = SDB.UI.NewSpinEdit(Form1)
SpinEdit2.Common.ControlName = "SpinEdit2"
SpinEdit2.Common.SetRect 200,50,40,21
SpinEdit2.MinValue = 1
SpinEdit2.MaxValue = 3
SpinEdit2.Value = 1
SpinEdit2.Common.Hint = ""
SpinEdit2.Common.Visible = True
Dim Label3 : Set Label3 = SDB.UI.NewLabel(Form1)
Label3.Common.ControlName = "Label3"
Label3.Common.SetRect 250,50,130,21
Label3.Common.Hint = ""
Label3.Common.Visible = True
Label3.Caption = "Cortinas per Set"
Dim Edit1 : Set Edit1 = SDB.UI.NewEdit(Form1)
Edit1.Common.ControlName = "Edit1"
Edit1.Common.SetRect 200,80,200,21
Edit1.Common.Hint = ""
Edit1.Text = "Cortinas"
Edit1.Common.Visible = True
Dim Label1 : Set Label1 = SDB.UI.NewLabel(Form1)
Label1.Common.ControlName = "Label1"
Label1.Common.SetRect 10,80,150,21
Label1.Common.Hint = ""
Label1.Common.Visible = True
Label1.Caption = "Cortinas Playlist Name"
Label1.AutoSize = "True"
Dim SpinEdit3 : Set SpinEdit3 = SDB.UI.NewSpinEdit(Form1)
SpinEdit3.Common.ControlName = "SpinEdit3"
SpinEdit3.Common.SetRect 200,110,40,21
SpinEdit3.MinValue = 0
SpinEdit3.MaxValue = 60
SpinEdit3.Value = 30
SpinEdit3.Common.Hint = ""
SpinEdit3.Common.Visible = True
Dim Label4 : Set Label4 = SDB.UI.NewLabel(Form1)
Label4.Common.ControlName = "Label4"
Label4.Common.SetRect 250,110,130,21
Label4.Common.Hint = ""
Label4.Common.Visible = True
Label4.Caption = "Cortinas Play Time"
Dim SpinEdit4 : Set SpinEdit4 = SDB.UI.NewSpinEdit(Form1)
SpinEdit4.Common.ControlName = "SpinEdit4"
SpinEdit4.Common.SetRect 10,110,40,21
SpinEdit4.MinValue = 0
SpinEdit4.MaxValue = 360
SpinEdit4.Value = 30
SpinEdit4.Common.Hint = ""
SpinEdit4.Common.Visible = True
Dim Label5 : Set Label5 = SDB.UI.NewLabel(Form1)
Label5.Common.ControlName = "Label5"
Label5.Common.SetRect 70,110,130,21
Label5.Common.Hint = ""
Label5.Common.Visible = True
Label5.Caption = "Cortinas Start Time"
If Not ( Ini.ValueExists( "Cortinas", "RandomizeSelection", "" ) ) Then
Ini.BoolValue( "Cortinas", "RandomizeSelection", "" ) = False
End If
CheckBox1.Checked = Ini.BoolValue( "Cortinas", "RandomizeSelection", "" )
If Not ( Ini.ValueExists( "Cortinas", "RandomizeCortinas", "" ) ) Then
Ini.BoolValue( "Cortinas", "RandomizeCortinas", "" ) = False
End If
CheckBox2.Checked = Ini.BoolValue( "Cortinas", "RandomizeCortinas", "" )
If Not ( Ini.ValueExists( "Cortinas", "CortinasPlaylistName", "" ) ) Then
Ini.StringValue( "Cortinas", "CortinasPlaylistName", "" ) = "Cortinas"
End If
Edit1.Text = Ini.StringValue( "Cortinas", "CortinasPlaylistName", "" )
If Not ( Ini.ValueExists( "Cortinas", "SongsPerSet", "" ) ) Then
Ini.IntValue( "Cortinas", "SongsPerSet", "" ) = 3
End If
SpinEdit1.Value = Ini.IntValue( "Cortinas", "SongsPerSet", "" )
If Not ( Ini.ValueExists( "Cortinas", "CortinasPerSet", "" ) ) Then
Ini.IntValue( "Cortinas", "CortinasPerSet", "" ) = 3
End If
SpinEdit2.Value = Ini.IntValue( "Cortinas", "CortinasPerSet", "" )
If Not ( Ini.ValueExists( "Cortinas", "CortinasTimer", "" ) ) Then
Ini.IntValue( "Cortinas", "CortinasTimer", "" ) = 30
End If
SpinEdit3.Value = Ini.IntValue( "Cortinas", "CortinasTimer", "" )
If Not ( Ini.ValueExists( "Cortinas", "CortinasStartTime", "" ) ) Then
Ini.IntValue( "Cortinas", "CortinasStartTime", "" ) = 0
End If
SpinEdit4.Value = Ini.IntValue( "Cortinas", "CortinasStartTime", "" )
End Sub
Sub SaveSheet(Sheet)
Ini.BoolValue( "Cortinas", "RandomizeSelection", "" ) = Sheet.Common.ChildControl("CheckBox1").Checked
Ini.BoolValue( "Cortinas", "RandomizeCortinas", "" ) = Sheet.Common.ChildControl("CheckBox2").Checked
Ini.StringValue( "Cortinas", "CortinasPlaylistName", "" ) = Sheet.Common.ChildControl("Edit1").Text
Ini.IntValue( "Cortinas", "SongsPerSet", "" ) = Sheet.Common.ChildControl("SpinEdit1").Value
Ini.IntValue( "Cortinas", "CortinasPerSet", "" ) = Sheet.Common.ChildControl("SpinEdit2").Value
Ini.IntValue( "Cortinas", "CortinasTimer", "" ) = Sheet.Common.ChildControl("SpinEdit3").Value
Ini.IntValue( "Cortinas", "CortinasStartTime", "" ) = Sheet.Common.ChildControl("SpinEdit4").Value
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' End of Form
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' Menus
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' Forms and Panels
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' Data Mapping
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' Standard Routines and Data Structures
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' Dictionary / Array Functions
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function OrderedItems(zDic)
OrderedItems = zDic.Items
End Function
Function OrderedKeys(zDic)
OrderedKeys=zDic.Keys
End Function
Function SortedKeys(zDic)
Dim a
a = OrderedKeys(zDic)
SortedKeys = Sort(a)
End Function
Function getKeybyIndex( zDic, zIndex )
Dim zArray : zArrary = OrderedKeys(zDic)
If zIndex < 0 or zIndex > Ubound(zArrary) Then
getKeybyIndex = -1
Else
getKeybyIndex = zArray(index)
End If
End Function
Function getItembyKey ( zDic, zKey )
getItembyKey = zDic.Item(zKey)
End Function
Function addItembyKey ( zDic, zKey, zItem )
If Not ( zDic.Exists( zKey ) ) Then
Call zdic.Add( zKey ,zItem )
addItembyKey = 1
Else
addItembyKey = -1
End If
End Function
Function DeleteItemByKey ( zDic, zKey )
If Not ( zDic.Exists( zKey ) ) Then
DeleteItembyKey = -1
Else
Call zdic.Remove( zKey )
DeleteItembyKey = 1
End If
End Function
' Simple Bubble Sort - could add a second param to indicate Ascending or Descending
Function sort(a)
Dim i,j,temp,myArray
myArray=a
for i = UBound(myArray) - 1 To 0 Step -1
for j= 0 to i
if myArray(j)>myArray(j+1) then ' change to >
temp=myArray(j+1)
myArray(j+1)=myArray(j)
myArray(j)=temp
end if
next
next
sort=myArray
End Function ' Sort
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' Tree Functions
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function GoToNode( zPath, zDelim )
Dim aPath : aPath = split( zPath, zDelim )
Dim i,oToNode
GoToNode = -1
Set oToNode= sdb.maintree.node_NowPlaying
For i = 0 to Ubound(aPath)
Do while Trim(aPath(i)) <> Trim(oToNode.Caption)
If SDB.MainTree.NextSiblingNode(oToNode) is Nothing Then
Exit Function
End IF
Set oToNode = SDB.MainTree.NextSiblingNode(oToNode)
Loop
If i < Ubound(a) Then
oToNode.expanded=true
Set oToNode = SDB.MainTree.FirstChildNode(oToNode)
End If
Next
Set SDB.MainTree.CurrentNode = GoToNode
GoToNode = 1
End Function
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' String Functions
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function qs(z)
qs = chr(34)&z&chr(34)
End Function
Function myJoin(a,d)
Dim i,s
S=""
For i=0 to Ubound(a)
If a(i)<>"" Then
If s="" Then
s=Trim(a(i))
Else
s=s&d&Trim(a(i))
End If
End If
Next
myJoin=s
End Function ' myJoin
' Return Array with elements trimmed and if token exists remove else add it
Function mySplitWithRemove(s,d,t)
Dim a,i,x,z
x=False
a=split(s,d)
for i=0 to Ubound(a)
if Trim(a(i))=Trim(t) Then
a(i)=""
x=True
End If
Next
If x Then
MySplitWithRemove=Split(myJoin(a,d),d)
Else
MySplitWithRemove=Split(myJoin(a,d) & d & t,d)
End If
End Function 'mySplit
Function aRandom(a)
' Randomize Array
Dim i,j,r,temp,myArray
myArray=a
Randomize
for i = 0 to Ubound(myArray)
r=int(rnd*(Ubound(myArray)))
temp=myArray(i)
myArray(i)=myArray(r)
myArray(r)=temp
next
aRandom=myArray
End Function
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' Test Functions
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function notEmptyorNull(z1)
If not (isNull(z1) or isEmpty(z1)) Then
notEmptyorNull=z1
Else
notEmptyorNull = Null
End If
End Function
Function ExistsTrackInPlayList( iTID, iPID )
If SDB.Database.OpenSQL("SELECT * FROM PlaylistSongs WHERE PlaylistSongs.IDSong = " & iTID & " AND PlaylistSongs.IDPlaylist = " & iPID).EOF Then
'Not In Playlist
ExistsTrackinPLaylist = False
else
'In Playlist
ExistsTrackinPLaylist = True
End If
End Function
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' Data Mapping
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' Numeric Functions
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function Max(number1, number2)
If number1 > number2 Then
Max = number1
Else
Max = number2
End If
end function
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' Data Structures and Classes
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Class rbIni
Property Get StringValue ( zSection, zKey, zFile )
Dim inif : Set inif = SDB.IniFile
If not (zFile = "") Then
StringValue = SDB.Tools.IniFileByPath(zFile).StringValue(zSection,zKey)
Else
StringValue = SDB.IniFile.StringValue(zSection,zKey)
End If
Set inif = Nothing
End Property
Property Let StringValue ( zSection, zKey, zFile, zString )
Dim inif : Set inif = SDB.IniFile
If not (zFile = "") Then
SDB.Tools.IniFileByPath( zFile ).StringValue( zSection, zKey ) = zString
Else
SDB.IniFile.StringValue( zSection, zKey ) = zString
'Call SDB.IniFile.Flush()
End If
Set inif = Nothing
End Property
Property Get IntValue ( zSection, zKey, zFile )
Dim inif : Set inif = SDB.IniFile
If not (zFile = "") Then
IntValue= SDB.Tools.IniFileByPath( zFile ).IntValue( zSection, zKey )
Else
IntValue = SDB.IniFile.IntValue( zSection, zKey )
End If
Set inif = Nothing
End Property
Property Let IntValue ( zSection, zKey, zFile, zInt )
Dim inif : Set inif = SDB.IniFile
If not (zFile = "") Then
SDB.Tools.IniFileByPath( zFile ).IntValue( zSection, zKey ) = zInt
Else
SDB.IniFile.IntValue( zSection, zKey ) = zInt
'Call SDB.IniFile.Flush()
End If
Set inif = Nothing
End Property
Property Get BoolValue ( zSection, zKey, zFile )
Dim inif : Set inif = SDB.IniFile
If not (zFile = "") Then
BoolValue= SDB.Tools.IniFileByPath( zFile ).BoolValue( zSection, zKey )
Else
BoolValue = SDB.IniFile.BoolValue( zSection, zKey )
End If
Set inif = Nothing
End Property
Property Let BoolValue ( zSection, zKey, zFile, zInt )
Dim inif : Set inif = SDB.IniFile
If not (zFile = "") Then
SDB.Tools.IniFileByPath( zFile ).BoolValue( zSection, zKey ) = zInt
Else
SDB.IniFile.BoolValue( zSection, zKey ) = zInt
'Call SDB.IniFile.Flush()
End If
Set inif = Nothing
End Property
Property Get ValueExists ( zSection, zKey, zFile )
Dim inif : Set inif = SDB.IniFile
If not (zFile = "") Then
ValueExists= SDB.Tools.IniFileByPath( zFile ).ValueExists( zSection, zKey )
Else
ValueExists = SDB.IniFile.ValueExists( zSection, zKey )
End If
Set inif = Nothing
End Property
Sub DeleteSection( zSection, zFile )
Dim inif : Set inif = SDB.IniFile
If not (zFile = "") Then
Call SDB.Tools.IniFileByPath( zFile ).DeleteSection( zSection )
Else
Call SDB.IniFile.DeleteSection( zSection )
'Call SDB.IniFile.Flush()
End If
Set inif = Nothing
End Sub
Sub DeleteKey( zSection, zKey, zFile )
Dim inif : Set inif = SDB.IniFile
If not (zFile = "") Then
Call SDB.Tools.IniFileByPath( zFile ).DeleteKey( zSection, zKey )
Else
Call SDB.IniFile.DeleteKey( zSection, zKey )
'Call SDB.IniFile.Flush()
End If
Set inif = Nothing
End Sub
Property Get Keys( zSection, zFile )
Dim inif : Set inif = SDB.IniFile
If not (zFile = "") Then
Set Keys = SDB.Tools.IniFileByPath( zFile ).Keys( zSection )
Else
Set Keys = SDB.IniFile.Keys( zSection )
End If
Set inif = Nothing
End Property
Property Get Sections( zFile )
Dim inif : Set inif = SDB.IniFile
If not (zFile = "") Then
Set Sections = SDB.Tools.IniFileByPath( zFile ).Sections
Else
Set Sections = SDB.IniFile.Sections
End If
Set inif = Nothing
End Property
End Class
Class rbKey
' Returns a unique (sequential) 4 digit - zero-filled integer
Private Key
Private z
Private Sub Class_Initialize()
Key = 0
End Sub
Public Function Create()
Key = Key + 1
z=Cstr(Key)
While len(z) < 4
z= "0" & z
Wend
Create = z
End Function
End Class
Class rbID
' Returns a unique (sequential) integer beginning with 1
Private ID
Private z
Private Sub Class_Initialize()
ID = 0
End Sub
Public Function Create()
ID = ID + 1
Create = iD
End Function
End Class
Class rbDelta
' Returns + or - 1
Private InitialValue
Private LastValue
Public Function initDelta(z)
InitialValue = z
LastValue = z
'msgbox("Delta init to: " & lastvalue)
End Function
Public Function GetDelta(z)
If z > lastvalue Then
GetDelta = 1
LastValue=z
ElseIF z < LastValue Then
GetDelta = -1
LastValue=z
End If
End Function
End Class
Sub Install()
Dim inip : inip = SDB.ApplicationPath&"Scripts\Scripts.ini"
Dim inif : Set inif = SDB.Tools.IniFileByPath(inip)
If Not (inif Is Nothing) Then
inif.StringValue("Cortinas","Filename") = "Auto\Cortinas.vbs"
inif.StringValue("Cortinas","Procname") = "Cortina"
inif.StringValue("Cortinas","Order") = "50"
inif.StringValue("Cortinas","DisplayName") = "Cortinas"
inif.StringValue("Cortinas","Description") = "Insert Cortinas between song sets"
inif.StringValue("Cortinas","Language") = "VBScript"
inif.StringValue("Cortinas","ScriptType") = "0"
SDB.RefreshScriptItems
End If
Call OnStartup()
End Sub
-
correohs
Re: Cortinas V1-5
Ray:
Finally I download it from the website. I dont know why it didnt work.
-------------- Excellent !!!! ---------------------------------------------
Small details.
Cortina Fadein. Can it has same time than the cortina fade out?
The Cortina Fadeout time is perfect!
Couple nice details.
Set those option on the Option Dialog box:
- Fade in Time: Default time the current Cortina Fadeout
- Fade out time: Default time the current Cortina Fadeout
- Wating time: Default the current time. that is also perfect ! (before to start playing the first track of the Master list set.)
Murray
Finally I download it from the website. I dont know why it didnt work.
-------------- Excellent !!!! ---------------------------------------------
Small details.
Cortina Fadein. Can it has same time than the cortina fade out?
The Cortina Fadeout time is perfect!
Couple nice details.
Set those option on the Option Dialog box:
- Fade in Time: Default time the current Cortina Fadeout
- Fade out time: Default time the current Cortina Fadeout
- Wating time: Default the current time. that is also perfect ! (before to start playing the first track of the Master list set.)
Murray
-
raybeau528
- Posts: 401
- Joined: Thu Sep 27, 2007 4:19 pm
- Location: Connecticut
Re: Cortinas V1-5
This is how the current timing is set:
When a track starts playing an event is called to check if it's a Cortina - If not, it just keeps playing as normal
If it's a Cortina then it checks if the Cortina Play Time is 0 and if it is then it just exits the routine and continues playing.
If it's not 0 then it checks if the Cortina Start Time is 0. If it's 0 then it just continues playing.
If the Cortina Start time is > 0 then it:
- Sets the volume to 0
- Jumps to the start time
- ??? 3 Second Gap here ??? (pause/stop for 3 seconds? )
- starts fading in the volume (this takes 2.5 seconds) (10 steps at .25 seconds per step to make it somewhat smooth)
- At this time a timer is enabled for the duration of the Cortina play time (so from start of the track you actually have
2.5 seconds for fade-in plus the Cortina play time)
When the Cortina Play Time finishes, it fades out for the same 2.5 seconds as the fade-in. It then starts what I call a Gap Timer which is set for 3 seconds after which the next track starts playing. That makes a total of 5.5 seconds from the time the Cortina starts the fade-out to the time the next track starts playing.
So the question is, do you want a 3 second gap of silence (pause cortina track) where I indicated? And do you want this gap even if the Cortina starts at the beginning and not in the middle ?
Ray
When a track starts playing an event is called to check if it's a Cortina - If not, it just keeps playing as normal
If it's a Cortina then it checks if the Cortina Play Time is 0 and if it is then it just exits the routine and continues playing.
If it's not 0 then it checks if the Cortina Start Time is 0. If it's 0 then it just continues playing.
If the Cortina Start time is > 0 then it:
- Sets the volume to 0
- Jumps to the start time
- ??? 3 Second Gap here ??? (pause/stop for 3 seconds? )
- starts fading in the volume (this takes 2.5 seconds) (10 steps at .25 seconds per step to make it somewhat smooth)
- At this time a timer is enabled for the duration of the Cortina play time (so from start of the track you actually have
2.5 seconds for fade-in plus the Cortina play time)
When the Cortina Play Time finishes, it fades out for the same 2.5 seconds as the fade-in. It then starts what I call a Gap Timer which is set for 3 seconds after which the next track starts playing. That makes a total of 5.5 seconds from the time the Cortina starts the fade-out to the time the next track starts playing.
So the question is, do you want a 3 second gap of silence (pause cortina track) where I indicated? And do you want this gap even if the Cortina starts at the beginning and not in the middle ?
Ray
-
correohs
Re: Cortinas V1-5
Ray:
The script works great!
I'd like to adjust some small details. that's all
lets focus just on the cortina track. and the events that happen when the script detect that is a cortina track.
When the cortina track is detected the script:
1- jump to " cortina start time " ( that is great! and work well.)
2- script set volume = 0
3- start playing the track
4- volume goes up to the original setting
5- script play the track for 'Cortina Play Time'
6- Volume decreased until Zero
7- Jump to Next song
Right?
Between point 2 and 3, can the script wait for 2 ??? before start playing?
Murray
------------------------------------------------------------------------------------------------------------------------------------------
Later I can try to explain you again the Cortina Dialog Box.
The script works great!
I'd like to adjust some small details. that's all
lets focus just on the cortina track. and the events that happen when the script detect that is a cortina track.
When the cortina track is detected the script:
1- jump to " cortina start time " ( that is great! and work well.)
2- script set volume = 0
3- start playing the track
4- volume goes up to the original setting
5- script play the track for 'Cortina Play Time'
6- Volume decreased until Zero
7- Jump to Next song
Right?
Between point 2 and 3, can the script wait for 2 ??? before start playing?
Murray
------------------------------------------------------------------------------------------------------------------------------------------
Later I can try to explain you again the Cortina Dialog Box.
-
correohs
Re: Cortinas V1-5
Ray:
I reviewed the procedures.
forget about my last post.
No more changes for now. the script is running GREAT!
Thank you a lot !
Murrayhs
I reviewed the procedures.
forget about my last post.
No more changes for now. the script is running GREAT!
Thank you a lot !
Murrayhs
-
raybeau528
- Posts: 401
- Joined: Thu Sep 27, 2007 4:19 pm
- Location: Connecticut
Re: Cortinas V1-6
Well, I was already working on a new version V1-6 allows you to set the fade-in and fade-out time. Check it out.
Ray
Ray
-
correohs
Re: Cortinas V1-6
Ray:
Nice Job!
But I found an error ( no big deal ) (we are debugging the script, right?)
Follow these steps:
First set Cortina OFF:
Select and Play a playlist that is also the one selected at the Cortina Dialog box Options to use as a Cortina Playlist.
Turn the Cortina ON:
Change setting such as Cortina Time and modify the starting point, fade-in and fade-out time and the others settings
then accept it, or apply it.
You should get an error. If you can not re-produce the error, I’ll send you details later. I’m away from my Media Monkey PC.
When Cortina is OFF I didn’t get any error message.
Conclusion:
Can you add a new option?
The option to play just the Cortina Play-List, same one that the user already set at the Cortina Dialog Box and, use the setting that already works well when a "Master" list is present. (The same script can be uses to previewing the tracks to create a dynamic atmosphere)
Have a nice day!
Murray
Nice Job!
But I found an error ( no big deal ) (we are debugging the script, right?)
Follow these steps:
First set Cortina OFF:
Select and Play a playlist that is also the one selected at the Cortina Dialog box Options to use as a Cortina Playlist.
Turn the Cortina ON:
Change setting such as Cortina Time and modify the starting point, fade-in and fade-out time and the others settings
then accept it, or apply it.
You should get an error. If you can not re-produce the error, I’ll send you details later. I’m away from my Media Monkey PC.
When Cortina is OFF I didn’t get any error message.
Conclusion:
Can you add a new option?
The option to play just the Cortina Play-List, same one that the user already set at the Cortina Dialog Box and, use the setting that already works well when a "Master" list is present. (The same script can be uses to previewing the tracks to create a dynamic atmosphere)
What do you think about it?Choose a Play-List and play it
if Play-list playing is = to the one selected at the Cortina Dialog Box Options AND Cortina is ON
let it use the Cortina Settings.
Have a nice day!
Murray
-
raybeau528
- Posts: 401
- Joined: Thu Sep 27, 2007 4:19 pm
- Location: Connecticut
Re: Cortinas V1-6
Murray, I'll see if I can duplicate the problem. Regarding the request, if I understand you correctly, it does that already. That is, if you select the Cortina playlist and click Play Now, and Cortina is enabled, then every track will have the Cortina settings applied to it - jump to start point, fade-in, fade-out, and only play for the duration of the play time set. I use it that way for testing.
Ray
Ray
-
raybeau528
- Posts: 401
- Joined: Thu Sep 27, 2007 4:19 pm
- Location: Connecticut
Re: Cortinas V1-6
Murray, I did get an error following your steps. Was it "Error executing script" ? I think I know what might cause that.
Ray
Ray