Code: Select all
With SDB.Player.CurrentSong
.Covers = GetImageFromClipboard
.UpdateDB
.WriteTags
End With
I'm trying to write the current image on the clipboard to the song's album art
Code: Select all
With SDB.Player.CurrentSong
.Covers = GetImageFromClipboard
.UpdateDB
.WriteTags
End With
Code: Select all
Set img = itm.AlbumArt.AddNew
img.RelativePicturePath = relpath(newpath,itm.Path)
img.ItemType = 3
img.ItemStorage = 0
Code: Select all
Function relpath(relp,path)
relpath = relp
Dim temp : temp = Left(path,InStrRev(path,"\"))
'check same folder
If InStr(relp,temp) = 1 Then
relpath = Mid(relp,Len(temp)+1)
Exit Function
End If
'check parent folders
If Left(temp,2) = "\\" Then
temp = Mid(temp,3)
End If
If Left(relp,2) = "\\" Then
relp = Mid(relp,3)
End If
Dim tp : tp = Left(temp,InStr(temp,"\"))
Dim tr : tr = Left(relp,InStr(relp,"\"))
If (UCase(tp) = UCase(tr)) Then
While (UCase(tp) = UCase(tr))
temp = Mid(temp,Len(tp)+1)
relp = Mid(relp,Len(tr)+1)
tp = Left(temp,InStr(temp,"\"))
tr = Left(relp,InStr(relp,"\"))
WEnd
relpath = ""
While (InStr(temp,"\") > 0)
relpath = relpath&"..\"
temp = Mid(temp,Len(tp)+1)
tp = Left(temp,InStr(temp,"\"))
WEnd
relpath = relpath&relp
End If
End Function