Sync playlist with network share

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Sync playlist with network share

Re: Sync playlist with network share

by Lowlander » Wed Aug 06, 2014 12:00 pm

To have files added to the Library you can use the Folder Monitor (Gold Feature) in File > Add/Rescan Files. It can run on startup or while MediaMonkey is running to automatically pickup new files.

The Export/Create Playlists 4 Child Nodes Addon can do automatic Playlist exports: http://www.mediamonkey.com/forum/viewto ... d+playlist

Sync playlist with network share

by kl2n » Mon Aug 04, 2014 8:50 pm

Hello!

I'm trying to write a script to sync a playlist with files in a network share, the purpose of this is to wirelessly keep my smartphone updated and commit purchased songs to my MM library. I have the very basics working - connecting to the network share and recursively enumerating files, connecting to the playlist by name and enumerating files. My question is; does anyone have suggestions on how to compare files in a network directory against entries in the library? What I really want to do is read the ID tag of each network file and compare them to the library files but I cannot for the life of me find a way to read ID tags from a file through the script properties.

Here's what I have so far. Once I figure out how to get the properties of the network files I'll figure out how to do the comparison.

Code: Select all

Sub CopyToBlackBerry()
	
	dim strBBPath(1)
	strBBPath(0) = "\\BlackBerry\removable_sdcard\music"
	strBBPath(1) = "\\BlackBerry\media\music"
	
	for iPath = 0 to ubound(strBBPath)
		set FSO = CreateObject("Scripting.FileSystemObject")
		set oParentFolder = FSO.GetFolder(strBBPath(iPath))
		ShowSubFolders(oParentFolder)
	next
		
	playlistTitle = "BlackBerry"
	set oPlayList = sdb.playlistbytitle(playlistTitle)
	set oTracks = oPlaylist.tracks
	
	msgbox(oTracks.count)
	
	for iTrack=0 to oTracks.count-1
		set cTrack = oTracks.item(iTrack)
			strPath = cTrack.path
			strLength = cTrack.songLength
			strTitle = cTrack.Title
			strArtist = cTrack.ArtistName
'		once I figure out how to compare, I'll write some comparison code
	next
	
End Sub


Sub ShowSubFolders(objFolder)
  Set colFolders = objFolder.SubFolders
  For Each objSubFolder In colFolders
    msgbox(objSubFolder.Path)
    Set colFiles = objSubFolder.Files
    For Each objFile In colFiles
'		this is where action should be taken on the file, call new sub
' 		need to figure out how to read the properties of a file on disk 
'		so that it can either be imported or skipped
		allFiles = allFiles & objFile.name & chr(10)
    Next
	msgbox(allFiles)
    ShowSubFolders(objSubFolder)
  Next
End Sub

Top