IPB

Welcome Guest ( Log In | Register )

101 Pages V  < 1 2 3 4 5 > »   
Reply to this topicStart new topic
Album Art Downloader XUI, A tool for downloading cover art
david_dl
post Sep 19 2007, 06:49
Post #51





Group: Members
Posts: 604
Joined: 17-December 05
From: New Zealand
Member No.: 26461



Here is an updated version of the iTMS script that can get fullsized art for even more albums. However sometimes the fullsized art will be large, and in TIFF format. I don't know if it's possible to report the filetype from the GetResult function (as it cannot be determined before GetResult is called), so you may end up with AlbumArtDownloader saving a TIFF as .jpg. The resultant file still works in foobar and windows picture gallery though, at least on vista.
Attached File(s)
Attached File  itunes.rar ( 982bytes ) Number of downloads: 1212
 
Go to the top of the page
+Quote Post
AlexVallat
post Sep 19 2007, 07:57
Post #52





Group: Developer
Posts: 1048
Joined: 31-July 06
Member No.: 33465



QUOTE (david_dl @ Sep 19 2007, 06:49) *
you may end up with AlbumArtDownloader saving a TIFF as .jpg.

If you have this problem, make sure that the filename pattern to save as doesn't end in .jpg, but ends in .%extension% instead. That way AlbumArtDownloader will determine the extension automatically from the image format, and correctly use .tif instead of .jpg.

Just one question, David, is there any reason you've chosen to use the older headers again, rather than the ones you suggested in your post here?

Also, could you give an example of a search that returns a tiff, for testing?

Thanks,

Alex
Go to the top of the page
+Quote Post
david_dl
post Sep 19 2007, 08:34
Post #53





Group: Members
Posts: 604
Joined: 17-December 05
From: New Zealand
Member No.: 26461



QUOTE (AlexVallat @ Sep 19 2007, 18:57) *
QUOTE (david_dl @ Sep 19 2007, 06:49) *
you may end up with AlbumArtDownloader saving a TIFF as .jpg.

Just one question, David, is there any reason you've chosen to use the older headers again, rather than the ones you suggested in your post here?

No, sorry, I thought I had modified the latest version, my mistake.
QUOTE
Also, could you give an example of a search that returns a tiff, for testing?

Menomena - I am the Fun Blame Monster
Go to the top of the page
+Quote Post
Mercachifle
post Sep 19 2007, 23:59
Post #54





Group: Members
Posts: 10
Joined: 25-November 06
Member No.: 38048



I can't load the program. It crashes on start:

CODE
Album Art Downloader has encountered a fatal error, and has had to close.
If you wish to report this error, please include this information, which
has been written to the file: C:\Archivos de programa\AlbumArtDownloader\errorlog.txt

App version: 0.9.0.0, running on Microsoft Windows NT 5.1.2600 Service Pack 2

System.Windows.Markup.XamlParseException: No se puede convertir la cadena 'AlbumArtDownloader.ico' del atributo 'Icon' en un objeto de tipo 'System.Windows.Media.ImageSource'. No se encontró ningún componente de procesamiento de imágenes apto para completar esta operación.  Error en el objeto 'AlbumArtDownloader.Splashscreen' en el archivo de marcado 'AlbumArt;component/splashscreen.xaml'. ---> System.NotSupportedException: No se encontró ningún componente de procesamiento de imágenes apto para completar esta operación. ---> System.Runtime.InteropServices.COMException (0x88982F50): Excepción de HRESULT: 0x88982F50
   --- Fin del seguimiento de la pila de la excepción interna ---
   en MS.Internal.HRESULT.Check(Int32 hr)
   en System.Windows.Media.Imaging.BitmapDecoder.SetupDecoderFromUriOrStream(Uri uri, Stream stream, BitmapCacheOption cacheOption, Guid& clsId, Boolean& isOriginalWritable, Stream& uriStream, UnmanagedMemoryStream& unmanagedMemoryStream, SafeFileHandle& safeFilehandle)
   en System.Windows.Media.Imaging.BitmapDecoder.CreateFromUriOrStream(Uri baseUri, Uri uri, Stream stream, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, Boolean insertInDecoderCache)
   en System.Windows.Media.Imaging.BitmapFrame.CreateFromUriOrStream(Uri baseUri, Uri uri, Stream stream, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption)
   en System.Windows.Media.ImageSourceConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   en System.ComponentModel.TypeConverter.ConvertFromString(ITypeDescriptorContext context, CultureInfo culture, String text)
   en System.Windows.Markup.XamlTypeMapper.ParseProperty(Object targetObject, Type propType, String propName, Object dpOrPiOrFi, ITypeDescriptorContext typeContext, ParserContext parserContext, String value, Int16 converterTypeId)
   --- Fin del seguimiento de la pila de la excepción interna ---
   en System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType)
   en System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException)
   en System.Windows.Markup.XamlTypeMapper.ParseProperty(Object targetObject, Type propType, String propName, Object dpOrPiOrFi, ITypeDescriptorContext typeContext, ParserContext parserContext, String value, Int16 converterTypeId)
   en System.Windows.Markup.BamlRecordReader.ParseProperty(Object element, Type propertyType, String propertyName, Object dpOrPi, String attribValue, Int16 converterTypeId)
   en System.Windows.Markup.BamlRecordReader.ReadPropertyRecordBase(String attribValue, Int16 attributeId, Int16 converterTypeId)
   en System.Windows.Markup.BamlRecordReader.ReadPropertyConverterRecord(BamlPropertyWithConverterRecord bamlPropertyRecord)
   en System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
   en System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord)
   en System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment()
   en System.Windows.Markup.TreeBuilder.Parse()
   en System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
   en System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
   en AlbumArtDownloader.Splashscreen.InitializeComponent()
   en AlbumArtDownloader.Splashscreen..ctor()
   en AlbumArtDownloader.Splashscreen.ShowIfRequired()
   en AlbumArtDownloader.App.OnStartup(StartupEventArgs e)
   en System.Windows.Application.<.ctor>b__0(Object unused)
   en System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   en System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   en System.Windows.Threading.DispatcherOperation.InvokeImpl()
   en System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   en System.Threading.ExecutionContext.runTryCode(Object userData)
   en System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   en System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   en System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   en System.Windows.Threading.DispatcherOperation.Invoke()
   en System.Windows.Threading.Dispatcher.ProcessQueue()
   en System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   en MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   en MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   en System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   en System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   en System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
   en System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
   en MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   en MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   en System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   en System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   en System.Windows.Threading.Dispatcher.Run()
   en System.Windows.Application.RunInternal(Window window)
   en System.Windows.Application.Run(Window window)
   en System.Windows.Application.Run()
   en AlbumArtDownloader.App.AlbumArtDownloader.IPriorInstance.Run()
   en AlbumArtDownloader.InstanceMutex.RunAppAsServiceHost(IPriorInstance instance, String channelUri)
   en AlbumArtDownloader.App.Main(String[] args)


What is the problem?
Go to the top of the page
+Quote Post
AlexVallat
post Sep 20 2007, 08:02
Post #55





Group: Developer
Posts: 1048
Joined: 31-July 06
Member No.: 33465



QUOTE (Mercachifle @ Sep 19 2007, 23:59) *
I can't load the program. It crashes on start:

What is the problem?


I'm sorry, I haven't a clue. The error report is saying that it can't display the program icon, which it needs to do in order to show a window, in this case the splash screen window, as that is the first to be shown.

As to why it can't display the program icon, I have no idea. You could try making sure you have the latest .net framework installed, but other than that, I have nothing to suggest, sorry.

Alex
Go to the top of the page
+Quote Post
Jojo
post Sep 20 2007, 20:15
Post #56





Group: Members
Posts: 1361
Joined: 25-November 02
Member No.: 3873



ok, I'm trying to figure this out. Is it possible to search for album art based on ID3 tags? If so, how would I do that? In addition, I don't like adding Album names for my Singles (I just leave it blank). Therefore, iTunes can't find the album art for the songs, since it only searches for "Artist - Album". It would be nice if I could use the title of a song as the Album title to solve this problem.

thank you

This post has been edited by Jojo: Sep 20 2007, 20:16


--------------------
--alt-presets are there for a reason! These other switches DO NOT work better than it, trust me on this.
LAME + Joint Stereo doesn't destroy 'Stereo'
Go to the top of the page
+Quote Post
entrecour
post Sep 20 2007, 21:14
Post #57





Group: Members
Posts: 4
Joined: 12-September 07
Member No.: 46995



QUOTE (AlexVallat @ Sep 9 2007, 18:39) *
QUOTE (Max Spicer @ Sep 9 2007, 18:02) *
Does Album Art Downloader XUI only work with mp3s? I tried pointing the file browser at my collection of flac files and it didn't find any albums.
Thanks,
Max

The file browser uses MediaInfo to read file tags. I don't think it supports album and artist information in flac (in fact I didn't think flac supported those sorts of tag at all), but if you want to request support for reading a file format, that's the project to ask. If the stand-alone MediaInfo app can read the tags, but Album Art Downloader doesn't, then that's a bug of mine - if you give me a sample file I can try and fix it.

Alex,

I haven't seen any further posts on this but I am also interested in the same issue.

I also encountered problems with flac and Album Art Downloader - it downloaded album art for 5 of my albums out of 100+. I can see no difference in the file information in MediaInfo for those particular 5 albums compared to the others. I am very keen to get a fix for this - what info or files can I send you to help you?

Thanks, David.
Go to the top of the page
+Quote Post
mobyduck
post Sep 21 2007, 08:03
Post #58





Group: Members
Posts: 570
Joined: 24-April 03
From: Italy
Member No.: 6159



QUOTE (Jojo @ Sep 20 2007, 11:15) *
Is it possible to search for album art based on ID3 tags? If so, how would I do that?
If I understand correctly what you're asking, you can do that using foobar + foo_run.

HTH.

Alessandro
Go to the top of the page
+Quote Post
AlexVallat
post Sep 21 2007, 08:20
Post #59





Group: Developer
Posts: 1048
Joined: 31-July 06
Member No.: 33465



QUOTE (Jojo @ Sep 20 2007, 20:15) *
ok, I'm trying to figure this out. Is it possible to search for album art based on ID3 tags? If so, how would I do that? In addition, I don't like adding Album names for my Singles (I just leave it blank). Therefore, iTunes can't find the album art for the songs, since it only searches for "Artist - Album". It would be nice if I could use the title of a song as the Album title to solve this problem.

If you mean from within foobar, then as mobyduck points out, foo_run is used for this, and you can pass whatever info you like to the Artist and Album command line args. If you mean within Album Art Downloader itself, then to search for album art based on ID3 tags, you use the File Browser. This can be pointed at a folder to scan, or you can just drag and drop files on to it.

It will not read the track title though, just Artist and Album. As you point out, some sources won't search for just an artist without an album. The way I see it, the Album is the CD that the track is on, even if there is only one track on that CD, and it is the Album that has art, not the track.

QUOTE (entrecour @ Sep 20 2007, 21:14) *
I also encountered problems with flac and Album Art Downloader - it downloaded album art for 5 of my albums out of 100+. I can see no difference in the file information in MediaInfo for those particular 5 albums compared to the others. I am very keen to get a fix for this - what info or files can I send you to help you?

If you have a file that, in MediaInfo, displays "Album" and "Performer" correctly, but in Album Art Downloader File Browser does not show the correct Album and Artist values in the columns, or does not appear in the file browser at all (please verify by dragging and dropping that particular file on to it), then it would be very helpful if you were able to send me that file.

You could try just sending me the text report from MediaInfo, but all that would let me do is verify that Album and Performer are correctly reported there, something I'm sure you're able to do just as well yourself!
Go to the top of the page
+Quote Post
entrecour
post Sep 21 2007, 13:43
Post #60





Group: Members
Posts: 4
Joined: 12-September 07
Member No.: 46995



I have sent you a PM with text output. Let me know how I should send the file to you.

Thanks, David.
Go to the top of the page
+Quote Post
~*McoreD*~
post Sep 22 2007, 00:40
Post #61





Group: Members
Posts: 568
Joined: 10-July 03
From: Australia
Member No.: 7693



Thanks david_dl and AlexVallat for providing base code for fetching iTMS artwork. GREAT Work. smile.gif

I noticed that the GetResponse method can take up to 100 seconds if an album art is found. So I added

CODE
        request.Timeout = TIME_OUT ' where TIME_OUT  = 5000 milliseconds by default


Any objections to that you think?

CODE
      Dim request As HttpWebRequest = CType(HttpWebRequest.Create(url), HttpWebRequest)
        request.UserAgent = "iTunes/7.4 (Macintosh; U; PPC Mac OS X 10.4.7)"
        request.Headers.Add("X-Apple-Tz", "-21600")
        request.Headers.Add("X-Apple-Store-Front", "143441")
        request.Headers.Add("Accept-Language", "en-us, en;q=0.50")
        request.Headers.Add("Accept-Encoding", "gzip, x-aes-cbc")
        Dim response As WebResponse = request.GetResponse
        request.Timeout = 5000
        Return response.GetResponseStream


This post has been edited by ~*McoreD*~: Sep 22 2007, 00:45
Go to the top of the page
+Quote Post
pirlouy
post Sep 22 2007, 15:56
Post #62


troll / multiple accounts


Group: Banned
Posts: 98
Joined: 22-June 05
Member No.: 22890



Hello Alex,

AlbumArtDownloader XUI has well progressed since first versions. Even if it does time, I've just wanted to say I don't have freeze anymore when I click on thumbnails ! Thanks.

Else I don't know if it's scripts or software, but it uses a huge number of RAM (I can easily be at 400Mo).
Go to the top of the page
+Quote Post
AlexVallat
post Sep 22 2007, 17:52
Post #63





Group: Developer
Posts: 1048
Joined: 31-July 06
Member No.: 33465



QUOTE (~*McoreD*~ @ Sep 22 2007, 00:40) *
I noticed that the GetResponse method can take up to 100 seconds if an album art is found. So I added
CODE
        request.Timeout = TIME_OUT ' where TIME_OUT  = 5000 milliseconds by default

Any objections to that you think?

5 seconds seems a bit short to me, I've had art come back slower than that. As long as the cancel button works, I don't think there is any need to add a shorter hard limit to the timeout - if you don't want to wait any longer for it, you don't have to. Feel free to add it to your local copy of the script, though, just remember to take a backup of it before installing a new version over it.

QUOTE (pirlouy @ Sep 22 2007, 15:56) *
AlbumArtDownloader XUI has well progressed since first versions. Even if it does time, I've just wanted to say I don't have freeze anymore when I click on thumbnails ! Thanks.

Else I don't know if it's scripts or software, but it uses a huge number of RAM (I can easily be at 400Mo).

Thanks, I've tried hard to improve the performance, and I'm glad its noticeable. Measuring RAM usage can be tricky with .net applications, particularly if you are just using the task manager to do it. They tend to grab all the RAM they like, and only release it when something else wants it. One trick I've seen is if you minimise and restore the Album Art Downloader window, that can get it to show a lower number in the task manager.

On the other hand, if you have a search window open with lots of results in, and have set it to download full size images, then 400Mb is not unreasonable at all. Large images take up lots of memory. If you are finding that memory usage keeps going up significantly, and doesn't go back down even after closing open windows, then there may be a leak I haven't found. Unfortunately these can be very tricky to track down, but if you think you've found one, PM me and I can try and work with you to resolve it.

Alex
Go to the top of the page
+Quote Post
AlexVallat
post Sep 22 2007, 19:31
Post #64





Group: Developer
Posts: 1048
Joined: 31-July 06
Member No.: 33465



AlbumArt Downloader XUI v0.10 Released

Some of you may have been hoping that the version after 0.9 would be 1.0, but it just doesn't work like that! I'm not waiting on anything specific to jump to a 1.0 release, but I think quite a bit of work around the website/wiki and documentation for it would be at least one requirement. So, this is 0.10.

This version is a stability release, which fixes some bugs that were reported:
  • Failing to save settings will no longer crash
  • Failing to load settings will no longer crash, and will provide options for recovery
  • Invalid characters in the Save path will no longer cause a crash
  • A workaround for a MediaInfo bug which would fail to recognize lower-case tags in FLAC files as been added.
Download:
AlbumArtDownloaderXUI.exe (Installer. Recommended)
AlbumArtDownloaderXUI.zip (zip archive for those who don't like installers)
.NET Framework 3.0 (required)
Go to the top of the page
+Quote Post
~*McoreD*~
post Sep 23 2007, 06:48
Post #65





Group: Members
Posts: 568
Joined: 10-July 03
From: Australia
Member No.: 7693



Great stuff Alex. smile.gif

I noticed that the 0.10 has

CODE
request.Headers.Add("X-Apple-Store-Front","143457")


but it won't work for me unless I have

CODE
request.Headers.Add("X-Apple-Store-Front", "143441")


I begin to wonder if this is dependent on the Country for iTunes Music Store.
Go to the top of the page
+Quote Post
AlexVallat
post Sep 23 2007, 08:19
Post #66





Group: Developer
Posts: 1048
Joined: 31-July 06
Member No.: 33465



QUOTE (~*McoreD*~ @ Sep 23 2007, 06:48) *
Great stuff Alex. smile.gif

I noticed that the 0.10 has

CODE
request.Headers.Add("X-Apple-Store-Front","143457")


but it won't work for me unless I have

CODE
request.Headers.Add("X-Apple-Store-Front", "143441")


I begin to wonder if this is dependent on the Country for iTunes Music Store.

Thanks!

The header might be country dependant, that seems at least reasonable. I thought the 143441 value was the latest one, as suggested here, but checking the file as shipped, it does seem to have gone back to 143457. Both values work just fine for me, strangely.

So, if iTunes isn't working for you, try this alternative itunes.boo, which has the 143441 value. I'd also be interested to hear if this version doesn't work for anyone, when the version in the 0.10 release does. Otherwise, I'll use this version for future releases.

Alex
Go to the top of the page
+Quote Post
~*McoreD*~
post Sep 23 2007, 09:13
Post #67





Group: Members
Posts: 568
Joined: 10-July 03
From: Australia
Member No.: 7693



Alex!

Have a go with and I wonder if you will be pulling hair off just like me!

50 Cent
Curtis

I was also wondering where do you use this code

CODE
    static def GetResult(url):
        try:
            return GetPageSecret(url + ".jpg");
        except e:
            return GetPageSecret(url + ".tif");


More in particular, to debug this thing more, I'd like to see an example string that passes as "url" to the GetResult method.

This is getting mighty exciting.

Thanks,
McoreD
Go to the top of the page
+Quote Post
AlexVallat
post Sep 23 2007, 10:00
Post #68





Group: Developer
Posts: 1048
Joined: 31-July 06
Member No.: 33465



QUOTE (~*McoreD*~ @ Sep 23 2007, 09:13) *
50 Cent
Curtis
Yep, no results for that. Neither does thejosher.net, it seems.

QUOTE (~*McoreD*~ @ Sep 23 2007, 09:13) *
I was also wondering where do you use this code

CODE
    static def GetResult(url):
        try:
            return GetPageSecret(url + ".jpg");
        except e:
            return GetPageSecret(url + ".tif");


More in particular, to debug this thing more, I'd like to see an example string that passes as "url" to the GetResult method.
That nice bit of work was from david_dl - it checks to see if the full album art is available either as a .jpg or as a .tif. Previously, only jpgs would be returned. An example of one of these partial url strings would be: "http://a1.phobos.apple.com/r10/Music/y2004/m03/d17/h17/s02.wlcqjasf".

The way that these scripts based on static methods with magic names works is as follows: First, the GetThumbs method is called. The first parameter to that method is an object with a method on it called AddThumb (since renamed to just Add, but the old name still works). AddThumb takes several parameters, the last of which is an arbitrary object that can be set to anything you like.

When (and if) a full size image is required for a result, the GetResult method is called, whose single parameter will be whatever object was passed in as the last parameter for the AddThumb method of that result. Quite often, the GetResult method just returns the parameter directly, as no further processing on it is needed.

The return value from GetResult, like the value passed for the first parameter of AddThumb, can be any of:
  • Bitmap (used directly)
  • Stream (Bitmap constructed from stream)
  • Uri (Stream downloaded from Uri)
  • String (Uri constructed from Bitmap)

In the iTunes case, the last parameter to the AddThumb method is a partial URL string that is extracted from the results XML returned from the initial query. When a full sized image is requested, the GetResult method first tries to complete that partial URL with ".jpg", then if that fails, tries it with ".tif" instead.

Although no scripts use it yet, because, lets face it, copying and pasting an existing one and modifying it is so much easier, I've added a more type-safe object-orientated way of implementing scripts, which does not rely on methods with magic names. If you add a reference to AlbumArtDownloader.Scripts.dll, then there is an interface: IScript. Implementing this makes your class a script. Also in that assembly there is an IScriptResults interface, which is what the object passed to GetThumbs (or IScript.Search) implements, so you can see what methods and properties are available on it.

If this is all too much information, I apologise, but it looked like you were interested in what was going on under the hood.

Alex
Go to the top of the page
+Quote Post
~*McoreD*~
post Sep 23 2007, 10:12
Post #69





Group: Members
Posts: 568
Joined: 10-July 03
From: Australia
Member No.: 7693



Alex, but did you try his alternative method using Album URL?

CODE
http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?id=262406609&s=143460


That's great info, I'd luv to have a dev chat with you online if you don't mind.. smile.gif

Currently I am working on trying to get 50 Cent - Curtis searchable.

Passed the TIF challenge.

Code here is an example to search the artwork from all the iTunes Stores around the world.

CODE
    Public Function GetArtworkPath() As String

        ' Usage :
        'Dim itms As New cITMSArt("4 Strings", "Turn It Around")
        'Process.Start(itms.GetArtworkPath)

        Try
            Dim iTMSdir As String = My.Settings.ArtworkDir + Me.artist + Path.DirectorySeparatorChar + Me.album
            Dim iTMSpath As String = iTMSdir + Path.DirectorySeparatorChar + "iTMS.jpg"

            If Directory.Exists(iTMSdir) = False Then
                Directory.CreateDirectory(iTMSdir)
            End If

            If File.Exists(iTMSpath) Then
                sWriteDebugLog("Found saved iTMS Artwork: " & iTMSpath)
                Return iTMSpath
            Else
                Dim wc As New WebClient
                For Each storeID As String In My.Settings.ListStoresID
                    Dim url As String = GetArtworkURL(storeID.Trim)
                    If url <> String.Empty Then
                        ' now we konw the url is valid
                        Try
                            wc.DownloadFile(url, iTMSpath)
                        Catch ex As System.Net.WebException
                            ' see if tif is availble
                            url = Path.ChangeExtension(url, ".tif")
                            iTMSpath = Path.ChangeExtension(iTMSpath, ".tif")
                            wc.DownloadFile(url, iTMSpath)
                            Try
                                Dim img As Image = Image.FromFile(iTMSpath)
                                ' save the jpg convert
                                Dim iTMSpathJPG As String = Path.ChangeExtension(iTMSpath, ".jpg")
                                img.Save(iTMSpathJPG, System.Drawing.Imaging.ImageFormat.Jpeg)
                                sWriteDebugLog(String.Format("Successfully converted {0} to JPG", iTMSpath))
                                iTMSpath = iTMSpathJPG
                            Catch errSave As Exception
                                ' Error converting
                            End Try
                        End Try
                        sWriteDebugLog("Fetched " & url)
                        Return iTMSpath
                    End If
                Next
                sWriteDebugLog("Could not get iTMS Artwork Path")
                Return String.Empty

            End If
        Catch ex As Exception
            sWriteDebugLog("Error getting iTMS Artwork Path")
            Return String.Empty
        End Try

    End Function


CODE
   Public Function GetArtworkURL(ByVal id As String) As String

        Dim x As New XmlDocument

        Dim search As String = "http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZSearch.woa/wa/coverArtMatch?an=" + artist + "&pn=" + album
        Console.WriteLine(search + " with " + id)
        Dim t As Stream = GetPageSecret(search, id)
        Try
            Dim gzi As New GZip.GZipInputStream(t)
            x.Load(gzi)
            sWriteDebugLog("Accessed iTMS ID: " & id)
        Catch ex As Exception
            sWriteDebugLog(String.Format("Error getting iTMS Artwork URL with Store ID: {0}. {1}", id, ex.Message))
            Return String.Empty
        End Try

        Dim tags As XmlNodeList = x.GetElementsByTagName("dict")
        If tags.Count = 0 Then
            Return Nothing
        Else
            Dim url As String = String.Empty
            Dim albumname As String = String.Empty
            Dim whichTag As Integer = 0

            For Each tag As Xml.XmlNode In tags(0).ChildNodes
                If tag.InnerText = "cover-art-url" Then
                    url = tag.NextSibling.InnerText
                ElseIf tag.InnerText = "playlistName" Then
                    albumname = tag.NextSibling.InnerText
                    Exit For
                End If
            Next

            If url.Length > 0 Then
                ' url is ' http://a1.phobos.apple.com/r10/Music/y2004/m08/d02/h11/s05.egorzxul.enc.jpg?downloadKey2=1190559591_ff0a61272432c71f489474b1a5712f97
                ' now just have to remove ".enc" and everything after the question make so you get
                ' http://a1.phobos.apple.com/r10/Music/y2004/m08/d02/h11/s05.egorzxul.jpg
                ' which is a valid artwork file!
                Return url.Substring(0, url.IndexOf("?")).Replace(".enc", "")
            Else
                sWriteDebugLog("iTMS artwork was not found")
            End If

        End If

        Return String.Empty

    End Function


Insight to how the scripts work was really great. Thank you for that!

This post has been edited by ~*McoreD*~: Sep 23 2007, 10:16
Go to the top of the page
+Quote Post
pirlouy
post Sep 23 2007, 11:17
Post #70


troll / multiple accounts


Group: Banned
Posts: 98
Joined: 22-June 05
Member No.: 22890



Just a little little bug: when you launch a new search (I use the same window), there is a thumbnail of the previous search !
Go to the top of the page
+Quote Post
AlexVallat
post Sep 23 2007, 13:45
Post #71





Group: Developer
Posts: 1048
Joined: 31-July 06
Member No.: 33465



QUOTE (pirlouy @ Sep 23 2007, 11:17) *
Just a little little bug: when you launch a new search (I use the same window), there is a thumbnail of the previous search !

Could you be a little more specific about what you are doing here? If I do a search, I get some results in the window. If I change the artist or album and press the Search button again, then the previous results are removed, and new ones start coming in. What is it you are seeing, are the new results added to the existing results? Or are no new results coming in at all? What did you change between one search and the next?

Alex
Go to the top of the page
+Quote Post
pirlouy
post Sep 23 2007, 19:17
Post #72


troll / multiple accounts


Group: Banned
Posts: 98
Joined: 22-June 05
Member No.: 22890



After some search, in fact, I think it's the local script which show the wrong thumbnail:


Another thing: I have not searched for now, but is it possible to automatically add a'1' or '2' at file end, when we save and the file already exists ? (I hope I'm clear)
For example (based on my screenshot, file "Madonna - Die Another Day.jpg" already exists: is it possible to automatically change name by Madonna - Die Another Day2.jpg for next files ?
Go to the top of the page
+Quote Post
AlexVallat
post Sep 23 2007, 19:49
Post #73





Group: Developer
Posts: 1048
Joined: 31-July 06
Member No.: 33465



QUOTE (pirlouy @ Sep 23 2007, 19:17) *
After some search, in fact, I think it's the local script which show the wrong thumbnail:


Another thing: I have not searched for now, but is it possible to automatically add a'1' or '2' at file end, when we save and the file already exists ? (I hope I'm clear)
For example (based on my screenshot, file "Madonna - Die Another Day.jpg" already exists: is it possible to automatically change name by Madonna - Die Another Day2.jpg for next files ?
Ah, OK, the Local Files search is special. I can't see exactly what file save path you are using, so I can't give you a complete answer, but the Local Files search tries to find existing files on your hard disk based on the save path and album/artist you are searching for.

To change what pattern it is using to look for files, click the ... button to the bottom of the Local Files source, and it has an option to specify where to look. Or, you can just uncheck the local files source and not use it at all, if you prefer.

I don't think automatically renaming second copies of files fits in very well with Album Art Downloader functionality. The idea is that you are downloading the art for an album, so once chances are if it already exists, you either want to keep it, or replace it with a better version, not save another copy.

Alex
Go to the top of the page
+Quote Post
pirlouy
post Sep 23 2007, 20:12
Post #74


troll / multiple accounts


Group: Banned
Posts: 98
Joined: 22-June 05
Member No.: 22890



QUOTE (AlexVallat @ Sep 23 2007, 20:49) *
Ah, OK, the Local Files search is special. I can't see exactly what file save path you are using, so I can't give you a complete answer, but the Local Files search tries to find existing files on your hard disk based on the save path and album/artist you are searching for.
Oops: D:\Mes documents\Ma musique\[07]pochettes\Madonna - Die Another Day.jpg (%artist% - %title%.jpg)

I have the jacket of Massive Attack and another called "Madonna - Die Another Day.jpg", so it should have shown me this file and not Massive Attack one.

QUOTE
I don't think automatically renaming second copies of files fits in very well with Album Art Downloader functionality. The idea is that you are downloading the art for an album, so once chances are if it already exists, you either want to keep it, or replace it with a better version, not save another copy.


That's what I thought until now, but since I've been using foo_uie_albumart, it could cycle between several images, so I can save several images if I want. Of course, I can change path manually, but it would have been easier if... But I can understand you don't want to add a lot of options...

Thanks for your answer.
Go to the top of the page
+Quote Post
iElectric
post Sep 24 2007, 12:08
Post #75





Group: Members
Posts: 20
Joined: 5-November 06
Member No.: 37191



AlexVallat, this has grown into a very nice app! Thanks.

I have only one "note".. Have you considered using tabs instead of new windows?
Go to the top of the page
+Quote Post

101 Pages V  < 1 2 3 4 5 > » 
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 20th April 2014 - 09:31