Need help with script - editing album art

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey.

Moderator: Gurus

raiden63
Posts: 6
Joined: Sun Nov 23, 2014 3:25 pm

Need help with script - editing album art

Post by raiden63 » Fri Nov 28, 2014 11:50 pm

As part of an auto-organize workflow script I am writing, I am trying to automatically re-tag the album art of all the tracks in a given album. The tracks are all FLAC format; I'm not sure if that's a problem for MM, since I'm given to understand that the tag standard is different from, say, MP3.

In the sample script below, I am using the CurrentSongList collection. My problem is that even with all the tracks I want to overwrite selected (Ctrl+A), the track that was selected via mouse click is the only one whose album art is overwritten. Not sure why this is happening?

Code: Select all

Sub QuickTrackMod
	Dim currentSongList, song, i
	
	On Error Resume Next
	
	Set currentSongList = SDB.CurrentSongList
	For i=0 To currentSongList.Count-1
		Set song = currentSongList.Item(i)
		
		'Commented out because calling 'Delete' does not seem to alter the AlbumArt collection here, even after calling UpdateAll. Yay infinite loops...
		'Do While song.AlbumArt.Count > 0
			'MsgBox "Deleting..."
			'song.AlbumArt.Delete(0)
		'Loop
		
		Set newArt = song.AlbumArt.AddNew
		newArt.PicturePath = "D:\Music\My Music\Album Art\[album art file here].jpg"
		newArt.Description = "Album Art"
		newArt.ItemType = 3
		newArt.ItemStorage = 0
	Next
	
	currentSongList.UpdateAll
	MsgBox "Done"
End Sub
MediaMonkey Gold version 4.1.5.1719

rovingcowboy
Posts: 14153
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)
Contact:

Re: Need help with script - editing album art

Post by rovingcowboy » Sun Nov 30, 2014 3:15 am

mediamonkey has to have all the tracks selected to change them all. just selecting one track will only change that one track.

select several songs like all one album then right click on them and click on properties. you will see a check box is now beside all the tag's fields on the properties panels that is for checking what data you want copied to all the selected songs.

you will of course never want to check the one beside the title if it is still there. as that will make all the songs the same title.

but check that out and see how it is done then you might be able to get your script to auto check the needed tag fields of only the selected album. but I think your going to have to do it in that way to achieve what you want. 8)
roving cowboy / keith hall. My skins http://www.mediamonkey.com/forum/viewto ... =9&t=16724 for some help check on Monkey's helpful messages at http://www.mediamonkey.com/forum/viewto ... 4008#44008 MY SYSTEMS.1.Jukebox WinXp pro sp 3 version 3.5 gigabyte mb. 281 GHz amd athlon x2 240 built by me.) 2.WinXP pro sp3, vers 2.5.5 and vers 3.5 backup storage, shuttle 32a mb,734 MHz amd athlon put together by me.) 3.Dell demension, winxp pro sp3, mm3.5 spare jukebox.) 4.WinXp pro sp3, vers 3.5, dad's computer bought from computer store. )5. Samsung Galaxy 5 Android 5) 6. Proscan tablet Android 4.3 ) 7. amd a8-5600 apu 3.60ghz mm version 4 windows 7 pro bought from computer store.

Peke
Posts: 11447
Joined: Tue Jun 10, 2003 7:21 pm
Location: Serbia
Contact:

Re: Need help with script - editing album art

Post by Peke » Sun Nov 30, 2014 7:13 am

From what I see here is what you need to change, I left it commented just in case.

Code: Select all

    Sub QuickTrackMod
       Dim currentSongList, song, i
       
       On Error Resume Next
       
       Set currentSongList = SDB.CurrentSongList
       For i=0 To currentSongList.Count-1
          Set song = currentSongList.Item(i)
          
          'Commented out because calling 'Delete' does not seem to alter the AlbumArt collection here, even after calling UpdateAll. Yay infinite loops...
          'Do While song.AlbumArt.Count > 0
             'MsgBox "Deleting..."
             'song.AlbumArt.Delete(0)
             'song.AlbumArt.UpdateDB
             'SDB.ProcessMessages
          'Loop
          
          Set newArt = song.AlbumArt.AddNew
          newArt.PicturePath = "D:\Music\My Music\Album Art\[album art file here].jpg"
          newArt.Description = "Album Art"
          newArt.ItemType = 3
          newArt.ItemStorage = 0
       Next
       
       currentSongList.UpdateAll
       SDB.ProcessMessages
       MsgBox "Done"
    End Sub
Best regards,
Pavle
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
How to add Images to forum

Post Reply