Script Request: Album Art Extractor to Overwrite WMPAlbumArt

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: Script Request: Album Art Extractor to Overwrite WMPAlbumArt

by Kiliman » Thu Feb 08, 2007 8:13 am

No problem. Thanks for sharing your scripts with the rest of us. It's the least I can do to help.

by trixmoto » Thu Feb 08, 2007 6:00 am

Thanks for looking at this kiliman, not using WMP I hadn't realised that the system flag was also being set. I'll work your modifications into the next official release, if that's ok?

by Kiliman » Wed Feb 07, 2007 3:38 pm

Actually, I just uploaded an updated version that adds a new option "Extract original image".

You can download it from the same place:

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

Kiliman

by Kiliman » Wed Feb 07, 2007 3:21 pm

If you want to extract the image as is, modify the following line (line 687 in my version):

Code: Select all

Set jpg = img.ConvertFormat(imgw,imgh,"image/jpeg",Compress,-1)  
to

Code: Select all

Set jpg = img
This will not do any conversion to the image.

by Jason Dunn » Wed Feb 07, 2007 3:11 pm

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?

by Kiliman » Wed Feb 07, 2007 2:26 pm

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!

by Jason Dunn » Wed Feb 07, 2007 12:55 pm

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?

by Kiliman » Wed Feb 07, 2007 11:10 am

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

by Jason Dunn » Wed Feb 07, 2007 8:55 am

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.

by Jason Dunn » Wed Feb 07, 2007 8:54 am

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.

by trixmoto » Wed Feb 07, 2007 4:21 am

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?

by Jason Dunn » Tue Feb 06, 2007 5:48 pm

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. :-)

by trixmoto » Mon Feb 05, 2007 4:25 am

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.

by Jason Dunn » Fri Feb 02, 2007 5:57 pm

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

by trixmoto » Thu Feb 01, 2007 11:56 am

Sorry, similar error messages appear on line 736 and 739 - could you make similar changes to these and try again?

Top