Squeezebox, MM3, Squeezecenter & ipod / Zen Integration

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Posts: 92
Joined: Sat Jul 08, 2006 4:03 am
Location: Deep South, Mainland Australia.

Re: Squeezebox, MM3, Squeezecenter & ipod / Zen Integration

Post by Volition »

By the way guys here is the code of the script i'm using at the moment. It's not much different but i'm not sure if originally i had fixed the delete file problem.
I also have to manuall go into the history file and delet a whole stack of tracks as i find every time i rescan it fills it up with a list of the whole db. It's easey for me to work out which ones to delete. It does get tiresome, but i haven't made the effort to look into this further.

If anyone knows of a setting to change in sc let me know. Otherwise that is something i need to get fixed on the SC plugin side.

Code: Select all

Option Explicit
'1. Save this text as 'SqueezeSync.vbs' in the Scripts-folder of MediaMonkey
'2. Add this Section to Scripts.ini


'3. Edit the path to your playcounter-file in the code below.
'4. Restart MediaMonkey
'5. You'll find "PlayCountImport" under Tools/Scripts

Public Const path = "z:\harddisk\My Music\Trackstat\TrackStat_iTunes_Hist.txt" 'PUT THE PATH TO YOUR FILE HERE

Sub SqueezeSync
   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)
      Do While Not txt.AtEndOfStream
         str = Trim(txt.ReadLine)
         arr = Split(str,"|")

 'arr(0) is Title
 '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
            		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
         End If
      Set sit = Nothing
    exit sub
   end if
   Call fso.deletefile(path, false)
End sub
Post Reply