how filter songs by cover art size?

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: how filter songs by cover art size?

Re: how filter songs by cover art size?

by Haaden2 » Mon Apr 18, 2022 5:55 pm

onkel_enno, I've been wanting to identify low res artwork for quite some time and I'm really happy to find your script. However when I run it I get the error:

Image

I am no coder, but do you have an idea what I need to do to get the script working?

by onkel_enno » Mon Jul 17, 2006 1:14 am

The Result is shown, when the Process is finished first. So wait and see.

Checking the album arts attached to the mp3 wasn't possible the time I wrote the script. I'll see if I can improve it.

EDIT:
Here it is:
Now you have to select the Tracks you want to check (maybe the whole library).
After the Process has finished, all Tracks are shown (or not) which have small Album Arts.

Code: Select all

'Create a File LowResCover.vbs in MediaMonkey\Scripts
'and add the Following to Scripts.ini

'[LowResCover]
'FileName=LowResCover.vbs
'ProcName=OnStartUp
'Order=6
'DisplayName=Low Resolution Covers
'Description=Shows all Tracks, which Cover's have a low Quality
'Language=VBScript
'ScriptType=0

Option Explicit

const Resolution = 90000 '300x300

Sub OnStartUp()

	Dim Progress
	Dim Tracklist
	Dim Track
	Dim CoverList
	Dim Cover
	Dim a, b
	Dim LowRes
	
	Set Progress = SDB.Progress
	Set Tracklist = SDB.SelectedSongList 
	Progress.MaxValue = Tracklist.Count-1
	for a = 0 to Tracklist.Count-1
		Set Track = Tracklist.Item(a)
		Progress.Value = a
		Progress.Text = SDB.Localize("Current song") & ": " & Track.ArtistName & " - " & Track.Title

		Set CoverList = Track.AlbumArt 
		for b = 0 to CoverList.Count-1
			Set Cover = Coverlist.Item(b).Image
			if Cover.Height*Cover.Width<=Resolution then
				LowRes = LowRes & Tracklist.Item(a).ID & ", "
				Exit For
			end if
			Set Cover = Nothing
		next
		
		Set CoverList = Nothing
		Set Track = Nothing
	next
	
	SDB.MainTree.CurrentNode = SDB.MainTree.Node_Library
	
	if Len(LowRes)>2 then 
		LowRes = Left(LowRes, Len(LowRes)-2)
		Dim Tracks
		Set Tracks = SDB.MainTracksWindow
		Tracks.AddTracksFromQuery("And Songs.ID In (" + LowRes + ")")
		Tracks.FinishAdding
		Set Tracks = Nothing
	end if
	
	Set Tracklist = Nothing
	Set Progress = Nothing
end Sub

by sr383 » Sat Jul 15, 2006 3:35 pm

I love the idea for this script, but I couldn't make it work. It "seems" to run (and the status bar shows that my library is being scanned), but I don't see any results. Most of my album art is imbedded in the MP3s. Does this script look there?

Thanks,

Stephen

by jhsmith » Fri Jul 14, 2006 11:03 am

thanks guys!

Onkel, I just sent you a PM about the script..

:D

by onkel_enno » Fri Jul 14, 2006 12:40 am

I've done a small Script some time ago. It scan through the Library and shows alls tracks that have Album Arts below the given resolution. (const Resolution)
Maybe it helps:

Code: Select all

'Create a File LowResCover.vbs in MediaMonkey\Scripts
'and add the Following to Scripts.ini

'[LowResCover]
'FileName=LowResCover.vbs
'ProcName=OnStartUp
'Order=6
'DisplayName=Low Resolution Covers
'Description=Shows all Tracks, which Cover's have a low Quality
'Language=VBScript
'ScriptType=0

Option Explicit

const Resolution = 90000 '300x300

Sub OnStartUp()
	
	Dim FSO
	Dim SDB
	Dim objShell
	Dim Progress
	Set FSO = CreateObject("Scripting.FileSystemObject")
	Set SDB = CreateObject( "SongsDB.SDBApplication")
	Set objShell = CreateObject("Shell.Application")
	Set Progress = SDB.Progress
	
	const SQLSelect = "SELECT Songs.ID, Medias.DriveLetter, Songs.SongPath, Covers.CoverPath, Artists.Artist, Songs.SongTitle"
	const SQLFrom   = "FROM Artists RIGHT JOIN ((Medias INNER JOIN Songs ON Medias.IDMedia = Songs.IDMedia) INNER JOIN Covers ON Songs.ID = Covers.IDSong) ON Artists.ID = Songs.IDArtist"
	const SQLWhere  = "WHERE Covers.CoverStorage=1"
	
	Dim objFile
	Dim objFolder
	Dim objFolderItem
	Dim Drive
	Dim Path
	Dim Cover
	Dim RecordSet
	Dim Width
	Dim Height
	Dim LowRes
	
	SDB.MainTree.CurrentNode = SDB.MainTree.Node_MyComputer 'to get sure that no other Titles are displayed
	SDB.MainTree.CurrentNode = SDB.MainTree.Node_Library
	
	Set RecordSet = SDB.DataBase.OpenSQL("Select Count(*) " & SQLFrom & " " & SQLWhere)
	Progress.MaxValue = RecordSet.ValueByIndex(0)
	Progress.Value = 0
	
	Set RecordSet = SDB.DataBase.OpenSQL(SQLSelect & " " & SQLFrom & " " & SQLWhere)
	Do While not RecordSet.EoF
		Progress.Text = SDB.Localize("Current song") & ": " & RecordSet.StringByName("Artist") & " - " & RecordSet.StringByName("SongTitle")
		
		If Mid(RecordSet.StringByName("CoverPath"), 2, 1) = ":" Then
	      Cover = RecordSet.StringByName("CoverPath")
	    ElseIf Left(RecordSet.StringByName("CoverPath"), 2) = "\\" Then
	      'Network Path
	      Cover = RecordSet.StringByName("CoverPath")
	    Else
	      On Error Resume Next
	      If Left(RecordSet.StringByName("SongPath"), 2) = "\\" Then
	        'Network Path
	        Path = FSO.GetFile(RecordSet.StringByName("SongPath")).ParentFolder
	      Else
	        Drive = Chr(RecordSet.ValueByName("DriveLetter") + 65)
	        Path = FSO.GetFile(Drive & RecordSet.StringByName("SongPath")).ParentFolder
	      End If
	      On Error GoTo 0
	      
	      Cover = Path & "\" & RecordSet.StringByName("CoverPath")
	    End If
		
		'Check Resolution
		if FSO.FileExists(Cover) then
			Set objFile = FSO.GetFile(Cover)
			Set objFolder = objShell.Namespace(objFile.ParentFolder + "\")
			set objFolderItem = objFolder.ParseName(objFile.Name)
			Width  = objFolder.GetDetailsOf(objFolderItem, 27)
			Height = objFolder.GetDetailsOf(objFolderItem, 28)
			
			if (Right(Width, 5) = "Pixel") and (Right(Height, 5) = "Pixel") then
				Width  = Int(Left(Width,  Len(Width)  - 5))
				Height = Int(Left(Height, Len(Height) - 5))
				if (Width * Height) < Resolution then
					LowRes = LowRes & RecordSet.StringByName("ID") & ", "
				end if
			end if
		end if
		
		RecordSet.Next
		Progress.Increase
		
		if Progress.Terminate then
		  Exit Do
		end if
	Loop
	
	if Len(LowRes)>2 then 
		LowRes = Left(LowRes, Len(LowRes)-2)
		Dim Tracks
		Set Tracks = SDB.MainTracksWindow
		Tracks.AddTracksFromQuery("And Songs.ID In (" + LowRes + ")")
		Tracks.FinishAdding
		Set Tracks = Nothing
	end if
	
	Set RecordSet = Nothing
	Set FSO = Nothing
	Set SDB = Nothing
	Set Progress = Nothing
end Sub
Tip: Save the Result in a Playlist if you don't want to perform the search each time again.

by Lowlander » Thu Jul 13, 2006 7:15 pm

This is not possible with MediaMonkey. It should be possible with scripts, but it might take a lot of processing as image meta-data are not stored in the library.

how filter songs by cover art size?

by jhsmith » Thu Jul 13, 2006 4:16 pm

Just wondering, is there a way to filter songs by cover art size? I mean show only albums with a tagged image lower than 500*500 or any other size? I'm trying to update all my small size cover art, with better quality scans. I think, Trixmoto once mentioned something about a similar script, but i could not find the post. Thanks in advance, all help is appreciated!! :D

Top