In an effort to sync MediaMonkey to Squeezecenter. I need to workout how to run the script below from Squeezecenter. I know that this script is being run however, i am getting no action. I also no the script works as i've run it with minor variable changes as a script within Mediamonkey.
What needs to be done to get it to work. I need to run this from a PERL script in another program. I don't want to Have MM open either.
Code: Select all
Option Explicit
Sub SqueezeSync(path)
Dim str, arr, songpath, sit, itm, playdate, newrate, pldat, propdat
Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
if fso.FileExists(path) then
Dim txt : Set txt = fso.OpenTextFile(path,1,False)
SDB.Database.BeginTransaction
Do While Not txt.AtEndOfStream
SDB.ProcessMessages
str = Trim(txt.ReadLine)
arr = Split(str,"|")
'arr(0) is Title
'arr(1)
'arr(2)
'arr(3) is SongPath
'arr(4) is Played or Rated
'arr(5) is Date in this format 20081209074549 yyyymmddhhmmss
'arr(6) is Rating
songpath = Mid(arr(3),2)
newrate = arr(6)
Set sit = SDB.Database.QuerySongs("AND (Songs.SongPath = '"&Replace(songpath,"'","''")&"')")
If Not (sit.EOF) Then
Set itm = sit.Item
if arr(4) = "rated" then
itm.rating = newrate
else
itm.Playcounter = itm.Playcounter + 1
pldat = arr(5)
propdat = Left(pldat, 4) & "-" & Mid(pldat, 5, 2) & "-" & Mid(pldat, 7, 2) & " " & mid(pldat, 9, 2) & ":" & mid(pldat, 11, 2) & ":" & right(pldat, 2)
playdate = FormatDateTime(propdat)
if DateValue(itm.LastPlayed) < DateValue(playdate) then
itm.LastPlayed = playdate
end if
end if
itm.UpdateDB
End If
Loop
Set sit = Nothing
SDB.Database.Commit
else
exit sub
end if
End sub
I have to acknowledge the help of Erland Isaksson, who has written the Squeezecenter plugin to hang this off. Thanks kindly.
Any help would get me my dream of Squeezecenter, Mediamonkey & ipod syncronization, automated. Woohoo. Then i can move on to World Domination of course.