Hi Everyone,

We'll i'm trying to get my MediaMonkey3 and Squeezebox integrating with
ratings playcounts and playtimes etc. The reason i use both are;
1. MM3 - Has great tagging Facilities (which is important for
Squeececenter)
2. MM3 - Has Brilliant Autoiplylists (Which i use with ratings, genres,
etc)
3. MM3 - Syncs all the above with my Portable players. (Zen vision:m &
Ipod Classic, which both in turn allow me to rate tracks)
4. Squeezbox - Allows me to play my Music anywhere in my house. I have
2 one in my lunge and one in my bedroom.

Now the task ahead is to sync all autoplaylists, ratings, playcounts
and playtimes. I suppose i'll break it up step by step. I've
accomplished quite a bit of these steps, i would like some help trying
to finish of my outstsanding issues. I see this as a bit of a project
and any assistance that can be provided would be great. As i've only
messed around with the most basic of scripts and only then i've used
others scripts and manipulated them.

Like i said earlier any assistance would be of great help, Specifically
Scheduling the script, and creating the script from the psuedo-code
below. I'd say it would take me a while.
In regards to assistance, Ideally if someone who has the knowledge
could knock up the code that would be awesome. Else if people can point
to scripts that do similar things and resources which will help me.

Firstly, Syncing Playlists and Autoplaylists
1. MM3 & Portable players use sync on MM3
2. I've created a playlist node called "A - Squeeze" - This has
playlists in it that i want to use with the Squeezecenter.
3. In Squeezecenter i've set my destination for playlists as
"F:\Playlists\A - Squeeze"
4. Using the Modified Export all m3u's script in Media Monkey  below i
run that to export the playlists within folders in "F:\Playlists\A -
Squeeze", you can see i've hard coded the destinations and playlist
node.

Code: Select all
Option Explicit

Dim path
Dim fso
Dim FSO2

' Recursively process all playlists
Sub GetPlaylists(Playlists, Plst, Prefix)
If Prefix <> "" Then Prefix = Prefix & "\"

Dim SubPlsts : Set SubPlsts = Plst.ChildPlaylists

Dim i, SubPlst, Title
For i = 0 To SubPlsts.Count - 1
Set SubPlst = SubPlsts.Item(i)
Title = Prefix & SubPlst.Title
If Not Playlists.Exists(Title) Then
Playlists.Add Title, SubPlst
End If
GetPlaylists Playlists, SubPlst, Title
Next
End Sub


Sub ExportM3USpecific
Dim iniF : Set iniF = SDB.IniFile
'Insert Path Name In this Line
path = "c:\Squeezebox\Playlists"
If path = "" Then Exit Sub
If Right(path, 1) <> "\" Then path = path & "\"
iniF.StringValue( "Scripts", "LastExportM3UsDir") = path
Set iniF = Nothing

' Connect to the FileSystemObject
Set fso = SDB.Tools.FileSystem
Set FSO2 = CreateObject("Scripting.FileSystemObject")

Dim Playlists : Set Playlists =
CreateObject("Scripting.Dictionary")

' Prepare a list of all playlists And Insert Playlist In
Here
GetPlaylists Playlists, SDB.PlaylistByTitle("By Ratings"),
""

' Go through the list and export each playlist
Dim i, plst, plsts, titles, title, tracks, folder
plsts = playlists.Items
titles = playlists.Keys

For i = 0 To playlists.Count - 1
Set plst = plsts(i)
Set tracks = plst.Tracks
title = Titles(i)

folder = "\"
If Instr(1, title, "\", 1) > 0 Then
folder = Left(title, InstrRev(title, "\", -1, 1))
title = Mid(title, InstrRev(title, "\", -1, 1) +
1)
If Not FSO2.FolderExists(path & folder) Then
FSO2.CreateFolder path & folder
End If
End If

If tracks.Count>0 Then
Call CreateM3UFile(path & folder &
fso.CorrectFilename(title) & ".m3u", tracks)
End If
Next

SDB.MessageBox "Exporting playlists complete.",
mtInformation, Array(mbOK)
End Sub


Sub CreateM3UFile(M3UPath, Tracks)
Dim fOut : Set fOut = fso.CreateTextFile(M3UPath, True)
fOut.WriteLine "#EXTM3U"

Dim i, Track, tLen, tArt, tTit
For i = 0 To Tracks.Count - 1
Set Track = Tracks.Item(i)

tLen = Track.SongLength
tArt = Track.ArtistName
tTit = Track.Title

fOut.WriteLine("#EXTINF:" _
& IIf(tLen>0, tLen \ 1000, "-1") & "," _
& IIf(tArt<>"", IIf(tTit<>"", tArt & " - " &
tTit, tArt), tTit) _
)
fOut.WriteLine Track.Path
Next
fOut.Close
End Sub


Function IIf(Test, rTrue, rFalse)
If Test Then IIf = rTrue Else IIf = rFalse
End Function



5. Ok, So that's the playlists from MM3 into A directory, I've set up
squeezecenter to rescan changes at 5am every day. So it' Picks these
Up.

Outstanding issues for syncing Playlists
I'd Like to run the script above automated using the windows scheduler,
i've had a look around. i just can't find any solid information, Pekes
windows scheduler is geared up for playlists not scripts. How can i
achieve this.

Syncing Ratings, Playcounts and Playtimes
1. Setup Squeezecenter to handle ratings. (This Syncs MM3's rating to
Squeezecenter)
1a- Add plugin "Trackstat" by Erland
1b- Add plugin "Custom Scan" by Erland (Setup Ratings scan option to be
automatic, this will add the ratings into squeezecenter)
2. Sync the ratings and Playtimes and counts from squeezecenter.
2a- Using the Trackstat plugin setup the itunes integration to update
as edited. this creates a txt file with the necessary details to parse
into MM3. I've set mine up to wirite to
"f:\Playlists\Trackstat\TrackStat_iTunes_Hist.txt" the output in this
file is as such;

Code: Select all
Pictures of You [Extended Dub Mix]|||O:\Music\The Cure\Mixed
Up\[Mixed Up]7-The Cure_Pictures of You [Extended Dub
Mix].mp3|played|20081208190833|100
Sun Is Shining|||O:\Music\Various Artists\History of Trojan Records
1968-1971\[History of Trojan Records 1968-1971]19-Bob Marley & the
Wailers_Sun Is Shining.mp3|played|20081208191753|100
Angie|||O:\Music\The Rolling Stones\Forty Licks\[Forty Licks]27-The
Rolling
The Jungle|||O:\Music\Faith No More\We Care a Lot\[We Care a
Lot]2-Faith No More_The Jungle.mp3|rated||60
The Jungle|||O:\Music\Faith No More\We Care a Lot\[We Care a
Lot]2-Faith No More_The Jungle.mp3|played|20081209074549|60



Outstanding issues for syncing Ratings, Played time and Playcounts
This is the important bit, i need to create a script which parses the
above txt file contents into MM3. And I was thinking to add this to the
start of the exporting playlists script at the top. and when all
finished create options to set destinations. However i need to get this
script worked out.

So in getting this script done here is the following Psuedo Code.

Code: Select all
If "f:\Playlists\Trackstat\TrackStat_iTunes_Hist.txt" does not
exist
then end
else
For every line up till end of txt repeat the following.
Is this Song a rating change or played change(Parse txt to check
wether song is played or rated)
Case is -rating change-
if song(use parse to find path) does not exist
than go to next song
else
Change rating (use parse to find)
go to next song
Case is -Played change-
if song(use parse to find path) does not exist
than go to next song
else
Change Played Time (use parse to find)
Increase Playcount
go to next song
End of txt file
then delete "f:\Playlists\Trackstat\TrackStat_iTunes_Hist.txt"
file
Run ExportM3USpecific



We'll that's it, that would sync MM3 with Squeezebox/Squeezecenter and
your Portable Mp3 players. Anyways, i'll keep this thread updated to my
progress, and all you Squeezebox MM3 users, let me know if you already
have something similar, or jump on board and give me a hand.

Kind regards,

Vol.


-- 
Volition
------------------------------------------------------------------------
Volition's Profile: http://forums.slimdevices.com/member.php?userid=5534
View this thread: http://forums.slimdevices.com/showthread.php?t=56114

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/plugins

Reply via email to