Page 1 of 2

Missing Album Art 2.0 [MM2+3]

Posted: Mon Jul 03, 2006 7:31 am
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

Posted: Sun Jul 09, 2006 8:59 pm
by MoDementia
Is that what creates these in properties -> album art ?

Image

Posted: Mon Jul 10, 2006 3:21 am
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).

Posted: Fri Sep 22, 2006 2:13 am
by trixmoto
Has anybody used this script - can anyone provide feedback?

Posted: Fri Sep 22, 2006 5:05 am
by pah68
Sorry mate, yeah I've used it and for me it does what I expected it to.....well.

Posted: Fri Sep 22, 2006 5:18 am
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! :)

Posted: Fri Sep 22, 2006 1:25 pm
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)

Posted: Sat Sep 23, 2006 5:45 am
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.

Posted: Sun Jan 07, 2007 2:36 am
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!

Posted: Sun Jan 07, 2007 12:39 pm
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.

Posted: Fri Mar 14, 2008 7:26 pm
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?

Posted: Sat Mar 15, 2008 4:12 pm
by trixmoto
It's on my list of scripts to update. To remove artwork tags in batch try my "Album Art Tagger" script.

Posted: Sun Mar 16, 2008 4:59 am
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?

Re: Missing Album Art 1.0 [MM2]

Posted: Wed Jul 23, 2008 9:06 pm
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.

Re: Missing Album Art 1.0 [MM2]

Posted: Thu Jul 24, 2008 3:33 am
by trixmoto
Sorry, this one appears to have fallen off my list! :oops: I'll try to get it updated for MM3 soon.