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.
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. ([color=blue]const Resolution[/color])
Maybe it helps:
[code]
'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
[/code]
Tip: Save the Result in a Playlist if you don't want to perform the search each time again.