Missing Album Art 2.0 [MM2+3]

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Missing Album Art 2.0 [MM2+3]

Post by trixmoto »

This script creates a node under Files To Edit called Missing Album Art. This node is populated with all the tracks which have external artwork and the files do not exist.

To populate this node you need to run the report with the same name. It will take several minutes to populate, depending on the size of your library - which is why it is run in the background.

The installer can be downloaded directly from my website. Enjoy! :)

Code: Select all

'
' MediaMonkey Script
'
' NAME: MissingAlbumArt 2.0
'
' AUTHOR: trixmoto (http://trixmoto.net)
' DATE : 17/08/2008
'
' INSTALL: Copy to Scripts\Auto directory and add the following to Scripts.ini 
'          Don't forget to remove comments (') and set the order appropriately'          
'
' [MissingAlbumArt]
' FileName=Auto\MissingAlbumArt.vbs
' ProcName=MissingAlbumArt
' Order=10
' DisplayName=Missing Album Art
' Description=Populates Missing Album Art node
' Language=VBScript
' ScriptType=1
'

Option Explicit

Sub onStartUp()
  'create node and add to tree
  Dim tree : Set tree = SDB.MainTree
  Dim node : Set node = tree.CreateNode
  node.Caption = "Missing Album Art"
  node.IconIndex = 55
  node.UseScript = Script.ScriptPath
  node.OnFillTracksFunct = "ShowMissing"
  node.SortCriteria = 2
  Call tree.AddNode(tree.Node_FilestoEdit,node,3)
  Set SDB.Objects("MissingAlbumArtNode") = node
End Sub

Sub ShowMissing(node)
  'check for list
  Dim list : Set list = SDB.Objects("MissingAlbumArtList")
  If list Is Nothing Then
    'warn node not yet populated
    Call SDB.MessageBox("MissingAlbumArt: You need to select 'File|Create Reports|Missing Album Art' from the menu before this node will be populated.",mtInformation,Array(mbOk))
  Else
    'add list to main window
    Dim trax : Set trax = SDB.MainTracksWindow
    Dim i : i = 0
    For i = 0 To list.Count-1
      Call trax.AddTrack(list.Item(i))
      SDB.ProcessMessages
    Next
    'finish off
    trax.FinishAdding
  End If
End Sub

Sub MissingAlbumArt
  'reset list
  Set SDB.Objects("MissingAlbumArtList") = Nothing
  Dim list : Set list = SDB.NewSongList
  Dim fso : Set fso = SDB.Tools.FileSystem
  
  'create progress bar
  Dim prog : Set prog = SDB.Progress
  prog.Value = 0
  Dim iter : Set iter = SDB.Database.OpenSQL("SELECT Count(*) AS SongCount FROM Songs")
  prog.MaxValue = iter.ValueByName("SongCount")
  prog.Text = "MissingAlbumArt: Initialising..."

  'loop through tracks
  Dim i : i = 0
  Dim j : j = 0
  Set iter = SDB.Database.QuerySongs("")
  Do While Not iter.EOF
    'update progress bar
    prog.Increase
    prog.Text = "MissingAlbumArt: Checking track "&prog.Value&"/"&prog.MaxValue&" (found: "&j&")..."
    SDB.ProcessMessages
    'check for artwork
    Dim art : Set art = iter.Item.AlbumArt
    If Not (art Is Nothing) Then
      'loop through track artwork
      For i = 0 To art.Count-1 
        'check for linked artwork
        If art.Item(i).ItemStorage = 1 Then
          'check if file exists
          If Not fso.FileExists(art.Item(i).PicturePath) Then
            'add track to list
            list.Add(iter.Item)
            j = j + 1
          End If
        End If
      Next
    End If
    'check next track
    If prog.Terminate Then 
      Exit Do
    Else
      iter.Next
    End If
  Loop
  
  'finish off
  Set prog = Nothing
  Set SDB.Objects("MissingAlbumArtList") = list
  Dim res : res = SDB.MessageBox("MissingAlbumArt: Do you want to see the results now?",mtConfirmation,Array(mbYes,mbNo))
  If res = mrYes Then
    'show node
    Dim tree : Set tree = SDB.MainTree
    Dim node : Set node = SDB.Objects("MissingAlbumArtNode")
    tree.CurrentNode = tree.Node_Library
    tree.Node_Library.Expanded = True
    tree.CurrentNode = tree.Node_FilestoEdit
    tree.Node_FilestoEdit.Expanded = True
    tree.CurrentNode = node
  End If
End Sub

Sub Install()
  Dim inip : inip = SDB.ApplicationPath&"Scripts\Scripts.ini"
  Dim inif : Set inif = SDB.Tools.IniFileByPath(inip)
  If Not (inif Is Nothing) Then
    inif.StringValue("MissingAlbumArt","Filename") = "Auto\MissingAlbumArt.vbs"
    inif.StringValue("MissingAlbumArt","Procname") = "MissingAlbumArt"
    inif.StringValue("MissingAlbumArt","Order") = "10"
    inif.StringValue("MissingAlbumArt","DisplayName") = "Missing Album Art"
    inif.StringValue("MissingAlbumArt","Description") = "Populates Missing Album Art node"
    inif.StringValue("MissingAlbumArt","Language") = "VBScript"
    inif.StringValue("MissingAlbumArt","ScriptType") = "1"
    SDB.RefreshScriptItems
  End If
  Call onStartUp()
End Sub
Last edited by trixmoto on Sat Mar 15, 2008 4:12 pm, edited 2 times in total.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Post by MoDementia »

Is that what creates these in properties -> album art ?

Image
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

This means it thinks there is art in the tag (physically, or an external link), but the image is either missing or corrupt. This script checks for missing external artwork, but not corrupt artwork (which could be in the tag or external).
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Has anybody used this script - can anyone provide feedback?
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
pah68
Posts: 1504
Joined: Wed Apr 07, 2004 5:26 pm
Location: Sydney, Australia

Post by pah68 »

Sorry mate, yeah I've used it and for me it does what I expected it to.....well.
Image
Image
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Normally I have to release version 1.1 fairly soon after 1.0 to fix all my bugs! I figured either by some fluke I'd managed to actually create a script that worked properly first time, or just no one was interested in trying it. I'm glad it works for you! :)
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
junglemonkey

Post by junglemonkey »

if it creates the image that MoDementia
pasted in their message then i dont want to use it because i use a different image then what they posted.
8)
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Please try reading the descriptions - this script does not create any images at all. It checks your tracks for external artwork, and if it has external artwork it checks your computer to see if it's there, and if it's not there than it has missing artwork and puts it in this node.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
cadmanmeg
Posts: 309
Joined: Sun Nov 19, 2006 5:28 am

Post by cadmanmeg »

So then it only checks the folder for which the song is in for external artwork? Since using MM, I have been trying to enbed all artwork, but I know I have tons of artwork that is still external and that is a process that I have yet to get to. So this script will come in handy, I am just trying to make sure I understand how it is going to work. Am going to try it out in the next day or two. Thanks again Trixmoto for the script!
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

It checks the tags of the tracks for an external image, in which case the tag contains a filename. The script then checks if the file in this location exists or not.

To embed all your artwork in one go you could try my Album Art Tagger script.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
SerialK
Posts: 31
Joined: Sun Feb 24, 2008 1:57 pm

Post by SerialK »

Is there going to be an update for MM3?

And is there a way to remove missing artwork entries from the tags instead of doing it album by album?
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

It's on my list of scripts to update. To remove artwork tags in batch try my "Album Art Tagger" script.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
SerialK
Posts: 31
Joined: Sun Feb 24, 2008 1:57 pm

Post by SerialK »

Ok, i'll try that script!
"Remove artwork which is invalid" should be the right option to remove missing art entries from the tags, right?
DumbPoet
Posts: 15
Joined: Fri Jul 18, 2008 2:05 pm

Re: Missing Album Art 1.0 [MM2]

Post by DumbPoet »

Just realized the power of Nodes today and this is the first thing I went out to search for... any chance of an update soon? Or is there some other solution that will do the same in Magic Nodes?
I looked throught the treads for Magic Nodes and didn't see anything.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: Missing Album Art 1.0 [MM2]

Post by trixmoto »

Sorry, this one appears to have fallen off my list! :oops: I'll try to get it updated for MM3 soon.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Post Reply