
Moderator: Gurus
(*
*)
on readFile(unixPath)
set foo to (open for access (POSIX file unixPath))
set txt to (read foo for (get eof foo))
close access foo
return txt
end readFile
-- Where all the playlists are
set playlistFolder to choose folder with prompt "Please choose the folder containing the Playlists"
set playlistFiles to my getPlaylistNames(playlistFolder)
--
--
--set root to playlistFolder as string
set addCount to 0
set playlistcount to count of playlistFiles
repeat with i from 1 to the playlistcount
-- the filename
set theFile to item i of playlistFiles
-- build the playlist name
set theName to my nameOf(POSIX path of theFile)
display dialog "Playlist to import " & theName giving up after 1
-- find or create the playlist in iTunes
tell application "iTunes"
try
set new_playlist to (some playlist whose name is theName)
on error errmesg number errn
--display dialog errmesg & return & return & "error number: " & ¬
(errn as text)
log "Create " & theName
set new_playlist to (make new user playlist with properties {name:theName})
end try
end tell
-- read the file contents
set thecontents to my readFile(POSIX path of theFile)
set thelines to every paragraph of thecontents
set thePathCount to my checkLInes(thelines)
-- loop through the lines
tell application "iTunes"
set i to 1
-- Get the list of tracks
set theTracks to (get a reference to every track of new_playlist)
set k to count of items of theTracks
--display dialog k
--display dialog thePathCount
if not k = thePathCount then
repeat with j from 1 to the count of thelines
set thetrack to (item j of thelines) as string
if not thetrack = "" then
set thetrack to POSIX path of (playlistFolder) & thetrack
repeat while (i ≤ k)
-- Find the path on this track
set theLocation to (location of (item i of theTracks)) as text
set theLocation to POSIX path of theLocation
--log i & k
--log thetrack & " " & theLocation
-- compare the new and old location
if not theLocation = thetrack then
-- remove the offending track
log "delete " & i & theLocation
delete item i of theTracks
set k to k - 1
else
exit repeat
end if
end repeat
if not (i ≤ k) then
try
set thetrack to POSIX file thetrack as string
log "Add " & thetrack
--display dialog "Add " & thetrack
add thetrack to new_playlist
set addCount to addCount + 1
end try
end if
set i to i + 1
end if
end repeat
end if
end tell
end repeat
display dialog "Complete. Added=" & addCount
on checkLInes(thelines)
set k to 0
repeat with j from 1 to the count of thelines
set thetrack to (item j of thelines) as string
if not thetrack = "" then
--set j to j - 1
set k to k + 1
end if
end repeat
--set k to count of thelines
return k
end checkLInes
on extOf(theFile)
set theSuffix to text ((offset of "." in theFile) + 1) thru -1 of theFile
return theSuffix
end extOf
on nameOf(thePath)
set n to (offset of "/" in (reverse of characters of thePath) as string) - 1
set theFile to text ((length of (thePath)) - n + 1) thru -1 of thePath
set theName to text 1 thru ((offset of "." in theFile) - 1) of theFile
return theName
end nameOf
on getPlaylistNames(playlistFolder)
tell application "Finder"
activate
set playlistFiles to name of every file of folder playlistFolder
end tell
set root to playlistFolder as string
set thePlaylistAliasList to {}
set playlistcount to count of playlistFiles
log playlistcount
repeat with i from 1 to the playlistcount
-- the filename
set theFile to item i of playlistFiles
--if type of theFile is file then
set theSuffix to my extOf(POSIX path of theFile)
--display dialog "Suffix " & theSuffix
if theSuffix = "m3u" then
set thePlaylist to {root & theFile} as alias
copy thePlaylist to the end of thePlaylistAliasList
end if
end repeat
return thePlaylistAliasList
end getPlaylistNamesmarkstuartwalker wrote:Play on Mac can run MM on a Mac ...
It was very easy. From recent recollection...
Downloaded PlayOnMac from http://www.playonmac.com/en/download.html 1.3.21 and installed
Created a new application for Internet Explorer 6 (this is probably the bit you missed). Note: "Application" is POM's terminology for a Wine Prefix.
Configure a sound driver for the Wine Prefix.
Added to that application the MM3 installation and created a shortcut for the non-skinned exe.
Added to that application an MM4 portable installation and created a shortcut for the non-skinned exe.
I must point out that I haven't done any thorough testing, indeed the check was pretty superficial.
You can expect an exception to be thrown at startup. This is normal.
wine ~/.wine/dosdevices/c\:/Program\ Files/MediaMonkey/MediaMonkey\ \(non-skinned\).exe \/NoSplash \/INIFILE=J:\\mmdb\\MediaMonkey.ini $(winepath -w $1)
markstuartwalker wrote:The MM portable installation refers to a normal MM4 installation but check the "Portable" option that is presented.
The MAD plugin can be found here http://www.mediamonkey.com/addons/brows ... -plug-ins/
I suggest that you stop using POM as I found it rather unstable. I find Wineskin much better.
Users browsing this forum: No registered users and 10 guests