Sub Putumayo
' Define variables
Dim list, itm, i, ia
' Get list of selected tracks from MediaMonkey
Set list = SDB.CurrentSongList
If list.Count=0 Then
Exit Sub
End If
Set UI = SDB.UI
' Create the window to be shown
Set Form = UI.NewForm
Form.Common.SetRect 0, 0, 400, 180
Form.FormPosition = 4 ' Screen Center
Form.BorderStyle = 3 ' Dialog
Form.Caption = SDB.Localize("Putumayo")
Set Lbl = UI.NewLabel( Form)
Lbl.Common.SetRect 10,15,370,40
Lbl.AutoSize = False
Lbl.Multiline = True
Lbl.Caption = SDB.LocalizedFormat( "Do you want to proceed Putumayo?", list.Count, 0, 0)
Set SE = UI.NewCheckBox(Form)
SE.Caption = SDB.Localize("Change Title and Artist?")
SE.Common.SetRect 10,65,280,20
SE.Checked = false
Set Btn = UI.NewButton( Form)
Btn.Caption = SDB.Localize("OK")
Btn.Common.SetRect 115,100,75,25
Btn.ModalResult = 1
Btn.Default = true
Set Btn = UI.NewButton( Form)
Btn.Caption = SDB.Localize("Cancel")
Btn.Common.SetRect 220,100,75,25
Btn.ModalResult = 2
Btn.Cancel = true
if Form.ShowModal=1 then
' Process all selected tracks
For i=0 To list.count-1
Set itm = list.Item(i)
If InStr(itm.AlbumName,"Putumayo Presents: ")=1 then
itm.AlbumName = Right(itm.AlbumName,Len(itm.AlbumName)-19)
End If
If SE.Checked then
itm.Title = itm.ArtistName & " - " & itm.Title
itm.ArtistName = "Putumayo Various Artists"
End If
itm.AlbumArtistName = "Putumayo World Music"
itm.Comment = "Putumayo Presents"
itm.Genre = "Этническая музыка"
itm.TrackOrder = CByte(itm.TrackOrder)
Set AAList = itm.AlbumArt
While AAList.Count>0
AAList.Delete(0)
Wend
set AA = AAList.AddNew
AA.PicturePath = Mid(itm.Path,1,InstrRev(itm.Path,"\")) & "folder.jpg"
AA.ItemType = 3
AA.ItemStorage = 0
AAList.UpdateDB
Next
list.UpdateAll
End If
End Sub
|