Script Request: Album Art Extractor to Overwrite WMPAlbumArt

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:

Post by trixmoto »

Sorry, I was trying something which didn't work and didn't fully undo it. Try downloading it again and use the mask "<path>\Folder".
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.
Jason Dunn
Posts: 46
Joined: Tue Apr 04, 2006 3:05 pm

Post by Jason Dunn »

trixmoto wrote:Sorry, I was trying something which didn't work and didn't fully undo it. Try downloading it again and use the mask "<path>\Folder".
Ok, closer...but unless I manually delete the Folder.jpg file first, the script errors out. Here's what it's set to do:

Mask: <path>\Folder
Key: Will be created - Duplicate - File already exists
These images will overwrite existing files.
Extracted images will be marked as hidden.

Then it gives an error saying that \Folder.jpg could not be created. The 240 x 240 JPG file becomes un-hidden by the script, but then not overwritten...
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

These settings work correctly for me, overwriting a 240x240 hidden "Folder.jpg" withh a 200x200 version (also hidden).

If you open the scriptfile in a text editor you'll find lines 766-769 are...

Code: Select all

                      MsgBox "Error: File '"&gettrackart&"' could not be created."
                    End If                
                  Else
                    MsgBox "Error: File '"&gettrackart&"' could not be created."
Could you please change this to be...

Code: Select all

                      MsgBox "Error: File '"&gettrackart&"' could not be created (766)."
                    End If                
                  Else
                    MsgBox "Error: File '"&gettrackart&"' could not be created (769)."
So that I can see which line the error is.
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.
Jason Dunn
Posts: 46
Joined: Tue Apr 04, 2006 3:05 pm

Post by Jason Dunn »

trixmoto wrote:If you open the scriptfile in a text editor you'll find lines 766-769 are...
I performed the edits as you requested, but I'm not getting a helpful error. Here's what I'm doing:

Mask: <path>\Folder
Key: Will be created - Duplicate - File already exists
These images will overwrite existing files.
Extracted images will be marked as hidden.

# Track Files to create
1 (SoCal VoCals) - Underground.mp3 M:\Music\A Capella\SoCal VoCals - SoCal VoCals\Folder.jpg

The error just says that the Folder.jpg could not be created. There's no number or code line anywhere in the error.

I must have done something wrong with the edit. You can download the VBS file here:

http://www.jasondunn.com/upload/

Thanks for your continued patience in working with me to find a solution to this. :-)
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Sorry, similar error messages appear on line 736 and 739 - could you make similar changes to these and try again?
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.
Jason Dunn
Posts: 46
Joined: Tue Apr 04, 2006 3:05 pm

Post by Jason Dunn »

trixmoto wrote:Sorry, similar error messages appear on line 736 and 739 - could you make similar changes to these and try again?
Ok, I made the changes and it says the error is happening on line 769.

I uploaded the new VB file if you want to take a look at it and confirm I made the right changes.

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

Post by trixmoto »

Did you change the messages to give the line numbers or did you just copy and paste again? You haven't uploaded the file so I can't see.
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.
Jason Dunn
Posts: 46
Joined: Tue Apr 04, 2006 3:05 pm

Post by Jason Dunn »

trixmoto wrote:Did you change the messages to give the line numbers or did you just copy and paste again? You haven't uploaded the file so I can't see.
I'm editing this in Notepad, and quite franky as a non-coder I don't really know exactly what I'm doing nor exactly what you're asking me to do. ;-) I've uploaded the current script I'm using - you have my email address, so if you like perhaps you can edit it the way you want and email to me and I'll test it out? I think that might be easier than me trying to figure out exactly what you're asking me to do. :-)
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

You have edited the script correctly, but I can't work our why your path is not appearing. Can you tell me the full path of the track that gives you this error?
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.
Jason Dunn
Posts: 46
Joined: Tue Apr 04, 2006 3:05 pm

Post by Jason Dunn »

trixmoto wrote:You have edited the script correctly, but I can't work our why your path is not appearing. Can you tell me the full path of the track that gives you this error?
All the info:

1. Extract artwork (copy from tag to mask)
Mask: <path>\Folder
Key: Will be created - Duplicate - File already exists
These images will overwrite existing files.
Extracted images will be marked as hidden.

# Track Files to create
1 (Boxtree) - Where Can I Go.mp3 M:\Music\Christian Pop\Boxtree - Sitting Still\Folder.jpg


The error I just got references line 766.
Jason Dunn
Posts: 46
Joined: Tue Apr 04, 2006 3:05 pm

Post by Jason Dunn »

I should add that what the script DOES do so far is make the existing folder.jpg un-hidden...and curiously enough, when I right-click and try to make it hidden again that option is greyed out.
Kiliman
Posts: 6
Joined: Wed Dec 06, 2006 3:42 pm

Post by Kiliman »

I looked at the script and figured out the problem. WMP marks the album art with the Hidden AND System attributes.

Your script only clears the Hidden attribute. That is why it can't overwrite the file.

I've modified the script to first clear all attributes (saving the current attributes to a variable), then after writing out the image, I restore the original attributes.

Here's the sections I changed:

In getalbumart()

Code: Select all

          
        Else
          loc = "#ff0000" 'red
          If Overwrite = 1 Then
            chk = True
            Artwork.Item(gettrackart) = "done"
            If boo Then
              Dim oldAttributes    
              oldAttributes = SetNormal(gettrackart) 
              Set out = SDB.Tools.FileSystem.CreateTextFile(gettrackart,True)
              If Not (out Is Nothing) Then
                Call out.WriteData(jpg.ImageData,jpg.ImageDataLen)
                out.Close
                Call RestoreAttributes(gettrackart, oldAttributes)
              Else
                MsgBox "Error: File '"&gettrackart&"' could not be created."
              End If
            End If              
          End If
        End If                     
Changed and added these functions

Code: Select all

Function SetNormal(pFilePath)
  Dim f : Set f = fso.GetFile(pFilePath)
  SetNormal = f.Attributes ' Return original attributes
  f.Attributes = 0
End Function

Function RestoreAttributes(pFilePath, pAttributes)
  Dim f : Set f = fso.GetFile(pFilePath)
  f.Attributes = pAttributes
  RestoreAttributes = True
End Function
Jason Dunn
Posts: 46
Joined: Tue Apr 04, 2006 3:05 pm

Post by Jason Dunn »

Kiliman wrote:I looked at the script and figured out the problem. WMP marks the album art with the Hidden AND System attributes.
Well that's quite interesting! Can you put the script up somewhere so I can download and give it a try?
Kiliman
Posts: 6
Joined: Wed Dec 06, 2006 3:42 pm

Post by Kiliman »

You can download it from here:

http://www.systemex.net/files/mediamonk ... er_mod.zip

NOTE: Hopefully trixmoto will update his official version with the fix. When he does, I recommend you use that version.

Good luck!
Jason Dunn
Posts: 46
Joined: Tue Apr 04, 2006 3:05 pm

Post by Jason Dunn »

That worked! Everything works the way it should now. Excellent! :D

I'm looking at the output, and it looks decent, but even at 90% quality there's some JPEG artifacting going on. Trixmoto, this is a long shot, but have you ever thought about having a direct JPEG extraction from the tag, without a resize or a re-save? As in, my embedded tags are already 600 x 600, and that's exactly the size I want as my Folder.jpg file. Would that be possible?
Post Reply