Re: mmStations V2.3
Posted: Fri Nov 14, 2008 2:26 pm
The section looks fine, thanks. I found the problem and will update the install package shortly.
Ray
Ray
The Music Manager for Serious Collectors
https://www.mediamonkey.com/forum/
Thanks, that fixed it.raybeau528 wrote:Nyn, found the problem - new version is available in post 1.
Ray
Ray:raybeau528 wrote:Nyn,
Here's a quick a dirty script to copy the Now Playing.
Code: Select all
' ' MediaMonkey Script ' ' NAME: SaveNowPlaying ' ' ' [SaveNowPlaying] ' FileName=SaveNowPlaying.vbs ' ProcName=SaveNowPlaying ' Order=210 ' DisplayName=Save NowPlaying ' Description=Save NowPlaying List to a PlayList ' Language=VBScript ' ScriptType=0 ' ' Option Explicit Sub OnStartup 'Create Save NowPlaying Menu Item Dim itm1 Set itm1 = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_NP,0,0) itm1.Caption = "Save NowPlaying" itm1.OnClickFunc = "SaveNowPlaying" itm1.UseScript = Script.ScriptPath itm1.IconIndex = 18 itm1.Visible = True End Sub 'OnStartup Sub SaveNowPlaying(arg) Dim tree : Set tree = SDB.MainTree Dim SelectedPlayList : Set SelectedPlayList = sdb.playlistbytitle( SDB.MainTree.CurrentNode.caption ) Dim SelectedSongList : Set SelectedSongList = SDB.CurrentSongList Dim NewSongList : Set NewSongList = SDB.NewSongList Dim TopPlayList : Set TopPlaylist = SDB.PlaylistByTitle("") Dim NewPlayList Set NewPlayList = TopPlayList.CreateChildPlaylist("Copy of NowPlaying "&dtnum) If not (NewPlayList is Nothing) Then NewPlayList.Clear End If NewPlayList.AddTracks(SDB.Player.CurrentSongList) End Sub ' Returns a 14 char string which changes every second - should be unique for this application function dtNum() dim y,m,d,h,n,s y = Cstr(DatePart("YYYY",Date)) m = zfill(Cstr(DatePart("m",Date)),2) d = zfill(Cstr(DatePart("d",Date)),2) h = zfill(Cstr(DatePart("h",now)),2) n = zfill(Cstr(DatePart("n",now)),2) s = zfill(Cstr(DatePart("s",Now)),2) dtNum = y & m & d & h & n & s end function ' Left fills with zeros function zfill(s,n) dim i,t t=s while len(t) < n t = "0" & t wend zfill = t end function
I would be content with a startup or shutdown autosave but if you could get it to save every hour or so that would be fantastic.raybeau528 wrote:Nyn,
By timer, do you mean automatically save the nowplaying list every x minutes/seconds ? I can look at saving at startup or shutdown as well.
Ray
Code: Select all
Dim Tmr : Set Tmr = SDB.CreateTimer( 1000*60*60 ) ' 1 hour Timer EnabledCode: Select all
'
' MediaMonkey Script
'
' NAME: SaveNowPlaying
'
'
' [SaveNowPlaying]
' FileName=SaveNowPlaying.vbs
' ProcName=SaveNowPlaying
' Order=210
' DisplayName=Save NowPlaying
' Description=Save NowPlaying List to a PlayList
' Language=VBScript
' ScriptType=0
'
'
Option Explicit
Sub OnStartup 'Create Save NowPlaying Menu Item
Dim itm1
Set itm1 = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_NP,0,0)
itm1.Caption = "Save NowPlaying"
itm1.OnClickFunc = "SaveNowPlaying"
itm1.UseScript = Script.ScriptPath
itm1.IconIndex = 18
itm1.Visible = True
Dim Tmr : Set Tmr = SDB.CreateTimer( 1000*60*60 ) ' 1 hour Timer Enabled
Tmr.Enabled=true
Script.RegisterEvent Tmr, "OnTimer", "SaveNowPlaying"
End Sub 'OnStartup
Sub SaveNowPlaying(arg)
Dim TopPlayList : Set TopPlaylist = SDB.PlaylistByTitle("")
Dim NewPlayList
Set NewPlayList = TopPlayList.CreateChildPlaylist("Copy of NowPlaying "&dtnum)
If not (NewPlayList is Nothing) Then
NewPlayList.Clear
End If
NewPlayList.AddTracks(SDB.Player.CurrentSongList)
End Sub
' Returns a 14 char string which changes every second - should be unique for this application
function dtNum()
dim y,m,d,h,n,s
y = Cstr(DatePart("YYYY",Date))
m = zfill(Cstr(DatePart("m",Date)),2)
d = zfill(Cstr(DatePart("d",Date)),2)
h = zfill(Cstr(DatePart("h",now)),2)
n = zfill(Cstr(DatePart("n",now)),2)
s = zfill(Cstr(DatePart("s",Now)),2)
dtNum = y & m & d & h & n & s
end function
' Left fills with zeros
function zfill(s,n)
dim i,t
t=s
while len(t) < n
t = "0" & t
wend
zfill = t
end function