On Jan 29, 2007, at 4:33 PM, karl arder wrote:

 Thanks Charles,

Before I get down to business, thanks for the convert to B&W formula you also posted. I have just been using BnW=(r+g+b)/3, which is a bit dark and the contrast is off. Cool!

Now to iTunes...
I was wondering how Apple handled this problem. Seems they had to figure out a way around this too.

So now I expose my ignorance... I'm not quite sure how to use the declares you provided. I assume I use the raw URL path straight from the iTunes list. I haven't a clue how to pass the two parameters for <charactersToLeaveUnescaped> & <legalURLCharactersToBeEscaped>. Do I have to further parse the file name for specific characters?

No. Note that the parameters come with default values; just use those (or pass "").


You need to replace the illegal characters with percent codes.  For
MacOS, you can use the following function.

The raw path already has escaped characters - a space is %20 and I again assume this is a 'legal' character. I have a tract by Bjork (with an umlaut over the 'o') that causes an error. Unless I had this tract I would never know this was an issue. How can I use these declares for any/all possible characters in a valid song name? Am I missing something simple???

Yes.  Try the function in a test app and see what happens to Björk. --


dim escapedURL as String = Escape("file://www.björk.com").


Thanks again, you and others on this list have been most helpful to a newcomer, it's nice to feel welcome here.

ka_

Message: 8
Subject: Re: Reading iTune XML Music List
From: Charles Yeomans <[EMAIL PROTECTED]>
Date: Mon, 29 Jan 2007 11:33:35 -0500


On Jan 28, 2007, at 7:39 PM, karl arder wrote:

Ok, I seem to be hitting my head against every low hanging object...

Song names/paths can have a broader scope of characters than
allowed in a URL. How do I now convert the paths correctly so I
don't get errors with these characters.

I guess I'm plowing over ground that is a well trodden path with
regards to this subject. Are there any other 'surprises' I can
look  forward to?


You need to replace the illegal characters with percent codes.  For
MacOS, you can use the following function.

Function Escape(theURL as String, charactersToLeaveUnescaped as
String = "", legalURLCharactersToBeEscaped as String = "") As String
    if Encoding(theURL) is nil then
      // parameter '" + theURL + "' does not have an encoding."
      return theURL
    end if

    soft declare function CFURLCreateStringByAddingPercentEscapes lib
"Carbon.framework" (allocator as Integer, originalString as
CFStringRef, charactersToLeaveUnescaped as CFStringRef,
legalURLCharactersToBeEscaped as CFStringRef, encoding as UInt32) as
CFStringRef

    const kCFAllocatorDefault = 0
    return CFURLCreateStringByAddingPercentEscapes
(kCFAllocatorDefault, theURL, charactersToLeaveUnescaped,
legalURLCharactersToBeEscaped, Encoding(theURL).Code)
End Function


And here is its inverse.

Function Unescape(theURL as String, charactersToLeaveEscaped as
String = "") As String
    if Encoding(theURL) is nil then
      // parameter '" + theURL + "' does not have an encoding."
      return theURL
    end if

    theURL = ConvertEncoding(theURL, Encodings.UTF8)

    soft declare function CFURLCreateStringByReplacingPercentEscapes
lib "Carbon.framework" (allocator as Integer, originalString as
CFStringRef, charactersToLeaveEscaped as CFStringRef) as CFStringRef

    const kCFAllocatorDefault = 0

    return CFURLCreateStringByReplacingPercentEscapes
(kCFAllocatorDefault, theURL, charactersToLeaveEscaped)

End Function


=
Wedding Favors, Silk Flowers and Petals
On sale now, 500 silk petals from $4.20, 6"x25yd. Tulle from $1.99. eFavormart provide a huge selection of wedding favors at exceptional prices. Don't miss out, be sure to check us out. http://a8-asy.a8ww.net/a8-ads/adftrclick? redirectid=9cc8467f3b6732fbbd0f073f5c48a125

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to